403Webshell
Server IP : 104.21.21.239  /  Your IP : 216.73.216.191
Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5
System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64
User : ec2-user ( 1000)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/mitzvahm/planner/mod/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/mitzvahm/planner/mod/pwd_reset.php
<?php include('_mod_security.php'); ?>
<?php
	$hkey_error = 0;
	$hkey = mysqli_real_escape_string($GLOBALS['con'], trim($_GET['hkey']));
	//var_dump($hkey);
	if (empty($hkey) || $hkey == '') :
		$hkey_error = 1;
	else :
		$sql = "SELECT * FROM users WHERE hash_key = '".$hkey."' AND hash_key_expires >= NOW() AND active = 1";
		$result = mysqli_query($GLOBALS['con'], $sql);
		if (mysqli_num_rows($result) < 1) :
			$hkey_error = 1;
			echo '<h1>This link is invalid or expired!</h1>';
			return;
		else :
			$row = mysqli_fetch_object($result);
		endif;
	endif;
	$form_error = 0;
	$form_error_text = '';
	$step = 1;
	if ($_POST['submitted_step1'] == '1') :
		if (empty($_POST['email'])) :
			$ar_err['email'] = 'Email required!';
			$err_flag = true;
		endif;
		if (!$err_flag) :
			$sql = "SELECT * FROM users WHERE email = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['email']))."' AND active = 1";
			$result = mysqli_query($GLOBALS['con'], $sql) or die('Database error!');
			if (mysqli_num_rows($result) > 0) :
				$row = mysqli_fetch_object($result);
				$security_question = $row->security_question;
				$step = 2;
			else:
				echo("<h3>Error: Invalid email address!</h3>");
				return;
			endif;
		endif;
	elseif ($_POST['submitted_step2'] == '1') :
		if (empty($_POST['email'])) :
			$ar_err['email'] = 'Email required!';
			$err_flag = true;
		endif;
		if (empty($_POST['security_question'])) :
			$ar_err['security_question'] = 'Security Question is required!';
			$err_flag = true;
		endif;
		if (empty($_POST['security_answer'])) :
			$ar_err['security_answer'] = 'Security Answer is required!';
			$err_flag = true;
		endif;
		if (!$err_flag) :
			$sql = "SELECT * FROM users WHERE email = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['email']))."' AND active = 1";
			$result = mysqli_query($GLOBALS['con'], $sql) or die('Database error!');
			if (mysqli_num_rows($result) > 0) :
				$row = mysqli_fetch_object($result);
				if (strtolower($_POST['security_question']) == strtolower($row->security_question) && strtolower($_POST['security_answer']) == strtolower($row->security_answer)) :
					$hash_md5 = md5(mt_rand(0,2147483647));
					$hash_expires = date('Y-m-d H:i:s', strtotime('+3 days'));
					$sql = "UPDATE users 
							SET hash_key = '".$hash_md5."'".
								",hash_key_expires = '".$hash_expires."'".
							" WHERE id = ".$row->id;
					mysqli_query($GLOBALS['con'], $sql) or die('Database error!');
					//***************** mail using PEAR *****************
					require_once "Mail.php";
					$mail_body = "<html>".
								"Please click on the link below or cut and paste it into your browser:<br /><br /> ".
								'<a href="'.$app_base."index.php?IX=pwd_reset&hkey=".$hash_md5.'">'.$app_base."index.php?IX=pwd_reset&hkey=".$hash_md5."</a> <br /><br />".
								"This link will expire 72 hours from the time this email was sent.".
								"</html>";
					$pmail_from = '[email protected]';
					$pmail_to["To"] = $row->email;
					$pmail_to["Bcc"] = $app_mail_bcc;
					$pmail_subject = 'Password reset instructions - MitzvahOrganizer.com';
					$pmail_body = $mail_body;
					$pmail_host = get_cfg_var('SMTP');
					$pmail_username = "";
					$pmail_password = "";
					$pmail_headers = array ('From' => $pmail_from,
					'To' => $pmail_to["To"],
					'Subject' => $pmail_subject,
					'MIME-Version' => '1.0',
					'Content-type' => 'text/html; charset=iso-8859-1');
					$smtp = Mail::factory('smtp',
					array ('host' => $pmail_host,
					 //'auth' => true,
					 'auth' => false,
					 'username' => $pmail_username,
					 'password' => $pmail_password
					 ));
					$pmail = $smtp->send($pmail_to, $pmail_headers, $pmail_body);
					if (PEAR::isError($pmail)) :
						echo("<h3>Message delivery failed...</h3>");
						echo $pmail->getMessage();
					else :
						//echo '<h3>Your reset instructions have been sent. Please check your email.</h3>';
						echo " ";
					endif;
					/*
					*/
					//**** ************************** *****
					/*
					$mail_to = $row->email;
					$mail_subject = "Password reset instructions - MitzvahOrganizer.com";
					$mail_body = "Please click on the link below or cut and paste it into your browser:\n\n ".
								$app_base."index.php?IX=pwd_reset&hkey=".$hash_md5." \n\n".
								"This link will expire 72 hours from the time this email was sent.";
					$mail_headers = 'From: '.$app_mail_from."\r\n".'Reply-To: '.$app_mail_from."\r\n" .'X-Mailer: PHP/'.phpversion();
					if (mail($mail_to, $mail_subject, $mail_body, $mail_headers)) :
						echo(" ");
					else :
					   echo("<p>Message delivery failed...</p>");
					endif;
					*/
				endif;
			endif;
			echo("<h3>If your information is verified, you will receive an email with password reset instructions shortly.</h3>");
			return;
		endif;
	elseif ($_POST['submitted_pwd'] == '1') :
		if (empty($_POST['email'])) :
			$ar_err['email'] = 'Email required!';
			$err_flag = true;
		endif;
		if (empty($_POST['security_question'])) :
			$ar_err['security_question'] = 'Security Question is required!';
			$err_flag = true;
		endif;
		if (empty($_POST['security_answer'])) :
			$ar_err['security_answer'] = 'Security Answer is required!';
			$err_flag = true;
		endif;
		if (empty($_POST['pwd_new'])) :
			$ar_err['pwd_new'] = 'New password required!';
			$err_flag = true;
			$err_tab = 'password';
		endif;
		if (empty($_POST['pwd_new2']) || $_POST['pwd_new2'] != $_POST['pwd_new']) :
			$ar_err['pwd_new2'] = 'New password confirmation must match!';
			$err_flag = true;
			$err_tab = 'password';
		endif;
		if (!$err_flag) :
			$sql = "SELECT * FROM users WHERE email = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['email']))."' AND hash_key = '".$hkey."' AND active = 1";
			$result = mysqli_query($GLOBALS['con'], $sql) or die('Database error!');
			if (mysqli_num_rows($result) > 0) :
				$row = mysqli_fetch_object($result);
				$salt_str = '';
				if (empty($row->password2)) :
					$salt_str = " ,password = NULL, salt = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['salt']))."' ";
				endif;
				if (strtolower($_POST['security_question']) == strtolower($row->security_question) && strtolower($_POST['security_answer']) == strtolower($row->security_answer)) :
					$sql = "UPDATE users 
							SET hash_key = NULL ".$salt_str.
								",hash_key_expires = '1980-01-01'".
								",password2 = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['pwd_new']))."' ".
							" WHERE id = ".$row->id;
					mysqli_query($GLOBALS['con'], $sql) or die('Database error!');
					echo("<h3>Your new password has been set.</h3>");
				else :
					echo("<h3>Verification error! Security question/answer incorrect.</h3>");
				endif;
			else :
				echo("<h3>Verification error! This link or email is invalid or expired!</h3>");
			endif;
			return;
		endif;
	endif;
