| Server IP : 209.209.40.120 / Your IP : 216.73.217.112 Web Server : Microsoft-IIS/10.0 System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586 User : NEWWWW$ ( 0) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/HostingSpaces/admin/247sms.com/wwwroot/ |
Upload File : |
<?php
include "general.php";
include "connect.php";
include 'sendmailclient.php';
function rand_string( $length ) {
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$size = strlen( $chars );
for( $i = 0; $i < $length; $i++ ) {
$str .= $chars[ rand( 0, $size - 1 ) ];
}
return $str;
}
function getUsername( $musername,$domain)
{
include "connect.php";
$cnt ="";
// $con=mysqli_connect("127.0.0.1","smsEngine","guEnaR28T","smartsmsrouter");
// Check connection
//if (mysqli_connect_errno())
//{
// echo mysqli_error($con);
//echo "-1";
// die();
// }
$query ="select * from userlogin where username='". $musername ."' and domain='".$domain."'";
//echo $query;
if(!$result= mysqli_query($con,$query))
{
//echo mysqli_error($con);
echo "Database error please try again";
mysqli_close($con);
exit();
}
$cnt= "";
while($row = mysqli_fetch_array($result))
{
//$cnt = $row['balairtime'];
$cnt="yes";
}
//echo $cnt;
mysqli_close($con);
return $cnt;
}
function getUser( $memail,$domain)
{
include "connect.php";
$cnt ="";
$query ="select * from userlogin where email='". $memail ."' and domain='".$domain."'";
//echo $query;
if(!$result= mysqli_query($con,$query))
{
//echo mysqli_error($con);
echo "Database error please try again";
mysqli_close($con);
exit();
}
$cnt= "";
while($row = mysqli_fetch_array($result))
{
$cnt = $row['username'];
//$cnt="yes";
}
//echo $cnt;
mysqli_close($con);
return $cnt;
}
function getPhone( $phonenumber,$domain)
{
include "connect.php";
$cnt ="";
// $con=mysqli_connect("127.0.0.1","smsEngine","guEnaR28T","smartsmsrouter");
// Check connection
//if (mysqli_connect_errno())
//{
// echo mysqli_error($con);
//echo "-1";
// die();
// }
$query ="select * from userlogin where phonenumber='". $phonenumber ."' and domain='".$domain."'";
//echo $query;
if(!$result= mysqli_query($con,$query))
{
//echo mysqli_error($con);
echo "Database error please try again";
mysqli_close($con);
exit();
}
$cnt= "";
while($row = mysqli_fetch_array($result))
{
//$cnt = $row['balairtime'];
$cnt="yes";
}
//echo $cnt;
mysqli_close($con);
return $cnt;
}
function getEmail( $memail,$domain)
{
$cnt ="";
include "connect.php";
//$con=mysqli_connect("127.0.0.1","smsEngine","guEnaR28T","smartsmsrouter");
// Check connection
//if (mysqli_connect_errno())
//{
// echo mysqli_error($con);
//echo "-1";
// die();
// }
$query ="select * from userlogin where email='". $memail ."' and domain='". $domain."'";
//echo $query;
if(!$result= mysqli_query($con,$query))
{
//echo mysqli_error($con);
echo "Database error please try again";
mysqli_close($con);
exit();
}
$cnt= "";
while($row = mysqli_fetch_array($result))
{
//$cnt = $row['balairtime'];
$cnt="yes";
}
//echo $cnt;
mysqli_close($con);
return $cnt;
}
//**************************
//**************************
// end of function
//$_SESSION['accounttype']="euro";
// if ($_SESSION['accounttype'] == "" ){
//header('Location: register.php?err=1');
// die();
// }
// $username =$_POST["username"];
//echo $username ."<br>";
//$pass =$_POST["password"];
//echo $pass."<br>";
$email =$_POST["fgotemail"];
//echo $email."<br>";
//$phonenumber =$_POST["phone"];
//echo $phonenumber."<br>";
date_default_timezone_set('Europe/London');
if ($email=="")
{
header('Location: fgot.php?err=4');
die();
}
//check if username already exists
$response =getUser($email,$domain);
if ($response=="")
{
header('Location: fgot.php?err=2');
die();
}
$username = $response;
//check if email already exists
$response =getEmail($email,$domain);
if ($response=="")
{
header('Location: fgot.php?err=1');
die();
}
$emailcode= rand_string(36);
$mysub = "Forgot Paasword " . $domain;
$myMessage ="Dear <b>". $username. "</b>,<br><br>";
$myMessage .= "Use the below link to reset your password<br><br>";
$myMessage .= "<a href='http://www.".$domain."/npass.php?email=".$email."&id=". $emailcode . "'>Click here to reset your password</a><br><br>";
$myMessage .= "Thanks for your interest in our service. " . "<br>";
$myMessage .= "<b>Support " . $domain."</b>";
$mysub = "Forgot Password " . $domain;
$myMessage2 ="Dear ". $username. ",\n\n";
$myMessage2 .= "Use the below link to reset your password\n\n";
$myMessage2 .= "http://www.".$domain."/npass.php?email=".$email."&id=" . $emailcode . "\n\n";
$myMessage2 .= "Thanks for your interest in our service. " . "\n";
$myMessage2 .= "Support " . $domain;
$mymail = sendmailtoclient($email,$myMessage,$myMmessage2,$mysub,$mfrom,$mfromname);
$query ="INSERT INTO fgotpass (username,email,emailcode,status,domain, dateused) VALUES ('". $username."','". $email."','".$emailcode."','0','". $domain. "','". date('Y-m-d H:i:s')."')";
if(!$result= mysqli_query($con,$query))
{
//echo mysqli_error($con);
header('Location: fgot.php?err=3');
mysqli_close($con);
die();
}
//$_SESSION['emailcode'] =$emailcode;
// $_SESSION['smscode'] =$smscode;
header('Location: fgot.php?err=0');
die();
?>