It should work on V1 also but not 100% sure. There are may ways to do it.
One way. This way updates the database.
<?php
session_start();
$demo="demo";
$dempass="Demo";
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;
$uq=$db->query("SELECT userid FROM users WHERE login_name='$demo' AND `userpass`=md5('$dempass')");
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['REMOTE_ADDR'];
/*
Use this to update the demo stats and other things
$rand_money=rand(1,10)*100;
$rand_cr=rand(1,5)*10;
$rand_stat=rand(1,5)*20;
$db->query("UPDATE users u JOIN userstats us SET u.lastip_login='$IP',u.last_login=unix_timestamp(), u.money='$rand_money' ,u.crystals='$rand_cr', us.strength='$rand_stat', hospital=0,jail=0, us.agility='$rand_stat' ,us.guard='$rand_stat' WHERE u.userid={$mem['userid']}");
*/
$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");
}
?>
This also works but does not update the demo info.
<?php
session_start();
$_SESSION['loggedin']=1;
$_SESSION['userid']=2;
header("Location: loggedin.php");
?>
Name the file what you like and add a link on you login or registration page. Not a big addition but can help.