AyKay47
-
Posts
3,281 -
Joined
-
Last visited
-
Days Won
1
Posts posted by AyKay47
-
-
Not the best of solutions, as now the bots doesn't even have to guess: They can just read the correct answer from the HTML code directly...
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 }
-
Depending on your response to psycho's questions, regular expressions may be an answer.
-
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.
-
-
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.
-
Talk about not reading the post...
-
Code is run from top to bottom. You're checking if a password and username have been set and telling it to echo that before anyone gets a chance to enter any data.
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?
-
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 } }
-
Post what you have tried so far.
-
Fuck off, write it yourself!
Sums it up nicely.
-
You are treating $result as if it were an object, when in fact its a mysql resource.
-
Got it figured out! thanks it was a small mistake in my codes. sorry to trouble you guys. Thank you!
Great, what was the issue?
-
That's exactly what the OP did in the very first post.
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
-
Debug the query using mysql_error
-
double check that the directives are being set correctly by running phpinfo()
-
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())
-
I did forget about that, my apologies.
-
<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'
-
add Parentheses () to tell sql how to evaluate it...
$instclasses = mysql_query("SELECT * FROM people where pid='$doin[pid]' OR (cpid='$doin[pid]' AND pid='$_POST[cpid]') OR cpid='$_POST[cpid]'");
not sure if this is your intent, but you get the idea of using the "()" to control the grouping
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.
-
Can you post your db table structure. I also don't quite understand your issue.
-
Is the query returning expected results?
-
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.
-
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.
-
This code seamlessly does nothing, $fd is being overwritten every iteration and nothing is accomplished. So what is the goal here?
Is This Right $Act==Del?
in PHP Coding Help
Posted
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.