Jump to content
xisto Community

rtester40

Members
  • Content Count

    3
  • Joined

  • Last visited

  1. This is another great PHP sight http://www.phpfreaks.com/ Richard
  2. I am doing the same type of thing for my PHP RPG im creating I found a very usefull PHP script on PHP freaks there is like 2 of them but Version 2 is the best the webpages is at http://www.phpfreaks.com/ the tutorial is @ http://forums.xisto.com/no_longer_exists/ I hope this is what you are looking for. Richard
  3. Hello I would like to say thank you for any help you might give me. I'm new to Apache / PHP and MySQL I have all them up and running propertly I think. I want to make a PHP online game and I need to set up an email server so I can have and authincation system. When the player creates an account I want the computer to email the player a link the have to click on to make there account active. I have a Comcast 8mbits broadband connection My server is running at http://forums.xisto.com/no_longer_exists/ My PHPinfo file is http://forums.xisto.com/no_longer_exists/phpinfo.php My FormMail File http://forums.xisto.com/no_longer_exists/formmail.php I have the PHP.inf file email stuff set up smtp.comcast.net port 25 I see nowhere in the php info file where to put in my username and password for the smtp server. but last time I tried to send email I accedently spammed my smtp server and they put a port 25 block on my modem they thought someone was using my account to spam mail people. I finally gotten the block off my modem and would like to try to set it up again but im a little afraid to try again because of what happened last time. This is the script Im using: <?php// Add as many Names/ Departments -- e-mail addresses as you want here$eMail[] = array( 'Information', 'richard.tester@gmail.com' );$eMail[] = array( 'Tech Support', 'richard.tester@gmail.com' );// CC sender?$ccSender = True;// Handle older versions of PHPif( ! isset( $_GET ) ) $_GET = &$HTTP_GET_VARS;if( ! isset( $_POST ) ) $_POST = &$HTTP_POST_VARS;if( ! isset( $_SERVER ) ) $_SERVER = &$HTTP_SERVER_VARS;?><HTML><HEAD><TITLE>Mail Me!</TITLE><?php if( ! isset( $_POST["EMail"] ) ) {?><script LANGUAGE="JavaScript"><!-- Beginfunction emailCheck (emailStr) {/* The following variable tells the rest of the function whether or notto verify that the address ends in a two-letter country or well-knownTLD. 1 means check it, 0 means don't. */var checkTLD=1;/* The following is the list of known TLDs that an e-mail address must end with. */var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;/* The following pattern is used to check if the entered e-mail addressfits the user@domain format. It also is used to separate the usernamefrom the domain. */var emailPat=/^(.+)@(.+)$/;/* The following string represents the pattern for matching all specialcharacters. We don't want to allow special characters in the address.These characters include ( ) < > @ , ; : \ " . [ ] */var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";/* The following string represents the range of characters allowed in ausername or domainname. It really states which chars aren't allowed.*/var validChars="\[^\\s" + specialChars + "\]";/* The following pattern applies if the "user" is a quoted string (inwhich case, there are no rules about which characters are allowedand which aren't; anything goes). E.g. "jiminy cricket"@disney.comis a legal e-mail address. */var quotedUser="(\"[^\"]*\")";/* The following pattern applies for domains that are IP addresses,rather than symbolic names. E.g. joe@[123.124.233.4] is a legale-mail address. NOTE: The square brackets are required. */var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;/* The following string represents an atom (basically a series of non-special characters.) */var atom=validChars + '+';/* The following string represents one word in the typical username.For example, in john.doe@somewhere.com, john and doe are words.Basically, a word is either an atom or quoted string. */var word="(" + atom + "|" + quotedUser + ")";// The following pattern describes the structure of the uservar userPat=new RegExp("^" + word + "(\\." + word + ")*$");/* The following pattern describes the structure of a normal symbolicdomain, as opposed to ipDomainPat, shown above. */var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");/* Finally, let's start trying to figure out if the supplied address is valid. *//* Begin with the coarse pattern to simply break up user@domain intodifferent pieces that are easy to analyze. */var matchArray=emailStr.match(emailPat);if (matchArray==null) {/* Too many/few @'s or something; basically, this address doesn'teven fit the general mould of a valid e-mail address. */alert("Email address seems incorrect (check @ and .'s)");return false;}var user=matchArray[1];var domain=matchArray[2];// Start by checking that only basic ASCII characters are in the strings (0-127).for (i=0; i<user.length; i++) {if (user.charCodeAt(i)>127) {alert("Ths username contains invalid characters.");return false; }}for (i=0; i<domain.length; i++) {if (domain.charCodeAt(i)>127) {alert("Ths domain name contains invalid characters.");return false; }}// See if "user" is validif (user.match(userPat)==null) {// user is not validalert("The username doesn't seem to be valid.");return false;}/* if the e-mail address is at an IP address (as opposed to a symbolichost name) make sure the IP address is valid. */var IPArray=domain.match(ipDomainPat);if (IPArray!=null) {// this is an IP addressfor (var i=1;i<=4;i++) {if (IPArray[i]>255) {alert("Destination IP address is invalid!");return false; }}return true;}// Domain is symbolic name. Check if it's valid.var atomPat=new RegExp("^" + atom + "$");var domArr=domain.split(".");var len=domArr.length;for (i=0;i<len;i++) {if (domArr[i].search(atomPat)==-1) {alert("The domain name does not seem to be valid.");return false; }}/* domain name seems valid, but now make sure that it ends in aknown top-level domain (like com, edu, gov) or a two-letter word,representing country (uk, nl), and that there's a hostname precedingthe domain or country. */if (checkTLD && domArr[domArr.length-1].length!=2 &&domArr[domArr.length-1].search(knownDomsPat)==-1) {alert("The address must end in a well-known domain or two letter " + "country.");return false;}// Make sure there's a host name preceding the domain.if (len<2) {alert("This address is missing a hostname!");return false;}// If we've gotten this far, everything's valid!return true;}function validate( form ){var digits="0123456789"var tempif (form.To.value=="" ) { alert( "To Required!") return false}if (form.From.value=="") { alert("From Required!") return false}if( ! emailCheck(form.EMail.value) ) { return false}if (form.Subject.value=="") {alert("Subject Required!")return false}return true}// End --></SCRIPT><?php } ?></HEAD><BODY><?php if( ! isset( $_POST["EMail"] ) ) { ?><form method="POST" onsubmit="return validate(this)" name="MailForm"<?php echo ((isset($_SERVER['PHP_SELF']))?' action="' . $_SERVER['PHP_SELF'] . '"' : '')?>> <!-- Un-comment the following line if you want ALL fields in the form copied to the message body --> <!-- <input type=hidden name="AllFields" value="Yes"> --> <div align="center"> <center> <table border="0" cellpadding="4" cellspacing="0"> <tr> <td valign="top" align="right">To:</td> <td><select size="1" name="To"><?php foreach( $eMail as $k => $a ) if( (isset($_GET["To"])) && ( $_GET["To"] == $k) ) echo "<option value=\"$k\" selected>$a[0]</option>\n"; else echo "<option value=\"$k\">$a[0]</option>\n";?> </select></td> </tr> <tr> <td valign="top" align="right">From:</td> <td><input type="text" name="From" size="44" maxlength="32"></td> </tr> <tr> <td valign="top" align="right">E-Mail:</td> <td><input type="text" name="EMail" size="44"></td> </tr> <tr> <td valign="top" align="right">Subject: </td> <td> <p align="center"><input type="text" name="Subject" size="44"></td> </tr> </table> </center> </div> <p align="center"><textarea name="Body" rows="10" cols="45"></textarea></p> <p align="center"><input type="submit" value="Send" name="Submit"></p><br><br> <center>This SPAM free script is available from <a href="http://forums.xisto.com/no_longer_exists/} else { echo "<B>Attempting to send message</b></BR></BR>\n"; $userip = ($_SERVER['X_FORWARDED_FOR']) ? $_SERVER['X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; // Build message Body $body = ""; if( isset( $_POST["AllFields"] ) ) { foreach( $_POST as $key => $value ) { if( $key == "To" ) { $body .= sprintf( "%s: \"%s\" <%s>\n\n", $key, $eMail[$value][0], $eMail[$value][1] ); } else if( ( $key != "AllFields" ) && ($key != "Submit" ) ) { $body .= sprintf( "%s: %s\n\n", $key, $value ); } } } else { $body = $_POST["Body"]; } if( get_magic_quotes_gpc() == 1 ) { $_POST["Subject"] = stripslashes( $_POST["Subject"] ); $body = stripslashes( $body ); } // Check for BCC injection... $checkInject = $_POST["From"] . "|" . $_POST["EMail"] . "|" . $_POST["Subject"] . "|" . $userip; if( preg_match( "/[\r\n]/", $checkInject ) ) { echo "Sorry! Spaming from this script is not allowed."; exit; } // Send the message if( mail( '"' . $eMail[$_POST["To"]][0] . '" <' . $eMail[$_POST["To"]][1] . '>', $_POST["Subject"], $body, 'Return-Path: "' . $_POST["From"] . '" <' . $_POST["EMail"] . ">\n" . 'From: "' . $_POST["From"] . '" <' . $_POST["EMail"] . ">\n" . 'Reply-To: "' . $_POST["From"] . '" <' . $_POST["EMail"] . ">\n" . (($ccSender)? 'Cc: "' . $_POST["From"] . '" <' . $_POST["EMail"] . ">\n" : "" ) . "X-Mailer: PHP/" . phpversion() . "\n" . "X-From-IP: " . $userip ) ) echo "Message Sent Successfully"; else echo "UNABLE To Send Message.";}?> </BODY></HTML>Thank you Notice from jlhaslip: Richard, please do not 'sign-off' your posts. Use the signature block in your profile. Thanks.
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.