Jump to content

djfox

Members
  • Posts

    327
  • Joined

  • Last visited

    Never

Everything posted by djfox

  1. I don`t understand what he means by his statement.
  2. Is it possible to specify an id number with that? I do that but then the numbers are all 0 when the count is called on (shouldn`t be 0). I`m not sure of what you mean.
  3. Is it possible to specify an id number with that?
  4. I can tell php to count how many entries in a table, but I can`t figure out how to tell it to count within a field. Goal: Count total number of items that are in people`s inventories. Example: Field name is "bought". bought holds the id numbers of virtual items that the person has bought with their virtual money. So there may be repeats. The guy who made this system for me had it set up that the items bought are stored in the field bought. SO it could appear something like: 6,7,6,19,21,20,23,36,49,59,69,69,69, I want the code to be able to count how many times an id number appears in bought in all of the accounts. Is it possible? If so, how do I do it?
  5. Just to be sure I read those correctly (in case I decide to change my mind later), to 60*60*24 says for seconds*minutes*hours, am I correct?
  6. This is what I currently have (I -think- this is where the session time is set for my site, someone else had made the session thing and I find no other place of numbers in regards to sessions): function RemoveSession() { $_SESSION = array(); if (isset($_COOKIE[session_name()])) { @setcookie(session_name(), '', time()-4200000000, '/'); } } If I want the session to last an entire day (24 hours), how would I adjust that?
  7. In between, as in "choose a number between 5 and 10. Anything below 5 or above 10 does not count."
  8. If I want to make an if statement where $value is between $a and $a + 15, how do I make this if statement with an in between?
  9. The recommended way to handle this is that when the person visits a page, their time slot in the database gets updated? Ok, I have one other question in regards to that. This the method of recording time/date in the database I use for my site: strftime("%B\ %e\,\ %Y %H:%M:%S", time()) How do I check the time to see if they get counted as online?
  10. Hm, ok. How would I do this exactly?
  11. I have it where when the user logs in, their status switches to online, and when they click the logout link, their status changes to logout. But how does this get changed when they just close the browser?
  12. Mind reader. I was about to ask how to be sure that the cron job doesn`t make the value in the negatives. In order to do that to make the account upgrade go back down, would I be putting in something like: UPDATE userdata set level=1, status=Basic WHERE daysleft=0 AND level>1
  13. Hm, interesting idea. How do I tell it to check to see if the days is 0 and expire the account?
  14. Cron job? Ok, the dates are entered by strftime("%B\ %e\,\ %Y %H:%M:%S", time()); How could I tell the cron job to check to see if it`s that date (the expiration date) before it degrades the account back down? (I`ve only recently learned about cron jobs so I`m still pretty new with it.)
  15. Accounts on my site can have upgrades but the upgrades are not permanent. For the moment, I have to hand-edit accounts if their upgrades expire. But I would like for the upgrades to expire on their own. What would be the best way for me to do this?
  16. I tried this: mysql_query("DELETE FROM coll_inven2 WHERE item=$item[2] AND user='$loggeduser' LIMIT $item[3] ;"); or die(mysql_error()); But I get this error: Parse error: syntax error, unexpected T_LOGICAL_OR in /home/secrett1/public_html/exchange3.php on line 83 (Line 83 is the line above.) I`m using coll_inven2 (with some play entries) to run tests for the code so that I don`t cause anything disastrous to happen to the real info.
  17. I got an error message (saying it couldn`t connect). Did I enter everything correctly: (username and password changed since this is all public and I don`t want people having their hands on them) mysql -u username -p password -e 'USE secrett1_artgallery;UPDATE ownedpets SET food=food-10;'
  18. I have the following code: <?php if ($lev > 0){ echo "<p>"; $res = mysql_query("SELECT id, name, excit, excam, exc FROM clothing WHERE id=$it"); $item = mysql_fetch_row($res); mysql_free_result($res); $res2 = mysql_query("SELECT id, name FROM collection WHERE id=$item[2]"); $item2 = mysql_fetch_row($res2); mysql_free_result($res2); $res3 = mysql_query("SELECT COUNT(*) FROM coll_inven WHERE item=$item[2] AND user='$loggeduser'"); $count = mysql_fetch_row($res3); mysql_free_result($res3); if ($item[4] == 1) { if ($count[0] >= $item[3]) { } elseif ($count[0] < $item[3]){ $more = $item[3] - $count[0]; echo "<p>You don`t have enough <b>$item2[1]</b>. You need <b>$more</b> more to make the exchange."; } } elseif ($item[4] ==0){ echo "This is not an exchange item!"; } } ?> What this page should do is check to see if someone has enough of a certain item in their inventory to make an exchange. If they don`t have enough, the exchange is not made, but if they do have enough, the exchange needs to take place. The code would need to delete the number of items needed ($item[3]) from coll_inven. Example: Item the person wants to exchange for is Disco Ball ($item[1]) They need 5 ($item[3]) glass shards ($item[2]/$item2[1]) The person has 5 ($count[0]) in their inventory So 5 ($item[3]) glass shards ($item[2]) from coll_inven that belong to the logged in person ($loggeduser) need to be deleted from the database. How will I tell the code to delete only 5 ($item[3]) entries in coll_inven where item=$item[2] and user=$loggeduser ? Will I be using LIMIT=$item[3] ?
  19. That does look much easier. The asterisks are still confusing me. When entering in the username and password for the line there, would I do something like mysql - u<george> - p<chips> - e 'USE <pets>;blahblah' Or would the info be entered without the signs?
  20. What I`m wanting it to do is subtract 10 from food of all entries in ownedpets table of my database, every 2 hours.
  21. Where would I learn more about that? * * * * * /usr/bin/wget http://http://secrettrance.net/petstatsedit.php Do I need to replace * * * * * /usr/bin/ with anything?
  22. So I would first need have a file, say petstatsedit.php which would have the actual work: <?php session_start(); //Date: January 2 2007 //For: www.secrettrance.net //Description: Edit Pet Stats include("dbcon.php"); require_once "design.php"; require_once "auth.php"; $Title = "Secret Trance: Edit Pet Stats"; require_once "header.php"; require_once "hidestatus.php"; mysql_query("update ownedpets set food = (food - 10)"); mysql_close($con); ?> Then I would also need a file, say petcronjob.php, which would be: <?php -f petstatsedit.php ?> Then in the cron job "command to run" field, I would enter http://secrettrance.net/petcronjob.php Am I correct?
×
×
  • 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.