Jump to content
MakeWebGames

Can't get past authenticate page


Raven1992

Recommended Posts

Hi guys i decided to change my login page and changed the authenticate page as well and this is the error i got

Error

Error handler not present

here the php file for it

<?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!<br>
<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!<br>
<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");
}

?>

 

if you can see the problem can you please tell me thanks.

Link to comment
Share on other sites

I think I counted about 50 errors before I fell asleep; any particular one you wanted to look at or you are you just hoping somebody will do complete rewrite for you?

The error you mention is not to my knowledge a PHP specific error - ie it is does not stem from the language itself; I can only assume it is generated from one of the includes.

Adding

error_reporting(-1);
ini_set("display_errors",1);

at the top of the file (and optionally immediately following any includes or requires) may well yield a large number of clues however.

Link to comment
Share on other sites

You're running 2.0.5 but with a v2.0.0 file, try this.

<?php 
session_name('MCCSID');
session_start();
if (!isset($_SESSION['started']))
{
   session_regenerate_id();
   $_SESSION['started'] = true;
}
ob_start();
if (function_exists("get_magic_quotes_gpc") == false)
{


   function get_magic_quotes_gpc()
   {
       return 0;
   }
}
if (get_magic_quotes_gpc() == 0)
{
   foreach ($_POST as $k => $v)
   {
       $_POST[$k] = addslashes($v);
   }
   foreach ($_GET as $k => $v)
   {
       $_GET[$k] = addslashes($v);
   }
}
require "lib/basic_error_handler.php";
set_error_handler('error_php');

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");
}

?>

As you can see all I've done is include the error handler and the new methods used in the 2.0.5 globals.php

require[color=#666666] [/color]"lib/basic_error_handler.php";
set_error_handler('error_php');

is the bit of code which will fix the "Error handler" issue.

Link to comment
Share on other sites

You're running 2.0.5 but with a v2.0.0 file, try this.

 

<?php 
session_name('MCCSID');
session_start();
if (!isset($_SESSION['started']))
{
   session_regenerate_id();
   $_SESSION['started'] = true;
}
ob_start();
if (function_exists("get_magic_quotes_gpc") == false)
{


   function get_magic_quotes_gpc()
   {
       return 0;
   }
}
if (get_magic_quotes_gpc() == 0)
{
   foreach ($_POST as $k => $v)
   {
       $_POST[$k] = addslashes($v);
   }
   foreach ($_GET as $k => $v)
   {
       $_GET[$k] = addslashes($v);
   }
}
require "lib/basic_error_handler.php";
set_error_handler('error_php');

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");
}

?>

 

As you can see all I've done is include the error handler and the new methods used in the 2.0.5 globals.php

 

require[color=#666666] [/color]"lib/basic_error_handler.php";
set_error_handler('error_php');

 

is the bit of code which will fix the "Error handler" issue.

well the page is right but still getting the error

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...