-
Notifications
You must be signed in to change notification settings - Fork 0
/
reg.php~
82 lines (65 loc) · 2.43 KB
/
reg.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
<?php
require_once('core/init.php');
$conn = new PDO("mysql:host=localhost;dbname=infotsav", "root", "root");
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$s="fdsdf";
$t=md5($_POST['name'].$_POST['password'].microtime());
$query = "SELECT * FROM users WHERE email = :email";
$q = $conn->prepare($query);
$q->bindParam(':email',$_POST['email']);
$q->execute();
$q->setFetchMode(PDO::FETCH_ASSOC);
$row=$q->fetch();
if(isset($row['name']))
{
Session::put('home','Sorry this email id is already in use.');
echo '<script>window.location="login.php";</script>';
}
else
{
$query="INSERT INTO users (name,email,password,salt,contact,school,city,avtar,emailcode) VALUES (:name, :email , :password , :salt ,:contact, :school,:city,:avtar,:code)";
$q = $conn->prepare($query);
$q->bindParam(':name',$_POST['name']);
$q->bindParam(':email',$_POST['email']);
$q->bindParam(':password',md5($_POST['password']));
$q->bindParam(':salt',$s);
$q->bindParam(':contact',$_POST['contact']);
$q->bindParam(':school',$_POST['school']);
$q->bindParam(':city',$_POST['city']);
$q->bindParam(':avtar',$_POST['emotion']);
$q->bindParam(':code',$t);
$q->execute();
$sql = "SELECT * FROM `users` WHERE `email` = :email";
$query = $conn->prepare($sql);
$query->bindValue(':email', $_POST['email']);
$query->execute();
$result = $query->fetchAll(PDO::FETCH_ASSOC);
print_r($result);
$query="INSERT INTO user_score (user_id,score) VALUES (:id, 0)";
$q = $conn->prepare($query);
$q->bindParam(':id',$result[0]['id']);
/*$q->bindParam(':email',$_POST['email']);
$q->bindParam(':password',md5($_POST['password']));
$q->bindParam(':salt',$s);
$q->bindParam(':contact',$_POST['contact']);
$q->bindParam(':school',$_POST['school']);
$q->bindParam(':city',$_POST['city']);
$q->bindParam(':avtar',$_POST['emotion']);
$q->bindParam(':code',$t); */
$q->execute();
Session::put('home','You Have been successfully registered. Please check your email to activate your account.');
?>
<html>
<form method="POST" name="form2" action="http://www.aasf.in/mailer/regmail.php">
<input type="hidden" name="name" value="<?php echo $_POST['name']; ?>">
<input type="hidden" name="email" value="<?php echo $_POST['email'];?>">
<input type="hidden" name="emailcode" value="<?php echo $t; ?>">
</form>
<script>
document.forms[0].submit();
</script>
</html>
<?php
echo '<script>window.location="login.php";</script>';
}
?>