
MDCode
Members-
Posts
640 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MDCode
-
You are going to have to provide more information. In which way are you trying to make it not apply?
-
if(isset($_POST['link'])){ if(!empty($_SESSION['ok'])){ echo "sorry you have already voted"; } mysql_query("UPDATE `mariolink` SET `link` = `link`+1"); session_start(); $_SESSION['ok'] = 1; You're checking if it's empty and echoing if it isn't. But if it is you aren't preventing it. Use an else { there if(!empty()) { } else { }
-
That error doesn't really matter. But you need to set the session first in the first code block I posted.
-
$_SESSION variables are variables, defined by your site. It is used in every php based login system to define all information about a user. To set a session variables you can do: <?php $_SESSION['username'] = asdf; ?> When used as: <?php // This command (session_start() should be the very first line of your document (after <?php of course), and should not be after any html session_start(); echo "Hello ".$_SESSION['username']."! "; ?> Will display: Hello asdf!
-
This is an html issue, not a php issue. Use onclick or onchange
-
Which Page To Insert From? (Account Validation)
MDCode replied to justlukeyou's topic in Application Design
When registering the user, insert the uniqid string into a table filled with verification links. Email the link to the user activate.php?link=link Using $_GET extract the link the user put, if any. Select from the table to see if it matches any, if it does, delete it and activate the user. -
Either storing in a file or database, you get the same result. Using the same amount of data in each.
-
That makes absolutely no sense. <?php // connection stuff $sql = mysql_query("SELECT * FROM `Votes`"); $row = mysql_fetch_assoc($sql); $zelda = $row['zelda']; $mario = $row['mario']; if(isset($_POST['zelda'])){ $zelda++; $sql = mysql_query("UPDATE `Votes` SET `zelda` = '$zelda'"); echo "Voted for zelda successfully!"; } if(isset($_POST['mario'])){ $mario++; $sql = mysql_query("UPDATE `Votes` SET `mario` = '$mario'"); echo "Voted for mario successfully!"; } ?> <html> <head></head> <body> <form action="" method="post"> <?php echo "Zelda has" . $zelda . "Votes"; ?> <br> <?php echo "Mario has " . $mario . "Votes"; ?> <br><br> <input type="submit" name="mario" value="Vote in Mario!"> <br><br> <input type="submit" name="zelda" value="Vote in Zelda!"> </form> </body> </html>
-
Please post the code here if you expect anyone to help. Not many people will download attachments due to security concerns.
-
Clearing Password Fields On Any Refresh Attempt
MDCode replied to TheNavigator's topic in Javascript Help
What do you mean by reveal? Are you using a input type of text instead of password? Anyone can edit your html with add-ons to browsers -
Clearing Password Fields On Any Refresh Attempt
MDCode replied to TheNavigator's topic in Javascript Help
It's not too clear as to what you want but you can try: <!-- Submitting form --> <form onsubmit="document.getElementByName('name of whatever field').value = ''"></form> <!-- Clicking button (Also works on links) --> <input type="button" onclick="document.getElementByName('name of whatever field').value = ''" /> -
Right from your source code <div id="left-header"> /* <img src="images/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"> */ <img class="float-left" src="Pictures_Other/sarcm_logo.png" alt="new picture" border="0" width="240" height="150" /> </div> /* */ is not an html comment (<!-- --> is) and is making the first thing the user see is a random square next to your banner. I'm not too sure what the random picture of an airplane in the bottom left of the page is doing? Does it serve a purpose? Your member's area doesn't work btw.
-
$_SESSION variables are set until the user "logs out." It will be available on every page of your site.
-
if($_SERVER['REQUEST_METHOD'] === "POST") { This would work better since IE has problems with submitting.
-
Which Page To Insert From? (Account Validation)
MDCode replied to justlukeyou's topic in Application Design
Just use uniqid() -
Php can not change URL content. I'm not even sure that htaccess will work in this case since I'm assuming you want to use the email located in the URL
-
Displaying Data Help - Rows Displayed Are Being Skipped
MDCode replied to Samza's topic in PHP Coding Help
Php was made that way. I don't know as to what the reason was. -
Warning: Creating Default Object From Empty Value
MDCode replied to dgowrie's topic in Third Party Scripts
It's doubtful that anyone will download a file attachment. Please post the code on here instead. -
Displaying Data Help - Rows Displayed Are Being Skipped
MDCode replied to Samza's topic in PHP Coding Help
What is this supposed to mean? It will only show even some of the times odd some other? Please explain in depth. Single quoted variables do not get parsed. Change the apostrophe of that echo to a quote. -
Validate The Form Using Recaptcha, On Success Post Data To New Form
MDCode replied to yesvee's topic in PHP Coding Help
It is not easy starting off if you have little experience in other languages. All you need is practice -
Validate The Form Using Recaptcha, On Success Post Data To New Form
MDCode replied to yesvee's topic in PHP Coding Help
Creating the SESSION is a bad idea because you're basically logging the user in without even validating them (unless you unset all variables at the end). Please post AccountCreation.php I'm sure it is not that complex. -
Validate The Form Using Recaptcha, On Success Post Data To New Form
MDCode replied to yesvee's topic in PHP Coding Help
If you header, it is not possible. Try using a function, that way you can stay on the same page, and use the code in your AccountCreation.php // Get a key from https://www.google.com/recaptcha/admin/create $publickey = "xxxxxxxxxxxxxx"; $privatekey = "xxxxxxxxxxxxx"; # the response from reCAPTCHA $resp = null; # the error code from reCAPTCHA, if any $error = null; # was there a reCAPTCHA response? if(isset($_POST["recaptcha_response_field"])) { $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if ($resp->is_valid) { // if by function RegisterUser(Your 20 variables each separated by a comma); } else { # set the error code so that we can display it $error = $resp->error; echo "Error captcha incorrect"; } } -
mysql_query does not do anything but execute the query. If you wish to display anything I suggest look into mysql_fetch_assoc, mysql_result, mysql_fetch_array, and echo.
- 1 reply
-
- i have a problem with my sql
- stuck sumwhere
- (and 2 more)
-
If that method is not working (which it should), why not just use: if(empty($field01) && empty($field02)) { echo '<p class="error">Please enter at least one field</p>'; } else { // whatever }
-
Validate The Form Using Recaptcha, On Success Post Data To New Form
MDCode replied to yesvee's topic in PHP Coding Help
The reCaptcha is made the way it is for a reason. What you are doing should work. If you mean you want the data from the form, to be submitted to the page after the header, you need to add variables to the URL Header("Location: http://mydomain.com/AccountCreation.php?user=blah&name=blahblah&yea=totally"); die;