Jump to content

Flinch

Members
  • Posts

    13
  • Joined

  • Last visited

    Never

About Flinch

  • Birthday 07/25/1989

Contact Methods

  • Website URL
    http://www.darkendlights.com

Profile Information

  • Gender
    Not Telling
  • Location
    computer, house, USA

Flinch's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. It maybe possible that your websever doesn't have a mail server configured to it. Seems unlikely, but that could be the cause. Check with your sever and see what they use as their mail protocol. A lot of online webservers use POP* (* = version number) as their defualt mail server. It may also be SMTP. Not sure what else it might be because I've forgotten most of that script by now. If your webserver does have a mail server, post back and we'll go from there.
  2. Flinch

    PHP Issue

    [!--quoteo(post=353474:date=Mar 9 2006, 08:12 PM:name=7pm)--][div class=\'quotetop\']QUOTE(7pm @ Mar 9 2006, 08:12 PM) [snapback]353474[/snapback][/div][div class=\'quotemain\'][!--quotec--] [b][!--sizeo:3--][span style=\"font-size:12pt;line-height:100%\"][!--/sizeo--]AWESOME!![!--sizec--][/span][!--/sizec--] Many Thanks Flinch you are the best!! The record label thanks you also![/b] [/quote] No problem. Glad to help someone in need!
  3. Flinch

    PHP Issue

    Indeed. Just like that. :) But, as your catalogue gets bigger, I would suggest implementing a database to make your job easier. PHP and MySQL (when used correctly) can be a powerful and will saw through any project you might need done.
  4. Flinch

    PHP Issue

    Okay, I ran this on my local server, and despite some notice errors (that won't affect you in runtime), I found only one parser error (forget to close the die() function on line 86), and fixed it. Try this: [code] $qtyrun = $_POST['qtyrun']; $qtyex = $_POST['qtyex']; $qtylate = $_POST['qtylate']; $qtyturn = $_POST['qtyturn']; $name = $_POST['yourname']; $email = $_POST['email']; $address = $_POST['address']; //START MY ADDITIONS// if(!$name or !$email or !$address) { if(!$name) die("You did not enter your name!"); if(!$email) die("You did not enter your email address!"); if(!$address) die("You did not enter your address!"); } //make sure the email is a valid one using a simple regular exp. i found at regexlib.com if(!preg_match("#^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$#", $email) ) { die("This is not a valid email address!"); } //use the simple function strip_tags() to clean out any html and JS from input $name = strip_tags($name); $address = strip_tags($address); //do some small variable handling $qtyrun = ($qtyrun == "") ? "0" : $qtyrun; $qtyex = ($qtyex == "") ? "0" : $qtyex; $qtylate = ($qtylate == "") ? "0" : $qtylate; $qtyturn = ($qtyturn == "") ? "0" : $qtyturn; //The above four lines will substitute the string "0" into the quantity variables if they are left empty. //make the body text that will be emailed $body = "An order has been submitted by: {$name}. They have requested the following quantities: DLI001 RUNWAY EP: {$qtyrun} DLI002 EXSTACY QUEEN: {$qtyex} DLI003 LATE NITE EP: {$qtylate} DLICD0602 TURNING IT: {$qtyturn} The address specified was: {$address}"; $subject = "Order form from {$name}"; mail("cajjmerewray@rogers.com", $subject, $body, "From: {$email}"); //Order form sent! echo "Your order has been recieved and will be processed shortly! Thank you for your business!"; [/code]
  5. Flinch

    PHP Issue

    [!--quoteo(post=353447:date=Mar 9 2006, 07:06 PM:name=7pm)--][div class=\'quotetop\']QUOTE(7pm @ Mar 9 2006, 07:06 PM) [snapback]353447[/snapback][/div][div class=\'quotemain\'][!--quotec--] Awww thanks flinch! But don't feel lazy man, please help me out if you can?. I've placed that verification part where you showed me. Now it's the email part I guess that is left? I'm so screwed on this.... [/quote] Oh ok..... [code] $qtyrun = $_POST['qtyrun']; $qtyex = $_POST['qtyex']; $qtylate = $_POST['qtylate']; $qtyturn = $_POST['qtyturn']; $name = $_POST['yourname']; $email = $_POST['email']; $address = $_POST['address']; //START MY ADDITIONS// if(!$name or !$email or !$address) {   if(!$name) die("You did not enter your name!");   if(!$email) die("You did not enter your email address!");   if(!$address) die("You did not enter your address!"); } //make sure the email is a valid one using a simple regular exp. i found at regexlib.com if(!preg_match("#^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$#", $email) ) {       die("This is not a valid email address!"; } //use the simple function strip_tags() to clean out any html and JS from input $name = strip_tags($name); $address = strip_tags($address); //do some small variable handling $qtyrun = ($qtyrun == "") ? "0" : $qtyrun; $qtyex = ($qtyex == "") ? "0" : $qtyex; $qtylate = ($qtylate == "") ? "0" : $qtylate; $qtyturn = ($qtyturn == "") ? "0" : $qtyturn; //The above four lines will substitute the string "0" into the quantity variables if they are left empty. //make the body text that will be emailed $body = "An order has been submitted by: {$name}. They have requested the following quantities: DLI001 RUNWAY EP: {$qtyrun} DLI002 EXSTACY QUEEN: {$qtyex} DLI003 LATE NITE EP: {$qtylate} DLICD0602 TURNING IT: {$qtyturn} The address specified was: {$address}"; $subject = "Order form from {$name}"; mail("your_email@domain.com", $subject, $body, "From: {$email}"); //Order form sent! echo "Your order has been recieved and will be processed shortly!  Thank you for your business!"; [/code] Okay, it's crude, and leaves a few holes in the security department, but it will work and do the job for what you need done. I haven't tested this myself, so if there are any parse errors, or any other problems, tell me and I'll fix them. Post back on your results! :)
  6. Depends on what kinds of fields they are, but if they're simple fields like text inputs, I would name the fields like "input1", "input2", "input3" and so. The, us for() to loop through every field and validate it. [code] for($i=1; $i <= 200; $i++) {   //validation code here    $field = "input".$i;   if(! isset($_POST[$field]) ) {      //empty!    } } [/code]
  7. Flinch

    PHP Issue

    [code] $qtyrun = $_POST['qtyrun']; $qtyex = $_POST['qtyex']; $qtylate = $_POST['qtylate']; $qtyturn = $_POST['qtyturn']; $name = $_POST['yourname']; $email = $_POST['email']; $address = $_POST['address']; //START MY ADDITIONS// if(!$name or !$email or !$address) {   if(!$name) die("You did not enter your name!");   if(!$email) die("You did not enter your email address!");   if(!$address) die("You did not enter your address!"); } //make sure the email is a valid one using a simple regular exp. i found at regexlib.com if(!preg_match("#^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$#", $email) ) {       die("This is not a valid email address!"; } //use the simple function strip_tags() to clean out any html and JS from input $name = strip_tags($name); $address = strip_tags($address); [/code] That's the simplest way to do all the form verification for the personal information. Sorry, I'm feeling a little lazy and I don't want to write out the entire script for you. :)
  8. Ya, if the data you are about to enter in the DB meets those qualifications you listed above, pull everyone out of the table staff that has an access level of >= 3, and then mail that. [code] $query = mysql_query("SELECT * FROM `staff` WHERE `access` >= '3'"); if(mysql_num_rows($query) >= 1) {   $sendto = "";    while($r = mysql_fetch_array($query)  ) {      if($sendto) {         $sendto .= ",{$r['email']}";      } else {         $sendto = $r['email'];      }    }    //send the email    mail($sendto, $subject, $body, "From: youremail@domain"); } [/code] Something along those lines would do the trick.
  9. Flinch

    PHP Issue

    I just posted this in your duped topic: Well, right now your script isn't doing anything, except gathering the vartiables. It needs to first do some data checking, you know, like making sure that no required input fields were left blank, and that the data entered in those input fields is legit and secure. You can mostly check these things with regular expressions, such as making sure it's a valid email address. Next, after you've made sure that all the data entered is where it's supposed to be and correct, then you can send it via email using the mail() function.
  10. Flinch

    PHP Issue

    Well, right now your script isn't doing anything, except gathering the vartiables. It needs to first do some data checking, you know, like making sure that no required input fields were left blank, and that the data entered in those input fields is legit and secure. You can mostly check these things with regular expressions, such as making sure it's a valid email address. Next, after you've made sure that all the data entered is where it's supposed to be and correct, then you can send it via email using the mail() function.
  11. [!--quoteo(post=353264:date=Mar 9 2006, 10:15 AM:name=spkenn5)--][div class=\'quotetop\']QUOTE(spkenn5 @ Mar 9 2006, 10:15 AM) [snapback]353264[/snapback][/div][div class=\'quotemain\'][!--quotec--] hi guys. first off, i have put my interest since long long ago but finally last 4 days i finally able to get my apache working, and have php,mysql installed... i want to make a site that looks similar to this [a href=\"http://ee.domaindlx.com/SpSClan/kenn5-world/index.asp\" target=\"_blank\"]http://ee.domaindlx.com/SpSClan/kenn5-world/index.asp[/a], i want to get the member thing to work so people can sign up and be a member to download or w/e or to get a full access at the site. is there a tips for me? for now im just trying scripts after scripts. thanks [/quote] I would suggest reading some of the many tutorials located on this site already. There are a few that I can recall that tackle the exact topic you are after. After you read the membership tutorials we have here, you'll soon get the hang of how memberships work and will begin to implement yor own ideas to make your site work the best. One tip I could give you is, if you want to make people have to log in to download things, the easiest way (for me, IMO) is to have a download script that will first check if the person is logged in (by either checking session vars, or however you get your membership system running), and then having it process the download request. [code] //goodies.php echo "<a href='download.php?id=1'>Download item one!</a>"; [/code] [code] //download.php if(!$_SESSION['user']) {    echo "You must login first to download this item!";    exit(); } else {    //code to start the download; probably using header() } [/code] Now that's pretty rough, and I simplified a lot of things, but that basically is how to get people to login before downloading material. Like I said though, as you become more effecient with PHP and membership systems, you can start implementing your own ideas and writing more advanced code. Good luck! :)
  12. Hey all, long time no post. So anyway, I'm writing a function that will parse user input from text forms based on a set of instructions passed to it by a multi-dimmensional array. Right now, I'm, working on a section that will allow me to specify what HTML tags are allowed through the array ($instruct), and parse them accordingly. The way my function will work is it starts off checking what HTML is allowed, and will replace any allowed tags's < & > with [[ & ]] so my next section, that converts non-allowed HTML tags into > & <, will not parse the wanted HTML. I'm not very good at explaining, so here's an example: [code]//Wanted HTML: <br> $text = "Here is a <br> <b>new</b> line!"; //my function will find any occurences of <br> and replace it with[[br]]. $return = parser($text, $instruct); echo $return; //will return the same string, with the <br> tag intact, and the <b> & </b> tags replaced with <b>. [/code] I think that demonstrates what I'm trying to do. So far, I haven't had too much problem, but I fear that the regular expression I wrote to do this checking is a little sub-par, and may not work. Here's my regular expression being used in a foreach loop. [code](<|</)(\s)*".$k."(\s)*([^>".$k."].+?)?(>|/>)[/code] The ."$k." parts are because all the tags that have been allowed are broken into another array, and cycled through the input text replacing where needed. So in our above example for the <br>, it would look like this: [code](<|</)(\s)*br(\s)*([^>br].+?)?(>|/>)[/code] This seems to work like I want, but when it comes to closing tags (</td></tr>) they just get replaced as [[td]] and [[tr]] instead of [[/td] and [[/tr]]. I'm wondering if anyone has any help or suggestions for me that I could use to tweak this regex to make my script work. It's been troubling for a few days now. Here's the concerned area of the script I'm talking about: [code] //use the normal regex                 if(preg_match("#(<|</)(\s)*".$k."(\s)*([^>".$k."].+?)?(>|/>)#im", $txt, $matches)) {                                           /*+------------THIS IS VERY IMPORTANT Y'ALL!-------------+                   + First and fifth elements are the < and > respectively                   + Second and third will ALWAYS be spaces                   + Fourth will be any markup inside the tag                   +------------------------------------------------------+*/                 //now, begin the replacement technique.                 print_r($matches);                 if(preg_match("#/#is", $matches[1]) ) {                     $add_in1 = "/";                 }                                  $add_in2 = ($matches[4] != "") ? " ".$matches[4] : "";                                  $this_tag = "[[".$add_in1.$k.$add_in2."]]";                                  $txt = preg_replace("#(<|</)(\s)*".$k."(\s)*([^>".$k."].+?)?(>|/>)#im", $this_tag, $txt);                 unset($this_tag, $add_in1, $add_in2);                                  } [/code] Thanks.
×
×
  • 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.