-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_user_process.php
executable file
·71 lines (51 loc) · 1.75 KB
/
create_user_process.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
<?php
/********************************************************
*
* phpAbstracts
* http://www.phpabstracts.com
*
* For copyright and license information, see readme.txt
*
*********************************************************/
//Include header template
include('header.php');
//Only ADMINs can view this page
if ($admin) {
//Grab variables from form
$login=$_POST['login'];
$pw = $_POST['pw'];
$name = $_POST['name'];
$email = $_POST['email'];
$role = $_POST['role'];
//Database Connection Variables
include('db.php');
//Connect to database
mysql_connect($host,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
//Insert values into database
$query = "INSERT INTO users VALUES ('', '$login', '$pw', '$name', '$email', '$role')";
mysql_query($query) or die(mysql_error());
//Close database
mysql_close();
//Send e-mail to new user
$to = $email;
$subject = "Welcome to " . $site_title;
$body = "Welcome to " . $site_title .
"\n\nYou may login to the system at " . $site_url .
"\n\nYour login information is below. Please do not delete this email." .
"\n\nLogin: " . $login . "\nPassword: " . $pw .
"\n\nThank you for your participation.";
$from = $site_email;
$headers = "From: $from";
mail($to, $subject, $body, $headers);
//Print confirmation
echo "<br /><br /><br />" .
"<div class='statusbox'>" .
"<p>User ID '" . $login . "' has been successfully created.</p>" .
"<p><a href='list.php'>Return " . $home_title . "</a> | <a href='list_users.php'>Return to " . $user_mgmt_title . "</a></p>" .
"</div>".
"<br /><br /><br />";
}//if admin
//Include footer template
include('footer.php');
?>