add_users.php
来自「vpn虚拟专用网络的一个开源搭建工具」· PHP 代码 · 共 56 行
PHP
56 行
<?php
include('lib/conf.php');
require_once 'lib/Session.php';
include('lib/function.php');
$name = $_POST["name"];
$surname = $_POST["surname"];
$user_name = $_POST["user_name"];
$email = $_POST["email"];
$pass = $_POST["pass"];
$pass1 = $_POST["pass1"];
$number = $_POST['txtNumber'];
//session_start();
if (md5($number) != $_SESSION['image_random_value']) {
echo "The Number Verification is not valid! Try again...<br>";
echo "<a href=\"javascript:history.back();\">Go back</a>";
exit();
}
// validate email
if(!ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'. '@'. '[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.' . '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $email)) {
echo "The email is not valid! Try again...<br>";
echo "<a href=\"javascript:history.back();\">Go back</a>";
exit();
}
if (($pass == "") || ($pass != $pass1)) {
echo "The password are different or null! Try again...";
echo "<a href=\"javascript:history.back();\">Go back</a>";
exit();
}
$hash=md5($email.$hidden_hash_var);
$conn = mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($dbname,$conn);
$now = date("YmdHis");
$query = "INSERT INTO `USERS` (`id`, `hash`, `pass`, `email`, `user_name`, `name`, `surname`, `status`) VALUES ('', '$hash', MD5('$pass'), '$email', '$user_name', '$name', '$surname', '$now');";
mysql_query($query)
or die("<br>Invalid query: $query\n<BR>\n" . mysql_error());
//mysql_close($conn);
$message = "Thank You For Registering at VPN COMMUNITY!".
"\nSimply follow this link to confirm your registration: ".
"\n\nhttp://ovpnwc.sourceforge.net/user_confirm.php?hash=$hash&email=". urlencode($email).
"\n\nIf you make your registration AFTER got a membership confirm is important that you follow again the link of the previus email, because YOU ARE STILL UNCORFIRMED from that VPN!".
"\n\nOnce you confirm, you can use the services on VPN COMMUNITY.";
$query = "INSERT INTO email VALUES (null, '$email', 'Confirm your registration to VPN Community', '$message');";
mysql_query($query)
or die("<br>Invalid query: $query\n<BR>\n" . mysql_error());
echo "A Email will be sent to $email in a minute!";
redirect("index.php?pag=myaccount", 5);
?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?