Jump to content
MakeWebGames

please help


iseeyou94056

Recommended Posts

Re: please help

 

<?php

session_start();
if(get_magic_quotes_gpc() == 0)
{
foreach($_POST as $k => $v)
{
 $_POST[$k]=addslashes($v);
}
foreach($_GET as $k => $v)
{
 $_GET[$k]=addslashes($v);
}
}

include "config.php";
global $_CONFIG;
define("MONO_ON", 1);
require "class/class_db_{$_CONFIG['driver']}.php";
$db=new database;
$db->configure($_CONFIG['hostname'],
$_CONFIG['username'],
$_CONFIG['password'],
$_CONFIG['database'],
$_CONFIG['persistent']);
$db->connect();
$c=$db->connection_id;
$set=array();
$settq=$db->query("SELECT * FROM settings");
while($r=$db->fetch_row($settq))
{
$set[$r['conf_name']]=$r['conf_value'];
}
if ($_POST['username'] == "" || $_POST['password'] == "")
{
die("<h3>{$set['game_name']} Error</h3>
You did not fill in the login form!

<a href=login.php>> Back</a>");
}
$uq=$db->query("SELECT userid FROM users WHERE login_name='{$_POST['username']}' AND `userpass`=md5('{$_POST['password']}')");
if ($db->num_rows($uq)==0)
{
die("<h3>{$set['game_name']} Error</h3>
Invalid username or password!

<a href=login.php>> Back</a>");
}
else
{
$_SESSION['loggedin']=1;
$mem=$db->fetch_row($uq);
$_SESSION['userid']=$mem['userid'];
$IP = ($_SERVER['HTTP_X_FORWARDED_FOR'])
   ?  $_SERVER['HTTP_X_FORWARDED_FOR']
   :  $_SERVER['REMOTE_ADDR'];
$db->query("UPDATE users SET lastip_login='$IP',last_login=unix_timestamp() WHERE userid={$mem['userid']}");
if($set['validate_period'] == "login" && $set['validate_on'])
{
$db->query("UPDATE users SET verified=0 WHERE userid={$mem['userid']}");
}
header("Location: loggedin.php");
}

?>

 

use that for the file what you get in your sql fields seems i my be a problem in there

Link to comment
Share on other sites

Re: please help

 

<?php
session_start();
if ($_POST['username'] == "" || $_POST['password'] == "")
{
die("<h3>Your Game Name Error</h3>
You did not fill in the login form!

<a href=login.php>> Back</a>");
}
include "mysql.php";
global $c;
$uq=mysql_query("SELECT userid FROM users WHERE login_name='{$_POST['username']}' AND `userpass`=md5('{$_POST['password']}')",$c) or die(mysql_error());
if (mysql_num_rows($uq)==0)
{
die("<h3>Your Game Name Error</h3>
Invalid username or password!

<a href=login.php>> Back</a>");
}
else
{
$_SESSION['loggedin']=1;
$mem=mysql_fetch_array($uq);
$_SESSION['userid']=$mem['userid'];
header("Location: loggedin.php");
}

?>
Link to comment
Share on other sites

Re: please help

This should do it.

 

<?php
session_start();
if ($_POST['username'] == "" || $_POST['password'] == "")
{
die("<h3>Your Game Name Error</h3>
You did not fill in the login form!

<a href=login.php>> Back</a>");
}
include "mysql.php";
global $c;
$uq=mysql_query("SELECT userid FROM users WHERE login_name='{$_POST['username']}' AND `userpass`=md5('{$_POST['password']}')",$c) or die(mysql_error());
if (mysql_num_rows($uq)==0)
{
die("<h3>Your Game Name Error</h3>
Invalid username or password!

<a href=login.php>> Back</a>");
}
else
{
$_SESSION['loggedin']=1;
$mem=mysql_fetch_array($uq);
$_SESSION['userid']=$mem['userid'];
header("Location: index.php");
}

?>
Link to comment
Share on other sites

Re: please help

 

This should do it.

 

<?php
session_start();
if ($_POST['username'] == "" || $_POST['password'] == "")
{
die("<h3>Your Game Name Error</h3>
You did not fill in the login form!

<a href=login.php>> Back</a>");
}
include "mysql.php";
global $c;
$uq=mysql_query("SELECT userid FROM users WHERE login_name='{$_POST['username']}' AND `userpass`=md5('{$_POST['password']}')",$c) or die(mysql_error());
if (mysql_num_rows($uq)==0)
{
die("<h3>Your Game Name Error</h3>
Invalid username or password!

<a href=login.php>> Back</a>");
}
else
{
$_SESSION['loggedin']=1;
$mem=mysql_fetch_array($uq);
$_SESSION['userid']=$mem['userid'];
header("Location: index.php");
}

?>

 

Whats the difference from the other one posted? lol

btw..you should sanitize the $_POST. values with mysql_real_escape_string().

To the OP, you could try this:

 

<?php
/*
Mccode V1, authenticate.php recode by PHP Scene.
*/
session_start();
include ('mysql.php');

$username = mysql_real_escape_string($_POST['username']);
$password = mysql_real_escape_string($_POST['password']);

if ($username == '' || $password == ''){
exit('Please make sure you fill the username and password fields in.
[url="login.php"]Back[/url]');
}

$check = mysql_query("SELECT `userid` FROM `users` WHERE `login_name` = '{$username}' AND `userpass` = md5('$password') LIMIT 1;", $c) or die(mysql_error());
if(!mysql_num_rows($check)){
exit('Account cannot be found with that username and password.');
}else{

$_SESSION['loggedin'] = 1;

$user = mysql_fetch_object($check);

$_SESSION['userid'] = $user->userid;

header('Location: index.php');
}

?>

 

(recode from scratch)

Link to comment
Share on other sites

Re: please help

 

This should do it.

 

<?php
session_start();
if ($_POST['username'] == "" || $_POST['password'] == "")
{
die("<h3>Your Game Name Error</h3>
You did not fill in the login form!

<a href=login.php>> Back</a>");
}
include "mysql.php";
global $c;
$uq=mysql_query("SELECT userid FROM users WHERE login_name='{$_POST['username']}' AND `userpass`=md5('{$_POST['password']}')",$c) or die(mysql_error());
if (mysql_num_rows($uq)==0)
{
die("<h3>Your Game Name Error</h3>
Invalid username or password!

<a href=login.php>> Back</a>");
}
else
{
$_SESSION['loggedin']=1;
$mem=mysql_fetch_array($uq);
$_SESSION['userid']=$mem['userid'];
header("Location: index.php");
}

?>

 

Whats the difference from the other one posted? lol

btw..you should sanitize the $_POST. values with mysql_real_escape_string().

To the OP, you could try this:

 

<?php
/*
Mccode V1, authenticate.php recode by PHP Scene.
*/
session_start();
include ('mysql.php');

$username = mysql_real_escape_string($_POST['username']);
$password = mysql_real_escape_string($_POST['password']);

if ($username == '' || $password == ''){
exit('Please make sure you fill the username and password fields in.
[url="login.php"]Back[/url]');
}

$check = mysql_query("SELECT `userid` FROM `users` WHERE `login_name` = '{$username}' AND `userpass` = md5('$password') LIMIT 1;", $c) or die(mysql_error());
if(!mysql_num_rows($check)){
exit('Account cannot be found with that username and password.');
}else{

$_SESSION['loggedin'] = 1;

$user = mysql_fetch_object($check);

$_SESSION['userid'] = $user->userid;

header('Location: index.php');
}

?>

 

(recode from scratch)

You don't need to use "mysql_real_escape_string" on a password, if it's beening hashed.. with md5/sha1/ ect

Link to comment
Share on other sites

Re: please help

This should do it.

<?php
session_start();
if ($_POST['username'] == "" || $_POST['password'] == "")
{
die("<h3>Your Game Name Error</h3>
You did not fill in the login form!

<a href=login.php>> Back</a>");
}
include "mysql.php";
global $c;
$uq=mysql_query("SELECT userid FROM users WHERE login_name='{$_POST['username']}' AND `userpass`=md5('{$_POST['password']}')",$c) or die(mysql_error());
if (mysql_num_rows($uq)==0)
{
die("<h3>Your Game Name Error</h3>
Invalid username or password!

<a href=login.php>> Back</a>");
}
else
{
$_SESSION['loggedin']=1;
$mem=mysql_fetch_array($uq);
$_SESSION['userid']=$mem['userid'];
header("Location: index.php");
}

?>

Whats the difference from the other one posted? lol

btw..you should sanitize the $_POST. values with mysql_real_escape_string().

To the OP, you could try this:

<?php
/*
Mccode V1, authenticate.php recode by PHP Scene.
*/
session_start();
include ('mysql.php');

$username = mysql_real_escape_string($_POST['username']);
$password = mysql_real_escape_string($_POST['password']);

if ($username == '' || $password == ''){
  exit('Please make sure you fill the username and password fields in.
[url="login.php"]Back[/url]');
}

$check = mysql_query("SELECT `userid` FROM `users` WHERE `login_name` = '{$username}' AND `userpass` = md5('$password') LIMIT 1;", $c) or die(mysql_error());
if(!mysql_num_rows($check)){
  exit('Account cannot be found with that username and password.');
}else{

  $_SESSION['loggedin'] = 1;

  $user = mysql_fetch_object($check);

  $_SESSION['userid'] = $user->userid;

  header('Location: index.php');
}

?>

(recode from scratch)

You don't need to use "mysql_real_escape_string" on a password, if it's beening hashed.. with md5/sha1/ ect

So mres'ing the password would potentially lock out any users with a ' in their password.

Link to comment
Share on other sites

Re: please help

 

This should do it.

 

<?php
session_start();
if ($_POST['username'] == "" || $_POST['password'] == "")
{
die("<h3>Your Game Name Error</h3>
You did not fill in the login form!

<a href=login.php>> Back</a>");
}
include "mysql.php";
global $c;
$uq=mysql_query("SELECT userid FROM users WHERE login_name='{$_POST['username']}' AND `userpass`=md5('{$_POST['password']}')",$c) or die(mysql_error());
if (mysql_num_rows($uq)==0)
{
die("<h3>Your Game Name Error</h3>
Invalid username or password!

<a href=login.php>> Back</a>");
}
else
{
$_SESSION['loggedin']=1;
$mem=mysql_fetch_array($uq);
$_SESSION['userid']=$mem['userid'];
header("Location: index.php");
}

?>

 

Whats the difference from the other one posted? lol

btw..you should sanitize the $_POST. values with mysql_real_escape_string().

To the OP, you could try this:

 

<?php
/*
Mccode V1, authenticate.php recode by PHP Scene.
*/
session_start();
include ('mysql.php');

$username = mysql_real_escape_string($_POST['username']);
$password = mysql_real_escape_string($_POST['password']);

if ($username == '' || $password == ''){
  exit('Please make sure you fill the username and password fields in.
[url="login.php"]Back[/url]');
}

$check = mysql_query("SELECT `userid` FROM `users` WHERE `login_name` = '{$username}' AND `userpass` = md5('$password') LIMIT 1;", $c) or die(mysql_error());
if(!mysql_num_rows($check)){
  exit('Account cannot be found with that username and password.');
}else{

  $_SESSION['loggedin'] = 1;

  $user = mysql_fetch_object($check);

  $_SESSION['userid'] = $user->userid;

  header('Location: index.php');
}

?>

 

(recode from scratch)

You don't need to use "mysql_real_escape_string" on a password, if it's beening hashed.. with md5/sha1/ ect

So mres'ing the password would potentially lock out any users with a ' in their password.

Yes that would be the case and in this case a bad idea.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...