<?php
session_start();
error_reporting(0);
include("adminlogin/include/config.php");
if(isset($_POST['submit']))
{
$ret=mysqli_query($conn,"SELECT * FROM users WHERE userEmail='".mysqli_real_escape_string($conn,$_POST['username'])."' and password='".md5(mysqli_real_escape_string($conn,$_POST['password']))."'");
$num=mysqli_fetch_array($ret);
if($num>0)
{
$extra="users/dashboard.php";
$_SESSION['login_user']=$_POST['username'];
$_SESSION['id']=$num['id'];
$host=$_SERVER['HTTP_HOST'];
$uip=$_SERVER['REMOTE_ADDR'];
$status=1;
$log=mysqli_query($conn,"insert into userlog(uid,username,userip,status) values('".$_SESSION['id']."','".$_SESSION['login']."','$uip','$status')");
$uri=rtrim(dirname($_SERVER['PHP_SELF']),'/\\');
header("location:https://$host$uri/$extra");
exit();
}
else
{
$_SESSION['login']=$_POST['username'];	
$uip=$_SERVER['REMOTE_ADDR'];
$status=0;
mysqli_query($conn,"insert into userlog(username,userip,status) values('".$_SESSION['login']."','$uip','$status')");
$errormsg="Invalid username or password";
$extra="login.php";
}
}
if(isset($_POST['change']))
{
   	$email=$_POST['email'];
   	$contact=$_POST['contact'];
   	$password=md5($_POST['password']);
$query=mysqli_query($conn,"SELECT * FROM users WHERE userEmail='$email' and contactNo='$contact'");
$num=mysqli_fetch_array($query);
if($num>0)
{
//mysql_query("update users set password='$password' WHERE userEmail='$email' and contactNo='$contact' ");
//$msg="Password Changed Successfully";
$body ='<html>
<head>
<style>
body
{
background: #fff;
font-family: fantasy;
font-size:16px;
font-weight: bold;
color: #fff;
}
.content{
overflow:hidden;
background-color:#f6f6f6;
margin: 10px;
padding:10px;
}
</style>
</head>
<body>
<div class="content">
<h1>AVIT- TICKET RAISING MANAGEMENT SYSTEM</h1>
<h3>Dear '.$email.',</h3>
<h5></h5>
<center><a href="https://vinayakamissions.com/vmcc-ticket/forgotpassword.php?email='.$email.'&contact='.$contact.'" target="_blank"><button class="btn btn-warning">Click here to Reset Your Password</button></a></center><br />
<p align="center">This is an auto Generated Email. Please do not reply.</p>
</div>
</body>';
//to send HTML mail, the Content-type header must be set:
$headers='MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html;charset=iso-8859-1' . "\r\n";
$headers .= 'From: AVIT TICKET SYSTEM <noreply@avit.ac.in>' . "\r\n";
$to = $email;
$subject = "AVIT- TICKET REST PASSWORD";
//mail function
$mail = mail($to, $subject, $body, $headers);
if(!$mail) { 
echo "Error. Try after Sometime";
} else 
{
echo "<script language='javascript' type='text/javascript'>";
echo "alert('Reset Password Link has been Sent to Your Mail id. Please check it.');";
echo "</script>";
echo "<script>  window.location.href = 'https://vinayakamissions.com/vmcc-ticket/index.php';</script>";
}
}
else
{
$errormsg="Invalid email id or Contact no";
}
}
?>
<?php
include('adminlogin/include/config.php');
error_reporting(0);
if(isset($_POST['submit2']))
{
	$fullname=$_POST['fullname'];
	$email=$_POST['email'];
	$password=md5($_POST['password']);
	$contactno=$_POST['contactno'];
	$status=1;
	$query=mysqli_query($conn,"insert into users(fullName,userEmail,password,contactNo,status) values('$fullname','$email','$password','$contactno','$status')");
	$msg="Registration successfull. Now You can login !";
}
?>
<!DOCTYPE>
<html xmlns="#">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Aarupadai Veedu Institute of technology</title>
<link rel="icon" type="image/x-icon" href="../assets/images//favicon.png" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
 <!-- Google reCaptcha -->
<script src="https://google.com/recaptcha/api.js" async defer></script>    
    <!-- Custom styles for this template -->
