Jump to content

waiwai933

Members
  • Posts

    36
  • Joined

  • Last visited

Everything posted by waiwai933

  1. Is it true that POSIX is being phased out and replaced by PCRE? If so, when will POSIX disappear completely from PHP?
  2. Well, it's possible and not possible. First though, your code would better be off with <?php if (!isset($error['name']) && !isset($error['email']) && !isset($error['password']) && !isset($error['accept'])) { echo ("<input name=\"submit\" type=\"submit\" onClick=\"document.contactForm.action='response.php';\" value=\"Submit\">"); } ?> The problem with your existing code was that it didn't pass anything through the brackets, which are the "then" part of "if..then..else". However, if you want it to update every moment, (this script only changes on page refresh, which might still break the script) then you should try Javascript.
  3. Ok, I've done some more fiddling with this, and I think this may be a database problem. It fixes itself when I delete the last character from the database, save, and re-add the last character, saving of course. Is this just a lucky correlation, or should I ask for this to be moved to the MySQL forum?
  4. HTML 5 is still under development. However, because many of the tags will remain the same, current browsers should be able to do a pretty good job of rendering HTML 5, although there may be problems that occur.
  5. Hi, For some reason, my code is attaching to one of the cookies it's setting and not the other, which makes it somewhat easier to diagnose, but I can't do it, partially because I've been working with the code for 2 hours and it feels fine. Here's a quick explanation of the code below: $serversecuritycode is fetched from the user , $safeusername is the username submitted through a form and taken through mysql_real_escape_string. When it's setting the cookies, the $serversecuritycode (the securitycode cookie) gets the %0D%0A attached. The username one stays fine. Here's the relevant code: if (!isset($_POST["username"]) || !isset($_POST["password"])) { $displayform=1; } else { $safeusername=mysql_real_escape_string($_POST["username"]); $safepassword=mysql_real_escape_string($_POST["password"]); $serverpassword = mysql_query("SELECT `password` FROM `users` WHERE username = \"{$safeusername}\""); $serversecuritycode = mysql_query("SELECT `securitycode` FROM `users` WHERE username = \"{$safeusername}\""); if(mysql_num_rows($serversecuritycode)==0) { $displayincorrect=1; } else { if($safepassword==mysql_result($serverpassword,0,0)) { // *** COOKIE AREA *** $serversecuritycode = mysql_result($serversecuritycode,0,0); setcookie("securitycode", $serversecuritycode, time()+63072000); /* Expires in 2 years */ setcookie("username", $safeusername, time()+63072000); $success=1; } else { $displayincorrect=1; } } } Another weird thing: At the part where I put the ***COOKIE AREA***, I used to have the following for debug purposes: echo ("$serversecuritycode"); For some reason, it never spat out a header error, which it has done before. Can anyone explain why?
  6. Ah, thank you. That explains why it only outputs an error when all the terms are 0. Is there a way to hide that warning since it's what I want to happen?
  7. Ok, that helps. Just two questions: 1. What does as $key =>$value do? I looked it up in the manual but couldn't make heads or tails of it. 2. When I use the code, it also outputs the following warning: Invalid argument supplied for foreach() in /directory/example.php on line 109 . How should I fix this? (Line 109 is the line that has the foreach)
  8. I'm sorry, I'm completely confused over that code. Could you add a couple of comments in there just so that I can learn what you're doing?
  9. Well, I don't want to know where a value is zero. I just want to know if a value is zero.
  10. Hi there. I have an array that I want to step through, and check if anything is equal to 1. If it is, then another variable is set to 0, otherwise if everything is 0, the variable is set to 1. Would the following code work? <?php $testnumber=0; while ($testnumber<9) { if($fail[$testnumber]==0) { $anothernumber++; } $testnumber++; } if($anothernumber>0) { $thirdnumber=0; } else { $thirdnumber=1; }
  11. Could someone please help? I've tried to use array_shift, but that doesn't seem to work. Maybe I'm using it wrong?
  12. I see. What if I just want to strip the first two lines? Would I use the existing query, and then just start with $lines[3] and on? If so, how would I make it go on forever, or at least until there are no more lines?
  13. What's the text that you're getting? Is it code or English?
  14. Ok, thank you. That's that headache. Now, for the second piece of code, is it possible to strip just the first two lines instead of the whole thing? And what does the $_POST['newd'] supposed to be?
  15. I see, sort of. How would I call a specific number of an array?
  16. So I can't get it to just take the first two lines? Then how should I do it if I want the get the first line into a variable, and the second line into another variable, and so on? Preferably without the so on.
  17. Thank you so much. I just have a question regarding the first part. How do I get it so that it only takes X number of lines?
  18. How do I open a file using HTTP in PHP, of course, and get just the first two lines. This would be a txt file. Then, how would I open the same file in FTP, and delete the first two lines? Thanks.
  19. I see. That makes much sense. So why do we sometimes use '{$variable}' and other times we use `$variable` in MySQL?
  20. Hi everyone. What are the differences between the three types of quotes? (ie. ', ", `) Is there perhaps an online manual for these sort of simple questions?
  21. How do you write a script that takes however many number of spaces, and simplifies it to become one space?
  22. Actually Corbin, your rewriting it made it make sense. Thanks. Actually, I'm new to both PHP and MySQL. I have just one question. What does the second line, the one that says $unames = mysql_real_escape_slashes($username); What does that line do? I can't find that command on Google.
×
×
  • 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.