jamesclues Posted July 25, 2017 Share Posted July 25, 2017 Basically I have form that after submission i want it to goto http://report.domain.com/ domain.com user entered in the form this is where the domain is picked up from $website =($_POST['website']); // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"1;URL=http://report.domain.com/<$website>">"; } else{ print "<meta http-equiv=\"refresh\" content=\"1;URL=freereport.html\">"; } ?> </body> </html> please, can anyone help I have been searching on google for 3 hours unable to find a solution. Quote Link to comment Share on other sites More sharing options...
requinix Posted July 25, 2017 Share Posted July 25, 2017 If $website="domain.com" then "http://report.domain.com/"will be "http://report.domain.com/". If that's not it then you have to describe what's happening. We're not psychic. 1 Quote Link to comment Share on other sites More sharing options...
jamesclues Posted July 25, 2017 Author Share Posted July 25, 2017 (edited) I Basically when a user submits the form $website="domain.com" so i want the user redirected to http://reports.mydomain.com/domain.com The red is the domain.com from the form submitted print "<meta http-equiv=\"refresh\" content=\"1;URL=http://report.domain.com/<$website>">"; Where read at the top $website is where the form submitted domain will appear... I tried this code but i get error 500 server // send email$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"1;URL=http://report.domain.com/<?php echo $website ?>">"; } else{ print "<meta http-equiv=\"refresh\" content=\"1;URL=freereport.html\">"; } ?> Edited July 25, 2017 by jamesclues Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted July 25, 2017 Share Posted July 25, 2017 That still tells us exactly nothing about what – is – wrong. Why is it so hard to understand that we aren't sitting in front of your screen? Anyway, forget about it. This code should be rewritten from top to bottom, because the 90s are over. Replace the shady mail() stuff with a proper mail library like PHPMailer. Get rid of the stupid refresh. It's annoying and violates the accessibility guidelines. Do a redirect with the Location header. Stop injecting unfiltered values into the URL. Validate the input and make sure it is in fact a domain. Chances are this was just the tip of the iceberg, so don't expect it to be a quick fix. 1 Quote Link to comment Share on other sites More sharing options...
Solution jamesclues Posted July 25, 2017 Author Solution Share Posted July 25, 2017 I took your advice and changed the code it's working now header("Location: http://reports.domain.com/$website"); }else{ header("Location: report.html"); } exit; ?> 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.