-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsignup.php
30 lines (28 loc) · 1.14 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
<?php
$dbhost = "localhost";
$dbname = "moneytracker";
$dbuser = "shubham8";
$dbpass = "shubham8";
try {
$conn = new PDO("mysql:host=$dbhost;dbname=$dbname", $dbuser, $dbpass);
$name = $_POST['name'];
$email = $_POST['email'];
$password = $_POST['pword'];
$cs = $_POST['cs'];
$sql = "INSERT INTO users VALUES (NULL, '" . $name . "', '" . $email . "', '" . $password . "', '" . $cs . "', '0',NULL)";
$stmt = $conn->exec($sql);
$code = substr(number_format(time() * rand(),0,'',''),0,5);
$message = "Your Activation Code is ".$code."";
$to=$email;
$sql = "INSERT INTO verifyemail VALUES ('".$code."','".$email."')";
$stmt = $conn->exec($sql);
$subject="Activation Code For Money Expense Tracker";
$from = '[email protected]';
$body="Click Below<br>";
$body.='http://www.shubhampatel.com/verification.php?id='.$email.'&code='.$code;
$headers = "From:".$from;
mail($to,$subject,$body,$headers);
echo "<script> alert('You have successfully Signed Up.Please Verify Your Email Address.'); window.location.href='index.php'; </script>";
} catch (PDOException $e) {
echo $e->getMessage();
}