-
Notifications
You must be signed in to change notification settings - Fork 0
/
sign_up.php
executable file
·82 lines (62 loc) · 1.94 KB
/
sign_up.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
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
<?php
//start session
session_start();
$conn_error = ""
//Local host
$dbhost = "localhost";
$dbuser = "root";
$dbpass = "";//"root";
$dbname = "myDB";
$conn = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
/*
if( mysqli_connect_errno($conn)){
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
function NewUser()
{
//get username and password from $_POST
$first = $_POST["first_name"];
$last = $_POST['last_name'];
$name = $first.' '.$last;
$email = $_POST["email"];
$username = $_POST["useranme"];
$password = $_POST["pass"];
$repass = $_POST["repass"];
$year = $_POST["year"];
$month = $_POST["month"];
$day = $_POST["day"];
$dob = $year.'-'.$month.'-'$day;
$gender = $_POST["gender"];
$verification_ques = $_POST["verification_question"];
$verification_ans = $_POST["verification_answer"];
$address = $_POST["address_name"];
$city = $_POST["city_name"];
$state = $_POST["state_name"];
$zipcode = $_POST["zip_code"];
$permanent_address = $address.','.$city.','.$state.' '.$zipcode;
//$query = "INSERT INTO users"
$query = "INSERT INTO users(Username,Password,Name,email,dob,gender,verification_question,verification_answer,location) VALUES ('$username','$password','$name','$email','$dob','$gender','$verification_ques','$verification_ans','$permanent_address')";
$data = mysql_query ($query) or die(mysql_error());
if($data)
{
echo "YOUR REGISTRATION IS COMPLETED....";
}else
{
echo "INCOMPLETE REGISTRATION! PLEASE TRY AGAIN..."
}
}
/*
$result = mysqli_query($conn, "SELECT * FROM users WHERE username='$username' AND password='$password'");
$num_of_rows = mysqli_num_rows($result);
//Check in the DB
if($num_of_rows > 0){
//If authenticated: say hello!
$_SESSION["username"] = $username;
header("Location: feed.php");
//echo "Success!! Welcome ".$username;
}else{
//else ask to login again..
echo "Invalid password! Try again!";
}
*/
?>