Jump to content

owner

Members
  • Posts

    71
  • Joined

  • Last visited

    Never

Everything posted by owner

  1. owner

    Timezones

    So you have to use the names, you cannot use an offset to set the default timezone?
  2. Hello, I am a bit confused on how I want to go about developing my application. I see PHP is now moving towards dates using a Country/City format of dates. My question is how is everyone going about making simple timezone selectors (Like selecting the date/time on Windows) on their web applications? I really don't want to display a list of every city from America as there are a ton just in that category. Then I thought, we can calculate the time using an offset... Well php doesn't really have a function to set the time via an integral offset. So my question is... What is the best way to take a stab at this? The only way I can think of this is to make a list of the timezones, have an offset such as +1, +2, +3.... and then have an array that links the offset to the Country/City date format and then use that to set the default timezone lol Thanks in advance! Owner
  3. I just setup virtual FTP users on my server and now the permissions are screwed up so php/apache can no longer save/edit my files. Which usergroup should I add them to? Thanks, owner
  4. Hello, I am trying to install some of the PEAR mail packages but am not having much luck. First I installed pear and have configured it. I followed: http://pear.php.net/manual/en/installation.checking.php and I get bool(true) when running the test to check if pear is installed correctly. Now when I try to use this sample php script: <?php include('Mail.php'); $recipients = 'joe@example.com'; $headers['From'] = 'richard@example.com'; $headers['To'] = 'joe@example.com'; $headers['Subject'] = 'Test message'; $body = 'Test message'; $params['sendmail_path'] = '/usr/lib/sendmail'; // Create the mail object using the Mail::factory method $mail_object =& Mail::factory('sendmail', $params); $mail_object->send($recipients, $headers, $body); ?> I get these errors: Warning: Mail_smtp::include_once(Net/SMTP.php) [mail-smtp.include-once]: failed to open stream: No such file or directory in /var/www/************/******/testMail/Mail/smtp.php on line 348 Warning: Mail_smtp::include_once() [function.include]: Failed opening 'Net/SMTP.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/************/******/testMail/Mail/smtp.php on line 348 Fatal error: Class 'Net_SMTP' not found in /var/www/************/******/testMail/Mail/smtp.php on line 349 If I download the pear package manually and throw the files in the same directory(the testMail directory), I get the same errors as well. Here is a list of the pear packages it says I have installed. I am trying to install these on Debian Lenny. Thanks, owner
  5. Do you have any examples? That is what I am stuck on
  6. I am not concerned with the database side of this to turn on/off things. I am concerned about how to make my application logical. I want each section of the site in its own class rather than each section of my site in one huge file. So I need some sort of way to figure out what file needs to be pulled to bring up that information rather than one file that pulls up everything. Basically, I need some sort of controller that controls what needs to be loaded and how it loads. I know I do not make much sense but I am a bit lost too lol owner
  7. I think I am looking for something more automatized? If I recall, I have seen some scripts online where you can store each page in its own file (class?) and based on the name of the file/class it is auto loaded. I would like to make this faster/easier to add/remove modules from my site. Any ideas are appreciated owner
  8. Hello, I am working on my own little project but it seems to be getting consistently messier. Right now, I have one file with a few classes in it. Each class is its own thing. database class for database, sessions for sessions, etc. My main class that is executed consists of a switch that gets what page the user is on and then calls the appropriate function in my main file. For example here is the layout of my script. file.php $page = new page(); echo $page->runApp(); class run{ function construct(){ } function runApp(){ switch($event){ case 'doSomething': $this->doSomething(); break; default: $this->doSomething(); break; } function doSomething(){ //Code } } } class database{ //Stuff } class session{ //stuff } So having one big file with everything in it is messy and a giant bloated file. I would like to move to something that is a bit more organized/logical and could be expanded easier. Could someone please point me in a direction to go? Thanks in advance, owner
  9. Hello, I am able to send/receive email fine with my script, but I am having problems processing an email when one is received. Right now when I receive an email from some people where the email is in text/plain it is really easy to process via matching a few keywords. However, if I get an email from outlook that is whole different story My goal is to figure out how to make a function grab key things out of the email regardless of which mail client the user uses (Sender, Date, Body, etc). If the user sends a html email, I would like to have it filter both so you can see both the html version and plaintext version. Does php have any built in functions or will I have to use a lot of regex and explode? Here is an example of what a "simple" outlook email looks like: ------=_NextPart_000_0009_01CAD1EE.8055F8E0 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable xmlns:o=3D"urn:schemas-microsoft-com:office:office" = xmlns:w=3D"urn:schemas-microsoft-com:office:word" = xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" = xmlns=3D"http://www.w3.org/TR/REC-html40">HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; = charset=3Dus-ascii">(filtered medium)">vlink=3Dpurple> style=3D'color:#1F497D'>test class=3DMsoNormal>style=3D'font-size:26.0pt;color:red'>123425634567p> 1.0pt;padding:3.0pt 0in 0in 0in'> style=3D'font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:= = ***** [mailto:*****@*******.com] Sent: Thursday, = April 01, 2010 10:07 PM To: = *****@*******.com Subject: = test class=3DMsoNormal> Test from = outlook! ------=_NextPart_000_0009_01CAD1EE.8055F8E0-- Best Regards, owner
  10. owner

    Storing Dates

    Hello, I am working on a calendar application. I was wondering what the best wayto store dates for it would be. Is there even a way to have mySQL select a date in the form of the unix timestamp where the month = x or the day = x? I have always just stored them using a unix timestamp with the time() function from php. Any suggestions would be greatly appreciated. Thanks! owner
  11. owner

    Insert next id

    Is there a way to copy the value from an autoincrementing column to the second column without the need of the second query?
  12. Hello, I am in need of a column where the numbers should be auto incremented if left null, but also allow for duplicate numbers if specified. Is this possible? If not, what would be the best way to go about it? Right now the only way I know I could achieve this is to grab the last inserted id from the last query and then make a second query to update the column of the first one with the same id. Thanks in advance! owner
  13. I am parsing a raw email with a php script (piping) but am having some troubles. I am having a heck of a time trying to extract the body from the message since each mail client sends them just a tad different. Is there an alternative to imap commands where instead of having to login to the account and specify the id; you can just feed the email directly to the function such as imap_body? Thanks in advance, owner
  14. No such luck Anything else I could try? owner
  15. I am trying to send a confirmation email when a user submits a forum back to the user. The problem that I am having is the email is being sent from root@localhost on my development machine rather than an address I specify in the headers. I am logged in to a real email account that I have using imap_open() and I know I am connected as I am able to read/delete emails. Here is what I am using to send the confirmation email: $headers = 'From: applications@mydomain.com' . "\r\n" . 'Reply-To: applications@mydomain.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail( $to , 'Application Submitted' , 'Your application has successfully been submitted.', $headers); imap_mail($to, 'Application Submitted', 'Your application has successfully been submitted.', $headers); Both mail and imap_mail send from the crazy address. Am I missing something? What's interesting is if I sent an email using squirrelmail or outlook manually, the from address shows up fine, it is just when it is sent from php that it gets all messed up. Thanks in advance! owner
  16. owner

    imap_mail

    I am trying to send a confirmation email when a user submits a forum back to the user. The problem that I am having is the email is being sent from root@localhost on my development machine rather than an address I specify in the headers. I am logged in to a real email account that I have using imap_open() and I know I am connected as I am able to read/delete emails. Here is what I am using to send the confirmation email: $headers = 'From: applications@mydomain.com' . "\r\n" . 'Reply-To: applications@mydomain.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail( $to , 'Application Submitted' , 'Your application has successfully been submitted.', $headers); imap_mail($to, 'Application Submitted', 'Your application has successfully been submitted.', $headers); Both mail and imap_mail send from the crazy address. Am I missing something? owner
  17. owner

    Execute php file

    Update: Here is a log from the mail.log file. Looks like I have done something wrong bigtime... Feb 10 20:20:14 ******** postfix/pipe[30361]: 63941EC086: to=<|/var/www/mail/forward.php@********.com>, orig_to=<test@********.com>, relay=dovecot, delay=0.05, delays=0.01/0.03/0/0.01, dsn=2.0.0, status=sent (delivered via dovecot service) Feb 10 20:20:14 ******** postfix/qmgr[30344]: 63941EC086: removed
  18. owner

    Execute php file

    Postfix. Here is a guide that I referenced when setting up my email (I know it is outdated, just used it as a reference): http://workaround.org/ispmail/etch I can send and receive email fine via telnet as well as outlook or squirrelmail. Here is what is in my php file that I am using for testing: #!/usr/bin/env php <?php // start output buffering ob_start(); // get your email from stdin $email = file_get_contents('php://stdin'); // do stuff // log your email to logfile /* $fp = fopen('log.txt', 'r'); if ($fp) { fwrite($fp, $email, strlen($email)); fclose(); }*/ // or send you a copy mail('myemail@********.com', 'email received', $email, 'from: mailman@********..com'); // clean the output ob_end_flush(); ?>
  19. owner

    Execute php file

    Right now I have it running wide open lol -rwxrwxrwx This is my first time trying to pipe something to an email. Is this command even correct for piping the mail? |/var/www/mail/forward.php? Some sites show I need to point it to that php directory that I don't seem to have.... Thanks for helping, owner
  20. owner

    Execute php file

    Ok I added that to the top of my php file and then added <?php right below, but it seems that the script still isn't executing properly (the script doesn't fully execute, it just hangs and I have to press control+c to break out of it) when called from Debian's CLI. What I am trying to do is to pipe an incoming email to the php file. Am I going about this wrong? Here is what command I am using to forward the email: |/var/www/mail/forward.php Thank you for the reply thorpe owner
  21. owner

    Execute php file

    I am running Debian 5.0 with latest updates, but I seem to be having problems when exciting a php script via Debian's CLI. It seems that Debian Lenny changed #!/usr/bin/php -q; as in the /usr/bin/php directory no longer exists. What is the proper way to add the hashbang to the top of the php script in debian? I have php5 as well as php5-cli installed. Thanks in advance! owner
  22. I think I figured it out, nvm
  23. $server = "localhost"; $user = "test@localhost"; $pass = "1234567"; $conn = @imap_open("\{$server/imap}INBOX", $user, $pass) or die("Connection to server failed"); When running this command, it cannot connect to my server. What's interesting is Squirrelmail works on my pc, but I cannot get these simple commands to work. I have verified both the email and password is correct as I can login to squirrelmail with them just fine. Any suggestions would be greatly appreciated, owner
×
×
  • 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.