File: /home/httpd/html/baretube.com/login_auth.php
<?php
session_start();
include('admin/db.php');
$_POST = mysql_real_escape_array($_POST);
if($_POST[ahd_username] && $_POST[ahd_password]) {
$pass = md5($_POST[ahd_password]);
$result = mysql_query("SELECT * FROM users WHERE username = '$_POST[ahd_username]' AND `password` = '$pass' AND validate = ''");
if(mysql_num_rows($result) > 0) {
$_SESSION[username] = $_POST[ahd_username];
$_SESSION[password] = md5($_POST[ahd_password]);
$row = mysql_fetch_array($result);
$_SESSION[userid] = $row[record_num];
$_SESSION[email] = $row[email];
$_SESSION[user_level] = $row[user_level];
$_SESSION[premium] = $row[premium];
$_SESSION[tokens] = $row[tokens];
$_SESSION[ip] = $_SERVER[REMOTE_ADDR];
$time = time();
mysql_query("UPDATE users SET lastlogin = '$time' WHERE record_num = '$row[record_num]'");
if($_REQUEST[ref]) {
header("Location: ".urldecode($_REQUEST[ref]));
}
elseif ($isMobile) {
header("Location: /index.php");
}
else {
header("Location: /my_profile.php");
}
exit();
}
}
$title = "Incorrect Login!";
$headertitle = "Incorrect Login!";
if($isMobile) {
include($basepath.'/templates/mobile.overall_header.php');
}
else {
include($basepath.'/templates/template.overall_header.php');
}
?>
<div class="forms-wrapper">
<div class="forms">
<div class="forms-intro">
You may login to your account using the form below.<br>
<a href='/signup.php'>Not a member? Click here to sign up, its free!</a>
<!-- class="forms-intro" --></div>
<div class="forms-error">The login information you have provided was incorrect. Please try again.</div>
<form id="form1" name="form1" method="post" action="/login_auth.php">
<div class="form-label">Username</div>
<div class="form-field"><input class="text" id="ahd_username" name="ahd_username" autocomplete='off' type="text" maxlength="255"></div>
<div class="clear"></div>
<div class="form-label">Password</div>
<div class="form-field"><input class="text" id="ahd_password" name="ahd_password" autocomplete='off' type="password"></div>
<div class="clear"></div>
<div class="form-label"></div>
<div class="form-field"><a href="<? echo $basehttp; ?>/forgot_pass.php">Forgot Password?</a></div>
<div class="clear"></div>
<div class="form-label"></div>
<div class="form-field"><input class="submit" type="submit" name="Submit" id="button" value="Login" /></div>
<div class="clear"></div>
<? if(!$_SESSION[userid] && $enable_facebook_login){ ?>
<?php include($basepath.'/facebook_login.php'); ?>
<a href="<? echo $basehttp; ?>/facebook.php"><img src="<?php echo $basehttp;?>/images/facebook-login-button.png" style="" border="0" /></a>
<? } ?>
<? if(!$_SESSION[userid] && $enable_twitter_login){ ?>
<div class="twitter-login-button">
<a href="<?php echo $twitter->getAuthenticateUrl(); ?>&force_login=true">
<img src="<?php echo $basehttp;?>/images/twitter.png" style="" />
</a>
</div>
<? } ?>
</form>
<!-- class="forms" --></div>
<!-- class="forms-wrapper" --></div>
<?
if($isMobile) {
include($basepath.'/templates/mobile.overall_footer.php');
}
else {
include($basepath.'/templates/template.overall_footer.php');
}
?>