-
Notifications
You must be signed in to change notification settings - Fork 1
/
form_amb.php
49 lines (44 loc) · 2.08 KB
/
form_amb.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
<?php
if(isset($_POST['subData'])){
if($_POST['Password']===$_POST['CPassowrd']){
require('./config.php');
$name=$_POST['Name'];
$college=$_POST['College'];
$email=$_POST['Email'];
$code=$_POST['Password'];
$hash = md5($code);
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$randomString = '';
for ($i = 0; $i<6; $i++) {
$index = rand(0, strlen($characters) - 1);
$randomString .= $characters[$index];
}
$sql ="INSERT INTO ambassador (`id`,`name`,`college`, `webmail`,`password`,`hash`,`refcode`) VALUES ('$name','$name', '$college', '$email', '$code','$hash','$randomString')" ;
$res=$mysqli->query($sql);
if(! $res){
echo $mysqli->error;
// echo query($sql);
}
else{
$message="Thank you for applying with us as cammpus ambassador. Please click here to activate your account http://localhost/e-cell/verfication.php?hash=".$hash."&email=".$email.". Invite more of your friends to win exciting goodies from e-club iitp";
require('./mail.php');
}
}
else
echo "password and confirm password do not match";
}
?>
<form action="" method="post" >
<label for="name">Name</label><br>
<input type="text" name="Name"required><br><br>
<label for="email">Email</label><br>
<input type="email" name="Email" required><br><br>
<label for="college">College</label><br>
<input type="text" name="College"required><br><br>
<label for="password">Password</label><br>
<input type="password" name="Password" required><br><br>
<label for="password">Confirm Password</label><br>
<input type="password" name="CPassowrd" required><br><br>
<input type="submit" name="subData" value="submit">
<p>Already have an account <a href="./login.php">click here</a></p>
</form>