stuffradio
Members-
Posts
253 -
Joined
-
Last visited
Everything posted by stuffradio
-
hah, glad it worked for you!
-
Do you have the folder set to 777 where you are uploading it to?
-
I have a script here that downloads attachments. When it's sent via email from a mobile it doesn't work... but on a normal email it does work. When I run the script from a mobile email it downloads the file as '.alternative'. I hope someone can help me <?php ###################################### #Coded By Jijo Last Update Date[Jan/19/06] ##################################### ########################################################## ###################### Class readattachment ############### class Readattachment { var $username; var $encrypted; var $pic; var $time; var $url; var $caption; var $tag; var $mes; function Readattachment() { $this->CI=& get_instance(); } function checkExists($username, $password) { $query = $this->CI->db->get_where('project_users', array('username' => $username, 'password' => $password)); if ($query->num_rows() > 0) { return true; } else { return false; exit; } } function checkAndUpload($arg, $pic) { preg_match("#username: ([a-zA-Z0-9]+)#i",$arg,$username); $username = $username[1]; preg_match("#password: ([a-zA-Z0-9]+)#i",$arg,$password); $password = $password[1]; preg_match("#caption: ([a-zA-Z0-9]+)#i",$arg,$caption); $caption = 'Default'; $encrypted = md5($password); $this->checkExists($username, $encrypted); $this->uploadData($username, $encrypted, $pic, time(), '', $caption, 'nsfw'); } function getdecodevalue($message,$coding) { if ($coding == 0) { $message = imap_8bit($message); } elseif ($coding == 1) { $message = imap_8bit($message); } elseif ($coding == 2) { $message = imap_binary($message); } elseif ($coding == 3) { $message=imap_base64($message); } elseif ($coding == 4) { $message = imap_qprint($message); } elseif ($coding == 5) { $message = imap_base64($message); } return $message; } function getdata($host,$login,$password,$savedirpath) { $mbox = imap_open ($host, $login, $password) or die("can't connect: " . imap_last_error()); $message = array(); $message["attachment"]["type"][0] = "text"; $message["attachment"]["type"][1] = "multipart"; $message["attachment"]["type"][2] = "message"; $message["attachment"]["type"][3] = "application"; $message["attachment"]["type"][4] = "audio"; $message["attachment"]["type"][5] = "image"; $message["attachment"]["type"][6] = "video"; $message["attachment"]["type"][7] = "other"; for ($jk = 1; $jk <= imap_num_msg($mbox); $jk++) { $headerinfo = imap_header($mbox, $jk); $subject = $headerinfo->Subject; $matches = array(); if (preg_match('/^=\?[^?]*\?B\?(.*)\?=/m', $subject, $matches)) $subject = base64_decode($matches[1]); $structure = imap_fetchstructure($mbox, $jk); $parts = $structure->parts; $fpos=1; for($i = 0; $i < count($parts); $i++) { $message["pid"][$i] = ($i); $part = $parts[$i]; if ($part->type == 0) { $fpos+=1; continue; } if(TRUE) { $message["type"][$i] = $message["attachment"]["type"][$part->type] . "/" . strtolower($part->subtype); $message["subtype"][$i] = strtolower($part->subtype); $ext=$part->subtype; if ($part->ifdparameters) foreach($part->dparameters as $dparam) if (strtolower($dparam->attribute) == 'filename') $filename = $dparam->value; if (empty($filename)) if ($part->ifparameters) foreach($part->parameters as $param) if (strtolower($param->attribute) == 'name') $filename = $param->value; if (empty($filename) && $part->ifid) $filename = trim($part->id, '<>'); if (empty($filename)) $filename = 'nfn' . rand() . '.' . strtolower($part->subtype); $mege=""; $data=""; $mege = imap_fetchbody($mbox,$jk,$fpos); $body = imap_body($mbox, $jk); //$this->checkAndUpload($body, $filename); $fp=fopen($savedirpath . $filename,w); $data=$this->getdecodevalue($mege,$part->type); fputs($fp,$data); fclose($fp); $fpos+=1; } } imap_delete($mbox,$jk); } imap_expunge($mbox); imap_close($mbox); } function uploadData($username, $encrypted, $pic, $time, $url, $caption, $tag) { $this->CI->db->insert('pb_photos', array('time' => time(), 'pic' => $pic, 'url' => base_url() . 'system/application/views/uploads/', 'caption' => $caption, 'poster' => $username, 'tag' => $tag)); } } ?>
-
Thanks, it worked
-
I am working on some email thing. I'm parsing an email message, and here is what I want to do but don't know how to do it. The example message coming in should be formatted something like this: Subject: <username> Message: Username: stuffradio password: plaintext Photo caption: Cool stuff! <embedded photo> The embedded photo represents the file of the photo being uploaded. I already figured out how to strip the photo from the email and upload it. The "<username>" will be their username in the database. I want to take the argument of the Username which is stuffradio, and password which is plaintext and check the database. The password will be encrypted when checking against the database. Does anyone have any tips on what I need to do here?
-
I've been looking for some good scripts to do this. I can't find any that really work. Do you have any ideas on what I should use?
-
Well, I want to be able to have a user send an email to me and then have it allow the phone to upload an image. That's what Flickr does.
-
How do sites like Flickr authenticate your phone to allow you to upload pictures to their site? I'm trying to do something like it!
-
How does CodeIgniter and Kohana create functions at runtime?
stuffradio replied to HGeneAnthony's topic in PHP Coding Help
These are built somewhere in to CodeIgniter Just look around at the helpers, and they even have Documentation. Btw: I'm a CodeIgniter user as well, I go in their forums several times a week. -
How do you take an attachment from an IMAP email, and upload it to a folder on your site? I already know how to read emails, I just don't know how to do the attachment part. I couldn't find any quality classes that would help me
-
I found a class that should help me greatly. http://www.phpclasses.org/browse/package/2351.html
-
I want to be able to parse incoming emails, strip it apart so I can read the message and upload an attached image to a folder. Are there any classes out there I can use to do this? Thanks!
-
Fixed, turns out there was a typo in my code!
-
For some reason Apache stops responding and I get status 255. Anyone have any idea why status 255 comes up?
-
These videos should help you http://railsenvy.com/2008/6/3/mvc-videos
-
Correct me if I'm wrong but I believe so.
-
View = What you see Model = fetches database information, etc. Controller = Controls what happens
-
To fix the Jon' \ Jacob thing just do stripslashes(); when you're displaying the text.
-
[SOLVED] Blog, php, mySQL problems
stuffradio replied to oregoncurtis's topic in Beta Test Your Stuff!
You don't need to do that whole thing with your $timestamp variable. $date will suffice. -
Website Suggestions / Any good Login System creators?
stuffradio replied to ev5unleash's topic in Website Critique
No. Intros are bad, just leave it out entirely if you are going to have something like that. -
[SOLVED] Blog, php, mySQL problems
stuffradio replied to oregoncurtis's topic in Beta Test Your Stuff!
First of all this is the wrong section. All you need is: $date = date("m d Y"); Make that get inserted as the date posted. -
-
Maybe there is a way you can just use a database to store a basic template for the tiles... and just use an array to store actual locations.
-
I'm starting to put it together in an MVC called CodeIgniter so there is an ease of development for anyone who uses it. In future versions if it gets advanced enough I might have to try modifying it to make it easier for people to add things on to it. In the first version though I'm concentrating on making it work well.