-
Notifications
You must be signed in to change notification settings - Fork 0
/
testprofile.php
55 lines (47 loc) · 1.03 KB
/
testprofile.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
53
54
55
<title>
test profile page
</title>
<?php
//include ('./inc/connect.inc.php');
include ('./inc/header.inc.php');
?>
<?php
$firstname="";
$lastname="";
$email="";
$username="";
if (isset($_GET['u'])) {
$pop = $_GET['u'];
$username = mysqli_real_escape_string($conn,$pop);
if (ctype_alnum($username)) {
//check if user exists
$query = "SELECT username, first_name, last_name, email FROM users WHERE username = '$username' ";
$check = mysqli_query($conn,$query);
if (mysqli_num_rows($check)== 1) {
$get = mysqli_fetch_assoc($check);
$username = $get['username'];
$firstname = $get['first_name'];
$lastname = $get['last_name'];
$email = $get['email'];
# code...
}
else
{
echo "<b>User does not exist</b>";
exit();
}
# code...
}
# code...
}
?>
<b>profile page of <?php echo "$username"; ?></b>
<br>
<br>
<b>First name: <?php echo "$firstname" ;?></b>
<br>
<br>
<b>Last name: <?php echo "$lastname"; ?></b>
<br>
<br>
<b>Email: <?php echo "$email" ;?></b>