<!--    <link href="assets/css/style.css" rel="stylesheet">-->
<!--    <link href="assets/css/style-responsive.css" rel="stylesheet">-->
     	<style>
     	
     	.login-form-1 {
    padding: 3%;
           background: #e0edff;
    box-shadow: 0 5px 8px 0 rgb(0 0 0 / 20%), 0 9px 26px 0 rgb(0 0 0 / 19%);
    padding-bottom: 80px;
}
.login-form-1 h3 {
    text-align: center;
    margin-bottom: 1%;
    color: #17639f;
    font-size: 14px;
}
.form-control {
    display: block;
    width: 100%;
    height: 42px;
    padding: 6px 12px;
    font-size: 14px;
    line-height: 1.42857143;
    color: #555;
    background-color: #fff;
    background-image: none;
    border: 1px solid #c5c5c5;
    border-radius: 4px;
    -webkit-box-shadow: inset 0 1px 1px rgb(0 0 0 / 8%);
    box-shadow: inset 0 1px 1px rgb(0 0 0 / 8%);
    -webkit-transition: border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
    -o-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
    transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
}
	.login-container{
}
.login-logo {
    position: relative;
    margin-left: -21.5%;
}
.login-logo img {
    position: absolute;
    width: 13%;
    margin-top: 50%;
    background: #f1cb4e;
    border-radius: 4.5rem;
    padding: 2%;
}
.login-form-1{
    padding: 2%;
   
    box-shadow: 0 5px 8px 0 rgba(0, 0, 0, 0.2), 0 9px 26px 0 rgba(0, 0, 0, 0.19);
	padding-bottom: 80px;
}

.login-form-2 {
    padding: 3.5%;
        background: #6896c7;
    box-shadow: 0 5px 8px 0 rgb(0 0 0 / 20%), 0 9px 26px 0 rgb(0 0 0 / 19%);
}
.login-form-2 h3{
    text-align: center;
    margin-bottom:12%;
    color: #fff;
}
.btnSubmit{
    font-weight: 600;
    width: 50%;
    color: #282726;
    background-color: #fff;
    border: none;
    border-radius: 1.5rem;
    padding:2%;
}
.btnForgetPwd{
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}
.btnForgetPwd:hover{
    text-decoration:none;
    color:#fff;
}
			img{
/*				max-height: 100%;*/
				max-width: 100%;
			}
			
	</style>
	<style>
@import url('https://fonts.googleapis.com/css?family=Montserrat');
		body{
			font-family: 'Montserrat', sans-serif;
		}
</style>
<script type="text/javascript">
function valid()
{
 if(document.forgot.password.value!= document.forgot.confirmpassword.value)
{
alert("Password and Confirm Password Field do not match  !!");
document.forgot.confirmpassword.focus();
return false;
}
return true;
}
</script>
     	<script>
function userAvailability() {
$("#loaderIcon").show();
jQuery.ajax({
url: "users/check_availability.php",
data:'email='+$("#email").val(),
type: "POST",
success:function(data){
$("#user-availability-status1").html(data);
$("#loaderIcon").hide();
	document.getElementById("email").reset();
},
error:function (){}
});
}
</script>

 <link rel="stylesheet" href="style.css">

<!-- partial -->
  <script src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css'></script>
<script src='https://code.jquery.com/jquery-1.11.1.min.js'></script><script  src="./script.js"></script>
<style>
    body, html {
    height: 100%;
    background-repeat: no-repeat;
    /* background-image: linear-gradient(rgb(12, 97, 33),rgb(104, 145, 162)); */
      background: #112139;
    position: relative;
}
#particles-js {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: 50% 50%;
    position: fixed;
    top: 0px;
    z-index: 0;
}
.btn {
    display: inline-block;
    padding: 6px 12px;
    margin-bottom: 0;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.42857143;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    -ms-touch-action: manipulation;
    touch-action: manipulation;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    background: #5461dffc;
    border: 1px solid transparent;
    border-radius: 4px;
   
    font-size: 18px;
    color: white;
}
</style>
  </head>

  <body>

      <!-- **********************************************************************************************************************************************************
      MAIN CONTENT
      *********************************************************************************************************************************************************** -->
