Jump to content

user51

Members
  • Posts

    19
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

user51's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I'm guessing I have to insert This code in the cron file and call it from there. Right?
  2. Ok guys, I'm gonna have to throw a question out there. I am building a mmorpg. And I could use some help with some coding. I have two cron files that run every hour and every day(24 hrs ) My question is, how can I add a visual countdown based on server time to show how long the cron has left to tick? I have tried many countdowns but most of them reset once I leave the page. So basically I need a countdown timer to show the user how long till he getts more food or whatever. Any help would be greatly appreciated. Thank you in advance for taking time to read and/or help.
  3. <?php require_once('inc/config.inc.php'); $sql = "SELECT `turns` FROM `exodus_users` WHERE 1 LIMIT 0, 30 "; echo "turns"; ?> the above $sql i pulled from phpmyadmin, config.inc.php has the login info. i still get just the word turns echoed, help
  4. that is all the code i have on the page, my goal is to just display that single field value, and use the same code to display other values on the top of the page in separate cells of a table. if you dont mind, how can i call to display that? again it does echo the user id but no the other cells.
  5. I am trying to display a single value on my page and i cant seem to display it for the life of me. can someone tell me if im doing something wrong? this is what i have so far: <?php require_once('inc/common.inc.php'); // Connect to the database db_connect(); // Check and update the authentication. check_auth(); db("select * from ${db_name}_users where login_id = '$login_id'"); echo "$login_id"; ?> obviously there is a field in the database that corresponds to turns and it is int(4), ..... Now, i am able to display $login_id, but when i try to display another field, named turns, it just displays a blank page. Any pointers would be appreciated thank you.
  6. im attempting to translate this file to php from perl, the original cron file was written in perl. the original translator left the job in the middle and this block was smack in the middle of the cron file, disabling some aspects of the game. im not sure if the original cron file actually worked right, but im moving down block by block trying to debug. thats why the code is a little messy, i understand what youre saying, just logically the code didnt make sense separating an if and /or elseif with a while in the middle.
  7. I thank you all for helping me with your pointers, however it appears that the script wasnt happy with placing an, if, while, elseif comand in that order, i shuffeled them around, while, if, and modified the elseif to if, and that did the trick. now im getting a series of other errors but hey, debuging, and coffe.... right? lol again thank you guys.
  8. my apologies guys , now im getting and unexpected endwhile. im having a brainlock here. any pointers as of where to place these?
  9. i apreciate the responses, one more question, should i end the while loop before or after the else statement? i am also a little lost with the closing braces. i thought i placed two of them at the end of the block.
  10. hello, i am having a problem in my cron file that runs daily, the code posted below at the last block at the elseif ($chance > 2.5) <b>Parse error</b>: syntax error, unexpected T_ELSEIF in <b>/home/content/run_daily.php</b> on line <b>240</b><br /> ... $db = $dbh->prepare("select star_id from {$game}_stars where event_random = '6'"); $db->execute(); $bh_sys = $db->fetchrow_hashref(); if ($bh_sys) { $chance = rand(5); if ($chance < 1) { mysql_query("update {$game}_stars set event_random = 1, metal = '0', fuel='0', star_name = 'BlackHole' where star_id = '$bh_sys->{star_id}'"); mysql_query("insert into {$game}_news (timestamp, headline, login_id) values (".time().",'The <b>SuperNova Remnant</b> in <b class=b1>system $bh_sys->{star_id}</b> has formed into a <b>blackhole</b>. Being a slow process, all ships managed to get out to system #<b>1</b>. We expect no further trouble from that system. <font color=lime>- - - Science Institute of Sol - - -</font>','-11')"); $db = $dbh->prepare("select location,login_id,ship_id,ship_name from {$game}_ships where location = '$bh_sys->{star_id}'"); $db->execute(); while ($ship_bh = $db->fetchrow_hashref()) { mysql_query("update {$game}_ships set location = '1' where ship_id = '$ship_bh->{ship_id}'"); mysql_query("insert into {$game}_messages (timestamp,sender_name,sender_id, login_id, text) values(".time().",'BlackHole','$ship_bh->{login_id}','$ship_bh->{login_id}','Your ship the <b class=b1>$ship_bh->{ship_name}</b> escaped a blackhole forming from a SuperNova Remnant in system #<b>$ship_bh->{location}</b>. It is now in system #<b>1</b>')"); mysql_query("update {$game}_users set location = '1' where location = '$bh_sys->{star_id}'"); print "\nSN remnant in $bh_sys->{star_id} to blackhole\n"; } elseif ($chance > 2.5) { mysql_query("update {$game}_stars set event_random = '14' where star_id = '$bh_sys->{star_id}'"); mysql_query("insert into {$game}_news (timestamp, headline, login_id) values (".time().",'After much study, we have decided that the star in system <b>$bh_sys->{star_id}</b> will <b class=b1>not</b> become a Blackhole, as it was not massive enough. This system will remain a harmless Super-Nova Remnant, with lots of minerals in. <font color=lime>- - - Science Institute of Sol - - -</font>','-11')"); print "\nSN remnant in $bh_sys->{star_id} safe\n"; } } ... Help
  11. problem is solved, called the picture from a different page with a function. thank you all for your time and effort.
  12. dear teddykiller, i apologize for not using the php tags, i didnt think i would have such a hard time on this problem, below is the source code called from index.php. <?php session_start(); include "system.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" /> <script src="javascript/functions.js" type="text/javascript"></script> <title>mark 1</title> <P align=center><FONT color=#000000> <span class="style4"> <?=getOnlineUsersCount()?> online</span><span class="style4"></span></span></FONT></P> <?php include "main.php"; ?> </body> </html> this is main.php <? if (!$_SESSION['isLogined']){ ?> <style type="text/css"> <!-- .style1 {font-size: xx-large} .style2 {font-size: large} body { background-image: url(if/Background%20Test.png); } a { font-size: medium; } #Layer1 { position:absolute; width:46px; height:31px; z-index:1; top: 1175px; } a:link { color: #FF0000; text-decoration: none; } a:visited { text-decoration: none; color: #999999; } a:hover { text-decoration: underline; color: #999999; } a:active { text-decoration: none; color: #FF0000; } .style6 {color: #A4A4A4} .style7 {color: #070707} .style9 {font-size: xx-large; font-weight: bold; } --> </style> <title>HomeBase</title><div align="center"> <TABLE cellSpacing=0 cellPadding=0 width=272 border=0> <TBODY> <TR> </TR> <TR> <TD class=menu_cell_repeater> <FORM action="" login.php method=post><INPUT type=hidden name=username> <INPUT type=hidden name=pword> <TABLE width=270 height="203" align=center class=small style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 5px; PADDING-TOP: 0px"> <TBODY> <TR> <TD height="24" align=middle> <div align="center"><font color="black" class="style1">Username:</font></div></TD></TR> <TR> <TD height="39" align=middle><div align="center"> <input name=uname class=style2 /> </div></TD> </TR> <TR> <TD height="98" align=middle> <div align="center"><span class="style1"><font color=black>Password:</font></span></div> <label> <div align="center"> <input name="psword" type="text" class="style2" value="" /> </div> </label></TD></TR> <TR> <TD height="30" align=top style="PADDING-TOP: 5px"><div align="center"> <input name="submit" type=submit class=style1 style="WIDTH: 250px" value=Login /> </div></TD> </TR> </TBODY></TABLE> <INPUT type=hidden value=@@@@@@@@@@@@@@name=hash> </FORM></TD></TR> <TR> <TD height="27" align=middle class=menu_cell_repeater_vert><A href="register.php" class="style2">Register</A></TD> </TR> <TR> <TD height="27" align=middle class=menu_cell_repeater_vert><A href="forgotpass.php" class="style2">Forgot Login?</A></TD> </TR> <TR> <TD></A></TD> </TR> <? }else{ setLastSeen($_SESSION['isLogined'],time()); $user=getUserDetails($_SESSION['isLogined']); $userR=getUserRanks($_SESSION['isLogined']); ?> <TR> <TD><div align="center"><A href="logout.php"><IMG alt=Logout src="imm/logout.png" width=137 border=0></A></div></TD></TR> <? } ?> </TBODY> </TABLE> </div> <P align="center"> <A href="index.php"> <?=$conf["race"][$user->race]["name"]?></A><span class="style2"> <? numecho ($userR->rank) ?> <? if ($_SESSION['isLogined']){ ?> <div align="center"> <table width="279" height="261" border="0"> <tr> <td width="108"> <div align="left"> Ammo <table width="108" height="42" border="0" background="if/Ammo.png"> <tr> <td width="50"><a href="armory.php"></a></td> <td width="48"><div align="center" class="style2"><a style="FONT-SIZE: 9pt; COLOR: black" href="armory.php"> <? numecho ($user->attackTurns) ?> </div></td> </tr> </table> </div></td> <td width="110"> <div align="left"> Cash <table width="108" height="42" border="0" background="if/Cash.png"> <tr> <td width="50"> </td> <td width="48"><div align="center"><font color="#250202"> <? numecho ($user->gold) ?> </font></div></td> </tr> </table> </div></td> </tr> <tr> <td> <div align="left"> Untrained <table width="108" height="42" border="0" background="if/Mercs.png"> <tr> <td width="47"> </td> <td width="51"><div align="center" class="style2"> <? numecho ($user->untrainedSold) ?> </div></td> </tr> </table> </div></td> <td> <div align="left"> Cash/Hour <table width="108" height="42" border="0" background="if/Cash per Time.png"> <tr> <td width="51"> </td> <td width="47"><div align="center" class="style2"><a style="FONT-SIZE: 9pt; COLOR: black"> <? numecho (getUserIncome($user));?> </a></div></td> </tr> </table> </div></td> </tr> <tr> <td> <div align="left"> Timer <table width="108" height="42" border="0" background="if/Next Turn.png"> <tr> <td width="48"> </td> <td width="50"><div align="center" class="style2""> <? $nextTurnMin=getNextTurn($user); $nextTurnMin=round($nextTurnMin/60); echo $nextTurnMin; ?> </div> </td> </tr> </table> </div></td> <td> <div align="left"> Rank <table width="108" height="42" border="0" background="if/Rank.png"> <tr> <td width="47"> </td> <td width="51"><div align="center" class="style2"> <? numecho ($userR->rank) ?> </div></td> </tr> </table> </div></td> </tr> <tr> <td> <div align="left"> Attack units <table width="108" height="42" border="0" background="if/Attacks.png"> <tr> <td width="49"><div align="center"></div></td> <td width="49"><div align="center" class="style2"><div align="center" class="style2"><a style="FONT-SIZE: 9pt; COLOR: black" href="train.php"> <? numecho ($user->trainedAttackSold)?> </div> </td> </tr> </table> </div></td> <td> <div align="left"> Defense Units <table width="108" height="42" border="0" background="if/Defences.png"> <tr> <td width="48"><div align="center"></div></td> <td width="50"><div align="center" class="style2"><div align="center" class="style2"><a style="FONT-SIZE: 9pt; COLOR: black" href="train.php"> <? numecho ($user->trainedDefSold)?> </div></td> </tr> </table> </div></td> </tr> <tr> <td><div align="left"> <div align="left">Mail </div> <table width="108" height="42" border="0" background="if/mail.png"> <tr> <td width="51"> </td> <td width="47"><div align="center" class="style2"><a style="FONT-SIZE: 9pt; COLOR: black" href="inbox.php"> <?=getMessagesCount($user->ID)?> </a></div></td> </tr> </table></td> <td><div align="left"> <div align="left">Help </div> <table width="108" height="42" border="0" background="if/Help.png"> <tr> <td width="51"> </td> <td width="47"> </td> </tr> </table></td> </tr> <tr> <td><div align="left"> Engage Enemy <table width="108" height="42" border="0" background="if/Attack Icon.png"> <tr> <td width="48"> </td> <td width="50"><div align="center" class="style2""><a href="battle.php">X</a></div></td> </tr> </table> </div></td> <td><div align="left"> <table width="108" height="42" border="0" background="if/Next Turn.png"> <tr> <td width="48"> </td> <td width="50"> </td> </tr> </table> </div></td> </tr> <tr> <td><div align="left"> <table width="108" height="42" border="0" background="if/Next Turn.png"> <tr> <td width="48"> </td> <td width="50"> </td> </tr> </table> </div></td> <td><div align="left"> <table width="108" height="42" border="0" background="if/Next Turn.png"> <tr> <td width="48"> </td> <td width="50"> </td> </tr> </table> </div></td> </tr> <tr> <td><a href="battle.php">battlefield</a></td> <td><span class="style9"> <?=$user->userName?> </span></td> </tr> </table> <p> // this is where im trying to run my script// <?php session_start(); $sql = "SELECT * FROM `userdetails` WHERE `race` = 1 LIMIT 0, 30 "; if(!$result) { echo "Query failed.<br />\n$sql<br />\n" . mysql_error(); } elseif(mysql_num_rows($result) == 0) { echo "No rows returned by query:<br />\n$sql"; } ?> </p> <p> </p> <table width="279" height="261" border="0"> </table> </div> <? } ?> messages such as <?=getMessagesCount($user->ID)?> display perfectly. maybe you can see what im missing here.
  13. session is started on index.php as of <? session_start(); include "system.php"; ?> system includes a library.php file with $conf["mail"]=".............."; $conf["sites_database_name"] = "......."; $conf["sites_database_name"] = "......"; $conf["sites_database_login"] = ".........."; $conf["sites_database_login"] = ".........."; $conf["sites_database_password"] = "..........."; $conf["sites_database_password"] = "........."; the page called from index.php is main.php main.php starts with a <?php session_start(); ?> main.php also contains the login page. <TR> <TD height="24" align=middle> <div align="center"><font color="black" class="style1">Username:</font></div></TD></TR> <TR> <TD height="39" align=middle><div align="center"> <input name=uname class=style2 /> </div></TD> </TR> <TR> <TD height="98" align=middle> <div align="center"><span class="style1"><font color=black>Password:</font></span></div> <label> <div align="center"> <input name="psword" type="text" class="style2" value="" /> </div> </label></TD></TR> <TR> <TD height="30" align=top style="PADDING-TOP: 5px"><div align="center"> <input name="submit" type=submit class=style1 style="WIDTH: 250px" value=Login /> </div></TD> </TR> </TBODY></TABLE> <INPUT type=hidden value=@@@@@@@@@@@@@@@@@ name=hash> </FORM></TD></TR> calls such as <? numecho ($user->cash ?> do display as numbers on the php page, i also am using a standalone php to verify that the user is in fact loged in <? if ($_SESSION['isLogined']){ echo "LOGED IN"; } else { echo "<br><center>You are not loged in. Try again.</center><br>"; exit; } ?> which echoes loged in right above the script im trying to run. :confused: latter ill try to create a separate login and retrieve the values from the table, maybe i can call them that way.
  14. guys, i am a dumb @@@, the query is runing just fine as of ; <?php if ($_SESSION['isLogined']){ $sql = mysql_query("SELECT `kind` FROM `users`"); $row = mysql_fetch_assoc($sql); switch($row['kind']) : case "1": echo '<"case 1">'; break; case "2": echo '<"case 2">'; break; case "3": echo '<"case 3">'; break; case "4": echo '<"case 4">'; break; default: echo '<"default">'; break; endswitch; } ?> --------------------- however the query is sorting players in the order they registered, so every time i try to run the query, it shows me the value of the player first registered, in my case, its kind =2, today i was able to display case 2 for one of the test characters im developing but.. as i forementioned im running to the same problem now im trying to call the query such as this; $sql = "SELECT DISTINCT `kind`,`ID` FROM users LIMIT 0, 30 "; phpmyadmin responds good to this command but i still get the default, i feel im getting closer but.... still no luck my next question is ... how do i make sure that i call this specific user id and kind? i mean, i would assume that it would be already called if the session has begun but its not doing it. something like if user_ID = (this specific player) then call the 'kind' row, if 'kind' row = (this specific player) then echo <image>
  15. session is started, i know that because what im tying to display, as i explained earlier is a flag of users kind, all the other stats are displaying, attack , defense, and stuff like that. <? numecho ($user->attackTurns) ?> the above code is how i display ammo, it displays a number. phpmyadmin does spit the number 1 when i run test queries on it however it does not recognize id='".$_SESSION['user_ID']."'"; ......
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.