fribse Posted September 15, 2009 Share Posted September 15, 2009 Hi guys I have squidguard running here blocking malicious websites and commercials, and it works like a charm. I would like to improve my 'site blocked' page that I've written. Currently it contains a 'mailto' link that sends a 'please open' mail with the URL that is blocked and in what category the block was. I would like to have php send the page, without the user having to invoke his own client, so I've written a page that should do this, and with a bit of help it got better, but it doesn't send a mail. I hope somebody can help me out. <?php $url = $_GET['url']; $group = $_GET['group']; $message = "Page blocked was $url <br> Group $group <br>"; $from = $_ENV['USER']; if (isset($_POST["submit"])) { mail('postmaster@lokal', 'Open this page, please!', 'Page that was blocked was $url \n Group was $group' , 'From: $from'); $message = "Your mail was sent"; } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title> Page blocked </title> </head> <body style="color: rgb(0, 0, 0); background-color: #dd5757;" alink="#00cccc" link="#0000ee" vlink="#551a8b"> <br /> <h1 style="text-align: center; background-color: #dd5757;"> <big> SPÆRRET </big> </h1> <div style="text-align: center; background-color: #dd5757;"> <br /> Page is blocked.<br /> If this is incorrect, please click below to ask for it to be opened.<br /> <br /> <br /> <img src="http://intranet/rotate_stop_sign_small.gif" alt="Stop Sign" /> <br /><br /> <br /><br /> <form action="<?php echo $_SERVER['PHP_SELF']; ?>"> <?php echo $message ; ?> <input type="image" src="http://intranet/rotate_open_sign.gif" value="Open page" name="submit" /> </form> </div> </body> </html> Quote Link to comment Share on other sites More sharing options...
Bricktop Posted September 15, 2009 Share Posted September 15, 2009 Hi fribse, Is "postmaster@lokal" a working email address? Also, I notice you are using the \n newline character in the email message, this can only be used when the text is enclosed in speechmarks "". It might be worth changing your code to read: mail("postmaster@lokal", "Open this page, please!", "Page that was blocked was $url \n Group was $group", "From: $from"); If you are receiving an error message post it so we can assist further. Thanks Quote Link to comment Share on other sites More sharing options...
fribse Posted September 15, 2009 Author Share Posted September 15, 2009 Hi fribse, Is "postmaster@lokal" a working email address? Hi Bricktop Thankyou for helping out. Well "the names have been changed to protect the innocent", so yes, it's a working e-mailaddress. Also, I notice you are using the \n newline character in the email message, this can only be used when the text is enclosed in speechmarks "". It might be worth changing your code to read: mail("postmaster@lokal", "Open this page, please!", "Page that was blocked was $url \n Group was $group", "From: $from"); I'll try and change it... didn't change anything If you are receiving an error message post it so we can assist further. Thanks No error as such, the text on the screen changes Page blocked was $url/blocked.php?submit.x=64 And the page title changes to include '?submit.x=64' 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.