Jump to content

AyKay47

Members
  • Posts

    3,281
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by AyKay47

  1. 1. Check that $_REQUEST['id'] is set and is an integer before using it, right now your code is open to SQL injection. 2. Where is $act coming from? 3. del is assumed to be a constant value without the value wrapped in quotes.
  2. Nonsense. Using both a hidden input and a session is a bit of overkill here. Storing the value in a session will be fine. <?php session_start(); // create an anti-spam calculation to be answered $first_num = rand(1, 3); $second_num = rand(1, 3); $multiplier = rand(2,3); if($_SERVER['REQUEST_METHOD'] == 'POST') { if($_POST['user_answer'] !== $_SESSION['actual_answer']) { echo "You didn't answer the anti-spam calculation correctly."; } else { echo "Correct!"; } } else { $_SESSION['actual_answer'] = ($first_num + $second_num) * $multiplier; ?> <form method='post' action=''> <?php echo "($first_num + $second_num) x $multiplier) = "; ?> <input type='text' name='user_answer' id='user_answer' /><br /><br /> <input type='submit' name='submit' value='go' /> </form> <?php }
  3. Depending on your response to psycho's questions, regular expressions may be an answer.
  4. Well both cannot be true which is my point. Either there is an error present or there isn't. I have to assume that it is something on the users part.
  5. The only thing I can think of for the code Pikachu posted is that there are 8 possible values for $_FILES[]['error'] and the OP has 7 in the switch. But even so, $error_msg should output the error value, the default switch value should output as well, something. That's what initially jumped out at me as well when reading the code.
  6. Talk about not reading the post...
  7. What? the OP has the error code inside of a condition that waits for the edit button to be clicked. davidolson, the code is doing exactly what you have coded it to do, what are you expecting it to do?
  8. num_rows is assumed a constant, you are after mysql_num_rows() The second error is being triggered because, again, you are using $result as if it is an object, it's not: if(mysql_num_rows($result) >= 2) { $email = 'mymail@gmail.com'; $subject = "LOW STOCK WARNING!"; $message = 'One or more products are running low:\r\n'; while($row = mysql_fetch_assoc($result)) { $message .= $row["product_id"] . "\r\n"; } if(mail($email, $subject, $message)) { //mail successfully sent } else { //mail unsuccessful } }
  9. Post what you have tried so far.
  10. Sums it up nicely.
  11. Great, what was the issue?
  12. Really? because I'm seeing output from a local php.ini file which I am not convinced is even in the right place to affect the script. OP, place phpinfo in your script and post the output for the directives post_max_size and upload_max_filesize
  13. Debug the query using mysql_error
  14. double check that the directives are being set correctly by running phpinfo()
  15. If you debug your code correctly, you will not need to ask us why something isn't working, error handling will tell you. You are treating $result as if it were an object, when in fact its a mysql resource. Edit: to simply answer the question above: $result = mysql_query() or die(mysql_error())
  16. I did forget about that, my apologies.
  17. <a href="/reports?next">Next</a> Unless you are using rewriteMod which I doubt, the above is an invalid URL and $_REQUEST['next'] will not contain anything. It needs to be something like href='reports.php?next=1'
  18. The OP is using () already in his second post. Also OP, we cannot tell you whether or not the query is correct for what you are trying to do without knowing what you are trying to do.
  19. Can you post your db table structure. I also don't quite understand your issue.
  20. Is the query returning expected results?
  21. You can either store the email and address of the current user in sessions as well, or you can query the database for the information.
  22. list() assigns the values from right to left, however the only time you actually need to worry about that is when you pass arrays with indices into the function. The OP is using list() correctly here. Refer to php.net Example#1. White_lily I ask what debugging steps you have taken because we need to know exactly where this code is failing. If you have "echoed all variables possible for values" then you should know where the code is failing. What is the value of $propicmargin? Add a condition to determine whether getimagesize() is working correctly: $size = getimagesize($propicmargin); if(!$size) { die("Could not find the size of file:<br />" . $propicmargin); } If the above code passes, $width and $height will be assigned values.
  23. This code seamlessly does nothing, $fd is being overwritten every iteration and nothing is accomplished. So what is the goal here?
×
×
  • 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.