Jump to content
MakeWebGames

Recommended Posts

Posted

I've been working on a game,

on the mccodes header you get the info from

Username and ID down to the last stats bar

aka health bar,

on the header i i placed an Iframe, in that iframe the Player stats,

I cant figure out the love of god how to get the Iframe page to actually load the Database stuff,

any help here would be good, what code would i need to put to get this to work?

Thanks

Posted

peter look at how the cron files grab data to begin with then you will know what to add i dont mean the SELECT OR ADD OR INSERTS but how the page calls for the complete DBASE

Posted
peter look at how the cron files grab data to begin with then you will know what to add i dont mean the SELECT OR ADD OR INSERTS but how the page calls for the complete DBASE

i tried

i tried the crons login code yesterday and it didnt work :(

global $db,$c,$ir, $set;

Posted (edited)
send me your script matey so i can have a look

here you go.

 

<?php
include "config.php";
global $db,$c,$ir,$set,$_CONFIG;
if($_GET['code'] != $_CONFIG['code']) { die(""); }
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'];


print "

<a id='button1a'><b>Player Info</b><br /></a>
<a id='button1a' href='usersonline.php'><b>Name:</b> $gn{$u} [{$ir['userid']}] $d $staff <br /></a>
<a id='button1a' href='gym.php'><b>Level:</b> {$ir['level']}<br /></a>
<a id='button1a' href='bank.php'><b>Money:</b> {$fm}<br /></a>
<a id='button1a' href='bank.php'><b>Bank Money:</b> {$ir['bankmoney']}<br /></a>
<a id='button1a' href='cyberbank.php'><b>Cyber Money:</b> {$ir['cybermoney']}<br /></a>
<a id='button1a' href='creditcard.php'><b>Credit Card:</b> {$ir['creditcard']}<br/></a>
<a id='button1a' href='crystaltemple.php'><b>Crystals:</b> {$ir['crystals']}<br /></a>
<a id='button1a' href='cigarettes.php'><b>Smoking Level:</b> {$ir['smoking']}<br /></a>
<a id='button1a' href='cigarettes.php'><b>Smoker:</b> $smoke<br /></a>
<a id='button1a' href='logout.php'><font color='white'>[</font><font color='red'>Emergency Logout</font><font color='white'>]</font></a>

";
}
?>
Edited by illusions
code thingy not workin
Posted
Hmm my notepad++ is playnig up wont save a file keeps saying its being used by another program

that sucks, well i'll have to leave it to you anyway,

i've tried loads of ideas, the only one i got to work was include "globals.php" which is ovious lol.

Posted (edited)

Take your html/output out of the while loop it will not repeat the info then.

<?php
include "config.php";
global $db,$c,$ir,$set,$_CONFIG;
if($_GET['code'] != $_CONFIG['code']) { die(""); }
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'];
}
print "

<a id='button1a'><b>Player Info</b></a>
<a id='button1a' href='usersonline.php'><b>Name:</b> $gn{$u} [{$ir['userid']}] $d $staff </a>
<a id='button1a' href='gym.php'><b>Level:</b> {$ir['level']}</a>
<a id='button1a' href='bank.php'><b>Money:</b> {$fm}</a>
<a id='button1a' href='bank.php'><b>Bank Money:</b> {$ir['bankmoney']}</a>
<a id='button1a' href='cyberbank.php'><b>Cyber Money:</b> {$ir['cybermoney']}</a>
<a id='button1a' href='creditcard.php'><b>Credit Card:</b> {$ir['creditcard']}</a>
<a id='button1a' href='crystaltemple.php'><b>Crystals:</b> {$ir['crystals']}</a>
<a id='button1a' href='cigarettes.php'><b>Smoking Level:</b> {$ir['smoking']}</a>
<a id='button1a' href='cigarettes.php'><b>Smoker:</b> $smoke</a>
<a id='button1a' href='logout.php'><font color='white'>[</font><font color='red'>Emergency Logout</font><font color='white'>]</font></a>

";
?>

E: Also try this;

<?php
session_start();
if (!isset ($_SESSION['userid']) ) {
   echo '<p>Not logged in.</p>';
   exit;
}
include "config.php";
global $_CONFIG;
if($_GET['code'] != $_CONFIG['code']) { die(""); }
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'];
}

