diff --git a/admin.php b/admin.php index 8e63267..f519143 100755 --- a/admin.php +++ b/admin.php @@ -1,378 +1,405 @@ -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -======= - ->>>>>>> b125b401454b56be238d78304a11077324913289 - + -admin - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - + + + - + - - - - - + + - + -
-
- -
+ + +
+ + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + \ No newline at end of file diff --git a/bulk.php b/bulk.php index 467358d..e0551d2 100755 --- a/bulk.php +++ b/bulk.php @@ -1,1108 +1,3 @@ -<<<<<<< HEAD -<<<<<<< HEAD - - - - - -Revenue Agency - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - -
- - - - - - -
-
- - -
-
-
- -
-

- -

- - - - - -
- - - - - - - - -     "; - - ?> - - - - - - - -
Bulk registration upload from Excel 
- - - -
-
- -
-
-
-
- -
-  Ensure that the file upload is in CSV Format Otherwise it will not save -
- -
-
-
-
-
-

-  Steps to save the file! - -

- -
-
    -
  1. Download the sample file format below on the mail icon or on top of the to the right corner of this page on a downoad icon
  2. -
  3. Fill the employee details in the columns of the file
  4. -
  5. Save the file as CSV not as xls
  6. -
  7. Upload the file
  8. -
-
- SAMPLE FORMAT  Note:The web as file type will only be noted on excel files download from this application - - -
- -
-
-
-
- - - - - -
-

- -

- -

- -

-

- -

- - - - - -
- - - - - -
-
- - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -<<<<<<< HEAD - -======= -<<<<<<< HEAD - -======= -======= - - - - - -Revenue Agency - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - -
- - - - - - -
-
- - -
-
-
- -
-

- -

- - - - - -
- - - - - - - - -     "; - - ?> - - - - - - - -
Bulk registration upload from Excel 
- - - -
-
- -
-
-
-
- -
-  Ensure that the file upload is in CSV Format Otherwise it will not save -
- -
-
-
-
-
-

-  Steps to save the file! - -

- -
-
    -
  1. Download the sample file format below on the mail icon or on top of the to the right corner of this page on a downoad icon
  2. -
  3. Fill the employee details in the columns of the file
  4. -
  5. Save the file as CSV not as xls
  6. -
  7. Upload the file
  8. -
-
- SAMPLE FORMAT  Note:The web as file type will only be noted on excel files download from this application - - -
- -
-
-
-
- - - - - -
-

- -

- -

- -

-

- -

- - - - - -
- - - - - -
-
- - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ->>>>>>> df822572559672ea85bbd59693e524784893f56f - ->>>>>>> 051e3a05876a2d069f673a826bf346c66ef58c96 ->>>>>>> 7eabdf6d7d9de5536e593380bdf14673cf4650fe -======= - ->>>>>>> 41be9d74513052b591eec7d91050db9fa06e3a9e + \ No newline at end of file diff --git a/db_connect.SAMPLE.php b/db_connect.SAMPLE.php index cc492ea..237df29 100755 --- a/db_connect.SAMPLE.php +++ b/db_connect.SAMPLE.php @@ -9,8 +9,7 @@ mysqli_select_db($db,"staff_db"); - - + $stableYZ="CREATE TABLE IF NOT EXISTS Inorg (id int(11) NOT NULL auto_increment, name varchar(300)NOT NULL,Phone varchar(300)NOT NULL,email varchar(100)NOT NULL, website varchar(300)NOT NULL,year varchar(10)NOT NULL,pname varchar(1000)NOT NULL,type varchar(30)NOT NULL, @@ -28,6 +27,7 @@ Type varchar(30)NOT NULL,Size decimal(10) NULL, content longblob NOT NULL,PRIMARY KEY(id) )"; $db->query( $stable1); + $stable56="CREATE TABLE IF NOT EXISTS Users (id int(11) NOT NULL auto_increment, Firstname varchar(200)NOT NULL, @@ -56,7 +56,6 @@ $db->query($stable4); - $sql="SELECT * FROM Administrator "; $result=mysqli_query($db,$sql); $rowcount=mysqli_num_rows($result); @@ -70,7 +69,7 @@ $querydy = "INSERT INTO Files (Title,Name,Size,Type) ". "VALUES ('Staff','staff.csv','76','application/vnd.ms-excel')"; $db->query($querydy) or die('Errorr, query failed to upload'); - + } diff --git a/db_connect.php b/db_connect.php index 125dd0a..f182eb7 100755 --- a/db_connect.php +++ b/db_connect.php @@ -1,14 +1,60 @@ connect_errno > 0){ + die('Unable to connect to database [' . $db->connect_error . ']'); } + + $db->query("CREATE DATABASE IF NOT EXISTS `staff_db`"); + //connected to the database -$db = new mysqli("localhost", "root", "", "staff_attendance"); -if ($db->connect_errno > 0) { - die('Unable to connect to database [' . $db->connect_error . ']'); -} +//$db = new mysqli("localhost", "root", "", "staff_attendance"); +//if ($db->connect_errno > 0) { +// die('Unable to connect to database [' . $db->connect_error . ']'); +//} $db->query("CREATE DATABASE IF NOT EXISTS `staff_db`"); -mysqli_select_db($db, "staff_db"); + //spouse information table + $stable90="CREATE TABLE IF NOT EXISTS Spouse (id int(11) NOT NULL auto_increment, + Emp_No varchar(300)NOT NULL, + Emp_Name varchar(300)NOT NULL, + Marital_status Varchar(300)NOT NULL, + Sex varchar(30)NOT NULL, + Date_married date NOT NULL, + Spouse_name varchar(300)NOT NULL, + District_married varchar(300)NOT NULL, + PRIMARY KEY(id) )"; + $db->query($stable90); + + print_r($db->error); + + + + $stable4="CREATE TABLE IF NOT EXISTS Administrator (id int(11) NOT NULL auto_increment, + Firstname varchar(30)NOT NULL,Sirname varchar(30)NOT NULL,Mtitle Varchar(30)NOT NULL, + Phone varchar(30)NOT NULL,Password varchar(30)NOT NULL,Email varchar(30)NOT NULL,PRIMARY KEY(id) )"; + $db->query($stable4); + + + + $sql="SELECT * FROM Administrator "; + $result=mysqli_query($db,$sql); + $rowcount=mysqli_num_rows($result); + + if($rowcount==0) + { + $enter="INSERT INTO Administrator (Password,Email,Firstname,Sirname,Mtitle,Phone) VALUES('admin','admin@gmail.com','Patrick','Mvuma','Mr','265999107724')"; + $db->query($enter); + + + $querydy = "INSERT INTO Files (Title,Name,Size,Type) ". + "VALUES ('Staff','staff.csv','76','application/vnd.ms-excel')"; + $db->query($querydy) or die('Errorr, query failed to upload'); + + } + + //below is a table of activities and supervisors $stableYZ = "CREATE TABLE IF NOT EXISTS Activities (id int(11) NOT NULL auto_increment, diff --git a/images/IMG-20211214-WA0004.jpg b/images/IMG-20211214-WA0004.jpg new file mode 100644 index 0000000..91df4ef Binary files /dev/null and b/images/IMG-20211214-WA0004.jpg differ diff --git a/images/WhatsApp Image 2022-01-04 at 16.47.14.jpeg b/images/WhatsApp Image 2022-01-04 at 16.47.14.jpeg new file mode 100644 index 0000000..df567b3 Binary files /dev/null and b/images/WhatsApp Image 2022-01-04 at 16.47.14.jpeg differ diff --git a/index.php b/index.php index dad67a7..adaecdb 100644 --- a/index.php +++ b/index.php @@ -75,7 +75,7 @@   Sign In - +
diff --git a/login.php b/login.php index b063a1a..4810c8d 100755 --- a/login.php +++ b/login.php @@ -1,4 +1,3 @@ - diff --git a/script/login.js b/script/login.js index c2592b3..63e38ba 100644 --- a/script/login.js +++ b/script/login.js @@ -1,120 +1,3 @@ -<<<<<<< HEAD -$("document").ready(function () { - /* handling form validation */ - $("#login-form").validate({ - rules: { - password: { - required: true, - }, - user_email: { - required: true, - email: true, - }, - }, - messages: { - password: { - required: - "please enter your password!!", - }, - user_email: - "please enter your email address!!", - }, - submitHandler: submitForm, - }); - /* Handling login functionality */ - function submitForm() { - var data = $("#login-form").serialize(); - $.ajax({ - type: "POST", - url: "login.php", - data: data, - beforeSend: function () { - $("#error").fadeOut(); - $("#login_button").html( - '   sending ...' - ); - }, - success: function (response) { - if (response == "ok") { - $("#login_button").html( - '   Signing In ...' - ); - setTimeout(' window.location.href = "admin.php"; ', 3000); - } else if (response == "member") { - $("#login_button").html( - '   Signing In ...' - ); - setTimeout(' window.location.href = "member.php"; ', 3000); - } else { - $("#error").fadeIn(1000, function () { - $("#error").html( - '
  ' + - response + - " !
" - ); - $("#login_button").html( - '   Sign In' - ); - }); - } - }, - }); - return false; - } -}); -||||||| 96e6c03 -<<<<<<< HEAD -$('document').ready(function() { - /* handling form validation */ - $("#login-form").validate({ - rules: { - password: { - required: true, - }, - user_email: { - required: true, - email: true - }, - }, - messages: { - password:{ - required: "please enter your password!!" - }, - user_email: "please enter your email address!!", - }, - submitHandler: submitForm - }); - /* Handling login functionality */ - function submitForm() { - var data = $("#login-form").serialize(); - $.ajax({ - type : 'POST', - url : 'login.php', - data : data, - beforeSend: function(){ - $("#error").fadeOut(); - $("#login_button").html('   sending ...'); - }, - success : function(response){ - if(response=="ok"){ - $("#login_button").html('   Signing In ...'); - setTimeout(' window.location.href = "admin.php"; ',3000); - } - else if(response=="member"){ - $("#login_button").html('   Signing In ...'); - setTimeout(' window.location.href = "member.php"; ',3000); - } - else { - $("#error").fadeIn(1000, function(){ - $("#error").html('
  '+response+' !
'); - $("#login_button").html('   Sign In'); - }); - } - } - }); - return false; - } -======= $('document').ready(function() { /* handling form validation */ $("#login-form").validate({ @@ -165,177 +48,4 @@ $('document').ready(function() { }); return false; } ->>>>>>> df822572559672ea85bbd59693e524784893f56f -}); -======= -<<<<<<< HEAD -<<<<<<< HEAD -$('document').ready(function() { - /* handling form validation */ - $("#login-form").validate({ - rules: { - password: { - required: true, - }, - user_email: { - required: true, - email: true - }, - }, - messages: { - password:{ - required: "please enter your password!!" - }, - user_email: "please enter your email address!!", - }, - submitHandler: submitForm - }); - /* Handling login functionality */ - function submitForm() { - var data = $("#login-form").serialize(); - $.ajax({ - type : 'POST', - url : 'login.php', - data : data, - beforeSend: function(){ - $("#error").fadeOut(); - $("#login_button").html('   sending ...'); - }, - success : function(response){ - if(response=="ok"){ - $("#login_button").html('   Signing In ...'); - setTimeout(' window.location.href = "admin.php"; ',3000); - } - else if(response=="member"){ - $("#login_button").html('   Signing In ...'); - setTimeout(' window.location.href = "member.php"; ',3000); - } - else { - $("#error").fadeIn(1000, function(){ - $("#error").html('
  '+response+' !
'); - $("#login_button").html('   Sign In'); - }); - } - } - }); - return false; - } -======= -$('document').ready(function() { - /* handling form validation */ - $("#login-form").validate({ - rules: { - password: { - required: true, - }, - user_email: { - required: true, - email: true - }, - }, - messages: { - password:{ - required: "please enter your password!!" - }, - user_email: "please enter your email address!!", - }, - submitHandler: submitForm - }); - /* Handling login functionality */ - function submitForm() { - var data = $("#login-form").serialize(); - $.ajax({ - type : 'POST', - url : 'login.php', - data : data, - beforeSend: function(){ - $("#error").fadeOut(); - $("#login_button").html('   sending ...'); - }, - success : function(response){ - if(response=="ok"){ - $("#login_button").html('   Signing In ...'); - setTimeout(' window.location.href = "admin.php"; ',3000); - } - else if(response=="member"){ - $("#login_button").html('   Signing In ...'); - setTimeout(' window.location.href = "member.php"; ',3000); - } - else { - $("#error").fadeIn(1000, function(){ - $("#error").html('
  '+response+' !
'); - $("#login_button").html('   Sign In'); - }); - } - } - }); - return false; - } ->>>>>>> df822572559672ea85bbd59693e524784893f56f -}); -======= -$("document").ready(function () { - /* handling form validation */ - $("#login-form").validate({ - rules: { - password: { - required: true, - }, - user_email: { - required: true, - email: true, - }, - }, - messages: { - password: { - required: - "please enter your password!!", - }, - user_email: - "please enter your email address!!", - }, - submitHandler: submitForm, - }); - /* Handling login functionality */ - function submitForm() { - var data = $("#login-form").serialize(); - $.ajax({ - type: "POST", - url: "login.php", - data: data, - beforeSend: function () { - $("#error").fadeOut(); - $("#login_button").html( - '   sending ...' - ); - }, - success: function (response) { - if (response == "ok") { - $("#login_button").html( - '   Signing In ...' - ); - setTimeout(' window.location.href = "admin.php"; ', 3000); - } else if (response == "member") { - $("#login_button").html( - '   Signing In ...' - ); - setTimeout(' window.location.href = "member.php"; ', 3000); - } else { - $("#error").fadeIn(1000, function () { - $("#error").html( - '
  ' + - response + - " !
" - ); - $("#login_button").html( - '   Sign In' - ); - }); - } - }, - }); - return false; - } -}); ->>>>>>> 41be9d74513052b591eec7d91050db9fa06e3a9e ->>>>>>> f8c5cafe4393badacaff9311579aee2ab63dd574 +}); \ No newline at end of file diff --git a/script/validation.min.js b/script/validation.min.js index 004dcaf..91e8c4e 100644 --- a/script/validation.min.js +++ b/script/validation.min.js @@ -1,4 +1,3 @@ -<<<<<<< HEAD /*! jQuery Validation Plugin - v1.11.1 - 3/22/2013\n* https://github.com/jzaefferer/jquery-validation diff --git a/spouselist.php b/spouselist.php new file mode 100644 index 0000000..cb4f7f7 --- /dev/null +++ b/spouselist.php @@ -0,0 +1,913 @@ + + + + + + Admin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+ + + + + + + +
+
+ + + + + + + +
+
+
+

Spouse information

+ + +
+  This screen displays 50 records use the search box to spool more records +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + "; + } + + ?> + + +
IDEMPLOYEE NOEMPLOYEE NAMEMARITAL STATUSSEXDATE MARRIEDSPOUSE NAMEDISTRICT MARRIED
$id$EmployeeNo$EmployeeName$MaritalStatus$Sex$DateMarried + $SpouseName + + + $DistrictMarried +
+ + +
+ +
+ + +
+
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/upload.php b/upload.php index e6f21d7..c608adb 100755 --- a/upload.php +++ b/upload.php @@ -1,5 +1,3 @@ -<<<<<<< HEAD -<<<<<<< HEAD query($query) or die('Error1, query failed'); + $db->query($query) or die('Error1, query failed '. $db->error); $memberadd="tyy"; $_SESSION['memberadded']=$memberadd; @@ -172,7 +170,7 @@ $userid=$_COOKIE['userid']; $useremail=$_COOKIE['useremail']; - $sqluser ="SELECT * FROM Users WHERE Password='$userid' && Email='$useremail'"; + $sqluser ="SELECT * FROM Users WHERE `Password`='$userid' && Email='$useremail'"; $retrieved = mysqli_query($db,$sqluser); while($found = mysqli_fetch_array($retrieved)) @@ -219,11 +217,11 @@ if(isset($_POST['orginitial'])){ - $orgname = mysqli_real_escape_string($db,$_POST["orgname"]); //Email variable - $orgphone =mysqli_real_escape_string($db,$_POST["orgphone"]); //password variable - $orgmail = mysqli_real_escape_string($db,$_POST["orgemail"]); //institution variable - $orgwebsite = mysqli_real_escape_string($db,$_POST["orgwebsite"]); //phone variable - $year= mysqli_real_escape_string($db,$_POST["orgyear"]);//Firstname variable + $orgname = mysqli_real_escape_string($db,$_POST["orgname"]); + $orgphone =mysqli_real_escape_string($db,$_POST["orgphone"]); + $orgmail = mysqli_real_escape_string($db,$_POST["orgemail"]); + $orgwebsite = mysqli_real_escape_string($db,$_POST["orgwebsite"]); + $year= mysqli_real_escape_string($db,$_POST["orgyear"]); $pagez= mysqli_real_escape_string($db,$_POST["page"]); $orgName = $_FILES['filed']['name']; $orgtmpName = $_FILES['filed']['tmp_name']; @@ -303,7 +301,7 @@ $sid = $filesop[6]; $count++; if($count>1){ - $query = "INSERT INTO Users (Firstname,Sirname,Mtitle,Email,Staffid,Rank,Department) ". + $query = "INSERT INTO Users (Firstname,Sirname,Mtitle,Email,Staffid,`Rank`,Department) ". "VALUES ('$mfname','$msname', '$mtitle','$mphone','$sid','$rank','$minstititution')"; $db->query($query) or die('Error1, query failed'); @@ -322,338 +320,74 @@ } } -?> - -?> -======= -======= ->>>>>>> 41be9d74513052b591eec7d91050db9fa06e3a9e -query($queryz) or die('Errorr, query failed to upload picture');} - - $quer = "UPDATE Users SET Firstname='$mfname',Sirname='$msname',Mtitle='$mtitle',Email='$memail',Staffid='$mid',Rank='$rank',Department='$minstititution' WHERE id='$id' "; - $db->query($quer) or die('Errorr, query failed to update'); - - $_SESSION['pass']="okjs"; - header("Location:admin.php"); - } - } - - -if(isset($_POST['addmember'])) + + + + if(isset($_POST['addSpouse'])) { - if($_POST['memail']!=''&&$_POST['mfname']!=''&&$_POST['msname']!=''&&$_POST['mphone']!=''&&$_POST['minstitution']!=''&&$_POST['mpassword']!='') + if($_POST['EmployeeNo']!=''&&$_POST['EmployeeName']!=''&&$_POST['MaritalStatus']!=''&&$_POST['Sex']!=''&&$_POST['DateMarried']!='' &&$_POST['SpouseName']!=''&&$_POST['DistrictMarried']!='') { - $mfname = mysqli_real_escape_string($db,$_POST['mfname']); - $msname = mysqli_real_escape_string($db,$_POST['msname']); - $memail=mysqli_real_escape_string($db,$_POST['memail']); - $mphone =mysqli_real_escape_string($db,$_POST['mphone']); - $minstititution = mysqli_real_escape_string($db,$_POST['minstitution']); - $mpassword = mysqli_real_escape_string($db,$_POST['mpassword']); - $pagex = mysqli_real_escape_string($db,$_POST['page']); - $orgName = $_FILES['filed']['name']; - $orgtmpName = $_FILES['filed']['tmp_name']; - $orgSize = $_FILES['filed']['size']; - $orgType = $_FILES['filed']['type']; - - - - if (isset($_POST["mr"])) - { - $mtitle="Mr"; - } - elseif(isset($_POST["miss"])) - { - $mtitle="Miss"; - } - elseif(isset($_POST["mrs"])) - { - $mtitle="Mrs"; - } - elseif (isset($_POST["dr"])) - { - - $mtitle="Dr"; - } - elseif (isset($_POST["pro"])) - { $mtitle="Pro"; - } - else - { - $mtitle=""; - } - - $check="SELECT * FROM Users WHERE Firstname='$mfname' && Sirname='$msname'"; + $EmployeeNo = mysqli_real_escape_string($db,$_POST['EmployeeNo']); + $EmployeeName = mysqli_real_escape_string($db,$_POST['EmployeeName']); + + $MaritalStatus=mysqli_real_escape_string($db,$_POST['MaritalStatus']); + $Sex =mysqli_real_escape_string($db,$_POST['Sex']); + + $DateMarried = mysqli_real_escape_string($db,$_POST['DateMarried']); + $SpouseName = mysqli_real_escape_string($db,$_POST['SpouseName']); + + $DistrictMarried=mysqli_real_escape_string($db,$_POST['DistrictMarried']); + echo $EmployeeName; + echo $Sex; + echo $MaritalStatus; + echo $DateMarried; + + + $check="SELECT * FROM Spouse WHERE Emp_No='$EmployeeNo' && Emp_Name='$EmployeeName'"; + $checks=mysqli_query($db,$check); - $found=mysqli_num_rows($checks); + $found=mysqli_num_rows($checks); + if($found==0) { - move_uploaded_file ($orgtmpName,'images/'.$orgName); - $query = "INSERT INTO Users (Firstname,Sirname,Mtitle,Email,Staffid,Rank,Department,Online,Picname) ". - "VALUES ('$mfname','$msname', '$mtitle','$mphone','$mpassword','$memail','$minstititution','Offline','$orgName')"; - $db->query($query) or die('Error1, query failed'); + $query = "INSERT INTO Spouse (Emp_No,Emp_Name,Marital_Status,Sex,Date_married,`Spouse_name`,`District_married`) ". + "VALUES ('$EmployeeNo','$EmployeeName', '$MaritalStatus','$Sex ','$DateMarried','$SpouseName','$DistrictMarried')"; + $db->query($query) or die('Error1, query failed '. $db->error); - $memberadd="tyy"; - $_SESSION['memberadded']=$memberadd; - header("Location:$pagex"); //member added successfully + $memberadd="tyy"; + + $_SESSION['spouseAdded']=$memberadd; + + header("Location:spouselist.php"); //member added successfully - }else{ - $_SESSION['memberexist']="member already exist"; - header("Location:$pagex"); + }else{ + $_SESSION['spouseExists']="member already exist"; + header("Location:admin.php"); - } - }else{ - $_SESSION['emptytextboxes']="Not all text boxes were completed"; - header("Location:$pagex"); + } + } + else{ + $_SESSION['emptytextboxes']="Not all text boxes were completed"; + header("Location:admin.php"); - } + } + } - if(isset($_POST['Valuedel'])){ - - $tutor=$_POST['Valuedel']; - $querry="SELECT * FROM Users WHERE id='$tutor' "; - $results=mysqli_query($db,$querry); - $checks=mysqli_num_rows($results); - if($checks!=0) - { - $querry="DELETE FROM Users WHERE id='$tutor'"; - $results=mysqli_query($db,$querry); - echo"ok"; - } - - - } - if(isset($_FILES['file2']['name'])&&$_POST['Change']) { - - $id=$_POST['id']; - $protocol=$_POST['category']; - $receiptName = $_FILES['file2']['name']; - $receipttmpName = $_FILES['file2']['tmp_name']; - $receiptSize = $_FILES['file2']['size']; - $receiptType = $_FILES['file2']['type']; - $pages=$_POST['page']; - - if($id=='') - { - $userid=$_COOKIE['userid']; - $useremail=$_COOKIE['useremail']; - $sqluser ="SELECT * FROM Users WHERE Password='$userid' && Email='$useremail'"; - $retrieved = mysqli_query($db,$sqluser); - while($found = mysqli_fetch_array($retrieved)) - { - $id= $found['id']; - } - } - - $qued="SELECT * FROM Profilepictures WHERE ids='$id' "; - $resul=mysqli_query($db,$qued); - $checks=mysqli_num_rows($resul); - if($checks!=0) - { - if( move_uploaded_file ($receipttmpName, 'admin/images/'.$receiptName)){//image is a folder in which you will save documents - $queryz = "UPDATE Profilepictures SET name='$receiptName',size='$receiptSize',type='$receiptType',content='$receiptName',Category='$protocol' WHERE ids='$id' "; - $db->query($queryz) or die('Errorr, query failed to upload'); - //$_SESSION['update']="yes"; - if($protocol=="Administrator"){ - header("Location:$pages"); - } - else{ - header("Location:user.php"); - } - } - - } - else{ - - if( move_uploaded_file ($receipttmpName, 'admin/images/'.$receiptName)){//image is a folder in which you will save documents - $queryz = "INSERT INTO Profilepictures (name,size,type,content,Category,ids) ". - "VALUES ('$receiptName','$receiptSize',' $receiptType', '$receiptName','$protocol','$id')"; - $db->query($queryz) or die('Errorr, query failed to upload'); - //$_SESSION['update']="yes"; - if($protocol=="Administrator"){ - header("Location:$pages"); - } - else{ - header("Location:user.php"); - } - - } - } - } - if(isset($_POST['orginitial'])){ - - $orgname = mysqli_real_escape_string($db,$_POST["orgname"]); //Email variable - $orgphone =mysqli_real_escape_string($db,$_POST["orgphone"]); //password variable - $orgmail = mysqli_real_escape_string($db,$_POST["orgemail"]); //institution variable - $orgwebsite = mysqli_real_escape_string($db,$_POST["orgwebsite"]); //phone variable - $year= mysqli_real_escape_string($db,$_POST["orgyear"]);//Firstname variable - $pagez= mysqli_real_escape_string($db,$_POST["page"]); - $orgName = $_FILES['filed']['name']; - $orgtmpName = $_FILES['filed']['tmp_name']; - $orgSize = $_FILES['filed']['size']; - $orgType = $_FILES['filed']['type']; - - - $sqln="SELECT * FROM Inorg WHERE name='$orgname' && website='$orgwebsite'"; - $resultn=mysqli_query($db,$sqln); - if($rowcount=mysqli_num_rows($resultn)==0) - { //$date= date("d.m.y"); - - move_uploaded_file ($orgtmpName, 'media/'.$orgName); - $enter="INSERT INTO Inorg (name,website,year,email,Phone,pname,size,content,type) - VALUES('$orgname','$orgwebsite','$year','$orgmail','$orgphone','$orgName','$orgSize','$orgName','$orgType')"; - $db->query($enter); - - $_SESSION['regk']="Pamzey"; - - header("Location:admin.php"); - - } - else{ - echo"Contents arleady exists"; - //exit; - } - } - - - if(isset($_POST['orgupdate'])){ - - $orgname = mysqli_real_escape_string($db,$_POST["orgname"]); //Email variable - $orgphone =mysqli_real_escape_string($db,$_POST["orgphone"]); //password variable - $orgmail = mysqli_real_escape_string($db,$_POST["orgemail"]); //institution variable - $orgwebsite = mysqli_real_escape_string($db,$_POST["orgwebsite"]); //phone variable - $year= mysqli_real_escape_string($db,$_POST["orgyear"]);//Firstname variable - $pagez= mysqli_real_escape_string($db,$_POST["page"]); - $idz= mysqli_real_escape_string($db,$_POST["pageid"]); - - $orgName = $_FILES['filed']['name']; - $orgtmpName = $_FILES['filed']['tmp_name']; - $orgSize = $_FILES['filed']['size']; - $orgType = $_FILES['filed']['type']; - - $sqln="SELECT * FROM Inorg WHERE id='$idz' "; - $resultn=mysqli_query($db,$sqln); - if($rowcount=mysqli_num_rows($resultn)!=0) - { - move_uploaded_file ($orgtmpName,'media/'.$orgName); - $enter="UPDATE Inorg SET name='$orgname',website='$orgwebsite',year='$year',email='$orgmail',Phone='$orgphone',pname='$orgName',content='$orgName',type='$orgType',size='$orgSize' WHERE id='$idz' "; - $db->query($enter); - - $_SESSION['regX']="Pamzey"; - - header("Location:admin.php"); - - } - else{ - echo"Contents arleady exists"; - //exit; - } - } - - if(isset($_POST["bulk"])) - { - $file = $_FILES['file']['tmp_name']; - $handle = fopen($file, "r"); - $c = 0;$count = 0; - while(($filesop = fgetcsv($handle, 1000, ",")) !== false) - { - $mtitle = $filesop[0]; - $mfname = $filesop[1]; - $msname = $filesop[2]; - $minstititution = $filesop[3]; - $rank = $filesop[4]; - $mphone = $filesop[5]; - $sid = $filesop[6]; - $count++; - if($count>1){ - $query = "INSERT INTO Users (Firstname,Sirname,Mtitle,Email,Staffid,Rank,Department) ". - "VALUES ('$mfname','$msname', '$mtitle','$mphone','$sid','$rank','$minstititution')"; - $db->query($query) or die('Error1, query failed'); - - $c = $c + 1; - } - - } - - if(isset($c)){ - $_SESSION['Import']=$c; - header("Location:bulk.php"); - } - else{ - echo "Sorry! There is some problem."; - } - } -?> + -?> -<<<<<<< HEAD ->>>>>>> df822572559672ea85bbd59693e524784893f56f -======= ->>>>>>> 41be9d74513052b591eec7d91050db9fa06e3a9e +?> \ No newline at end of file