<?php

$aeupe_url = $_SERVER['HTTP_ORIGIN'].'/acis/ais/';
session_start();
$current_username =  $_SESSION['imd_Uname'];
$basepath = explode('modules',getcwd());//die;

/*
if(isset($_REQUEST['token']) && !empty($_REQUEST['token']) && isset($_REQUEST['fp_id']) && !empty($_REQUEST['fp_id']))
{	
	//echo "<pre>";print_r($_REQUEST);die;
	require_once($basepath[0]."config.php");
	$conn = pg_connect("host=localhost dbname=arrupeco_acis user=postgres password=Tapioca113##");
	$token = $_REQUEST['token'];
	$fp_id = $_REQUEST['fp_id'];

	//$sql1 = "update forgot_password set status='1' where token=$token and id=$fp_id";
	//echo $sql1;die;	
	$query1 =  pg_query($conn, "update forgot_password set status=1 where token='".$token."' and id='".$fp_id."' ");
	//echo "query1 =";var_dump($query1);echo "<br>";
	if($query1){
    	
		$sql2 = "select * from forgot_password where token='".$token."' and id='".$fp_id."'";
		$query2 =  pg_query($conn, $sql2);
    	$result = pg_fetch_all($query2);
    	//echo "<pre>"; print_r($result);die;
    	if($result[0]['user_type'] == 'students'){
        	$sql3 = "update students set password='".$result[0]['password']."' where cfield_2='".$result[0]['email']."'";
        } else if($result[0]['user_type'] == 'users'){
        	$sql3 = "update users set password='".$result[0]['password']."' where cfield_2='".$result[0]['email']."'";
        } 
    	//echo $sql3;die;
    	$query3 = pg_query($conn, $sql3);
    	var_dump($query3);
    	if($query3){
        	//Delete request record
        	$query4 = pg_query($conn, "delete from forgot_password where token='".$token."' and id='".$fp_id."' ");
        	echo "<script>alert('Password Updated Successfully..'); </script>"; //die('ddddd');
        	header('location:'.$aeupe_url);
        	//die('truuuuu');
        	//echo "query3 =";var_dump($query3);echo "<br>";
    	//echo $sql3;die;
        } else {
        		$query5 =  pg_query($conn, "update forgot_password set status=0 where token='".$token."' and id='".$fp_id."' ");
        		echo "<script>alert('SORRY! Please try again'); </script>"; //die('ddddd');
        		header('location:'.$aeupe_url);
        } 
    	
	} 
}   

*/
?>