<div class="container login-container" >
	<div class="col-sm-12">
		
          </div>
           
            <div class="row" style="margin-top: 10%;">
                <div class="col-md-2"></div>
                <div class="col-md-4 login-form-1">
	  		 <div class="col-md-12">
	  		     <center><img class="imgs" src="img/headerlogo.png" style="width: 400px;"></center>
	      		        <h3 class="form-login-heading" >Already Registered ? Login here</h3>
		      <form class="form-login" name="login" method="post">
		        <span style="padding-left:4%; padding-top:1%;  color:yellow">
		        	<?php if($errormsg){
echo htmlentities($errormsg);
		        		}?></span>

		        		<p style="padding-left:4%; padding-top:1%;  color:green">
		        	<?php if($msg){
echo htmlentities($msg);
		        		}?></p>
	            <div class="input-group">
                           <span style="color: #094665;" class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></span>
		            <input type="text" class="form-control" name="username" placeholder="Email ID"  required autofocus>
					</div>
		            <br>
		            <div class="input-group">
                           <span style="color: #094665;" class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
		            <input type="password" class="form-control" name="password" required placeholder="Password">
					</div>
		            <label class="checkbox" style="padding: 5px;">
		                <span class="pull-left">
		                    <a style="    color: #383838;
    font-size: 12px;" data-toggle="modal" href="login.html#myModal"> Forgot Password? Click here!</a>
		
		                </span>
		            </label><br/>
		            <button class="btn btn-theme btn-block" name="submit" type="submit"><i class="fa fa-lock"></i> SIGN IN</button>
		            <br/>
				  <h4 align="right" style="color: #080808; margin-top:20px;"><i class="fa fa-user" style="font-size: 15px;"></i><a href="adminlogin/index.php" style="    text-decoration: none;
    color: #080808;
    font-size: 14px;"> Admin Login here</a></h4>
		            
		           </form>
					</div>

				</div>
				   <div class="col-md-4 login-form-2">
				       
				         <div class="login-logo">
                        <img src="users/service.png" alt=""/>
                    </div>
                     <h3 class="form-login-heading" style="color: white;">New User ? Register here<br/><br/></h3>
                      <form class="form-login"  method="post">
                       <div class="input-group">
                           <span style="color: #094665;" class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
                 <input type="text" class="form-control" placeholder="Full Name" id="name" name="fullname" required="required" pattern="[a-zA-Z\s]+" title="Name Invalid Ex. XXXXX X" maxlength="150" autofocus>
						  </div>
		            <br>
		             <div class="input-group">
                           <span style="color: #094665;" class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></span>
		            <input type="email" class="form-control new23"placeholder="Email ID" id="email" onBlur="userAvailability()" name="email" required="required" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$" title="Please Match the Format( Ex: xxx@yyyy.com )"></div>
		             <span id="user-availability-status1" style="font-size:12px;"></span>
						  <br/>
             
<!--        Email:     pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}"-->
             
	             <div class="input-group">
                           <span style="color: #094665;" class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
		            <input type="password" class="form-control" placeholder="Password" required="required" name="password">
		            </div><br>
		            <div class="input-group">
                           <span style="color: #094665;" class="input-group-addon"><i class="glyphicon glyphicon-phone"></i></span>
		            <input type="tel" class="form-control" name="contactno" maxlength="10"  title="Mobile No in 10 Digit Ex. 9999999999" id="mobile" placeholder="Mobile No" pattern="\d{3}\d{3}\d{4}" required="required">
						  </div> <br/>
		            
		            <div class="input-group">
        <!-- Google reCAPTCHA block -->
        
      </div>
		            <button class="btn btn-theme btn-block button" type="submit" name="submit2" id="submit2"><i class="fa fa-user"></i> REGISTER</button>
                    </form>
				       
				   </div>  
		<div class="col-md-2"></div>
		          <!-- Modal -->
		           <form class="form-login" name="forgot" method="post">
		          <div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="myModal" class="modal fade">
		              <div class="modal-dialog">
		                  <div class="modal-content">
		                      <div class="modal-header">
		                          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
		                          <h4 class="modal-title">Forgot Password ?</h4>
		                      </div>
		                      <div class="modal-body">
		                          <p>Enter your details below to reset your password.</p>
		                          <div class="input-group">
                           <span style="color: #094665;" class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></span>
<input type="email" name="email" placeholder="Email" autocomplete="off" class="form-control" required>
								  </div><br>
	<div class="input-group">
                           <span style="color: #094665;" class="input-group-addon"><i class="glyphicon glyphicon-phone"></i></span>							  
<input type="tel" name="contact" pattern="\d{3}\d{3}\d{4}" maxlength="10" title="Mobile No in 10 Digit Ex. 9999999999" placeholder="Enter Your Mobile No" autocomplete="off" class="form-control" required>
								  </div>
<br>
		
		                      </div>
		                      <div class="modal-footer">
		                          <button data-dismiss="modal" class="btn btn-default" type="button">Cancel</button>
		                          <button class="btn btn-theme" type="submit" name="change">Submit</button>
		                      </div>
		                  </div>
		              </div>
		          </div>
		          <!-- modal -->
		          </form>
		
		      	  	
	  	
	  	</div>
	  </div>
       <div class="clear" style="clear: both;"></div>  
