vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Discussion: Forum participation by email (https://vborg.vbsupport.ru/showthread.php?t=12061)

03-29-2001 04:44 PM

Quote:

Originally posted by JamesUS
I'm going to give this a shot during the school holidays (week after next), so watch out for a release in a few weeks :)
Easter Holidays?

03-29-2001 05:28 PM

Yup :)

Sarge 04-10-2001 05:40 AM

Easter is coming up!
IS this still a go?

MrLister 04-10-2001 12:58 PM

add restrictions so only like 100 e-mails per day to one user.

JamesUS 04-10-2001 01:31 PM

Yes I still plan to do it but I doubt it will be done any time particularly soon - it is a major hack to make.

Sarge 04-10-2001 02:59 PM

this could double the size of my board!

dons 04-10-2001 10:14 PM

The ability to receive a digest goes hand and hand with this I think. dcs

chrispadfield 04-12-2001 10:44 AM

i did start this a while ago, and got somewhere but not very far. Just in case this is any use to James:

PHP Code:

<?

require("./admin/global.php");

 function pop3_open($server, $port)  
  {
    global $POP3_GLOBAL_STATUS;

    $pop3 = fsockopen($server, $port);

    // Maybe some people need something like:
    // $pop3 = fsockopen($server, $port, &$errno, &$errstr, 30);
    
    if ($pop3 <= 0) return 0;

    $line = fgets($pop3, 1024);
        $POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] = substr($line, 0, 1);
        $POP3_GLOBAL_STATUS[$pop3]["LASTRESULTTXT"] = substr($line, 0, 1024);

    if ($POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] <> "+") return 0;

    return $pop3;
  }

  function pop3_user($pop3, $user)
  {
    global $POP3_GLOBAL_STATUS;

    fputs($pop3, "USER $user\r\n");
    $line = fgets($pop3, 1024);
        $POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] = substr($line, 0, 1);
        $POP3_GLOBAL_STATUS[$pop3]["LASTRESULTTXT"] = substr($line, 0, 1024);
    
    if ($POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] <> "+") return 0;

    return 1;
  }

  function pop3_pass($pop3, $pass)
  {
    global $POP3_GLOBAL_STATUS;

    fputs($pop3, "PASS $pass\r\n");
    $line = fgets($pop3, 1024);
        $POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] = substr($line, 0, 1);
        $POP3_GLOBAL_STATUS[$pop3]["LASTRESULTTXT"] = substr($line, 0, 1024);
    
    if ($POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] <> "+") return 0;

    return 1;
  }
  
  function pop3_stat($pop3)
  {
    global $POP3_GLOBAL_STATUS;

    fputs($pop3, "STAT\r\n");
    $line = fgets($pop3, 1024);
        $POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] = substr($line, 0, 1);
        $POP3_GLOBAL_STATUS[$pop3]["LASTRESULTTXT"] = substr($line, 0, 1024);

        if ($POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] <> "+") return 0;

    if (!eregi("+OK (.*) (.*)", $line, $regs)) 
        return 0;

    return $regs[1];
  }

  function pop3_list($pop3)
  {    
        global $POP3_GLOBAL_STATUS;
  
        fputs($pop3, "LIST\r\n");
        $line = fgets($pop3, 1024);
        $POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] = substr($line, 0, 1);
        $POP3_GLOBAL_STATUS[$pop3]["LASTRESULTTXT"] = substr($line, 0, 1024);

        if ($POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] <> "+") return 0;

    $i = 0;
    while  (substr($line  =  fgets($pop3, 1024),  0,  1)  <>  ".")
    {
        $articles[$i] = $line;
        $i++;
    }
    $articles["count"] = $i;

    return $articles;
  }

  function pop3_retr($pop3, $nr)
  {
        global $POP3_GLOBAL_STATUS;
  
        fputs($pop3, "RETR $nr\r\n");
        $line = fgets($pop3, 1024);
        $POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] = substr($line, 0, 1);
        $POP3_GLOBAL_STATUS[$pop3]["LASTRESULTTXT"] = substr($line, 0, 1024);

        if ($POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] <> "+") return 0;

    $i = 0;
        while  (substr($line  =  fgets($pop3, 1024),  0)  !=  ".\r\n")
        {
                $data[$i] = $line;
                $i++;
        }
        $data["count"] = $i;

        return $data;
  }


  function pop3_dele($pop3, $nr)
  {
        global $POP3_GLOBAL_STATUS;

        fputs($pop3, "DELE $nr\r\n");
        $line = fgets($pop3, 1024);
        $POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] = substr($line, 0, 1);
        $POP3_GLOBAL_STATUS[$pop3]["LASTRESULTTXT"] = substr($line, 0, 1024);

        if ($POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] <> "+") return 0;


        return 1;
  }

  function pop3_quit($pop3)
  {
        global $POP3_GLOBAL_STATUS;

        fputs($pop3, "QUIT\r\n");
        $line = fgets($pop3, 1024);
        $POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] = substr($line, 0, 1);
        $POP3_GLOBAL_STATUS[$pop3]["LASTRESULTTXT"] = substr($line, 0, 1024);

        if ($POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] <> "+") return 0;

        return 1;
  }
  
  
