include_once("myconnect.php");
include_once "session.php";
if(isset($_SESSION["sbjbs_userid"])&&($_SESSION["sbjbs_userid"]<>""))
{
header("Location:"."gen_confirm.php?errmsg=".urlencode('You are already logged in as '.$_SESSION["sbjbs_username"]));
die();
}
$config=mysql_fetch_array(mysql_query("select * from sbjbs_config"));
if($config["sb_signup_verification"]=="no")
{
header("Location:"."addmember.php");
die();
}
$errcnt=0;
if(count($_POST)<>0) //IF SOME FORM WAS POSTED DO VALIDATION
{
if(!get_magic_quotes_gpc())
{
$email=str_replace("$","\$",addslashes($_REQUEST["email"]));
}
else
{
$email=str_replace("$","\$",$_REQUEST["email"]);
}
if ( !isset( $_REQUEST["email"] ) || (strlen(trim($_REQUEST["email"] )) == 0) )
{
$errs[$errcnt]="Email Address must be provided";
$errcnt++;
}
elseif(preg_match ("/[;<>&]/", $_REQUEST["email"]))
{
$errs[$errcnt]="Email can not have any special character (e.g. & ; < >)";
$errcnt++;
}
else
{
$mem_query=mysql_query ("select * from sbjbs_seekers where sb_email_addr='$email'");
if ($mem=mysql_fetch_array($mem_query))
{
$errs[$errcnt]="Some member has already registered with this email id.";
$errcnt++;
}
}
if($errcnt==0)
{
$config=mysql_fetch_array(mysql_query("select * from sbjbs_config "));
mysql_query ("delete from sbjbs_signups where sb_email='$email'");
$rnum = mt_rand(1,1000000000);
$insert_str="Insert into `sbjbs_signups` ( sb_email ,sb_rnum,sb_onstamp)
VALUES ( '$email','$rnum','" . date("YmdHis",time()) . "')";
mysql_query($insert_str);
if(mysql_affected_rows()>0)
{
//==================send confirmation mail================
$sb_null_char=$config["sb_null_char"];
$signup_url=$config["sb_site_root"]."/addmember.php?rnum=$rnum&email=".$_REQUEST["email"];
$sql = "SELECT * FROM sbjbs_mails where sb_id=10" ;
$rs_query=mysql_query($sql);
if ( $rs=mysql_fetch_array($rs_query) )
{
$from =$rs["sb_fromid"];
$to = $_REQUEST["email"];
$subject =$rs["sb_subject"];
$header="From:" . $from . "\r\n" ."Reply-To:". $from ;
$body=str_replace("%email%", $_REQUEST["email"],str_replace("%password%",$sb_null_char,str_replace("%lname%", $sb_null_char,str_replace("%fname%", $sb_null_char,str_replace("%username%", $sb_null_char, $rs["sb_mail"]) ))));
$body=str_replace("%signup_url%",$signup_url,str_replace("%login_url%",$sb_null_char,$body));
if(isset($rs["sb_html_format"])&&($rs["sb_html_format"]=="yes"))
{
$header .= "\r\nMIME-Version: 1.0";
$header .= "\r\nContent-type: text/html; charset=iso-8859-1\r\n";
//$body=str_replace("\n","
",$body);
}
//echo "--from:-$from----to:-$to---sub:-$subject----head:-$header----";
//echo "
$body"; //die(); if( $rs["sb_status"]=='yes') mail($to,$subject,$body,$header); } //======================================================== // echo "
| Your signup request cannot be processed due to following reasons | |
| 1 | |