Jump to content

IanArcher

Members
  • Content Count

    115
  • Joined

  • Last visited

Everything posted by IanArcher

  1. Ok, using this setup or building off of it (because i've never used AJAX before) how would I implement that? If possible, can you provide some coding snippets?
  2. I'm writing an application using PHP and MySQL that is a TV Guide/TV Listings to pull the results of the following fields: id – int(11) name – varchar(255) chan_position – int(3) src_image – varchar(255) time – varchar(255) title – varchar(255) date – varchar(25) This is the code I've tried so far that basically displays all results as a table: <?php require('db.php'); ?> <div class="container"> <? //Start table echo "<table id='guide'>"; echo "<th>Channel</th>"; echo "<th>Title</th>"; e
  3. You're right, It's pretty tricky, but I managed to achieve what i wanted with this: <script type="text/javascript" language="javascript"> window.onload = function() { $('.form_input_select[name="Country[]"]').attr("value","PSC"); /*$('.form_input_select[name="REGION[]"]').html('');*/ /*$('.form_input_select option[value=""]').attr("selected","selected");*/ $('.form_input_select[name="Country[]"]').live('change', function(e) { var pay = $(this).val(); $.get('/m/events/home/?ajax=state&
  4. I commented out those lines of code: /*$('.form_input_select[name="REGION[]"]').html('');*/ /*$('.form_input_select option[value=""]').attr("selected","selected");*/ $('.form_input_select[name="Country[]"]').live('change', function(e) { var pay = $(this).val(); $.get('/m/events/home/?ajax=state&country='+pay, {}, function(r) { $('.form_input_select[name="REGION[]"]').html(r); }); }); $('.form_input_select[name="REGION[0]"]').html(''); /*$('.form_input_select option[value=""]').attr("selected","selected");*/ $('.form_input_select[name="Country[0]"]').live('cha
  5. In essence, PHP is putting out the list of options to the dropdown, but the person before used this javascript code to work with the Country dropdown. Before the Region dropdown was a standalone field filled with options from the database using PHP. And on a slower connection, you can see the pre-populated value that the user has chosen for their region, until the page is finished loading and the Javascript overwrites it to be blank. I only want the javascript to stop doing that until the Country menu is changed. Does that look possible in the code?
  6. Thanks for the response, there is an existing code for this on the site i'm doing it for, i was just thinking of reinventing it. Here it is, i've highlighted the part i'm referring to: <script type="text/javascript"> var oBxUserStatus = new BxUserStatus(); oBxUserStatus.userStatusInit('<bx_url_root />', __is_profile_page__); /** * Zehair : */ $(document).ready(function() { /*** Region Code Starts Here ***/ $('.form_input_select[name="REGION[]"]').html(''); $('.form_input_select option[value=""]').attr("selected","selected"); $('.form_input_select[name="Country[]"
  7. Hello,I need a some assistance with this javascript/jquery script.I have a page where Every Region/Province/State is a MySQL table called `States`Organization: There is a dropdown menu called Province, that has all these Regions in it. I'm trying to make it so that when a user selects a country from the Country dropdown menu: <select add_other="" multiplyable="true" class="form_input_select" name="Country[]"> The Province drop-down menu below it runs a query to show all States/Provinces that belong to the Country selected and filters/strips out the others that don't. <select ad
  8. Agreed, also Apple iPhone Mail doesn't use text/html Content, it uses text/plain. No matter where you add a photo into the body as well, no image tag will show up. Just the photo's Content headers. The most logical thing to do would be just to extract the plain text from the body. I considered writing a script to create img tags where those photo insertions should be, but that would require appending the parts together somehow, set a default image size say 400x350 (But that presents even more complications), and changing the header to text/html. But that literally seems near impossible to do a
  9. I managed to get around this and successfully deal with this image looping & image naming process by using a recently published class found here:http://www.electrict...ge-attachments/ and followed up that class by using it as an include in the script that creates variables such as $text_part, $html_part, and wrote the following: /**** The below sequence manages IMAGE Tags in E-mail are supplied by direct URL links ****/ if (preg_match_all('/<img\s+([^>]*)src="http(s)?:\/\/(.*)"/i', $emailMessage->bodyHTML, $matches)) { echo '<br />Detected E-mail Client uses URL lin
  10. Wow to be honest, i really have no idea where to start off writing something for that. Again, not asking to be spoonfed, but maybe some example code please?
  11. How could i start to write something like that? Any specific functions>? Because this sounds similar to the example code you gave for the $fname = ''; $cid = '';
  12. I wrote something to deal with filenames in the MIME headers that causeuse individual names like that, which can cause overwriting, no where i need to save the attachment with that filename that has been modified is the issue. This is somehwere earlier in the script where attachments and filenames for them are processed: // DECODE DATA $data = ($partno)? imap_qprint(imap_fetchbody($mbox,$mid,$partno)): // multipart imap_body($mbox,$mid); // not multipart // Any part may be encoded, even plain text messages, so check everything. if ($p->encoding==4) $data = quoted_printable_de
  13. Another realization i had is that, because the script i'm using to replace the src attribute's value of an image tag with that of the filename for the CID element in the MIME headers, once a filename is renamed, the replace will be useless if the file that has been saved has been renamed. So the image tag's src won't be pointing to an actual file anymore
  14. Images are saved using: // process attachments foreach ($attachments as $imageFilename => $data) { // places all attachments in the directory defined by $aSubject file_put_contents("$aSubject/" . $imageFilename, $data); } Will that be an issue or just follow what you suggested?
  15. I know it exists somewhere along that lines of using the function, but i mean, during testing, i had an email with 3 .jpeg images sent from Gmail and in the MIME Headers they are all named image.jpeg, and when it came down to saving them only one got saved, so renaming must take place before saving.
  16. coutning the parts in the email was pretty simple: $struct = imap_fetchstructure($mbox,$no); $num_parts = sizeof($struct->parts); It's just the issue where some email clients give their attachments with the same extension the same filename, for e.g. image.jpegBecause when i test with an email with multiple attachments and have them saved to a directory, only one file gets saved.If been researching a way to possibly modify the MIME header if the value of a name of filename attribute is already present in the email, but that's an issue because the attachment part on the script
  17. That's true, i see what your getting at. I'll work on that counting the parts in the email returned from imap_fetchstructure, then i'll have a clearer view of replacing multiple cid: images with the actual file.
  18. I hard-coded $num_parts like that only for a short time, I intend of getting the exact number for it after i had completed this part of the testing actually. I moved the $images array out of the for loop for $num_parts, yet still only one image is being properly replaced, the other still remains a cid: entity.
  19. So i made my edits to the code you gave, and it does the replacement, yet the test email i'm working with has two image tags in the body, and it only replaces on. I've been working for a while now trying to get it to jump to other image tags in the body to do replacements with the proper filenames for all of them, but no luck. Used preg_match_all, if statements, even tried putting the code in a function called imageConvert. Forgive me if this is simple to you, I'm still unclear on how i should arrange it to properly replace all the image tag's sources with the filenames even after re-reading t
  20. I was looking at it in the actual for loop and saw the $num_parts variable and trying to figure if something was being done with it, because i never actually used a for loop, only foreach loops before and it should've occured to me anyhow, but what should it be actually? I'm not to sure myself.$num_parts = ''; or $num_parts = array();
  21. So if i have: for($i = 1; $i <= $num_parts; $i++){ $fp = fopen('mimeheaders.txt', 'w'); $mimepart = imap_fetchmime($mbox, $no, $i); //1st part fwrite($fp, $mimepart); fclose($fp); $mimeSave = file_get_contents('mimeheaders.txt'); //save a copy of the headers $images = array();} Is that what you're referring to when you say Using a regex right? I'm not that sure about how to go about beginning to write something like that. Could this be an example of what you are referring to? $attachments = array(); // PARAMETERS // get all para
  22. Ok so following your guide justsomeguy, i have happed the CID to the names using: echo '<br />Array Joins<br/>';$mergeArr = array_combine($nameArr, $cidArr);echo '<pre>';print_r($mergeArr);echo '</pre>'; Which prints Array JoinsArray( [Image1[2].gif] => 813DEC0642E941F0845447B680DA566A@BrinardHP [Image2[2].gif] => 6829CB8F2D5D43AAB115DE06572E770A@BrinardHP [] =>) Just to be sure, is this the kind of mapping process you were referring to? If so i was trying to search the array using regexp to test it but it kept throwing the expects parameter to be
  23. Also, i am using the below code to strip off the 'cid:' string from the CID match, but it keeps throwing the else message: if(array_search('cid:', $srcArr)){str_replace('cid:', '', $srcArr);} else {echo 'No cid affix found<br />';} echo '<hr>'; I used,in_array and preg_replace to no avail. Any ideas? It's how i am going to match up the content-id values with the cid matches.
×
×
  • Create New...