⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 memb_confirm.php

📁 vpn虚拟专用网络的一个开源搭建工具
💻 PHP
字号:
<?php
require_once 'lib/Session.php';
if (isset($_SESSION['image_random_value'])) {
// remove the random value from session
$_SESSION['image_random_value'] = '';
}
include('lib/conf.php');

$hash = $_GET["hash"];
$idcomm = $_GET["idcomm"];
$email = $_GET["email"];

//verify that they didn't tamper with the email address
$new_hash=md5($email.$hidden_hash_var);
if ($new_hash && ($new_hash==$hash)) {
	$conn = mysql_connect($dbhost,$dbuser,$dbpass);
	mysql_select_db($dbname,$conn);

	$query ="SELECT * FROM `USERS` WHERE email='$email' AND status='1'";
	$result=mysql_query($query)
	or die("<br>Invalid query: $query\n<BR>\n" . mysql_error());
	if (!$result || mysql_num_rows($result) < 1) {
	include('head.php');
// this is new user
?>
		<div id="maincontent">
			<div class="item">
				<h2 class="title">.: User Registration :.</h2>
				<form method="post" action="add_users.php" name="insertForm" id="insertForm">
					<p class="first">Name:
					<input type="text" name="name" size="30" maxlength="30" /></p>
					<p class="first">Surname:
					<input type="text" name="surname" size="30" maxlength="30" /></p>
					<p class="first">User Name:
					<input type="text" name="user_name" size="30" maxlength="30" /></p>
					<p class="first">Email:
					<input type="text" readonly="readonly" name="email" size="30" value="<?echo $email?>" /></p>
					<p class="first">Password:
					<input type="password" name="pass" size="30" maxlength="30" /></p>
					<p class="first">Confirm Password:
					<input type="password" name="pass1" size="30" maxlength="30" /></p>
					<p class="first">Number Verification:
					Type the number you see in the picture below.</p>
					<p class="first"><img src="usr-auth/randomImage.php"></p>
					<p class="first">
					<input name="txtNumber" type="text" id="txtNumber" value size="5"></p>
					<p class="first">View the
					<a target="_blank" href="tos.html">Terms of Service</a> &amp;
					<a target="_blank" href="privacy.html">Privacy Policy</a>.
					<br>
					You must accept them to register a account</p>
					<input type="submit" value="I accept. Register my account" />
				</form>
			</div>
		</div>
<?
	}
	else {
// the user is already registred
		include('login.php');
		include('head.php');
		include('lib/function.php');

		$conn = mysql_connect($dbhost,$dbuser,$dbpass);
		mysql_select_db($dbname,$conn);


//find this record in the db
		$query = "SELECT * FROM `MEMB` WHERE hash='$hash' AND confirmed='0'";
		$result=mysql_query($query)
		or die("<br>Invalid query: $query\n<BR>\n" . mysql_error());
		if (!$result || mysql_num_rows($result) < 1) echo "ERROR - Hash Not Found or Not succed login";
		else {

// ip_num generator
			$query ="SELECT * FROM `COMM` WHERE id='$idcomm'";
			$result=mysql_query($query)
			or die("<br>Invalid query: $query\n<BR>\n" . mysql_error());
			$row = mysql_fetch_array ($result);

			$ipnet = $row["subnet"];
			$mask = $row["netmask"];
			$host = $row["tot_usr"]+1;
			$ip = ip2long($ipnet);
			$nm = ip2long($mask);
			$nw = ($ip & $nm);
			$bc = $nw | (~$nm);
			$broadcast_addr = long2ip($bc);
			$ip_num=CalculateIPRange($ipnet, $broadcast_addr, $host);

//confirm the email and set account to active
			$query="UPDATE `MEMB` SET id='$uid',ip_num='$ip_num',confirmed='1' WHERE hash='$hash' AND id1='$idcomm'";
			mysql_query($query)
			or die("<br>Invalid query: $query\n<BR>\n" . mysql_error());

//update the number of the subscribed users
			$query="UPDATE `COMM` SET tot_usr='$host' WHERE id='$idcomm'";
			mysql_query($query)
			or die("<br>Invalid query: $query\n<BR>\n" . mysql_error());
			//mysql_close($conn);
			redirect("index.php?pag=myaccount");
		}
	}
	include('foot.php');
}
else {
	echo "HASH or EMAIL INVALID - UPDATE FAILED";
}
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -