mushfik Posted February 3, 2015 Share Posted February 3, 2015 Can Someone please look at the following zip file and edit index and code-gen so when someone refer required amount of visitors, php echo will redirect them to complete.php I have got css and js but not uploading as they are too big Thanks (please help me) script.zip Quote Link to comment Share on other sites More sharing options...
QuickOldCar Posted February 3, 2015 Share Posted February 3, 2015 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> Quote Link to comment Share on other sites More sharing options...
scootstah Posted February 3, 2015 Share Posted February 3, 2015 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. 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.