
PK 
<?php
ob_start();
//error_reporting(E_ALL ^ E_NOTICE);
@session_start();
ini_set('allow_url_include',1);
date_default_timezone_set("Asia/Kolkata");
set_time_limit(600);
ini_set('max_execution_time',600);
require_once 'admin/includes/settings/PDODB.php';
include 'admin/includes/modules/functions.php';
$function = new FUNCTIONS();
if(isset($_POST['sendLogin'])){
$username = !empty($_POST['username'])?trim($_POST['username']):"";
$email = !empty($_POST['email'])?trim($_POST['email']):"";
$password = !empty($_POST['password'])?trim($_POST['password']):"";
//print_r($password); exit;
//$password = md5($password);
// Check if email domain is xyz.com
$email_domain = substr(strrchr($email, "@"), 1);
if(strtolower($email_domain) !== 'coforge.com') {
$error_msg = "Only coforge.com email domains are allowed.";
}
elseif ($password == 'techcon@2025') {
//print_r($password); exit;
$loginQuery = "SELECT * FROM `users` WHERE username='$username' OR email='$email' AND isactive='1'";
$pdodb = PDODB::getInstance();
$result = $pdodb->query($loginQuery);
if(!empty(count($result))){
$ipaddress = $function->getRealIpAddr();
$userId = $result[0]['id'];
$pdodb = PDODB::getInstance();
$sqlupdate = "UPDATE `users` SET username='$username' WHERE `users`.`id` = '$userId'";
$resultupdate = $pdodb->query($sqlupdate);
$sql2 = "INSERT INTO `tb_loginlogs` SET userId='$userId', ipAddress='$ipaddress'";
$result2 = $pdodb->query($sql2);
PDODB::closeInstance();
$_SESSION['userId'] = $result[0]['id'];
echo "<script>window.location.href='webcast.php';</script>";
}else{
//Alert
$pdodb = PDODB::getInstance();
$sql = "INSERT INTO `users` SET username='$username', email='$email'";
$result = $pdodb->query($sql);
$insert_user = $pdodb->lastInsertId();
$ipaddress = $function->getRealIpAddr();
$userId = $insert_user;
$sql2 = "INSERT INTO `tb_loginlogs` SET userId='$userId', ipAddress='$ipaddress'";
$result2 = $pdodb->query($sql2);
PDODB::closeInstance();
$_SESSION['userId'] = $insert_user;
echo "<script>window.location.href='webcast.php';</script>";
}
}else {
//print_r($password); exit;
$error_msg = "Password not Match. Please try again!";
}
}
?>
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>Coforge Login</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel='stylesheet' href='css/bootstrap.min.css'>
<link rel='stylesheet' href='css/style.css'>
<link href="images/favicon.png" rel="shortcut icon" type="image/png">
<style type="text/css">
body {
/*width: 100vw;
height: 100vh;*/
background: url('images/powering ai.png');
background-size: cover;
}
.error { color: red; }
.last{
position: absolute;
bottom: 1%;
margin-bottom: 10px;
padding: 0 20px;
}
.logo1{ filter: drop-shadow(-10px -10px 10px black); width:65%; }
</style>
</head>
<body>
<div class="container py-5">
<div class="row justify-content-center">
<div class="col-md-3 col-10">
<img src="images/logo.png" class="img-fluid">
</div>
</div>
<div class="row justify-content-center">
<div class="col-md-4 col-10 loginform">
<form action="" method="POST" id="loginForm">
<div class="mb-3">
<input type="text" class="form-control mb-3" id="username" name="username" placeholder="Name">
<input type="email" class="form-control mb-3" id="email" name="email" placeholder="Email ID">
<input type="password" class="form-control mb-3" id="password" name="password" placeholder="Password">
</div>
<p style="color:red; text-align: center;"><?=(!empty($error_msg))?$error_msg:'';?></p>
<button type="submit" class="btn login-btn" name="sendLogin" id="sendLogin">Login</button>
</form>
</div>
</div>
</div>
<div class="container-fluid last">
<div class="row">
<div class="col-md-2 col-5">
<img src="images/TechCon_Hackathon Logo_Dark.png" class="img-fluid logo1">
</div>
<div class="col-md-8 col-2">
</div>
<div class="col-md-2 col-5">
<img src="images/TechCon_Innovation_dark2025.06.24.png" class="img-fluid logo1" style="float: right;">
</div>
</div>
</div>
<!-- partial -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script src="js/jquery.form-validator.min.js"></script>
<script src='js/bootstrap.bundle.min.js'></script>
<script type="text/javascript">
$("#loginForm").validate({
rules: {
username: {
required: true
},
password: {
required: true
},
mobile: {
required: true,
minlength: 10,
maxlength: 10,
//number: true
digits: true
},
email: {
required: true,
email: true/*,
emailValidate: true*/
}
},
messages: {
username: {
required: "Please enter your name"
},
password: {
required: "Please enter password"
},
mobile: {
required: "Please enter mobile No",
minlength: "Mobile No Must Contain at least 10 digit",
maxlength: "Mobile No Must Not Exceed 10 digit",
digits: "Please enter only digit"
},
email: {
required: "Please enter email address",
email: "Please enter valid email"
},
},
submitHandler: function(form) {
$(form).find('button[type="submit"]').prop('disabled', true);
$(form).find('button[type="submit"]').text('Please wait..', true);
form.submit();
}
});
</script>
</body>
</html>


PK 99