?>

<script>
	encode_pwd = function()
	{
		if (document.getElementById('pwd_new').value)
		{
			document.getElementById('pwd_new').value = CryptoJS.SHA512(document.getElementById('salt').value + document.getElementById('pwd_new').value);
		}
		if (document.getElementById('pwd_new2').value)
		{
			document.getElementById('pwd_new2').value = CryptoJS.SHA512(document.getElementById('salt').value + document.getElementById('pwd_new2').value);
		}
		return true;
	}

</script>

<h1>Password Reset</h1>

<div class="cleardiv">
	&nbsp;
</div>
<div class="tab_content" id="tab_content_general" style="display:block;">
	<?php
		if (empty($hkey) || $hkey == '') :
	?>
			<form method="post" action="" >
				<table>
					<tr valign="top">
						<td class="label">
							Your email:
						</td>
						<td>
							<input type="text" id="email" name="email" class="input-box" maxlength="75" value="<?php echo $_POST['email']; ?>" <?php if ($step != 1) : echo 'readonly="readonly"'; endif; ?>" />
							<?php show_form_error($ar_err['email']); ?>
						</td>
					</tr>
					<?php
						if ($step == 2) :
					?>
							<tr>
								<td>
									Security Question
								</td>
								<td>
									<input type="text" id="security_question" name="security_question" class="input-box" maxlength="75" readonly="readonly" value="<?php echo $security_question; ?>" />
									<?php show_form_error($ar_err['security_question']); ?>
								</td>
							</tr>
							<tr>
								<td>
									Security Answer
								</td>
								<td>
									<input name="security_answer" id="security_answer" type="text" maxlength="100" value="<?php echo $_POST['security_answer']; ?>"  />
									<?php show_form_error($ar_err['security_answer']); ?>
								</td>
							</tr>
							<tr valign="middle">
								<td colspan="2" align="right">
									<input type="hidden" id="submitted_req" name="submitted_step2" value="1"  >
									<input type="submit" name="button" value="Submit" class="default-button" >
								</td>
							</tr>
					<?php
						else:
					?>
							<tr valign="middle">
								<td colspan="2" align="right">
									<input type="hidden" id="submitted_req" name="submitted_step1" value="1"  >
									<input type="submit" name="button" value="Next..." class="default-button" >
								</td>
							</tr>
					<?php
						endif;
					?>
				</table>
			</form>
	<?php
		else :
			if (empty($row->salt)):
				$row->salt = hash('sha512', random_bytes(64));
			endif;
	?>
			<form method="post" action=""  onsubmit="encode_pwd();">
				<input type="hidden" id="submitted_pwd" name="submitted_pwd" value="1"  >
				<table>
					<tr valign="top">
						<td class="label">
							Your email:
						</td>
						<td>
							<input type="text" id="email" name="email" class="input-box" maxlength="75" value="<?php echo $_POST['email']; ?>" />
							<?php show_form_error($ar_err['email']); ?>
						</td>
					</tr>
					<tr>
						<td>
							Security Question
						</td>
						<td>
							<input type="text" id="security_question" name="security_question" class="input-box" maxlength="75" readonly="readonly" value="<?php echo $row->security_question; ?>" />
							<?php show_form_error($ar_err['security_question']); ?>
						</td>
					</tr>
					<tr>
						<td>
							Security Answer
						</td>
						<td>
							<input name="security_answer" id="security_answer" type="text" maxlength="100" value="<?php echo $_POST['security_answer']; ?>"  />
							<?php show_form_error($ar_err['security_answer']); ?>
						</td>
					</tr>
					<tr>
						<td>
							New Password
						</td>
						<td>
							<input name="salt" id="salt" type="hidden" value="<?php echo $row->salt; ?>"  />
							<input name="pwd_new" id="pwd_new" type="password" maxlength="150" value=""  />
							<?php show_form_error($ar_err['pwd_new']); ?>
						</td>
					</tr>
					<tr>
						<td>
							Confirm New Password
						</td>
						<td>
							<input name="pwd_new2" id="pwd_new2" type="password" maxlength="150" value=""  />
							<?php show_form_error($ar_err['pwd_new2']); ?>
						</td>
					</tr>
					<tr valign="middle">
						<td colspan="2" align="right">
							<input type="submit" name="button" value="Submit" class="default-button" >
						</td>
					</tr>
				</table>
			</form>
	<?php
		endif;
	?>
</div>

Youez - 2016 - github.com/yon3zu
LinuXploit