Jump to content

php_joe

Members
  • Posts

    175
  • Joined

  • Last visited

    Never

Posts posted by php_joe

  1. [quote]Thanks but that would require my intervention for every email sent to the list's email address.
    [/quote]
    No, you could set it up so that it's automatic. Just like this forum that sends emails to members who have "subsrcribed" to a particular topic.

    Just give each member a "moderated" or "unmoderated" status and, if they're "unmoderated" have the code loop through a list of email addresses and [b]mail()[/b] each one.

    Joe
  2. [quote author=btherl link=topic=112824.msg458424#msg458424 date=1161923525]But I don't think there's any way to make the variable name inline, like $var_{$othervar}_1.  $name = 'var_{$othervar}_1'; $$name = 'val'; will work though.
    [/quote]

    It works, but my mistake was that you can't do it before the = sign, but it's ok to have it afterwards.
  3. There you go then :)

    [code]$file = file_get_contents("database.txt");
    $lines = explode("\n", $file);
    foreach($lines as $key => $value){
    $row = "row_{$key}";
    $$row = $value;
    $$row = explode(',', $value);
    }

    echo "$row_0[0]<br>";
    echo "$row_0[1]<br>";
    echo "$row_0[2]<br>";
    echo "$row_1[0]<br>";
    echo "$row_1[1]<br>";
    echo "$row_1[2]<br>";
    echo "$row_2[0]<br>";
    echo "$row_2[1]<br>";
    echo "$row_2[2]<br>";
    [/code]
  4. No, it's not your file, it's my code.

    if you use this:
    [code]$file = file_get_contents("test.txt");
    $lines = explode("\n", $file);
    foreach($lines as $key => $value){
    //Play with each line in here ($lines[#])
    $pieces = explode(',', $value);
    //Play with each piece of information in here ($pieces[#])
    }[/code]
    Then you can modify each piece of information, but I'm not sure how to assign a unique variable to each piece. Maybe someone else can help you.

    Joe
  5. I don't know what < it is refering to, but I did find one mistake of mine:

    You should change the code to:
    [code]$badwords = file("badwords.txt");
    foreach($badwords as $key => $value){
    if (eregi($value, $contents)){
    echo "Error, no comments were submitted. You may not have any rude words in your comment!";
    die();
    }
    }[/code]
    and not use the [b]}else{[/b], otherwise it will send a copy of the email for each word in badwords.txt

    If you put this before the mail script then it would kill the page before the mail was sent. The parse error is probably due to an attempt to output html.

    And no, you want to create badwords.txt like this:
    [code]sex
    viagra
    adult[/code]
    with each word on a separate line.
  6. The text file is like this:

    Column1,Column2,Column3
    c1r1value,c2r1value,c3r1value
    c1r2value,c2r2value,c3r2value

    [code]$file = file_get_contents("database.txt");
    $lines = explode("\n", $file);
    foreach($lines as $key => $value){
    $pieces = explode(",", $lines);
    $row_{$key}_1 = $pieces[0];
    $row_{$key}_2 = $pieces[1];
    $row_{$key}_3 = $pieces[2];
    }[/code]

    $row_0_1 = Column1
    $row_0_2 = Column2
    $row_0_3 = Column3
    $row_1_1 = c1r1value
    $row_1_2 = c2r1value
    $row_1_3 = c3r1value
    $row_2_1 = c1r2value
    $row_2_2 = c2r2value
    $row_2_3 = c3r2value
  7. Make a list of words to add to the filter.

    Then put this at the top of the php file:

    [code]$badwords = file("badwords.txt");
    foreach($badwords as $key => $value){
    if (eregi($value, $contents)){
    echo "Error, no comments were submitte.You may not have any rude words in your comment!";
    die();
    }else{
    $to = "1994@hotmail.com";
    $subject="Comment";
    $from="Dan's Website";
    if($contents != "")
    {
       //send mail - $subject & $contents come from surfer input
       mail($to, $subject, $contents, $from_header);
       // redirect back to url visitor came from
       
    }
      else
    {
       print("<HTML><BODY>Error, no comments were submitted!");
       print("</BODY></HTML>");
    }
    }
    }
    [/code]

    I'm sure there's a better way then cycling through each bad word, maybe someone else can offer it. :)

    Though I think that you shouldn't tell the spammers that you're filtering their messages or they will just alter the words slightly (like using a one instead of a lower case "L", or putting a period in the wo.rd).

    Joe
  8. [quote author=ImJustBrndn link=topic=112733.msg457739#msg457739 date=1161823879]
    I'm curious as to how to hide file extensions in the browser's address bar. For example

    http://www.threadless.com/submit
    http://www.threadless.com/submit.php

    both take you to the same file, but if you go to the one without the .php, the .php never shows up. Can someone please tell me how to do this, I've searched and not been able to find it out. Thanks in advance guys, you rock.

    Brandon
    [/quote]

    For [b]http://www.threadless.com/submit[/b] you just make a folder named "submit" and then name the file index.php instead of "submit.php"

    Joe
  9. So, basicly you want to copy Yahoo Groups, right?

    Use the code above, and modify it thusly:

    [code]<?php
    $file = file_get_contents("filename.txt");
    if(!eregi($youremail, $file)) die();
    $to1 = explode("|", $file);
    foreach($to1 as $key => $value){
    $to = $value;
    $subject= yoursubject;
    $msg = yourmessage;
    $headers='From: '.$youremail."\r\n".'MIME-Version: 1.0'."\r\n".'Content-type: text/html; charset=iso-8859-1'."\r\n";
    mail($to,$subject,$msg,$headers);
    }
    ?>[/code]

    Let me know if it works :)

    Joe
  10. What are you sending as your headers?

    You don't need to use an old program, you can use this script:
    [code]<?php
    $to      = 'nobody@example.com';
    $subject = 'the subject';
    $message = 'hello';
    $headers = 'From: webmaster@example.com' . "\r\n" .
      'Reply-To: webmaster@example.com' . "\r\n" .
      'X-Mailer: PHP/' . phpversion();

    mail($to, $subject, $message, $headers);
    ?> [/code]

    or this to send html mail:
    [code]<?php
    $to      = 'nobody@example.com';
    $subject = 'the subject';
    $message = 'hello';
    $headers = 'From: webmaster@example.com' . "\r\n" . 'Reply-To: webmaster@example.com' . "\r\n" . 'Content-type: text/html; charset=iso-8859-1' . "\r\n" . 'X-Mailer: PHP/' . phpversion();

    mail($to, $subject, $message, $headers);
    ?> [/code]

    Joe
  11. It sounds like you're asking if PHP or CSS is better?

    You can use them together. I'm a big fan of PHP. If you are making a webpage for a "non-technical user" you can even use the [b]nl2br()[/b] function to allow the user to enter their text in a text file (without any code required) and the PHP will add the html break at each line break.

    Joe
  12. Yes, I know it sounds shady, but if I just wanted to get around blocks I could use Ghostzilla. I don't want to randomise it (though I'm curious if it could be done, just like I'm curious about everything else), I want to use a specific address.

    You see, I telecommute (working through the internet; data entry, typing, ect...) and I also travel a lot (I'm currently in China) but some of the sites that I work through are restricted to the USA so I can't use them when I'm on a trip. I'd like to be able to set up my proxy to reflect the IP address of my home in Oregon so that I can continue to work when I'm outside the states.

    I'd also like to know how to prevent others from doing this to my site  ;)

    Joe
×
×
  • 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.