Location: PHPKode > projects > Chirp: The Microblog > chirp.v.1.1/confirm.php
<?php



	error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);

	

	include("includes/config.inc.php");

	include("includes/db.inc.php");

	include("language/language.".$language.".php");

	

	if (isset($_GET['token']) && !empty($_GET['token'])){

		$ssid = trim(htmlspecialchars($_GET['token'], ENT_QUOTES));

		

		$result = mysql_query('SELECT * FROM users_waiting WHERE VERID = "'.$ssid.'" LIMIT 1');

		$cnt = mysql_num_rows($result);

		

		if($cnt == 1){

			$row = mysql_fetch_array($result);

			$newpw = r_id();

			$newpw = substr($newpw, 2, 6);

			$sql = 'INSERT INTO users (USERNAME,FIRSTNAME,LASTNAME,EMAIL,STATE,SIGNUPDATE,PASSWORD) VALUES ("'.$row['USERNAME'].'","'.$row['FIRSTNAME'].'","'.$row['LASTNAME'].'","'.$row['EMAIL'].'","'.$row['STATE'].'","'.$row['SIGNDATE'].'","'.md5($newpw).'")';

			mysql_query($sql) or die(mysql_error());

			$sql = 'DELETE FROM users_waiting WHERE VERID = "'.$ssid.'" LIMIT 1';

			mysql_query($sql) or die(mysql_error());

			if (sendregemail($newpw, $row['EMAIL'])){

				echo $conmsg1;

			}else{

				echo $conmsg2;

			}

		}else{

			echo $conmsg3;

		}

	}else{

		exit();

	}



function r_id(){

	$strtime = md5(microtime());

	return $strtime;

}

	

function sendregemail($ssid, $rcpt){

	global $site_email_address;

	global $language;

	global $sitename;

	global $url;

	

	include("language/language.".$language.".php");

	

	$headers = "From: ".$site_email_address."\n"; // From address

	$headers .= "Reply-To: ".$site_email_address."\n"; // Reply-to address

	$headers .= "Organization: ".stripslashes($sitename)."\n"; // Organisation

	$headers .= "Content-Type: text/html; charset=iso-8859-1\n"; // Type

	$subj = stripslashes($sitename). $conmsg4;

	$letter = file_get_contents('letters/confirmation_reply.letter.html');

	$regmsg = $conmsg6.'<strong>'.$rcpt.'</strong><br />

	'.$conmsg7.' <strong>'.$ssid.'</strong><br /><br />'.$conmsg8;

	$regmsg = $letter.$regmsg;

	if(mail($rcpt, $subj, $regmsg, $headers)){

		return true;

	}else{

		return false;

	}

}



?>
Return current item: Chirp: The Microblog