This repository was archived by the owner on Aug 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathedit_save.php
52 lines (45 loc) · 2.05 KB
/
edit_save.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
session_start();
$user=$_SESSION['key'];
?>
<?php
require 'cnn.php';
require 'hash.php';
if(isset($_POST["name"])) {
if( trim($_POST["name"]) != "" ) $name = trim($_POST["name"]);
// Date of birth
$dd = $_POST["dd"];
$dm = $_POST["dm"];
$dy = $_POST["dy"];
if( trim($_POST["sex"]) != "" ) $sex = trim($_POST["sex"]);
$bgroup = $_POST["jumpMenu"];
if( trim($_POST["quantity"]) != "" ) $quantity = trim($_POST["quantity"]);
if( trim($_POST["phone"]) != "" ) $phone = trim($_POST["phone"]);
if( trim($_POST["email"]) != "" ) $email = trim($_POST["email"]);
if( trim($_POST["password"]) != "" ) $password = trim($_POST["password"]);
if( trim($_POST["address2"]) != "" ) $post = trim($_POST["address2"]);
if( trim($_POST["address3"]) != "" ) $district = trim($_POST["address3"]);
if( trim($_POST["weight"]) != "" ) $weight = trim($_POST["weight"]);
// Last Date of Donation
$ld = $_POST["ld"];
$lm = $_POST["lm"];
$ly = $_POST["ly"];
if( trim($_POST["admnyear"]) != "" ) $admnyear = trim($_POST["admnyear"]);
if( trim($_POST["branch"]) != "" ) $branch = trim($_POST["branch"]);
if( trim($_POST["batch"]) != "" ) $batch = trim($_POST["batch"]);
// Convert Last date of Donation to correct format
$last2 = $ld.'-'.$lm.'-'.$ly;
$last = date('Y-m-d H:i:s', strtotime($last2));
$hashed_pass = superHash($password);
// Convert date of birth to correct format
$dob = $dd.'-'.$dm.'-'.$dy;
$date_of_birth = date('Y-m-d H:i:s', strtotime($dob));
$result="UPDATE registration SET Name='$name',DOB='$date_of_birth',Gender='$sex',Bloodgroup='$bgroup',Weight='$weight',AdmissionYear='$admnyear',Branch='$branch',Batch='$batch',ContactNo='$phone',Emailid='$user',LastDonation='$last',District='$district',Post='$post' WHERE Emailid='$user'";
$resulto="UPDATE user SET PWD='$hashed_pass' WHERE UserID= '$user'";
mysql_query($resulto,$link);
if(!mysql_query($result,$link))
die ('Error' . mysql_error());
else
header( 'Location: ./profile.php');
}
?>