Jump to content

Php echo is not redirecting


mushfik

Recommended Posts

That is such a mess, I'm sorry but it is.

 

spaghetti php and html code all over (should make all the processing logic by itself and output results into html afterwards)

enormous amount of js added (whatever they all do who knows but would make one heavy site to visit)

ip's change so is no reliable way to know the ip, plus allowing forwarded ones, should use user accounts instead and a few checks (still no guarantee but is better)

not everyone has a static ip, if their ip changes they will either not get credit or someone else will if happen to get the same ip (using a users based system is better to keep track of them)

mysql_* is deprecated

using unescaped $_GET values into mysql queries, use mysql_real_escape_string()

are suppressing all errors with @, instead should add error reporting or errors within code and be taking advantage of it

 

 

Anyway, I would ordinarily say to use a header() redirect in the code, but you output html before can call on it

 

You might as well add even more javascript at around line 130 in index.php

<?php echo '<a href="complete.php">Click here to continue is your prize</a>';
?>

<script type="text/JavaScript">
window.location = "http://your-site.com/complete.php"
</script>

or a timed one if want them to see that message

<script type="text/JavaScript">
setTimeout("location.href = 'http://your-site.com/complete.php';",5000);
</script>
Link to comment
Share on other sites

Yikes.

 

I agree with QOC, adding that Javascript is probably the most painless way to handle it. About the sending HTML before headers, well, you could always wrap your output in an output buffer, which will allow all of the PHP to execute before any output is sent. It's an ugly way to do it but it's definitely the least of his problems.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.