[PHP] Re: Imap and attachments
here is a script I use to get jpg attachments with IMAP.. good luck from[0]->mailbox."@".$header->from[0]->host.''; return $header->from[0]->mailbox."@".$header->from[0]->host; } function get_structure($mbox,$i) { $structure = imap_fetchstructure($mbox, $i); return $structure; } function no_attachments($structure) { global $mbox; $attach = sizeof($structure->parts); //# OF ATTACHMENTS echo ''.$attach.' attachments '; return $attach; } function get_attached_file($structure, $username, $k,$i) { global $mbox; $encoding = $structure->parts[$k]->encoding; $Name = strtolower($structure->parts[$k]->dparameters[0]->value); //$NewFile[$k-1] = $Name; echo $Name.''; if(strstr($Name, '.jpg') && !strstr($Name, 'masthead.jpg')) { echo 'In File Loop'; $File = base64_decode(imap_fetchbody($mbox, $i, $k+1)); $fp = fopen("C:/TEMP/".$username.$Name ,"w+"); fwrite ($fp, $File, 1); fclose($fp); } return $Name; } /* ** ** */ // CONNECT TO IMAP SERVER $mbox = imap_open("{mail.myserver.net:143}INBOX", "USERNAME", "PASSWORD"); if($mbox) { echo 'CONNECTED TO INBOX...'; } $error = imap_errors(); $alerts = imap_alerts(); /* ** ** */ $msg_cnt = imap_num_msg($mbox); htm($msg_cnt); for($msg_num=1; $msg_num<=$msg_cnt; $msg_num++) { $structure = get_structure($mbox, $msg_num); $num_attach = no_attachments($structure); $phone_address = get_phone_address($msg_num); //get_attached_file($structure,1,1); for($i=0; $i<$num_attach; $i++) { get_attached_file($structure, 'jim_', $i, $msg_num); } } imap_close($mbox); print_r($error); print_r($alerts); ?> "Evert | Rooftop Solutions" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I started using the IMAP functions and ran into a problem with some > headers for attachments. > > The first one is: > > Content-type: image/psd; x-unix-mode=0644; name=FinalVersion6.psd > Content-transfer-encoding: base64 > Content-disposition: inline; filename=FinalVersion6.psd > > Generated by Mac Mail. The filename wont show up in the result of for example imap_fetchstructure. > > The second is: > > Content-Type: text/plain > Content-Disposition: attachment; > filename="Video(019).3gp" > Content-Transfer-Encoding: base64 > > I suspect this one has something to do with the linebreak. It's generated by a modern nokia (7650 I think) > > > I additionaly found a problem calling imap_fetchbody with a non-existent msg number. This will result in a segfault. > > grt, > Evert > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Reading directory contents
what you need is to make a recursive function, that is a function that calls itself like function open_dir() { if(is_dir($my_dir)) { open_dir(); } else { // read files here } } basically you're saying... I'm reading the top level directory, are you a file? ok I'll read you, are you a directory? ok I'll open you up and read your files, and it continues until all files are read. You can stored the data into an associative array and you can use that array later to generate your data. hope that helps, if not google recursive functions Jim Ashley M. Kirchner wrote: A file system question for you folks. We have a folder that contains the following structure of files for each of our sales reps in the company: $TOP_FOLDER$/ /$SalesRep1/ /$Client1/ /File1.ext /$Client2/ /File1.ext /File2.ext /$SalesRep2/ /$Client1/ /File1.ext /$Client2/ /File1.ext /File2.ext /$Client3/ /File1.ext /File2.ext /File3.ext etc., etc. What I'd like to do it iterate through this $TOP_FOLDER$ and generate a page that looks as follows: $SalesRep1 Clients: 2 Files: 3 Total size: xxx [MB/GB] $SalesRep2 Clients: 3 Files: 6 Total size: xxx [MB/GB] etc., etc. So I need to traverse through all the directories, while counting stuff at the same time (ignoring . and .. as I go) and at the end do some pretty display of all the information (I can figure that out later, I just need to collect data right now.) Right now, when I do an opendir() and readdir() I only get the contents of the top folder. How do I get the rest, and count the data as well? -- A -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Building PHP5 on Windows - VS.net?
Has anyone successfully built php5 using visual studio.net ? or is VC6 still only supported? thanks, Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Building PHP5 on Windows - VS.net?
do you happen to remember what issues you may have had? thanks again [EMAIL PROTECTED] wrote: Jim, i had only minor issues, but it builds fine otherwise. "Jim Plush" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Has anyone successfully built php5 using visual studio.net ? or is VC6 still only supported? thanks, Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: passing variables between pages without sessions
Ross, is there a reason you don't want to use sessions again? Creating an associative array of each pages answers is much cleaner than passing hidden fields or get vars. Another option you could use it write the files to disk after each page save, that way if anything goes wrong(IE user computer shuts down) you dont have to have them start from scratch, you can load all the data from disk and have them start where they left off. If you're going to do multi page that option is the best for not pissing off customers because they can finish the form on their timeline. Ross Hulford wrote: I am creating a form but instead of having a long form I want to break it down into a few stages but need to pass the variables bewteen the pages. I have done this before using sessions but would like to know if there is an alternative way to do this? R. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: eregi expression for checking a domain
this should work for any web address starting with www. // test for domain $domain = "www.example.com"; // This pattern will match anything that STARTS with www followed by a period, followed by at least 2 characters, // numbers and periods followed by a period followed by at least two characters $pattern = "#^www\.([a-zA-Z0-9.-]{2,}\.[a-zA-Z]{2,})$#"; if(preg_match($pattern, $domain, $matches)) { echo 'Matched. Domain is: '.$matches[1]; } else { echo 'NO MATCHY DUDE'; } Ross Hulford wrote: Does anyone know a working eregi expression for determining a domain is valid? don't need the http:// just looking for www.thedomain.com cheers, R. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: eregi expression for checking a domain
also, note I used preg_match instead of ereg, preg is a better choice over ereg usually (flexibility, speed, etc) Ross Hulford wrote: Does anyone know a working eregi expression for determining a domain is valid? don't need the http:// just looking for www.thedomain.com cheers, R. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP/Craig's List Scripts?
Mike check out hotscripts.com in the PHP section, there are a billion scripts on there. you should be able to find one that matches your needs Jim carreraSC wrote: Hi, Has anyone ever seen a mockup or simulation of CL done in PHP, for download? I need to do a small scale version of it for an unrelated (non-competitive) space, and I thought it might save some time. Thanks! Mike in Boulder -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Screen resolution in php
you can get the resolution from javascript then pass that info to php using HTTP REQUEST http://jibbering.com/2002/4/httprequest.html or super low budget way could be to get that information from javascript then right after forward the page using javascript with the resolution variable in the query string IE &res=jsvar [EMAIL PROTECTED] wrote: Hi, How can i get the screen resolutin in php. I've read that i can't this. With java i can do this. document.write("Your Screen Resolution Is : "); document.write(screen.width + " x " + screen.height); My question is how can pass the screen resolution from java to a variable? It is a better way? Any help would be appreciated! Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: recommending a PHP book?
Hey Danny, no good books on that subject regarding php/mcv that I've seen but PHP Architecht has some good articles on MVC, I believe they have a free issue that has a huge article on PHP/MVC. www.phparch.com Danny Lin wrote: Can any one recommend a good book that discusses MVC design patterns with PHP (and mySQL)? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: getting text with strange encodng
Where did the string come from? Jim PHP WebBlog = http://www.litfuel.net/plush/ Diana Castillo wrote: Does anyone know what kind of string encoding this is : ®® mA® and how can I decode this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Convert time
try something like echo date("Y, m, d, g, i, s", $timevalue); thats based on your example or you can do echo date("m/d/Y g:i s", $timevalue); which would show something like 05/19/2005 5:45 23 Jim's PHP Weblog www.litfuel.net/plush [EMAIL PROTECTED] wrote: Hi, I have a database where i store the username and date when he registered. The time when he registered is using the time() function. I want to display the date he registered in this format: year, month, day, hour, minute, second. Please somebody tell me how can i do that. I know is is very stupid from me that i've stored the date when a user register using the time() function. Thank you very very much in advance for your help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php