Jump to content

denewey

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

denewey's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have a php database search engine that works great, only thing is all results display on one page. I'm trying to figure out a simple handling for breaking it down 20 results to a page without passing the db query results from page to page. Is there a way to formulate a sql query so it gives me the first 20 results, then the next 20 results, etc.? Or is there some other simple method. the only options I'm looking at right now are: 1. re-execute the sql query on each page and only display the results desired (i.e. if you want results 21 - 40 loop through the first 20 but don't display them... OR 2. Save all results in an array and pass it page to page and display the desired results from that array. I can't help but think there is a simpler method. Any ideas?
  2. I cannot seem to get multiple attachments to send with the php mail function. I am able to send an individual html attachment, but now I am trying to add an image attachment and it doesn't go. With the additional code for the image attachment the mail sends the first attachment but not the second. Here is the code I have: function mail_attached($to, $from, $subject, $message, $filename, $headers = '') { $unique_sep = md5(uniqid(time())); $headers .= "From: $from\n"; $headers .= "MIME-Version: 1.0\nContent-Type: multipart/mixed;boundary=\"$unique_sep\";\n"; $headers .= "charset=\"iso-8859-1\"\nContent-Transfer-Encoding:7bit\n\n"; $headers .= "If you are reading this, then your e-mail client does not support MIME.\n"; $headers .= "--$unique_sep\n"; $headers .= "Content-Type: text/html; name=\"" . $filename[0]['filename'] . "\"\n"; $headers .= "Content-Transfer-Encoding: 8bit\n"; $headers .= "Content-Disposition: attachment; filename=\"" . $filename[0]['filename'] . "\"\n\n"; echo "The file name1 is {$filename[0]['filename']}<br>";//DEBUG $filedata = implode("", file($filename[0]['file'])); $headers .= $filedata . "\n\n"; $headers .= "--$unique_sep--\n"; $headers .= "Content-Type: image/jpg; name=\"" . $filename[1]['filename'] . "\"\n"; $headers .= "Content-Transfer-Encoding: base64\n"; $headers .= "Content-Disposition: attachment; filename=\"" . $filename[1]['filename'] . "\"\n\n"; echo "The file name2 is {$filename[1]['filename']}<br>";//DEBUG $filedata2 = implode("", file($filename[1]['file'])); $headers .= chunk_split(base64_encode($filedata2)); $headers .= "--$unique_sep--\n"; mail($to, $subject, $message, $headers); } $date = time(); $handle = fopen("./forms/form12b25-" . $date . ".htm", "w+"); if($handle) { fwrite($handle, $HTML); fclose($handle); $f_array_1 = array('file'=>"./forms/form12b25-" . $date . ".htm",'mimetype'=>"text/plain",'filename'=>"form12b25-" . $date . ".htm"); $f_array_2 = array('file'=>"ballot-checked.jpg",'mimetype'=>"image/jpg",'filename'=>"ballot-checked.jpg"); $file_array = array($f_array_1, $f_array_2); mail_attached("denewey@gmail.com", "12b25@edgarfilingagent.com", "form12b25 Submission", "form12b25 Submission Generated", $file_array); Does anyone have an idea of what I'm doing wrong? In the two debug lines where I echo the file names I am getting the correct names for each file. Thanks
  3. Hi, I installed secureimage CAPTCHA from a quick start guide at http://www.phpcaptcha.org/ in one application and it worked fine - no glitches. I then installed it in another application and it failed. The second application had a mod_rewrite file structure and I don't know if that is what was throwing it off. To get it to work I ended up using an absolute path to the file that creates the captcha image (secureimage_show.php), like so: <img id="captcha" src="http://www.edgarfilingagent.com/wp-content/themes/edgar/securimage/securimage_show.php" alt="CAPTCHA Image" /> For the reload of the image I also used an absolute path to the image generating file, BUT this does not work: <a href="#" onclick="document.getElementById('captcha').src = 'http://www.edgarfilingagent.com/wp-content/themes/edgar/securimage/securimage_show.php' + Math.random(); return false">Reload Image</a><br /> With this the functionality of checking the code submission works properly, BUT the reload of the image does not work. When I click on "Reload image" I get the ALT text. I'm perplexed why the absolute path works for initial loading of the page/image but doesn't when I try to reload the image and don't know if it's the mod_rewrite or the javascript operating in that environment or something with the php image generating file or what. Any suggestions?
  4. It turned out that the image file itself was not being given the permissions of the directory it was uploaded to so I had to do "chmod($fpath,0644);" to change the permissions of the file after it was uploaded.
  5. Thanks for your response. To answer your question: {} are needed for interpolating array elements and complex object references inside double quotes. For the purpose of my script they are not needed, but another developer added them in an attempt to help me sort out this problem. I tried your solution of getting everything into double quotes and that didn't work either. I did discover that on the display of the page when I right click on the image and select 'view image' I get a 403 Forbidden error - "You don't have permission to access photos/xxx.jpg on this server." Any idea what that's all about? I made sure I had the right permissions on the directories and the dummy image displays from the same directory. Is there some handling of permissions I need to do for an uploaded file?
  6. I have a very strange thing happening on something I’m developing. I don’t know whether it’s a PHP problem or HTML or something else. It is a page for a profile of a client of the web site, which allows the client to upload a photo. I have a dummy image that’s displayed before the client uploads the image. When the client uploads the new image though, it will not display. I have verified that the image actually gets uploaded. It’s in the same directory as the dummy image. The img tag contains the same path to the new img as with the old dummy image yet the new image will not display. I’ve also verified that the database does get updated with the name of the new image. Everything seems to be as it should be, yet the image does not display. It has got me baffled! Below is the text that handles the image display: <?php $photo_display = "<img src='/photos/"; $get_photo = mysql_query("SELECT photo FROM client_profile WHERE client_id = '{$cid}'"); list ($photo) = mysql_fetch_row($get_photo); if($photo != "") { $cphoto = "photos/{$photo}"; $img_size = getimagesize($cphoto); $adjust = $img_size[0]/100; $wide = $img_size[0]/$adjust; $wpos = strpos($wide, "."); if($wpos !== false) { $wide = substr_replace($wide, "", $wpos); } $high = $img_size[1]/$adjust; $hpos = strpos($high, "."); if ($hpos !== false) { $high = substr_replace($high, "", $hpos); } $photo_display .= "{$photo}' width='{$wide}' height='{$high}' />"; //THIS ONE DOESN’T DISPLAY } else { $photo_display .= "blank_head.jpg' />"; // THIS ONE DISPLAYS ON THE PAGE } echo $photo_display; ?> Does anyone have any idea what I’m running into? ??? denewey
×
×
  • 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.