-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsignup_script.php
More file actions
46 lines (30 loc) · 1.17 KB
/
signup_script.php
File metadata and controls
46 lines (30 loc) · 1.17 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
<?php
require 'includes/common.php';
$email = mysqli_real_escape_string($con, $_POST['email']);
$name = mysqli_real_escape_string($con, $_POST['name']);
$password = mysqli_real_escape_string($con, $_POST['password']);
$year = mysqli_real_escape_string($con, $_POST['year']);
$club= mysqli_real_escape_string($con, $_POST['clubs']);
$branch = mysqli_real_escape_string($con, $_POST['branch']);
$about = mysqli_real_escape_string($con, $_POST['aboutme']);
$stmt1 = $con->prepare('SELECT id FROM users WHERE email = ?');
$stmt1->bind_param('s', $email); // 's' specifies the variable type => 'string'
$password=md5($password);
$stmt1->execute();
$stmt1->store_result();
$result = $stmt1->bind_result($id);
$row = $stmt1->num_rows;
if($row>0)
{
echo "<h2>Email id already exists. Try a different one</h2>";
}
else
{
if($stmt=$con->prepare("Insert into users(email,name,password,year,club,branch,about) values (?,?,?,?,?,?,?)")){
$stmt->bind_param("sssssss", $email,$name,$password,$year,$club,$branch,$about); // 's' specifies the variable type => 'string'
$stmt->execute();
$stmt->close();
header('Location:login.php');
}
}
?>