0xV3NOMx
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 : 18.223.159.237


Current Path : /var/www/html/kswu/orms/src/
Upload File :
Current File : /var/www/html/kswu/orms/src/registration.php

<?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 * from masuser 
	where femail = '{$emailid}'";
	$rst1 = $aobj_context->mobj_db->GetRow($query1);
	if($rst1)
	{
		$err_data = "Account already exists with this email address. Check your registered email for the password. In case password is not received, use Forgot Password option to get new password"; 	 	
		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);
	SendMailOtPToUser($emailid,$otpaswrd);
	if($rst2)
	{	
		
		$suc_data = "Registered Successfully. Use the Password sent to the registered Email id. / Mobile No. For login"; 	 	
		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"]);
	
	$query1 = "select m.* from masuser m
	where femail = '{$emailid}'";
	$rst1 = $aobj_context->mobj_db->GetRow($query1);
	//var_dump($query1);
	$otpaswrd = generateRandomString();
	if($rst1)
	{
		
		$query = "update masuser set  fpassword = '{$otpaswrd}',floginsmsstatus = null where femail = '{$emailid}'";
	$rst2 = $aobj_context->mobj_db->Execute($query);	
	SendMailOtPToUser($emailid,$otpaswrd);
	if($rst2)
	{	
		
		$suc_data = "Use the Password sent to the registered Email id. / Mobile No. for Login"; 	 	
		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;
	}
	
	}
	else
	{
		$err_data = "Account does not exists with this email address.Please Use New Registration."; 	 	
		echo $aobj_context->mobj_output->ToJSONEnvelope($err_data,-1,"Failure");
		return false;
	}	
	
	//$otpaswrd = generateRandomString();
	
	
}


function SendMailOtPToUser($emailid,$otpaswrd)
{
	require_once("sendGridMail.php");
	
	$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 Akkamahadevi Women`s University, Vijayapura,</p></br>";
	$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>Your registration is Done successfully for the notification. 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="KSWUUNI - KSWU Notification(Confirm your Registration)";	 
	$data='true';
	$data = sendGridMail($emailid,$subject,$message);
	// var_dump($data);
	// die();

}
	
function generateRandomString($length = 8)
{
    return strtoupper(substr(sha1(rand()), 0, $length));
}

?>