Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 13.58.103.70
<?php
function newregistration($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
session_start();
$username = trim($aobj_context->mobj_data["username"]);
$emailid = trim($aobj_context->mobj_data["emailid"]);
$mobileno =trim($aobj_context->mobj_data["mobileno"]);
//FNOTIFICATION
$query1 = "select m.* from masuser m
where femail = '{$emailid}'";
$rst1 = $aobj_context->mobj_db->GetRow($query1);
if($rst1)
{
$err_data = "Account already exists with this email address.";
echo $aobj_context->mobj_output->ToJSONEnvelope($err_data,-1,"Failure");
return false;
}
$num = $mobileno;
$otpaswrd = generateRandomString();
$query = "insert into masuser(fusername, fmobile, femail, fpassword,fregdate)
values('{$username}','{$num}','{$emailid}','{$otpaswrd}',now())";
$rst2 = $aobj_context->mobj_db->Execute($query);
if($rst2)
{
SendMailOtPToUser($emailid,$otpaswrd);
$suc_data = "Registered Successfully. Use the Password sent to the registered Email id.";
echo $aobj_context->mobj_output->ToJSONEnvelope($suc_data,0,"Success");
return;
}
else
{
$err_data = "Some error as occured";
echo $aobj_context->mobj_output->ToJSONEnvelope($err_data,0,"Success");
return false;
}
}
function sendpassword($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$emailid = trim($aobj_context->mobj_data["emailid"]);
$otpaswrd = generateRandomString();
$query = "update masuser set fpassword = '{$otpaswrd}' where femail = '{$emailid}'";
$rst2 = $aobj_context->mobj_db->Execute($query);
if($rst2)
{
SendMailOtPToUser($emailid,$otpaswrd);
$suc_data = "Use the Password sent to the registered Email id.";
echo $aobj_context->mobj_output->ToJSONEnvelope($suc_data,0,"Success");
return;
}
else
{
$err_data = "Some error as occured";
echo $aobj_context->mobj_output->ToJSONEnvelope($err_data,0,"Success");
return false;
}
}
function SendMailOtPToUser($emailid,$otpaswrd)
{
require_once("cManualMailer.php");
$query = "select FNOTIFICATION from control";
//$rst1 = $aobj_context->mobj_db->GetRow($query);
//$advno = $rst1['FNOTIFICATION'];
$message="<html>";
$message.="<body>";
$message.="<style>";
$message.=".mail_tbl td{text-align:left; padding:2px; font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif;}";
$message.="</style>";
$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>Dear Candidate,</p></br>";
$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>Greetings from Central University of Karnataka,</p></br>";
$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>Your registration is Done successfully for the notification {$advno}. Continue with application entry using the registered id and password given below.</p></br>";
$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'> Login Password : {$otpaswrd}</p>";
$message.="</br>";
$message.="</body>";
$message.="</html>";
$subject="CUKUNI - Action required: Confirm your Registration";
$data='true';
$data= send_manual_mail($emailid,$subject,$message,$replay_to=null,$cc=null,$bcc=null);
}
function generateRandomString($length = 8)
{
return strtoupper(substr(sha1(rand()), 0, $length));
}
?>
|