/    Sign up×
Community /Pin to ProfileBookmark

What to do to make this PHP code do what I want

Hi,

I’m not a programmer or coder toany extent and just trying to understand what this part of PHP code is doing and how to make it do what I want. My understanding is that the code will check “vercode” and see if it is empty or wrong value entry and then display “Incorrect verification code!” with a link “Click Here” to get back to the page.

What I want is that instead of displaying the “Incorrect verification code!” etc I want the code to take the user to “http://www.castironcookwaredepot.com/verification.html” which is formatted to look just like the rest of my website.

I do not know what the “(“location:http://www.castironcookwaredepot.com/verification.html“)” is doing in the code. Please let me know as what changes I need to make to get this working the way I want it to. Thanks much in advance and appreciate your help.

[code]session_start();
if ($_POST[“vercode”] != $_SESSION[“vercode”] OR $_SESSION[“vercode”]==”) {

$var = “<br /><br /><br /><br /><center><font face=’tahoma, verdana, arial, helvetica’ color=’#333333′><h2>$site_Name”;
$var.= “</h2><p><font size=’2′ face=’Arial, Helvetica, sans-serif’ color=’#FF0000′><strong>Incorrect verification code!</strong><br /><br /></font><font size=’2′ face=’Arial, Helvetica, sans-serif’><a href=’javascript:history.back();’> Click Here</a> to try again.</font></p><br /></center>”;
echo $var;
exit;
header (“location:http://www.castironcookwaredepot.com/verification.html”);[/code]

Thanks & Regards
Learner

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@DasherMar 15.2011 — Is this what you want?
[code=php]
session_start();
if ($_POST["vercode"] != $_SESSION["vercode"] OR $_SESSION["vercode"]=='') {

//$var = "<br /><br /><br /><br /><center><font face='tahoma, verdana, arial, helvetica' color='#333333'><h2>$site_Name";
//$var.= "</h2><p><font size='2' face='Arial, Helvetica, sans-serif' color='#FF0000'><strong>Incorrect verification code!</strong><br /><br /></font><font size='2' face='Arial, Helvetica, sans-serif'><a href='javascript:history.back();'> Click Here</a> to try again.</font></p><br /></center>";
//echo $var;
//exit();
header ("location:http://www.castironcookwaredepot.com/verification.html");
}
// if okay continue on this page.
[/code]
Copy linkTweet thisAlerts:
@Matt_DMar 16.2011 — Headers need to be sent before any other content to a clients browser.

What [I]Dasher[/I] suggests is correct. But you will not be able to show the text and then redirect the user.

The redirect with text will need to be coded into the page you wish to display
Copy linkTweet thisAlerts:
@learner99authorMar 17.2011 — Thanks much and I have tested this whole of yesterday but I was running into the same old issue I had before that the "vercode" was not being validated. This "Vercode" is for Captcha code on the form at http://www.castironcookwaredepot.com/tellafriend.html

Rest of the form is being validated like email/name etc but skipping the captcha code and allowing the form to get submitted.

Any help would be greatly appreciated. Thanks much again.

Regards

Learner
Copy linkTweet thisAlerts:
@DasherMar 17.2011 — Your form is being submitted to "http://s.p8.hostingprod.com/@castironcookwaredepot.com/php/tellafriend.php" and not to "http://www.castironcookwaredepot.com/tellafriend.html" so I expect you never see the POST data in the current page.




"You code will do exactly what it is told to do, not what you want it to do."
Copy linkTweet thisAlerts:
@learner99authorMar 17.2011 — Dasher, Thanks but it went over my head. Could you please tell me as what is that I need to do to make it work. I'm just trying to replicate the same exact code which is working on my other website http://www.bestsafetyapparel.com/tellafriend.html onto my new website page http://www.castironcookwaredepot.com/tellafriend.html

Thanks

Learner
×

Success!

Help @learner99 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...