// end of class.. this is where it starts :)



### CONNECT TO POP3 SERVER


// so we are connecting
 $pop3 = pop3_open("mail.techuk.com", "110");
 if (!$pop3) {
    printf("[ERROR] Failed to connect to localhost<BR>\n");
    return 0;
 }
 
// with thus username 
 if (!pop3_user($pop3, "testing@ascifi.com")) {
    printf("[ERROR] Username failed!<BR>\n");
    return 0;
 }
 
 // and this password
 if (!pop3_pass($pop3, "****")) {
    printf("[ERROR] PASS failed!<BR>\n");
    return 0;
 }
 
 
### END OF CONNECTION


### FIND OUT HOW MANY ARTICLES - FUTURE LOOP

// finding out how many articles there are. if none giving error message i think
 $articles = pop3_list($pop3);
 if (!$articles) {
    printf("[ERROR] LIST failed!<BR>\n");
    return 0;
 }
 
 
$listit = pop3_list($pop3);

$numrows = count ($listit);
for ($count = 0; $count < $numrows; ++$count) {

echo HtmlSpecialChars($listit[$count]);
echo "<br>";
}
  
  
### END OF ARTICLE COLLECTION
 
// re-fresh $count 
$count = 0;  

### PROCESS THE EMAIL ###

// first lets retrieve the email
$data = pop3_retr($pop3, 8);

// start loop on email array
$numrows = count ($data);
for ($count = 0; $count < $numrows; ++$count) {

// create variables from the whole message
$message .= HtmlSpecialChars($data[$count]);
$message_html .= HtmlSpecialChars($data[$count]);
$message_html .= "<br>";

// check to see if divide, if so tell script we are no dealing with the body
if ($data[$count] == "\r\n") {
$stop = "1";
}


## we are doing header stuff here ##
if ($stop != "1") {
$header2 .= $data[$count];

// first lets get the subject

if (eregi("Subject:", $data[$count], $arr)) {
$subject = substr($data[$count],9);

echo "<b>have found the subject</b><br>";
} else {
echo "failed to find the subject<br>";
}

// second the return email address

$foo = 'From: "Chris Padfield" <chris@freeontheweb.com>';

if (eregi("<([^>]*)>",$data[$count],$arr)) {
$email = $arr[1];

echo "<b>have got email</b><br>";
} else {
echo "failed to get email<br>";
}

## now we are creating the body ##
} elseif ($stop == "1") {


$body2 .=$data[$count];
}


// end the email array loop
}

### EMAIL HAS BEEN PROCESSED ###


### CHECK TO SEE IF USER IS BANNED ###

// first check to see if this user has been banned.

if ($email == "banned") {

echo "sorry.. you are banned ....";

} elseif ($ip == "banned") {

echo "sorry.. you are banned ....";

} else {


### END OF USER BANNING CHECK ALTHOUGH } CONTINUES TO END ###



### WHAT DO WE DO BASED ON SUBJECT ###

// first if empty:

if ($subject == "") {

echo "Uh oh, the subject is empty";

} elseif ($subject == "help") {

echo "ar... we need to send help now";

} elseif ($subject == "new thread") {

echo "we now need to start a new thread"; 

} elseif ($subject == "Subscribe") {

echo "we need to subscribe them to this forum";

} elseif ($subject == "Unsubscribe") {

echo "we need to unsubscribe them to this forum";

} elseif ($subject == "daily") {

echo "we need to change settings to daily";

} elseif ($subject == "instant") {

echo "we need to change settings to instant";

} else {

// now a "command" so probably a post (or an error). Need to extract info from subject.

$delimiter == "**";


if (eregi("([[:digit:]]{1,})",$subject,$arr)) {

$threadno = (trim($arr[1]));
echo $threadno;
 
} else {

echo "Serious problem... did not match anything at all! Send back email with error message";
 
}


// end of subject matching
}

// end of email and ip address check


### END OF SUBJECT PROCESSING ###







#### done parsing, lets do some printing of found variables

echo "<b>Subject:</b><br>";
echo subject;
echo "<P>";
echo "<b>Email:</b><br>";
echo $email;
echo "<P>";
echo "<b>Clean Subject</b><br>";
echo $threadno;
echo "<P>";
echo "<B>Message Html</b><br>";
echo $message_html;
echo "<P>";
echo "<B>Header:</b><br>";
echo $header2;
echo "<P>";
echo "<b>Body:</b><br>";
echo $body2;



?>


JamesUS 04-12-2001 04:11 PM

Thanks Chris - much appreciated :)
I will go through it properly a little later on :)

writhe 07-19-2001 07:42 PM

JamesUS-

Did you ever write the hack? I'm looking into setting up a bulletin board but am desperate to have your email support as a feature. Please let me know if it is finished, will be finished soon, or if someone else has already done so.


All times are GMT. The time now is 08:17 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02511 seconds
  • Memory Usage 1,780KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete