Jarppi Posted October 22, 2008 Share Posted October 22, 2008 Can anyone help me with this problem. After the validation is true, to make it go directly url address. How can I put php to do that ? Here is the code: <?php } else { include("action.php"); $img = new action(); $valid = $img->check($_POST['code']); if($valid == true) { what to put here to go directly to url after true value ; } else { echo "<center>Wrong code. Type new code, please. <p><a href=\"javascript:history.go(-1)\">Try again.</a></center>"; } } Quote Link to comment Share on other sites More sharing options...
.josh Posted October 22, 2008 Share Posted October 22, 2008 header("Location: http://www.blah.com"); Quote Link to comment Share on other sites More sharing options...
Jarppi Posted October 22, 2008 Author Share Posted October 22, 2008 :-\ I tryed that, but it did not help ? Some how it just stays on the same page where fill that value and not go to that location http address. Any other ideas ? I put it like this: if($valid == true) { header("Location: http://www.blah.com"); } else { Quote Link to comment Share on other sites More sharing options...
DarkWater Posted October 22, 2008 Share Posted October 22, 2008 We'd need to see the whole script. It's most likely that you're outputting something before the call to header(). Add the following lines to the TOP of your script: ini_set('display_errors', 1); error_reporting(E_ALL); Show us any new errors. Quote Link to comment Share on other sites More sharing options...
Jarppi Posted October 22, 2008 Author Share Posted October 22, 2008 Here the whole code. <?php session_start(); ?> <html> <head> <title>MMAF - Modified Motorcycle Association of Finland</title> </head> <body> <CENTER> <P> Ole hyvä ja kirjoita kuvavarmenne ennen kuin pääset täyttämään MMAF:n jäsenhakemusta. <P> Tämän olemme joutuneet tekemään estääksemme mahdolliset hakkerien hyökkäykset ja "spämbottien" toiminta. <P> <?php if (empty($_POST)) { ?> <form method="POST"> <img src="securimage_show.php?sid=<?php echo md5(uniqid(time())); ?>"><br /> <input type="text" name="code" /><br /> <input type="submit" value="Lähetä" /> </form> <?php } else { include("securimage.php"); $img = new Securimage(); $valid = $img->check($_POST['code']); if($valid == true) { header("Location: http://www.mmaf.fi"); } else { echo "<center>Antamasi kuvavarmenne teksti on väärin. <p><a href=\"javascript:history.go(-1)\">Yritä uudelleen.</a></center>"; } } ?> <A href="http://www.mmaf.fi/">Tästä pääset takaisin MMAF:n etusivulle.</A> </body> </html> Quote Link to comment Share on other sites More sharing options...
.josh Posted October 22, 2008 Share Posted October 22, 2008 Yep. You've got output before the header call, and probably have error reporting turned off so it's not screaming at you. Look into ob_start() for a bandaid fix or rethink your script to not have output before a header call for a better solution. Quote Link to comment Share on other sites More sharing options...
Jarppi Posted October 22, 2008 Author Share Posted October 22, 2008 I´m so dumb ass with php that I don't know what to do and how to do fix this. And I don't know how to put output before header call in this script... What is output part of this script ? Quote Link to comment Share on other sites More sharing options...
.josh Posted October 22, 2008 Share Posted October 22, 2008 Anything that generates text. Including extra blank lines and spaces. Quote Link to comment Share on other sites More sharing options...
neromir Posted October 22, 2008 Share Posted October 22, 2008 Anything outside the <?php ?> tags is automatically output. So, if you even have something like this: <?php // header call here ?> It's still invalid because you have a blank line before the start of the php tag that is sent to the browser as output. Quote Link to comment Share on other sites More sharing options...
Jarppi Posted October 23, 2008 Author Share Posted October 23, 2008 I just don't get it ??? What is causing this... This is the error text: Warning: Cannot modify header information - headers already sent by (output started at /var/www/users/mmaf/www.mmaf.fi/html/kuvavarmenne/varmenne_url.php:17) in /var/www/users/mmaf/www.mmaf.fi/html/kuvavarmenne/varmenne_url.php on line 32 Quote Link to comment Share on other sites More sharing options...
.josh Posted October 23, 2008 Share Posted October 23, 2008 Anything that generates text. Including extra blank lines and spaces. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.