Jump to content

Carth

Members
  • Posts

    31
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling
  • Location
    UK

Carth's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. If this data is already in the database, then it doesn't matter so much. The script to correct it only needs to be run once, even if it's slow or needs multiple passes. From then on only insert the data if it's in the correct format. Do any string modification in PHP beforehand - and there are more efficient ways to do it in PHP than in SQL.
  2. You don't decrypt MD5, it's a one way thing hash, that's the point of it. If you must send them the password in an email, use the password before it's been hashed? If they have forgotten their password, reset it to something random, and send them that. Then allow them to change their password later.
  3. And if you do that, make sure the horrible magic_quotes_gpc isn't on (you'd be surprised how many servers still use old versions of PHP set up like that)! Either disable it in your php.ini, or at the top of every script check get_magic_quotes_gpc() and call stripslashes() appropriately. You don't want to escape your data twice.
  4. I think you want a database, rather than relying on the client's cookies to store data. Cookies/session can easily be altered, and is not a reliable storage solution. To tie a particular character to a person, you would want some form of identification (username/password), and you can use sessions or cookies for that.
  5. Can you post what you've got so far?
  6. I think you should escape the backslash, but maybe it works without.. try? Edit: sorry I misread your code when I posted earlier. You are matching invalid characters and then returning true if it didn't find any? Should work...
  7. Can you show your code? It probably calls htmlspecialchars() or htmlentities() somewhere?
  8. Are you absolutely sure the new lines are disappearing? Because I really can't see why. If you output text to the browser you need to send a header at the top of your script: header("Content-type: text/plain"); Otherwise the browser won't display the new lines because it thinks it's HTML still. Oh, another thing to consider. Depending on how you are viewing this text, you might want to use a different end of line character. Windows expects "\r\n", while Unix just expects "\n". If you are transferring the file in binary mode FTP or something weird, then your new lines won't display.
  9. OK then. You will have to change it like this: mysql_connect("localhost", "username", "password") or die(mysql_error()); mysql_select_db("database") or die(mysql_error()); $uid = $_GET['ID']; $counter = 1; $frm = 1; while ( $frm <= 18 ) { ${"bq" . $frm} = $_POST["bq" . $frm ]; $frm = $frm + 1; } while ( $counter <= 18 ) { mysql_query("UPDATE questions SET bq". $counter ." = '" . ${"bq" . $counter} . "' WHERE ID = 'uid'"); $counter = $counter + 1; }
  10. What sort of thing is in $vars, and what is in $xchange? In the code above, the latter is just an empty array so the inner foreach loop will never happen.
  11. "$bq" . $frm . " = $_POST[bq" . $frm . "]" This line doesn't make sense. It's just a long string concatenation, and some of your PHP code is inside the string. I can't work out what that line is supposed to do, but if you explain it maybe I can tell you how it should be. As you can see from the syntax highlighting, the assignment is inside the string. Also it doesn't end in a semicolon. If you were planning on setting $bq18, $bq17 etc, and then accessing them, then that code won't work. It would have to use variable variables. What you have on the left of your assignment is just a string concatenation, not a variable to assign to. But that is a messy way of doing it, you'd be better with an array.
  12. I don't know how to do exactly what you asked. One thing you could do is write: The keeper falls backwards, and somehow the ball hits the base of %s feet, preventing catastrophe. The right defender takes the ball under control, and moves off. And then $commentary = sprintf($commentary, $sex_possessive_single); You can have as many %s (strings) or other things like %d for when an integer is expected, then just list them afterwards as parameters to sprintf() or printf(). So long as they are in the same order. Or you can do a str_replace() $commentary = str_replace("\$sex_possessive_single", $sex_possessive_single, $commentary); Trouble with that is you have to write it for every different variable.
  13. After looking at the problem, I don't actually see the point of calling wget in a PHP script. It will halt execution while waiting for it to return, which means you still time out after 30 seconds. If you prevent it from halting execution, then you don't know when the download has finished. If your script waits for it to finish then you are going to time out again. So you need a second script to get at the file that you used wget on. I believe the original suggestion - the very first reply - was to use wget yourself in a shell, not to use wget in PHP. Then use FTP or scp, and no need to write a script when these tools do exactly that already. But I don't understand the point of this. It sounds like a proxy server.
  14. Uhm target_url was an example, did you even read the man page that gizmola posted. Replace target_url with the actual URL, don't leave it in the command. wget http://thesite.com/files/brochure1.zip And if you'd done half as much Googling as you claim, and less bumping, you'd know that.
  15. I think you should set up a cron job on your server. Is it Linux and can you SSH to it? Edit: I may have misunderstood what you want to do... I thought you wanted to schedule when your script should run, such as a backup script. But maybe you wanted to limit the times when someone can access a PHP script. If you could clarify...
×
×
  • 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.