<HTML><HEAD><TITLE>JCAM Virtual Classroom</TITLE><meta http-equiv="Content-Type" content="text/html" charset="UTF-8" /><meta http-equiv="Content-Language" content="en-us" />

					
					<script language='JavaScript' src="<?php echo $aeupe_url;?>js/ajax.js"></script>
					<script language='JavaScript'> runPutFocus=false;</script>
					<script language="javascript" src="<?php echo $aeupe_url;?>js/menu_func.js"></script>
					
					<!-- <link rel=stylesheet type=text/css href='style.css'> -->
                          
                    <style>.tdbg, .thbgtable th {color:white;}</style><style>.SelectedTopTab {background-image:url(<?php echo $aeupe_url;?>themes/green/bg.png);background-position:top;}.StandartBGStyle {background-image:url(<?php echo $aeupe_url;?>themes/green/bg_dark.png);}.Gridtable_header, #GridScalex_layer {background-image:url(<?php echo $aeupe_url;?>themes/green/bg_dark2.png);background-color:white;background-repeat:repeat-x;}.select-free{position:absolute;z-index:10;overflow:hidden;/*must have*//*width:209px;/*must have for any value*/;
				}
				.hilite{background-color:749FFF !important;}
                .hilite1{background-color:bddb80 !important;}

				</style>
				
				<link rel=stylesheet type=text/css href="<?php echo $aeupe_url;?>images/themes/stylesheet.css">  <link rel="stylesheet" type="text/css" media="all" href="<?php echo $aeupe_url;?>js/jscalendar/calendar-blue2.css" />
	    		<script type="text/javascript" src="<?php echo $aeupe_url;?>js/jscalendar/calendar.js"></script>
				<script type="text/javascript" src="<?php echo $aeupe_url;?>js/jscalendar/lang/calendar-en.js"></script>
				<script type="text/javascript" src="<?php echo $aeupe_url;?>js/jscalendar/calendar-setup.js"></script>
				<script type="text/javascript" src="<?php echo $aeupe_url;?>js/tipmessage/main15.js"></script></HEAD><BODY height=100% 
                 leftmargin=0 marginwidth=0 style='margin-top:20;margin-bottom:0;' 
                  background="<?php echo $aeupe_url;?>themes/green/bg_dark.png" ><CENTER>
				<TABLE height=100% width=100% align=center bgcolor=white><TR><TD height=100% width=100% valign=top align=center><BR><BR>
                <img src="<?php echo $aeupe_url;?>images/themes/logo_new.png" border=0><BR><BR><font size=4 color=gray> </font><BR><BR>
                <TABLE height=10% width=50% align=center bgcolor=white><TR><TD height=100% width=100% valign=top align=center 
                bgcolor=white><center><TABLE border="0" width="90%" cellspacing="0" cellpadding="0"><TR><TD><table border="0" width="100%"
               cellspacing="1" cellpadding="0" ><TR><TD class=BoxHeading  
                style="background-image:url(<?php echo $aeupe_url;?>themes/green/BoxHeading.png);">
                <font face=Verdana,Arial,sans-serif size=3><b style="color:#ffffff;visibility:hidden;">Forgot Password</b></font></TD></TR><tr><td>
                <table class="color_ra" border="0" width="100%" cellspacing="2" cellpadding="5" 
                style="border:1px solid #69b21e;border-radius: 0px 0px 5px 5px"><tr><td>
                <img src="<?php echo $aeupe_url;?>images/pixel_trans.gif" border="0" width="100%" height="1"></td></tr><tr><td align=left >
                <form name='forgotpswdform' class='forgotpswdform' method='post' action='<?php echo $aeupe_url;?>modules/mod_ssetup/forgotpswd_action.php'>
		<center><table border='0' cellspacing='0' cellpadding='5'>
		
		<tr>
			<td align=right><font color=gray><b>Email</b></font></td>
			<td align=left><input type='email' name='USER_EMAIL' size='25' maxlength='115' required /></td>
			
		</tr>
      
       

		<td align=CENTER colspan=2><INPUT type=submit name="forgotpswdform" value='Submit'></td>

		</table></center></form></td></tr><tr><td><img src="<?php echo $aeupe_url;?>images/pixel_trans.gif" border="0" alt="" width="100%" height="1"></td></tr></table></td></tr></table></TD></TR></TABLE></center></TABLE></TD></TR><TR><TD width=100% valign=bottom style="text-align:justify;" border=4></TD></TR><td style='text-align:right;height:20px;width:100%;float:right;background-image:url(<?php echo $aeupe_url;?>themes/green/bg_light.png);background-position:bottom'><A HREF=http://www.arrupecollege.org>ACIS</A> version 1.0 &copy; 2009-2020</td></table></DIV>
		<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
		<script>
			jQuery(document).ready(function(){
				jQuery('form.forgotpswdform').submit( function(e){ 
                	//alert('hhhh');
   					e.preventDefault();
                	var formData = new FormData(jQuery(this)[0]);
                	formData.append('form_type','forgotpswdform');
                	jQuery.ajax({
                    	url: "<?php echo $aeupe_url;?>"+'modules/mod_ssetup/forgotpswd_action.php',
                    	type:"post",
                    	data:formData,
                    	dataType:'json',
                    	error:function(xhr,statusText){
                        	console.log(statusText);
                        },
                    	success:function(data){
                        	if(data.success == 'true'){
                            	alert(data.message);
                            } else {
                            	alert(data.message);
                            	return false;
                            }
                        	/*console.log(data);
                        	alert(data.success);
                        	alert(data.message); */
                        },
                    	 processData: false,
    					 contentType: false,
                    });
                
                	//alert('helllo');
    
				});
			});
		</script>
		
		
		</BODY></HTML>	
 
