This repository was archived by the owner on Nov 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmyaccount.php
More file actions
129 lines (108 loc) · 3.95 KB
/
Copy pathmyaccount.php
File metadata and controls
129 lines (108 loc) · 3.95 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<!DOCTYPE html>
<?php
session_start();
require_once ("connect.php");
$priv=0;
if(!isset($_SESSION['user'])){
header("Location: index.php");
}
if(isset($_SESSION['user'],$_SESSION['password'],$_SESSION['priv'])){
require_once ("sess.php");
$priv=$_SESSION['priv'];
}
$err=array(
'N'=>true,
'A'=>true,
'T'=>true
);
if($_SERVER['REQUEST_METHOD']=='POST'){
$val=array(
'N'=>$_POST['name'],
'A'=>$_POST['address'],
'T'=>$_POST['tel']
);
$N=is_string($_POST['name']);
$A=is_string($_POST['address']);
if(strlen($val['T'])>=11 && strlen($val['T'])<=13 || strlen($val['T'])==0){
$T=true;
}else{
$T=false;
}
if($N && $A && $T){
//insert data in databaes
$sql="UPDATE user_info SET Name=:Name, address=:address, telphone=:telphone WHERE u_name=:u_name AND password=:password";
$stmt = $conn->prepare($sql);
$stmt->bindparam(':Name',$val['N'],PDO::PARAM_STR);
$stmt->bindparam(':address',$val['A'],PDO::PARAM_STR);
$stmt->bindparam(':telphone',$val['T'],PDO::PARAM_STR);
$stmt->bindparam(':u_name',$_SESSION['user']);
$stmt->bindparam(':password',$_SESSION['password']);
$stmt->execute();
}else{
if(!$N){$err['N']=false;}
if(!$A){$err['A']=false;}
if(!$T){$err['T']=false;}
}
}
$title = "صالة جامع التركي" ;
$name_page = str_replace(array(dirname($_SERVER['SCRIPT_NAME']), ".php"), "", $_SERVER['SCRIPT_NAME']);
$name_page = trim($name_page , '\/');
$PATH = "http://localhost/turkeyMosque/";
?>
<!-- begin footer and page end -->
<?php include("header.php"); ?>
<!-- end footer and page end -->
<div id="page">
<div id="main-content">
<!-- begin main content -->
<br/>
<?php
$sql="SELECT * FROM user_info WHERE u_name=:u_name AND password=:password";
$stmt = $conn->prepare($sql);
$stmt->bindparam(':u_name',$_SESSION['user']);
$stmt->bindparam(':password',$_SESSION['password']);
$stmt->execute();
$row = $stmt->fetch(PDO::FETCH_ASSOC);
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" accept-charset="utf-8" class="form-style-4">
<label for="uname">
<span>الاسم الحساب :</span>
<input name="uname" type="text" value="<?php echo " ".$row['u_name']; ?>" readonly="readonly" />
</label>
<label for="name">
<span><?php if(!$err['N']){ echo '<b class="err">الاسم :</b>';} else { echo "الاسم :"; } ?></span>
<input name="name" type="text" value="<?php echo $row['Name']; ?>" placeholder=" ادخل اسم مستعار "
pattern="([a-zA-Z]{1})([a-zA-Z0-9_-]{2,16})" title="يجب ان يتكون من 3 احرف وارقام والحرف الاول يكون حرف" maxlength="16" />
</label>
<label for="address">
<span><?php if(!$err['A']){ echo '<b class="err">العنوان :</b>';} else { echo "العنوان :"; } ?></span>
<input name="address" type="text" value="<?php echo $row['address']; ?>" placeholder=" ادخل العنوان " />
</label>
<label for="tel">
<span><?php if(!$err['T']){ echo '<b class="err">رقم الهاتف :</b>';} else { echo "رقم الهاتف :"; } ?></span>
<input name="tel" type="text" value="<?php echo $row['telphone']; ?>" placeholder=" ادخل رقم الهاتف xxx-xxxxxxx"/>
</label>
<label for="email">
<span>الايميل :</span>
<input name="email" type="text" value="<?php echo " ".$row['email']; ?>" readonly="readonly"/>
</label>
<label>
<span> </span><input type="submit" value="حفظ التعديل" />
</label>
</form>
<br/>
<!-- end main content -->
</div>
<div id="main-sidebar">
<!-- being sidebar content -->
<?php include("sidebar.php"); ?>
<!-- end sidebar content -->
</div>
<div class="clear"></div>
</div>
<!-- end footer and page end -->
<?php include("footer.php"); ?>
<!-- end footer and page end -->
</div>
</body>
</html>