-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsignup.php
44 lines (34 loc) · 1.33 KB
/
signup.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
<?php
session_start();
include ("variables.php");
$secret = rand() . rand() . rand() . rand();
//$secret = $secret . rand();
$conn = new PDO("mysql:host = $dbhost;dbname=$dbname",'root');
$sql = "insert into `login` (id,password,activated,priority,secret,facebook,name) VALUES (:id,:password,:activated,:priority,:secret,:facebook,:name)";
$q = $conn->prepare($sql);
if($q->execute(array(':id'=>$_SESSION['newid'],
':password'=>$_SESSION['newpassword'],
':activated'=>0,
':priority'=>0,
':name'=>$_GET['name'],
':facebook'=>$_GET['facebook'],
':secret'=>$secret))){
//echo $_SESSION['newid'] . $secret . $_SESSION['newpassword'];
require_once "../../../../php/PEAR/Mail.php";
$to = $_SESSION['newid'] . '@iitk.ac.in';
$subject ="book4me registration confirmation link";
$body = "Please click http://" . $site . "activate.php?secret=" . $secret . "&&id=" .$_SESSION['newid'] . " to complete registration";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'port' => $port,
'auth' => true,
'username' => $username,
'password' => $password));
if($mail = $smtp->send($to, $headers, $body)) echo "a mail sent";
else echo "fail retry again";
}
else echo "unsuccessful";
?>