<?php
/**************************************************************************************************
|
| iDocScript - Document Sharing Script
| http://www.idocscript.com
| webmaster@idocscript.com
|
|**************************************************************************************************
|
| By using this software you agree that you have read and acknowledged our End-User License 
| Agreement available at http://www.idocscript.com/eula.html and to be bound by it.
|
| Copyright (c) 2011 iDocScript.com. All rights reserved.
|**************************************************************************************************/

include("include/config.php");
include("include/functions/import.php");
$thebaseurl = $config['baseurl'];

if ($_REQUEST['userid'] != "")
{
	if (is_numeric($_REQUEST['userid']))
	{
		if (($_REQUEST['userid'] != $_SESSION['USERID']) || ($_SESSION['USERID']<=0) || (!is_numeric($_SESSION['USERID'])))
		{
			header("Location:$config[baseurl]/login");
		}
		else
		{
			$userid = cleanit(intval($_REQUEST['userid']));
			$email = $_SESSION['EMAIL'];
			$query = "SELECT code FROM members_verifycode WHERE USERID='".mysql_real_escape_string($_SESSION['USERID'])."'";
            $executequery = $conn->execute($query);
			$verifycode = $executequery->fields['code'];
			STemplate::assign('verifycode',$verifycode);			
			$sendto = $_SESSION[EMAIL];
			$sendername = $config['site_name'];
			STemplate::assign('sendername',$sendername);
			$from = $config['site_email'];
			$subject = $lang['579']." ".$sendername;
			$sendmailbody = $lang['790']." ".$_SESSION['USERNAME'].",<br><br>";
			$sendmailbody .= $lang['638']."<br><br>";
			$sendmailbody .= "<a href='".$thebaseurl."/confirmemail/".$verifycode."'>".$thebaseurl."/confirmemail/".$verifycode."</a><br><br>";
			$sendmailbody .= $lang['578'].",<br>";
			$sendmailbody .= $sendername;
            mailme($sendto,$sendername,$from,$subject,$sendmailbody,$bcc="");
			$message = $lang['651'];					
		}
	}
	else
	{
		$error = $lang['652'];	
	}
}

STemplate::assign('pagetitle',$lang['653']);
STemplate::assign('message',$message);
STemplate::assign('error',$error);

//TEMPLATES BEGIN
STemplate::display('header.tpl');
STemplate::display('empty.tpl');
STemplate::display('footer.tpl');
//TEMPLATES END
?>