Jump to content

gausie

Members
  • Posts

    40
  • Joined

  • Last visited

    Never

Everything posted by gausie

  1. Thanks for the reply! It's not possible you can put that in terms of ereg(), or can i copy the regex straight over? It's just that, I am using a system that has already been built around using ereg in this specific place. Thanks again Gausie
  2. Now this seems like something that would be useful in regex, so theres no doubt I'm missing something here, but I want to match something that isn't the word "hiya", within a sentence, but you cant use ([^hiya]) because that doesnt letter h, i, y or a be used. How do i tell it only the whole word should be not allowed? Sam
  3. How can PHP tell me if a remote directory exists. I know how to detect a file, just file_get_contents and see if there's an error, but how would I detect a folder? Thanks Gausie
  4. Hi everyone! When you go back to a page that you have "POST" ed variables (from a form) to, it asks you whether you want to refresh the page. Is there way to stop it asking? Any way at all would be great! Thanks in advance Gausie
  5. Right. In Mozilla - what does "deprecated arguments usage" mean? The lines of code are at the beginning of defining a function (SetCookie): [quote]var argv = SetCookie.arguments; var argc = SetCookie.arguments.length;[/quote] Any help? Thanks Gausie
  6. Hi! I'm getting the following error on page load [quote]Line: 1 Char: 42 Error: Expected ')'[/quote] Perhaps the most troubling thing is that my "Line 1" is "<html>"! Thanks Gausie
  7. Hi everyone Here is the script I've made - working in Firefox but not in IE. Any suggestions? [code]<form onsubmit="return false;" name="region_form"> <select name="region_select" style="width: 90%;" onchange="regionListChange();"> <option>England</option> <option>N. Ireland</option> <option>Scotland</option> <option>Wales</option> <option>R. O. I.</option> </select> </form> <div id="region_list"></div>[/code] and here is the regionListChange command... [code]function regionListChange(){ var england="<table class=\"region_list_table\"><tr><td colspan=\"2\" align=\"center\">All areas</td></tr><tr><td>Birmingham</td><td>Bournemouth</td></tr><tr><td>Bradford</td><td>Brighton</td></tr><tr><td>Bristol</td><td>Cambridge</td></tr><tr><td>Coventry</td><td>Derby</td></tr><tr><td>Exeter</td><td>Guildford</td></tr><tr><td>Hull</td><td>Ipswich</td></tr><tr><td>Kent</td><td>Leeds</td></tr><tr><td>Leicester</td><td>Liverpool</td></tr><tr><td>Luton</td><td>London</td></tr><tr><td>Manchester</td><td>Middlesbrough</td></tr><tr><td>Newcastle</td><td>Norwich</td></tr><tr><td>Nottingham</td><td>Oxford</td></tr><tr><td>Plymouth</td><td>Portsmouth</td></tr><tr><td>Reading</td><td>Sheffield</td></tr><tr><td>Southampton</td><td>Southend</td></tr><tr><td>Stoke</td><td>York</td></tr></table>"; var nireland="<table class=\"region_list_table\"><tr><td colspan=\"2\" align=\"center\">All areas</td></tr><tr><td>Belfast</td><td>&nbsp;</td></tr></table>"; var scotland="<table class=\"region_list_table\"><tr><td colspan=\"2\" align=\"center\">All areas</td></tr><tr><td>Aberdeen</td><td>Dundee</td></tr><tr><td>Edinburgh</td><td>Glasgow</td></tr><tr><td>Inverness</td><td></td></tr></table>"; var wales="<table class=\"region_list_table\"><tr><td colspan=\"2\" align=\"center\">All areas</td></tr><tr><td>Cardiff</td><td>Swansea</td></tr></table>"; var roi="<table class=\"region_list_table\"><tr><td colspan=\"2\" align=\"center\">All areas</td></tr><tr><td>Cork</td><td>Dublin</td></tr></table>"; switch(document.region_form.region_select.value){ case "England": document.getElementById("region_list").innerHTML = england; break; case "N. Ireland": document.getElementById("region_list").innerHTML = nireland; break; case "Scotland": document.getElementById("region_list").innerHTML = scotland; break; case "Wales": document.getElementById("region_list").innerHTML = wales; break; case "R. O. I.": document.getElementById("region_list").innerHTML = roi; break; } }[/code] Thanks Gausie
  8. Ok I did it using session_id() instead of $PHPSESSID Thanks everyone! Sam
  9. $PHPSESSID is an empty variable... I end up with the link [b]index.php?lo=t&v=[/b] with nothing afterwards! Thanks Sam
  10. Ok Well to log out, you click on a link that brings you to "[b]index.php?lo=t[/b]" The website has areas where users can have their own customised HTML Somone could easily put a link like this "[b]<a href="index.php?lo=t">Click here to go to my webpage</a>[/b]", but this link would instead log the viewer out. How can I verify that the "Log Out" button is being pressed only from where I want it to be pressed?
  11. Hi blackerutuf You have to send the email as HTML, and then specify images etc. within the HTML. www.php.net says... [code]<?php // multiple recipients $to  = 'aidan@example.com' . ', '; // note the comma $to .= 'wez@example.com'; // subject $subject = 'Birthday Reminders for August'; // message $message = ' <html> <head>   <title>Birthday Reminders for August</title> </head> <body>   <p>Here are the birthdays upcoming in August!</p>   <table>   <tr>     <th>Person</th><th>Day</th><th>Month</th><th>Year</th>   </tr>   <tr>     <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>   </tr>   <tr>     <td>Sally</td><td>17th</td><td>August</td><td>1973</td>   </tr>   </table> </body> </html> '; // To send HTML mail, the Content-type header must be set $headers  = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n"; $headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n"; $headers .= 'Cc: birthdayarchive@example.com' . "\r\n"; $headers .= 'Bcc: birthdaycheck@example.com' . "\r\n"; // Mail it mail($to, $subject, $message, $headers); ?> [/code] The important bits there are that you should include [quote]$headers  = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";[/quote] within your headers and also lay out the email as a html page Hope that helps Sam
  12. Hi everyone! Great to be back - haven't visited for quite some time - and I return with a question! To log out of my script, you send "lo=t" to a page. However, the website I am making allows user-customisable scripts, and so anyone feeling particularly vandalous might make a "fake" link that logs the visiting user out. How can I verify that the link was from the correct area? I have the feeling I could make use of the SID but I don't know how! Thanks Sam
  13. Thanks everyone! Looking at all your input, I'm thinking of maybe setting a cookie with a timestamp? If the spammers are determined enough to then clear cookies before each post, I'll make a table with IP against timestamp. Thanks again Sam
  14. I'm having a bit of trouble. I made a website for the birth of my baby cousin and made my own guestbook for it. [url=http://www.anouskat.com]http://www.anouskat.com[/url]. However, the guesbook is being flooded with spam. I've tried to filter out words but it doesn't help because there is some spamming with no words I can pick up safely. Can someone help me with an antispam script? Here is the "add a guestbook entry" script that I wrote (a long time ago): [code]<?php ob_start(); function validemail($email) {   if(eregi("^[a-z0-9._-]+@+[a-z0-9._-]+.+[a-z]{2,3}$", $email)) return TRUE;   else return FALSE; } if(!isset($_REQUEST['name'])){ header("Location: guestbook.php"); exit(); } if((empty($_REQUEST['name'])) || (empty($_REQUEST['email'])) || (empty($_REQUEST['comment']))){ header("Location: guestbook.php?error=empty"); exit(); } if(!validemail($_REQUEST['email'])){ header("Location: guestbook.php?error=email"); exit(); } $name = $_REQUEST['name']; $email = $_REQUEST['email']; $timeout = 60 * 60 * 24 * 30; if($_REQUEST['remember']=="on"){ setcookie("anouskaname", "$name", time()+$timeout); setcookie("anouskaemail", "$email", time()+$timeout); }else{ if(isset($_COOKIE['anouskaname'])){ setcookie("anouskaname", "", time()-$timeout); setcookie("anouskaemail", "", time()-$timeout); } } if(eregi("viagra|cialis|anal|mortgage|levitra|fuck|shit|cunt|pussy|casino|vagina|drug|forex|tramadol|carisprodol|gambling|lesbian|porn|sexy|hentai|cock|voyeur|threesome|amateur|phentermine|cheap|passport", $_REQUEST[comment])){ die("INAPPROPRIATE COMMENT"); } $time = time(); include_once('db.inc.php'); mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query = "INSERT INTO anouskat VALUES ('','$name','$email','$_REQUEST[comment]','$_REQUEST[commenton]','$time','$_SERVER[REMOTE_ADDR]','')"; mysql_query($query); mysql_close(); header("Location: guestbook.php"); ?>[/code] Please someone help. Perhaps a new post every 24 hours or something? Thanks Sam
×
×
  • 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.