Jump to content

poirot

Members
  • Posts

    646
  • Joined

  • Last visited

    Never

Everything posted by poirot

  1. Yes it is, but the client should have the session ID.
  2. I just looked at your first post more carefully, and I really can't think of a good solution. So, can I give you an advice instead? Calculating time left befire expiration is not like "oh my, it must be totally accurate"; if I were a user with more than 1 year of time I wouldn't worry about "hey, its lacking 1 day" or something as long as I know the expiration date itself. So, you should measure the advantages and drawbacks, I would prefer something less accurate over a slow script.
  3. It depends, you can use something like this: [code]function inform_user($email) { // code goes here }[/code] Or this: [code]function inform_user() {    global $email; }[/code] For further information, look for "Variable Scope" in the Manual.
  4. Maybe it's a server setting... Some servers just won't let PHP create/delete files in certain or all directories...
  5. This should be OK... But where is the image resource ($im)? Also note that your script actually outputs an image, meaning that you shouldn't mix it with HTML or whatever, like.
  6. poirot

    echos

    Well, displaying the query was very helpful: select playerid, user, email, fatigue, maxfat, power, speed, dex, intel, health, maxhealth, gender from players where user='' As you see, user='', it's empty. Your script is not recording the user id.
  7. I am afraid you can't, these functions are for programs being executed by the server if I am not wrong... So, you can't simply use it in Windows, for example;
  8. When I get home I'll try to write something, but if I end up with something like this, I'd think it's really not worth the hassle...
  9. Try this one: [code]$sql = 'REPLACE INTO Stock (stockAmt) VALUES (" stockAmt - ' . $row1['quantity']. ' ") WHERE stockID = "' . $row1['stockID']. ' " ';[/code]
  10. It's simple, the session ID can be stored in a cookie file or passed through the URLs. Placing the SID in URLs will ensure that sessions will work if your visitor disabled cookies.
  11. It uses Regular Expressions, which is something I am not good at. Try to google some Regex tutorials... This is a Regex you can use to validate IP's: [code]^(([3-9]\d?|[01]\d{0,2}|2\d?|2[0-4]\d|25[0-5])\.){3}([3-9]\d?|[01]\d{0,2}|2\d?|2[0-4]\d|25[0-5])$[/code]
  12. You can use explode() 2 times... But I would rather create a multidimensional array: [code] $data = array (    '0' => array (       'img'   => 'image1.jpg';       'descr' => 'information about this one'     ),    '1' => array (       'img'   => 'image2.jpg';       'descr' => 'information about the second one.'     ), );[/code] serialize() it and store in a txt. It's more accurate.
  13. I am not sure if I got what you want... But let's say you have a "database file", and the values are stored as a serialized array... So you can use something like this: [code]$data = unserialize(file_get_contents('file_name_here.php'); echo '<input type="text" name="name"  value="' . $data['name'] . '">'; echo '<input type="text" name="email"  value="' . $data['email'] . '">';[/code]
  14. As far as I know, PHP can't mess with files or programs... You should try a desktop app...
  15. Yep, it's simple... You can use regular expressions to check if the HTTP_REFERER is domain1.com and if it returns true you use die() or whatever... But as GingerRobot said, it's not a very good idea since this header is not "trustworthy"
  16. Hmm, I am not getting what you want... [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Basically when I add a page that I want to be counted I want the script to see if the page is already written to the table, if not to write it in one column and start the count in the other. If the page already exists just +1 the count and return the result.[/quote] What should the script define as "page already written"? What are the pages themselves?
  17. You can store the uploaded file somewhere and record the path in the database instead. I think it's easier.
  18. Well, you can use strtotime() to convert "English" dates to UNIX timestamps; then subtract them [a href=\"http://us3.php.net/manual/en/function.strtotime.php\" target=\"_blank\"]http://us3.php.net/manual/en/function.strtotime.php[/a]
  19. Just a note: If you are trying to add them to a text field, use htmlspecialchars and htmlentities to convert the single and double quotes.
  20. Don't use addslashes in this case. Change your code to: <input type=text name='headline' size=63 tabindex=13 value="<?php print $Headline; ?>"> Notice that I've changed the single quotes to double quotes. This will prevent the browser from "thinking" that value stopped where it shouldn't stop. Also, by using this, your $Headline string can't contain double quotes
×
×
  • 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.