-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtryit.php
31 lines (28 loc) · 973 Bytes
/
tryit.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
<html>
<head>
<meta http-equiv="refresh" content="1;url=tryon.php">
</head>
</html>
<?php
if(isset($_GET['namec'])) {
$name=$_GET['namec'];
session_start();
if(isset($_SESSION['username'])) {
$username=$_SESSION['username'];
} else {
header("location:loginindex.php");
}
$connect = MYSQL_CONNECT('localhost', 'root', '') or die('Unable to connect to MySQL server');
mysql_select_db('tryon') or die('Unable to select database');
$result=MYSQL_QUERY("select name from tryon where username='$username'");
$numrows = mysql_num_rows($result);
if($numrows==0) {
$result1 = MYSQL_QUERY("insert into tryon (name,username) values('$name','$username')");
} else {
$result1 = MYSQL_QUERY("update tryon set name='$name' where username ='$username'");
}
echo '<img src="try2.php"><br>';
echo "$name<br>";
echo '<a href="tryon.php">try on</a>';
}
?>