Jump to content

[SOLVED] Login help...


ronnie88

Recommended Posts

I'm having a prob with this login script I made... When I try to login I just get the error

 

wrong username/password combination or account not yet activated

 

but I know activation = 1 in the db... and that the name and password has been registered.. I also tried echoing the results and the username and pass get through

 

 

This is what checks the login info and DB..

<?
session_start();
header("Cache-control: private");
include 'includes/db_connect.php';



if (!$_SESSION['username'] || !$_SESSION['email']){
$username = $_POST['username'];
$password = $_POST['password'];
$username = strip_tags($username);
$password = strip_tags($password);
$ip = $REMOTE_ADDR;
$domain = $_SERVER['REMOTE_ADDR'];

$username=strtolower($username);

if((!$username) || (!$password)){
    echo "You have not submitted one or more fields <br />";
}else{



///check INFO
$sql = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password' AND activated='1' LIMIT 1");
$login_check = mysql_num_rows($sql);


///other
if ($login_check > '1'){





        ini_set(session.cookie_lifetime, "3600");
        session_register('username');
        $_SESSION['username'] = $username;
        session_register('email_address');
        $_SESSION['email_address'] = $email_address;






         $timestamp = time();
$timeout = $timestamp-$timeoutseconds;
$cool = gmdate('Y-m-d h:i:s');
mysql_query("UPDATE users SET lastlogin='$cool' WHERE username='$username'");
mysql_query("UPDATE users SET online='$timestamp' WHERE username='$username'");

mysql_query("UPDATE users SET ip='$domain' WHERE username='$username'");



        ?>
<meta http-equiv="Refresh" content=0;url=mb.php>
<?

} else {
    echo "wrong username/password combination or account not yet activated<br />
    <br />";
    include 'login.php';
}}}
?>

 

 

This is my login page...

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01

Transitional//EN">

<html>

<head onload="window.status='Welcome To

GDG Mafia'">
	<META name="GDG Mafia"

content="An Online Text Based Mafia Game.">
	<META keywords="mafia, Mafia,

games, text game, base mafia, good games, internet

game, free games, fun, powermad, php games">
	<title>GDG Mafia

</title>
	<link href="global.css" type="text/css"

rel="stylesheet">
	<style type="text/css"

media="screen"><!--
#layer1        { visibility: visible; position: absolute; top:

100px; left: 100px; width: 158px; height: 102px }
#layer2        { visibility: visible; position: absolute; top:

465px; left: 100px; width: 69px; height: 21px }
--></style>

</head>


<body bgcolor="#000000" text="#FFFFFF" link="#FFFFFF"

vlink="#FFFFFF" alink="#FFFFFF"

onload="document.login.username.focus()">
<form id="login" action="logincheck.php" method="post"

name="login">
  <center>       <tf>
            <center><img border="0" src="logo.jpg" ></center>
            <tr>
            <tr>
            <font size="1"><b><font face="Verdana">Site Best Viewed And Played With FireFox www.mozilla.com 
            <br><br>Hello & Welcome To GDG Mafia Online Multiplayer Game.
            <br> This is not another mafia game but a mafia game with a twist,
            <br> as you play you will realize this game to be very different to others out there.
            <br> New features will be added regularly so that you can enjoy this gaming experience online.
<br>
            <br>
            </font></b></font>
          </center>
        </td>
      </tr>
      <tr>
        <td height="30" width="196">
          <div align="center"><font size="1"

face="Verdana"><b>Username:</b></font></div>
</td>
<div align="center"><font size="1"
        <td width="200">
          <input type="text" style="background-color:#000000;

font: 10pt verdana; color:#ffffff; border: 1px solid #900dbf;"

name="username" size="24">
        </td>
      </tr>
      <tr>
       <div align="center"><font size="1"
        <td height="30">
          <div align="center"><font size="1"

face="Verdana"><b>Password:</b></font></div>
        </td>
        <td>
          <input type="password"

style="background-color:#000000; font: 10pt verdana;

color:#ffffff; border: 1px solid #900dbf;" name="password"

size="24">

        </td>
      </tr>
      <tr>
        <td colspan="2" valign="top" height="36">
          <center>
            <input type="submit" name="Submit" value="Submit">
          </center>
        </td>
      </tr>
  <tr><td colspan=2><center>

<center>
              <font size=0.5 face=verdana><b>||<a href="register.php"> Register</a>
              || <a href="lost.php">Lost</a> ||</b></font>
            </center></center></td></tr>
    </table>
  </center>
</form>
</body>

</html>

 

thanks in advance..

Link to comment
https://forums.phpfreaks.com/topic/167344-solved-login-help/
Share on other sites

Okay another Q I'am getting this error now... after I login...

 

Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /home/content/r/o/n/ronnie1988/html/online/MAFIA/db_connect.php on line 11

Unable to connect to MySQL server.

 

 

My DB connect page Looks like this...:

 

<?php
//Makes DB Connection
$connection = mysql_connect("onlinegame99.db.4599506.hostedresource.com","XXXX","XXXX"); 
// select database
$db = mysql_select_db("CCCX", $connection); 
//Closes Connection
mysql_close($connection);
?>

 

 

 

I made sure the mysql.sock is available and it is according to PHPInfo... and right destination file too..

 

Link to comment
https://forums.phpfreaks.com/topic/167344-solved-login-help/#findComment-882417
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.