PHP Classes

Problems running the script

Recommend this page to a friend!

      pop3.class.inc  >  All threads  >  Problems running the script  >  (Un) Subscribe thread alerts  
Subject:Problems running the script
Summary:MySQL errors
Messages:10
Author:Simon Gelfand
Date:2005-09-09 08:53:51
Update:2007-10-07 16:04:10
 

  1. Problems running the script   Reply   Report abuse  
Picture of Simon Gelfand Simon Gelfand - 2005-09-09 08:53:51
I just took the package as is from the site, installed entered my email connetion information and mysql information.

But for some reason i keep getting error's that the tables do not exsist in the, is there an sql file i am meant to run before trying out this script?

Thanks,

Simon

  2. Re: Problems running the script   Reply   Report abuse  
Picture of Steffen Stollfuß Steffen Stollfuß - 2005-09-09 14:50:38 - In reply to message 1 from Simon Gelfand
Hy...

normally the tables should installed automaticly, butr if you want I can send you an email with the needed sql file....

regard
Jointy (Hemp Cluster)

  3. Re: Problems running the script   Reply   Report abuse  
Picture of Daniel Sepeur Daniel Sepeur - 2006-06-26 07:33:49 - In reply to message 2 from Steffen Stollfuß
Hello,

the SQL-Tables will be created too late in the original version of this script.
In line 90 of the file pop3_test.php, the script will test for existence of a message wich is found on the server:

$query = 'SELECT `unique_id` FROM `'.$msg_table.'` WHERE 1 AND `unique_id` = \''.$unique_id.'\' LIMIT 0, 1';

At this moment, the required tables are not existant because they will be created later in line 142:

if($savetomysql){

In this if, the function save2mysql (pop3.class.inc) will be called and then it will create the appropriate tables.

Therefore i added a small function to pop3.class.inc like this

/*
Funktion create_mysql_tables($mysql_socket,$dir_table = "inbox",$msg_table = "messages")
Access: Public

*/
function create_mysql_tables($socket,$dir_table = "inbox",$msg_table = "messages"){

$this->mysql_socket = $socket;

// Create Table for Mail Header Data
$query = 'CREATE TABLE IF NOT EXISTS `'.$dir_table.'` (`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`unique_id` varchar(255) NOT NULL default\'\',
`msg_id` TEXT NOT NULL, `from` TEXT NOT NULL, `to` TEXT NOT NULL, `subject` TEXT NOT NULL,
`date` TEXT NOT NULL, `cc` TEXT, `bcc` TEXT, `content_type` TEXT, `content_encode` TEXT,
`mime_version` TEXT, `x_mailer` TEXT, `x_priority` INT( 1 ) DEFAULT \'3\', `reply_to` TEXT, `sender` TEXT,
`mail_followup_to` TEXT, `mail_reply_to` TEXT, `return_receipt_to` TEXT, `disposition_notification_to` TEXT,
`received` TEXT NOT NULL, `create` TIMESTAMP(14) NOT NULL, `read` TINYINT(1) DEFAULT \'0\' NOT NULL,
PRIMARY KEY ( `id` )) TYPE = MYISAM';
if(!mysql_query($query,$this->mysql_socket)){
$this->error = __LINE__." POP3 create_mysql_tables() - MySQL Error: ". mysql_errno() ." -- ". mysql_error();
$this->_cleanup();
return FALSE;
}

// Create table for messages !!!
$query = 'CREATE TABLE IF NOT EXISTS `'.$msg_table.'` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`unique_id` VARCHAR( 255 ) NOT NULL , `linenumber` INT UNSIGNED NOT NULL , `linetext` TEXT,
PRIMARY KEY ( `id` ) ) TYPE = MYISAM ';

