This repository was archived by the owner on Sep 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreg.php
More file actions
56 lines (44 loc) · 1.29 KB
/
reg.php
File metadata and controls
56 lines (44 loc) · 1.29 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
47
48
49
50
51
52
53
54
55
56
<?php require_once("includes/connection.php") ?>
<?php require_once("includes/funcs.php") ?>
<?php
$username = $_POST['account'];
$pass = encrypt_pass($_POST['password1']);
$phone = $_POST['mobile'];
$email = $_POST['email'];
$checkbox = $_POST['acceptterms'];
//starting session
session_start();
try{
//checks form filled in
if(!filled_out($_POST)){
throw new Exception('you have not filled out the form correctly - please go back and try again.');
}
}
catch(Exception $e){
echo $e->getMessage();
exit;
}
//register session variable
$_SESSION['valid_user'] = $username;
$query = "INSERT INTO users_info(
user_name, user_id, mobile, email, confirm
) VALUES(
'{$username}', '{$pass}', '{$phone}', '{$email}', '{$checkbox}'
)";
$result = mysql_query($query);
try{
if(!$result){
throw new Exception('error loading the page - please go back and try again.');
}
}
catch(Exception $e){
echo 'duplicate username' .$e->getMessage();
exit;
}
echo ("<p style=\" font-size: 1.9em; \">");
echo ("You were successfully registered! <b>{$username}</b> <br/>");
echo ("click here to load, get some time into your account, then sign in and browse <br/>");
echo ("<a href='index.php'> Home </a>");
echo ("</p>");
?>
<?php mysql_close($connection); ?>