Jump to content

dj-kenpo

Members
  • Posts

    155
  • Joined

  • Last visited

    Never

Everything posted by dj-kenpo

  1. not sure what I am doing wrong. I am trying to send an email and I can send the html part, and the image works INLINE as a background, but I CANNOT get the text/plain background alternate version to work at all. it just shows up as an attachment or not at all can anyone see what I am doing wrong??? -------------------- $headers = "From: me <$admin_email>\r\n"; $headers .= "Reply-To: $admin_email\r\n"; $headers .= "Return-Path: $admin_email\r\n"; $headers .= "MIME-Version: 1.0 "."\n"; $headers .= "Content-Type: multipart/related; boundary=\"multipart_related_boundary\" This is a multi-part message in MIME format."; $inline = chunk_split(base64_encode(file_get_contents("image.jpg"))); ob_start(); //Turn on output buffering ?> --multipart_related_boundary Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <style type="text/css"> <!-- .style2 {font-family: Georgia, "Times New Roman", Times, serif; color: #5D6568; font-size: 18px; } a {font-family: Georgia, "Times New Roman", Times, serif; color: #5D6568; font-size: 12px; font-weight: bold;} --> </style> </head> <body bgcolor="#ffffff" text="#000000"> <table width="600" height="500" border="0" cellpadding="0" cellspacing="0" background="cid:image_identifier"> <tr> <td width="108" height="165"> </td> <td width="319"> </td> <td width="173"> </td> </tr> <tr> <td height="25"> </td> <td><div align="center" class="style2"><? print "$fromFirstName $fromLastName"; ?></div></td> <td> </td> </tr> <tr> <td height="90"> </td> <td> </td> <td> </td> </tr> <tr> <td height="23"> </td> <td width="319"><div align="center"> <a href="http://<? print $link; ?>">Click Here</a> </div></td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> </table> </body> </html> --multipart_related_boundary Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit this is the plain version of the message that is not working --multipart_related_boundary Content-Type: image/jpeg; name="email_back.jpg" Content-Transfer-Encoding: base64 Content-ID: <image_identifier> Content-Disposition: inline; filename="email_back.jpg" <? print $inline; ?> --multipart_related_boundary-- <?php //copy current buffer contents into $message variable and delete current output buffer $message = ob_get_clean(); //send the email $mail_sent = @mail($toEmail, $Subject, $message, $headers); //if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" echo $mail_sent ? "Mail sent&" : "Mail failed&";
  2. I'm trying to replace occurances of <IMG src="cid:7C9A73FA-F063-4654-8278-80110A5A2B16@local"> type tags in emails displayed in a browser. they come from inline images in emails $cid_counter=0; $body = preg_replace('/"cid:/', '"imap_file_download.php?folder=Inbox&file=0&msgno=289m=view&cid='.$cid_counter++, $body, 100,$cid_count); replaces it, but $cid_counter will not increment (stays at 0 as expected, so will microtime), and $cid_count simply gives me a total number of replacements (and cannot be put back in..) this won't allow me to link the new link to an image, as if there's 5 cid's they now all have the same link. there's no variable to differentiate them.... is there some way I go do a for loop to replace one at a time using the number of replacements?? for instance, if I know there's 2 occurances of cid, can I somehow do another replace and make one designated as 1, and another 2? Thanks
  3. wicked. thanks wildteen! if anyones interested her's the full workign code to increment a filename, if you had an upload system, or in my case, email attachments. function file_name_int_increment($orig_filename, $new_name,$filename_bare,$ext,$array, $count){ if(array_key_exists ($new_name, $array )){ $count++; $new_name = $filename_bare."[$count].".$ext; $count = file_name_int_increment($orig_filename, $new_name, $filename_bare,$ext,$array, $count); }//if return $count; }//end function call the function after you upload the file and store that file name into an array of filenames. in this case my array of filenames is called $attachments. $photos_uploaded = $_FILES['imap_file']; $orig_filename = $photos_uploaded['name']; if(is_array($attachments)){ $ext = end(explode('.',$orig_filename)); $filename_bare = str_replace(".".$ext, "",$orig_filename); $count = file_name_int_increment($orig_filename, $orig_filename, $filename_bare,$ext,$attachments, 0);} } this will correctly format the new filename eg image.jpg image[1].jpg image[2].jpg image[3].jpg if they are the same filename + extension. hopefully that helps someone...
  4. Ok, that did it obviously. silly me. I've never run a function within a function before so i forgot about the count not 'magicly' carrying. I'm dumb. there's still some weirdness though that might be my misunderstanding? after it figures out that say, count should be '6' it will then loop through 6 more times... for no reason, if it were 7, then 7 times, etc.. see the out put if exists-14.gif 0 if exists-14.gif[1] 1 if exists-14.gif[2] 2 if exists-14.gif[3] 3 if exists-14.gif[4] 4 if exists-14.gif[5] 5 elsedd2-14.gif - 14.gif[6] -6 2- will return 6 dd2-14.gif - 14.gif[6] -6 2- will return 6 dd2-14.gif - 14.gif[5] -6 2- will return 6 dd2-14.gif - 14.gif[4] -6 2- will return 6 dd2-14.gif - 14.gif[3] -6 2- will return 6 dd2-14.gif - 14.gif[2] -6 2- will return 6 dd2-14.gif - 14.gif[1] -6 2- will return 6 dd3-14.gif [6] //// 14 /. gif why would it continue running the function? we have our number, the if statment is not fulfilled, and there's nothign telling it to GO back to the function..... very confused...
  5. in this case it gets to 3, which is the correct count, ut then counts back down to 1. it ALWAYS counts back down to 1, instead of returning the value... I don't see how this is possible, it should be done running
  6. it's 3am and I'm going mental, this makes no sense. I have a function that adds a number to a file if it exists ie file[1].jpg file[2].jpg, just incase they're the same name. the function works, ok, but then GOES IN REVERSE...! instead of returnin the value when it get to return; it somehow goes in reverse?! I commented like crazy, so here's the function + results it prints... I've lost my mind... function file_name_int_increment($orig_filename, $new_name,$array, $count){ if(array_key_exists ($new_name, $array )){ print "if exists-$new_name $count<br />"; $count++; $new_name = $orig_filename."[$count]"; file_name_int_increment($orig_filename, $new_name, $array, $count); print "file_name_int_increment($orig_filename, $new_name, $array, $count);<br />"; }//if else{ print "else"; } print "dd2-$orig_filename - $new_name -$count<br />"; print "2- will return $count<br />"; return $count; }//end function $count = file_name_int_increment($orig_filename, $orig_filename, $attachments, 0);} $attachments is my array of filenames... output if exists-14.gif 0 if exists-14.gif[1] 1 if exists-14.gif[2] 2 elsedd2-14.gif - 14.gif[3] -3 2- will return 3 file_name_int_increment(14.gif, 14.gif[3], Array, 3); dd2-14.gif - 14.gif[3] -3 2- will return 3 file_name_int_increment(14.gif, 14.gif[2], Array, 2); dd2-14.gif - 14.gif[2] -2 2- will return 2 file_name_int_increment(14.gif, 14.gif[1], Array, 1); dd2-14.gif - 14.gif[1] -1 2- will return 1 dd3-14.gif [1]
  7. unfortunetly I am selecting from the table on every page load. the system checks if a user already has a session id by searching the table for a session id on this day. if so, it increments the click count by 1, otherwise it inserts a new entry. so it will cause the front end to become slow. right now I have an index on session_id (32 char) user_id and timestamp. I'm worried about 1 year form now when it's ready to burst
  8. well, that is an issue then. the images are fine, render once I always say, but the 100k db limit. I'm keeping my own site stats and it really doens't take long to reach 100,000 hits for a website, so the table will reach 100k, for that part of the table alone, very soon. bots are kept in a seperate table and 1 row per day for ALL bots, so that's not bad, 365 rows per year per user, but the main human stats table is growing fast. not sure if I should cut it up and create a seperate table for daily stats and then have it delete the extra records from the main table, so it works as a sort of temp space... or just say screw it and get more server horse power... the problem with creating daily stats then becomes how do you store that info (ie top 20 pg view, top 20 referrers + normal hit counts) so that it's also available for a monthly view. storing it as a text field for the 20 items wouldn't work cuz then I couldn't sort 30 days of it well, or I could? I guess php can break the text into array data again but that seems really round about... ahhh cpu.. how you cost me.
  9. acctually, that doesn't really seem any faster than a shared host. I guess shared hosts (some) burst up in speed perhaps? I guess the difference would come in if you had 10 users trying to do this all around the same time, and I had 10 years trying to do this all around the same time, then yours would be faster and mine probably wouldn't run at all.. I'm guessing anyways. that does in a way help, and also not, it still leaves me very confused on the issue, in a way, even more so now.
  10. that's the problem at this point I just have friends on it, so I'm not rolling in the money for the project. I'm on dreamhost shared right now and no, I'm not satisfied with it, but there doesn't seem to be much better. mediatemple seems ok, but also has it's issues, most other shared hosts are crap, low storage/andwidth for higher cost. the vps would be another bottleneck but at say $50-100/month atleast nto crazy in price. I'm even considering a server colocation and just throwing in a 1 or 2ghz system on it, it would be cheaper then a comparible dedicated, and really, probably not that many issues. but that's all off topic... some of my issues are in say a simple resize/crop, taking a 2megapixel digicam image, inside a folde,r maybe there's 200 images, then runnign it through a first crop, that make sit either 500wide or 500px tall (depends on portrait or landscape) as well as a cropped 140px x 105px thumb. simpel really, but on both my laptop (1.3ghz pentium mobile, equiv to 2.2ghz p4) and on dreamhost, I get about 19 images and then a stall a 30 second, script kill. not a huge issue, I coded in a line to make it stop at 15 then give a button to continue onto the next 15, but on a vps or shared this *might* not be as much of an issue? what sort of speed do you get comparativly then, as you asked for an example.
  11. (take this lightly, I'm not an idiot, so yes I know there's no deffinate answer!) how do you tell how much cpu your app requires? can anyone give examples as to user count/ app complexity? I'm doign a content management system, right now mostly for friends while I beta it, and it's doing fine with 10+ users on shared hosting. the front end is slowly being converted so it's all cached, so mostly html except for when soemthign changes and is rebuilt. the backend is not insane, but not light either mysql calls + lotta looping arrays etc. image manipulation scripts that are pretty long running building 8 different images for each one added sometimes (various thumbnails...) so when does someone switch from shared-> vps -> dedicated? what sort of numbers slash complexity would you wager for YOUR app...? I'd like to avoid paying $100/month as long as possible, but obviously also not go that route to soon if $20 will cut it
  12. re: asp. HAHHAHA, woops. wasn't even thinking! stupid me....
  13. cool, 1 down. 4+ to go. also need to disable asp, jsp ruby, etc. I wonder, you can tell apache to parse say, .rss as a php file. perhaps I can just do the reverse and tell it to parse EVERYTHING on this domain as .html. so nothing dynamic can possibly run. but how do I place the htaccess file outside of the domain directory and then refrence THAT domain only?
  14. Weird question to ask on the php forum I know ... I want to have a small add on for my main site that's an open ftp area (ftp.domain.com). private, but really, people share passwords etc so not so private when all is said and done. problem is, I don't want people uploading php scripts and running something like, ../main_domain/ delete everything script. It's to be used for images only, a sort of temp folder online. (ie, webforms are slow and annoying for large numbers of files...) can I disallow php/asp/jsp and anything else (you can think of) dangerous via an htaccess command? also, can the htaccess file for that be outside of the root directory? otherwise anyone can delete it...
  15. coolio, didn't know about glob.. and I wouldn't have known how to find it either, "glob? ya, I had one of those under my bed last week. nasty monsters, never had one in the closet though..."
  16. is it possible to delete a file and use an asterix? (or any wildcard) ie, I tried @unlink(Username_CV_."*"); and @unlink(Username_CV_.*); to no success. the ending is a date, so it could be Username_CV_june27_2007 or aug31 or whatever, and obviously I don't want to delete ALL the files from other users as well... I guess I could store the file name in a table, but it would be nicer to not need that to simply delete simple a file... thanks!
  17. just wondering what system everyone, or anyone(?) uses to create pdfs? php has a built in one, then there's ezpdf, which is an add-on? and I think a few others? anyone have an opinion on which is best? I got confused real fast as you have to count from the bottom UP and I for the list I want to export, some things are 1 line, some 3 lines, etc, so counting up looks confusing... especially I don't even know how to gauge what's one line or not... eg, 100chars of i and 100chars of Z take up a different amount of space... Thanks in advance for any opinions, name calling, arguments, or hair pulling that may ensue
  18. most shared hosts disable the ability for subdomains unless you use their panels. simple htaccess won't work
  19. dude, I'm not shouting, I'm just using bold to reiterate. this: $Timestamp_today = strtotime ("July 28 2007"); gives TWO different times on the different servers. this baffles me 1185606000 vs 1185595200
  20. for what I'm doing I DON'T want the hours. I am storing ONE timstamp universal per day. it's to track how many bots hit the site. storing an exact tiemstamp woudl result in thousands of rows per day rather than one with incremental click value
  21. little confused, on my localhost vs my server I get 2 different timestamps for "July 28 2007" same code, $month = date("F"); $date = date("d"); $year = date("Y"); $Timestamp_today = strtotime ("$month $date $year"); my understadnign is they shoudl e the same as all I want to store is month/day/year not hours yet localhost gives me "1185595200" and my host server gives me "1185606000". what am I doing wrong? i just want the bare date with no hours and I'd liekt hem to be the same. and YES my tiem is set correct on my computer and the server is the same, minu it's ina different tiem zone, but again, if hours are ignored, it shouldn't matter.
  22. ya, but to do that correctly you need to change the path. otherwise if you're on a shared server you're counting other stuff. if you even can with the defualt setup.
  23. dude 8ms isn't a problem, do you know how fast 8ms is? if you NEED things to be faster than a few ms, for soem crazy reason, then load everything into ram. the sql table, apache, php etc. 8ms sounds like the harddrive seek time. computers don't do things instantly, it's simply NOT possible.
  24. best way is to not use the default session path. make your own, then count how many session files there are in that directory. google will reveal the exact code of it. it's better than tryin to do any elaborate sql work to 'try' to figure out who's still logged in....
  25. Ya, that makes sense now, thanks guys! I love how everytime I learn soemthign I realize there's 1000's of things I don't know about php.
×
×
  • 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.