Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
<?php
//This page let log in
include('config.php');
if(isset($_SESSION['username']))
{
unset($_SESSION['username'], $_SESSION['userid']);
setcookie('username', '', time()-100);
setcookie('password', '', time()-100);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous"/>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<link href="<?php echo $design; ?>/style.css" rel="stylesheet" title="Style" />
<title>Login</title>
</head>
<body>
<div align="center">
<div class="header" style="margin: auto;width: 100%;margin-top: 10px">
<img width="80%" src="<?php echo $design; ?>/images/logo.png" alt="Forum" />
</div>
</div>
<div class="message" style="color: black">You have successfully been logged out.<br />
<a href="login.php">Home</a></div>
<?php
}
else
{
$ousername = '';
if(isset($_POST['username'], $_POST['password']))
{
if(get_magic_quotes_gpc())
{
$ousername = stripslashes($_POST['username']);
$username = mysqli_real_escape_string(stripslashes($_POST['username'])); //salman
$password = stripslashes($_POST['password']);
}
else
{
$username = mysqli_real_escape_string($var,$_POST['username']); //salman
$password = $_POST['password'];
}
$req = mysqli_query($var,'select password,id from users where username="'.$username.'"');
$dn = mysqli_fetch_array($req);
if($dn['password']==sha1($password) and mysqli_num_rows($req)>0)
{
$form = false;
$_SESSION['username'] = $_POST['username'];
$_SESSION['userid'] = $dn['id'];
if(isset($_POST['memorize']) and $_POST['memorize']=='yes')
{
$one_year = time()+(60*60*24*365);
setcookie('username', $_POST['username'], $one_year);
setcookie('password', sha1($password), $one_year);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<link href="<?php echo $design; ?>/style.css" rel="stylesheet" title="Style" />
<title>Login</title>
</head>
<body>
<div align="center">
<div class="header" style="margin: auto;width: 100%;margin-top: 10px">
<img width="80%" src="<?php echo $design; ?>/images/logo.png" alt="Forum" /></a>
</div>
</div>
<div class="message" style="color: black">You have successfully been logged.<br />
<a href="<?php echo $url_home; ?>">Home</a></div>
<?php
}
else
{
$form = true;
$message = 'Invalid username and password';
}
}
else
{
$form = true;
}
if($form)
{
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<link href="<?php echo $design; ?>/style.css" rel="stylesheet" title="Style" />
<title>Login</title>
</head>
<body>
<div align="center">
<div class="header" style="margin: auto;width: 100%;margin-top: 10px">
<a href="<?php echo $url_home; ?>"><img width="80%" src="<?php echo $design; ?>/images/logo.png" alt="Forum" /></a>
</div>
</div>
<?php
if(isset($message))
{
echo '<div class="message">'.$message.'</div>';
}
?>
<!-- <div class="contentlogin"> -->
<div class="contentusers">
<?php
// $nb_new_pm = mysqli_fetch_array(mysqli_query($var,'select count(*) as nb_new_pm from pm where ((user1="'.$_SESSION['userid'].'" and user1read="no") or (user2="'.$_SESSION['userid'].'" and user2read="no")) and id2="1"')); // by salman
// $nb_new_pm = $nb_new_pm['nb_new_pm'];
?>
<div class="box">
<div class="box_left">
WCSF Index &gt; Login
</div>
<div class="box_right">
<a href="signup_request.php">Signup Request</a>
</div>
<div class="box_right">
<!-- <a href="list_pm.php">Your messages(<?php echo $nb_new_pm; ?>)</a> - <a href="profile.php?id=<?php echo $_SESSION['userid']; ?>"><?php echo htmlentities($_SESSION['username'], ENT_QUOTES, 'UTF-8'); ?></a> (<a href="login.php">Logout</a>) -->
</div>
<div class="clean"></div>
</div>
<form action="login.php" method="post">
Please, type your IDs to log:<br />
<div class="login">
<label for="username">Username</label><input type="text" name="username" id="username" value="<?php echo htmlentities($ousername, ENT_QUOTES, 'UTF-8'); ?>"/><br />
<label for="password">Password</label><input type="password" name="password" id="password" /><br />
<!-- <label for="memorize">Remember</label><input type="checkbox" name="memorize" id="memorize" value="yes" /> --><br />
<div class="center"><input type="submit" value="Login"/></div>
</div>
</form>
</div>
<?php
}
}
?>
<!-- <div class="foot">
<p><b>Water Control System and Discussion Portal for Farmers</b></p>
</div> -->
</body>
</html>