-
Notifications
You must be signed in to change notification settings - Fork 0
/
submit.php
45 lines (34 loc) · 1.06 KB
/
submit.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
<?php
$first=$_POST["firstname"];
$last=$_POST["lastname"];
$user=$_POST["username"];
$password=$_POST["password"];
$email=$_POST["email"];
$p=md5($password);
$con=mysqli_connect('sql308.byethost11.com','b11_18001806','eshu@123','b11_18001806_dbms');
if (mysqli_connect_errno($con))
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sq = "SELECT * FROM SignUp WHERE Username ='$user' ";
$result=mysqli_query($con,$sq);
if(mysqli_num_rows($result))
{
echo "username already exists retry again";
die();
}
$sql="INSERT INTO SignUp(`First_Name`,`Last_name`,`Username`,`Password`,`email`) VALUES('$first','$last','$user','$p','$email')";
$result = mysqli_query($con,$sql) ;
if($result)
{
echo "Successful redirecting ......";
echo '<script language="javascript">';
echo 'alert("Successful")'; //not showing an alert box.
echo '</script>';
header('Refresh: 3; URL=http://stockmanager.byethost11.com/stock/index.php');
}
else
{
echo "Retry user not created";
}
?>