if(!mysql_query($query,$this->mysql_socket)){
$this->error = __LINE__." POP3 create_mysql_tables() - MySQL Error: ". mysql_errno() ." -- ". mysql_error();
$this->_cleanup();
return FALSE;
}
$this->mysql_socket = FALSE;
$message = "TABLE CREATION DONE";
return($message);
} // EOF

I call this funtcion in pop3_test.php on line 73 directly after this

$db["link"] = mysql_connect($db["addr"],$db["user"],$db["pass"]) or die(mysql_error());
mysql_select_db($db["use"],$db["link"]) or die(mysql_error());

...like this ...

// Zuallererst schaun wir, ob die MySQL-Tabellen schon eingerichtet sind
if($savetomysql){
if($create_tables = $pop3->create_mysql_tables($db["link"],$db["dir_table"])){
echo "Required MySQL Tables created!! \r\n <br>";

$loadtime += getmtime() - $start ;
print "<br><b>Zeile ".__LINE__."</b> Erforderliche MySQL-Tabellen erzeugt";
print "<br>Benötigte Zeit: ".round($loadtime,3)." Sekunden<br>";
unset($loadtime);

}else{
echo $pop3->error;
return;
}
}

I have found alot of more small typos and bad usage of Variables and Array-Elements.
If someone is interested, i can ask the author to review my changes and take it over to the original code.

Daniel

  4. Re: Problems running the script   Reply   Report abuse  
Picture of Eric Gunn Eric Gunn - 2006-10-31 11:03:24 - In reply to message 3 from Daniel Sepeur
Yes please post your corrections. I can't get this to function properly.

  5. Re: Problems running the script   Reply   Report abuse  
Picture of Steffen Stollfuß Steffen Stollfuß - 2006-11-06 15:40:59 - In reply to message 4 from Eric Gunn
Hy @ll,

1. Daniel please send me your corrections
2. The mysql support was REALLY only AN EXPERIMENT not more.....

^^if you use this function...please be sure what you do there

PS: I planned to make a version 2 of this class with my new and better skills.

MsG
J0inty

  6. Re: Problems running the script   Reply   Report abuse  
Picture of John Holmes John Holmes - 2007-08-02 07:57:35 - In reply to message 5 from Steffen Stollfuß
Did you end up creating a Version 2 of this function...?


  7. Re: Problems running the script   Reply   Report abuse  
Picture of Steffen Stollfuß Steffen Stollfuß - 2007-08-02 21:01:27 - In reply to message 6 from John Holmes
I began with a version 2 with php5 and socket extension support....

But its not finish now.

At time I have to learn for my study and so the time isn't my friend ;)

regards
Jointy

  8. Re: Problems running the script   Reply   Report abuse  
Picture of alphonse tan alphonse tan - 2007-10-03 04:28:04 - In reply to message 7 from Steffen Stollfuß
hi,

Im testing this class on windows using apache, php/mysql on a localhost setting..

This is the only message i get when i do pop3_test.php..
Incorrect table name ''

I get to setup the table "inbox" manually.. but when i check with phpmyadmin.. the table does not seem to appear...

Please advice.. Thanks and keep up the good work!

Alphonse
alphonse.tan@gmail.com

  9. Re: Problems running the script   Reply   Report abuse  
Picture of alphonse tan alphonse tan - 2007-10-03 04:31:11 - In reply to message 8 from alphonse tan
hi,

it's me again.. i would just like to inquire what these mean:

1) Keine neuen Nachrichten !
2) Nachricht als gelöscht markiert !!!

Thanks..

alphonse

  10. Re: Problems running the script   Reply   Report abuse  
Picture of Steffen Stollfuß Steffen Stollfuß - 2007-10-07 16:04:10 - In reply to message 9 from alphonse tan
1) Keine neuen Nachrichten !
No new mails !!!

2) Nachricht als gelöscht markiert !!!
Message marked as delete !

Means the "dele msgnum" command was send to the pop3 server....the message will delete if the "quit" command was send.

j0inty.sL

 
For more information send a message to info at phpclasses dot org.