$userInfo = $db->query('SELECT `userid`, `level`, `bank_money`, `money`, `cybermoney`, `creditcard`, `crystals`, `smoking` FROM `users` WHERE (`userid` = '.$_SESSION['userid'].')');
if ($db->num_rows($userInfo) > 0) {
   $ir = $db->fetch_row($userInfo);
   //Your html output, I've no idea what the var smoke is supposed to be so...
   $smoke = 'Fix this'; //^^

   print "

   <a id='button1a'><b>Player Info</b></a>
   <a id='button1a' href='usersonline.php'><b>Name:</b> $gn{$u} [{$ir['userid']}] $d $staff </a>
   <a id='button1a' href='gym.php'><b>Level:</b> {$ir['level']}</a>
   <a id='button1a' href='bank.php'><b>Money:</b> ".number_format($ir['money'])."</a>
   <a id='button1a' href='bank.php'><b>Bank Money:</b> {$ir['bankmoney']}</a>
   <a id='button1a' href='cyberbank.php'><b>Cyber Money:</b> {$ir['cybermoney']}</a>
   <a id='button1a' href='creditcard.php'><b>Credit Card:</b> {$ir['creditcard']}</a>
   <a id='button1a' href='crystaltemple.php'><b>Crystals:</b> {$ir['crystals']}</a>
   <a id='button1a' href='cigarettes.php'><b>Smoking Level:</b> {$ir['smoking']}</a>
   <a id='button1a' href='cigarettes.php'><b>Smoker:</b> $smoke</a>
   <a id='button1a' href='logout.php'><font color='white'>[</font><font color='red'>Emergency Logout</font><font color='white'>]</font></a>

   ";
?>
Edited by Djkanna
Posted
Take your html/output out of the while loop it will not repeat the info then.

 

<?php
include "config.php";
global $db,$c,$ir,$set,$_CONFIG;
if($_GET['code'] != $_CONFIG['code']) { die(""); }
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'];
}
print "

<a id='button1a'><b>Player Info</b></a>
<a id='button1a' href='usersonline.php'><b>Name:</b> $gn{$u} [{$ir['userid']}] $d $staff </a>
<a id='button1a' href='gym.php'><b>Level:</b> {$ir['level']}</a>
<a id='button1a' href='bank.php'><b>Money:</b> {$fm}</a>
<a id='button1a' href='bank.php'><b>Bank Money:</b> {$ir['bankmoney']}</a>
<a id='button1a' href='cyberbank.php'><b>Cyber Money:</b> {$ir['cybermoney']}</a>
<a id='button1a' href='creditcard.php'><b>Credit Card:</b> {$ir['creditcard']}</a>
<a id='button1a' href='crystaltemple.php'><b>Crystals:</b> {$ir['crystals']}</a>
<a id='button1a' href='cigarettes.php'><b>Smoking Level:</b> {$ir['smoking']}</a>
<a id='button1a' href='cigarettes.php'><b>Smoker:</b> $smoke</a>
<a id='button1a' href='logout.php'><font color='white'>[</font><font color='red'>Emergency Logout</font><font color='white'>]</font></a>

";
?>

 

E: Also try this;

<?php
session_start();
if (!isset ($_SESSION['userid']) ) {
   echo '<p>Not logged in.</p>';
   exit;
}
include "config.php";
global $_CONFIG;
if($_GET['code'] != $_CONFIG['code']) { die(""); }
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'];
}

$userInfo = $db->query('SELECT `userid`, `level`, `bank_money`, `money`, `cybermoney`, `creditcard`, `crystals`, `smoking` FROM `users` WHERE (`userid` = '.$_SESSION['userid'].')');
if ($db->num_rows($userInfo) > 0) {
   $ir = $db->fetch_row($userInfo);
   //Your html output, I've no idea what the var smoke is supposed to be so...
   $smoke = 'Fix this'; //^^

   print "

   <a id='button1a'><b>Player Info</b></a>
   <a id='button1a' href='usersonline.php'><b>Name:</b> $gn{$u} [{$ir['userid']}] $d $staff </a>
   <a id='button1a' href='gym.php'><b>Level:</b> {$ir['level']}</a>
   <a id='button1a' href='bank.php'><b>Money:</b> ".number_format($ir['money'])."</a>
   <a id='button1a' href='bank.php'><b>Bank Money:</b> {$ir['bankmoney']}</a>
   <a id='button1a' href='cyberbank.php'><b>Cyber Money:</b> {$ir['cybermoney']}</a>
   <a id='button1a' href='creditcard.php'><b>Credit Card:</b> {$ir['creditcard']}</a>
   <a id='button1a' href='crystaltemple.php'><b>Crystals:</b> {$ir['crystals']}</a>
   <a id='button1a' href='cigarettes.php'><b>Smoking Level:</b> {$ir['smoking']}</a>
   <a id='button1a' href='cigarettes.php'><b>Smoker:</b> $smoke</a>
   <a id='button1a' href='logout.php'><font color='white'>[</font><font color='red'>Emergency Logout</font><font color='white'>]</font></a>

   ";
?>

thank you so much, works a charm, now i can carry on with my work, thanks illusions aswell :)

Posted

having the player info tabbed is alot better due to the fact it updates the info on the stats quicker, only problem is i dont know how to get the links in the iframe to load on the main page :s

i tried target='_blank' but that dont seem to work :s

Posted (edited)

and which lines to i need to remove so it dont require a code,

the config code thing stops fuctions from working :(

Reason is i've made the banking in the side menu,

you need the code for the page to work, but once it comes up it works, the problem is when you deposit or withdraw it uses a withdraw function,

I've tried to take the config code out but it didnt work, any help would be a great help

Edited by peterisgb

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