Jump to content

apw

Members
  • Posts

    96
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

apw's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Hello Hello, when a member logins into my game, I'm pulling information from my database and this information, depending on what actions the member does, either increases or decrease certin information in the database, this in turn is displayed to the member. However, in order for this information to be displayed, the member must refresh the screen. Is there ANY way I can display the new, current information to the member without them constantly hitting the refresh button? The member usually sits on one section of the screen but I am aware that if they leave that screen and go to something else and return the new information will appear, but what if the member just sits on one screen, without hitting the refresh can I still display the new updated information to them? Thanks
  2. Hello Hello, I was wondering if you could give me your suggestions on simplifying some code I had written. What I'm attempting to do is the following: I created a database table called barn, I added a few rows in the barn (as tests) called .. slot1_name to slot5_name in each of these i filled as different foods such as potatoes, carrots, tomatoes, pumpkins and grapes (as examples) now my question is, after i query my DB as follows: $barnstats="SELECT * from fw_barn where playername='$player'"; $barnstats2=mysql_query($barnstats) or die("Could not get user stats"); $barnstats3=mysql_fetch_array($barnstats2); I now have all my slots loaded into my $barnstats3 (i think) but my question is ... Say player A wants to buy another food from the vendor, the script has all the current foods that player A has in their barn .. but needs to check to see if any available slot1 to slot5 are empty .. what I did was I wrote 5 different if statements checking to see if those slots are already filled .. is there just one if statement I can write instead to check all slot1 to slot5 to see if they are either empty OR have something already inside them? Thanks in advance for your help
  3. Hello I wrote a simple but effective countdown script .. you simply plug in the time (*nix time) that you want the script to end and it will countdown from now using the time(); function .. which is all good in a way, however here is what I'm running into the problem. I included the code below that I use for this simple script but as the time goes on, poor player has to keep hitting refresh for the time to update. This is because I store the time(); in my database along with the future time. Instead of poor player A having to keep hitting the refresh button is there a way I can script this to where no refresh is needed and the time continues to update then when the $ctime (current time) hits $etime (future time) the script stops and say it updates the database? I figured $etime by taking this and doing a simple: $etime = 30; Time I want to advance the current real time. So .. then I subtracted $etime - $ctime to get the difference But you already knew that .. If you could give me a hand, I'd greatly appreciate it, even simpilify my messy code to possibly get the result I'm looking for .. How about a javascript .. would that work as well? I have an exaple below the first set of code the code runs until the timer reaches 0 then restarts .. instead of restarting maybe have the code just end and preform a DB update? // Sets and posts current time to DB $my_time=time(); // current time $update_time="update bbg_timers set ctime='$my_time' where username='$username'"; mysql_query($update_time) or die("could not query"); $time_remain2=$etime-$ctime; // $time_remain2=$ctime-$etime; $difference=$time_remain2; $difference=$time_remain2; $hours_difference = floor($difference / 3600); $difference = $difference % 3600; $minutes_difference = floor($difference / 60); $seconds_difference = $difference % 60; $secshow = false; $timeleft = ''; if ($hours_difference > 0) { $timeleft .= $hours_difference . 'h '; } else { $secshow = true; } if ($diff > 60) { $timeleft .= $minutes_difference . 'm '; } elseif ($diff > 60 && !$seconds) { $timeleft = '<1m'; } if ($secshow) { $timeleft .= $seconds_difference . 's '; } if ($diff < 0) { print "Diff is < 0"; } if (($diff * 60) < 15) { // print "You have $hours_difference hours, $minutes_difference minutes, and $seconds_difference remaining"; } } Here is the other javascript code I was talking about -- I took this from the footer file of my bnt game (giving credit) so I'm not exactly sure what some of the code means // Update counter $res = $db->Execute("SELECT last_run FROM $dbtables[scheduler] LIMIT 1"); $result = $res->fields; $mySEC = ($sched_ticks * 60) - (TIME()-$result[last_run]); ?> <script language="javascript" type="text/javascript"> var myi = <?=$mySEC?>; setTimeout("rmyx();",1000); function rmyx() { myi = myi - 1; if (myi <= 0) { myi = <? echo ($sched_ticks * 60); echo "\n";?> } document.getElementById("myx").innerHTML = myi; setTimeout("rmyx();",1000); } </script> <? echo " <b><span id=myx>$mySEC</span></b> $l_footer_until_update <br>\n"; // End update counter Thanks again
  4. Hello Hello i have 2 quesstions that maybe someone can assist me with. I have a register and login page on my site and was wondering how do I get the persons IP address? My second question is Once i have this IP how do I use php to store this ip into my sql database? Thanks
  5. Went word for word with your example and used test.php as my test page and got no errors just a blank white screen
  6. Hello How do i use preg_match to keep people from directly accesssing files? I have this so far but it comes up to blank screen with no error: If (preg_match("/test.php/i", $PHP_SELF)) { print "you cannot view this file directly"; die(); } Thanks again
  7. Here is the potatoplant.php that is giving me problems
  8. The exact error message iis: Warning: cannot send header information - headers already sent by (output startpotato.phped at potato.php:60) in potato.php on line 118. If its refering to line 60 this line has a <?php to start a new batch of php code Line 118 has this: header("location: sell.php"); die();
  9. I have the session_start() posted at the very top of the page where the form is located and when i went to click on the link i got the cannot modify headers ... The session_start is before any othwr code is even started including where i tell the script the database name and info. Im not sure now what the problem iis
  10. Hello I have a php page called potato for.php with 3 different submit buttoms on it which are called auction, sell and cancel. At the bottom of the page i have this for each of the 3 submit buttoms: To tell the code what to do after the user selects one of the forrms buttons If (isset($_post["auction"])) { Now that i have this my question is with these how do i redirect the user to a page like auction.php or to barn.php without using a javascript to do so Thanks I
  11. Hello I have on my website login page this: Sessionn_start(); if(isset($_session['player'])) { Session_destroy(); Even with the cache cleared im getting cannot send session cache limiter headers already sent How i fix this? Thanks
  12. Hello I had 2 questions that maybe someone can help me with. My first question is about restricting certin names when someone registers on my website such as admin or guest. However I may get the occasional person who may try names such as admin2 or guest2. How do I setup some sort of restriction that not only blocks names such as admin or guest but also any other names that may have the word admin or guest in the name? My second question is about adding commas in numbers over 999. My script looks very funny with numbers over 999 that have no comma in them. How would you do this? Thanks
  13. So I can exec() search.exe and have it execute? Will this also execute the extra perameters thats needed to run this search bot such as search.exe -i <site url?>
×
×
  • 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.