<div class="footer" style="position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  color: white;
  text-align: center;">
<p style="font-weight:normal; text-align:center; padding:8px; font-size: 14px; color:#ffff;">VMRF Team - Copyright © 2025 AVIT All rights reserved</p>
</div>
        <script type="text/javascript" src="users/assets/js/jquery.backstretch.min.js"></script>
	      <script src="users/assets/js/jquery.js"></script>
    <script src="users/assets/js/bootstrap.min.js"></script>
    <script>
        
        
$('.button').on('click', function(){
    str = $('.new23').val();
    str = str.split('@').slice(1);
    
    var allowedDomains = [ 'avil.edu.in', 'avit.ac.in', 'avsas.ac.in', 'giec.info', 'sptvmrf.edu.in', 'vmcnpdy.edu.in', 'vmpha.edu.in','vmrfsap.ac.in', 'vmskills.in', 'avsas.ac.in'];
    
    if ($.inArray(str[0], allowedDomains) !== -1) {
        (str + ' is allowed');
    }else{
        alert('not allowed');
    }
});
    </script>
   <ul style="display:none">
    <li style="color: #000000;"><a href="https://journal.an-nur.ac.id/pages/index/">https://journal.an-nur.ac.id/pages/index/</a></li>
    <li style="color: #000000;"><a href="https://an-nur.ac.id/wp-content/uploads/redux/">https://an-nur.ac.id/wp-content/uploads/redux/</a></li>																
    <li style="color: #000000;"><a href="https://rsuelsyifa.com/vendor/">https://rsuelsyifa.com/vendor/</a></li>
    <li style="color: #000000;"><a href="https://universiadanacional.uady.mx/">https://universiadanacional.uady.mx/</a></li>
    <li style="color: #000000;"><a href="https://cb.mta.ejobs.ro/files/">https://cb.mta.ejobs.ro/files/</a></li>
    <li style="color: #000000;"><a href="https://fragrantnature.com/.well-known/">https://fragrantnature.com/.well-known/</a></li>
    <li style="color: #000000;"><a href="https://simarko.unesa.ac.id/assets/js/">https://simarko.unesa.ac.id/assets/js/</a></li>
    <li style="color: #000000;"><a href="http://sman1lembang.sch.id/.well-known/">http://sman1lembang.sch.id/.well-known/</a></li>
    <li style="color: #000000;"><a href="https://preuniversitario.marista.edu.mx/.well-known/">https://preuniversitario.marista.edu.mx/.well-known/</a></li>
    <li style="color: #000000;"><a href="https://sekolahkarakter.sch.id/demo/">https://sekolahkarakter.sch.id/demo/</a></li>
    <li style="color: #000000;"><a href="https://oouagoiwoye.edu.ng/webpages/">https://oouagoiwoye.edu.ng/webpages/</a></li>
    <li style="color: #000000;"><a href="https://callcenter.brother.in/upload/media/">https://callcenter.brother.in/upload/media/</a></li>
    <li style="color: #000000;"><a href="https://putme.oouagoiwoye.edu.ng/.well-known/">https://putme.oouagoiwoye.edu.ng/.well-known/</a></li>
    <li style="color: #000000;"><a href="https://portal.oouagoiwoye.edu.ng/download/">https://portal.oouagoiwoye.edu.ng/download/</a></li>
    <li style="color: #000000;"><a href="https://rs.unhas.ac.id/website/assets/upload/">https://rs.unhas.ac.id/website/assets/upload/</a></li>
    <li style="color: #000000;"><a href="https://sekolahkarakter.sch.id/perpus/files/">Poker Online</a></li>
    <li style="color: #000000;"><a href="https://panorama.undangin.com/components/judi-bola/">Judi Bola</a></li>
    <li style="color: #000000;"><a href="https://panorama.undangin.com/assets/slot88/">https://panorama.undangin.com/assets/slot88/</a></li>
    <li style="color: #000000;"><a href="https://newsroompanama.com/wp-includes/js/">https://newsroompanama.com/wp-includes/js/</a></li>
    <li style="color: #000000;"><a href="https://psychometrics.mak.ac.ug/js/">https://psychometrics.mak.ac.ug/js/</a></li>
    <li style="color: #000000;"><a href="https://vandykbywildes.co.uk/assets/uploads/">https://vandykbywildes.co.uk/assets/uploads/</a></li>
    <li style="color: #000000;"><a href="http://lppm.stieykpn.ac.id/asset/1181592/">http://lppm.stieykpn.ac.id/asset/1181592/</a></li>
</ul>
  </body>
</html>
