peterisgb Posted November 22, 2011 Share Posted November 22, 2011 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 Quote Link to comment Share on other sites More sharing options...
Uridium Posted November 22, 2011 Share Posted November 22, 2011 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 Quote Link to comment Share on other sites More sharing options...
peterisgb Posted November 22, 2011 Author Share Posted November 22, 2011 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; Quote Link to comment Share on other sites More sharing options...
Uridium Posted November 22, 2011 Share Posted November 22, 2011 send me your script matey so i can have a look Quote Link to comment Share on other sites More sharing options...
peterisgb Posted November 22, 2011 Author Share Posted November 22, 2011 (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 November 22, 2011 by illusions code thingy not workin Quote Link to comment Share on other sites More sharing options...
peterisgb Posted November 22, 2011 Author Share Posted November 22, 2011 tho this repeats the same name etc all the way down the page :'( Quote Link to comment Share on other sites More sharing options...
Uridium Posted November 22, 2011 Share Posted November 22, 2011 are you just adding this to an iframe ? Quote Link to comment Share on other sites More sharing options...
peterisgb Posted November 22, 2011 Author Share Posted November 22, 2011 are you just adding this to an iframe ? well the iframe is in header.php the iframe auto opens playerinfo.php which is the page i just posted, Quote Link to comment Share on other sites More sharing options...
Uridium Posted November 22, 2011 Share Posted November 22, 2011 ah kk leave it with me i'll have a look Quote Link to comment Share on other sites More sharing options...
peterisgb Posted November 22, 2011 Author Share Posted November 22, 2011 ah kk leave it with me i'll have a look thanks lord master :) Quote Link to comment Share on other sites More sharing options...
Uridium Posted November 22, 2011 Share Posted November 22, 2011 Hmm my notepad++ is playnig up wont save a file keeps saying its being used by another program Quote Link to comment Share on other sites More sharing options...
peterisgb Posted November 22, 2011 Author Share Posted November 22, 2011 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. Quote Link to comment Share on other sites More sharing options...
peterisgb Posted November 22, 2011 Author Share Posted November 22, 2011 http://www.w3schools.com/html/tryit.asp?filename=tryhtml_intro Quote Link to comment Share on other sites More sharing options...
Djkanna Posted November 22, 2011 Share Posted November 22, 2011 (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 November 22, 2011 by Djkanna Quote Link to comment Share on other sites More sharing options...
peterisgb Posted November 23, 2011 Author Share Posted November 23, 2011 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 :) Quote Link to comment Share on other sites More sharing options...
peterisgb Posted November 23, 2011 Author Share Posted November 23, 2011 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 Quote Link to comment Share on other sites More sharing options...
peterisgb Posted November 23, 2011 Author Share Posted November 23, 2011 (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 November 24, 2011 by peterisgb Quote Link to comment Share on other sites More sharing options...
peterisgb Posted November 24, 2011 Author Share Posted November 24, 2011 ok solved it Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.