Jump to content

damianjames

Members
  • Posts

    46
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Male
  • Location
    Plano, TX

damianjames's Achievements

Member

Member (2/5)

0

Reputation

  1. That was it! Thanks so much... I should read what PHP tries to tell me a little closer, since I've been searching high and low within email.php instead of the language file where it told me to look! Thanks again!
  2. Hi all - It's gotta be something obvious, but I can't for the life of me how I'm sending output in this file before I send a header redirect. Can anyone see it? <?php //Initialize securimage captcha session_start(); require_once('dbconnect.php'); // initialize db connection to populate email address include_once('../securimage/securimage.php'); $language = $_POST['lang']; include($language . ".php"); //Load language file for feedback. TODO: Maintain separate file for this so the script doesn't need to load so many unused variables? $securimage = new Securimage(); if ($securimage->check($_POST['captcha_code']) == false) { die($contact_bad_captcha); } // pump post vars into local vars and clean them up, assign to session to display on contact completion function lang($language) { //Give hidden post var for language a human name switch ($language) { case en: return "English"; break; case es: return "Español"; break; default: return "Español"; } } $reason = htmlentities($_POST['reason'], ENT_QUOTES); $name = htmlentities($_POST['name'], ENT_QUOTES); $email = htmlentities($_POST['email'], ENT_QUOTES); $phone = htmlentities($_POST['phone'], ENT_QUOTES); $cell = htmlentities($_POST['cell'], ENT_QUOTES); $method = htmlentities($_POST['method'], ENT_QUOTES); $comments = htmlentities($_POST['comments'], ENT_QUOTES); $lang = lang($language); // Query for email addresses $query = "SELECT `description`,`email` FROM contact WHERE `code` = \"" . $reason . "\" AND `language` = \"" . $language . "\""; $result = mysql_query($query); while ($row = mysql_fetch_assoc($result)) { $to = $row['email']; $reason = $row['description']; } $subject = "ELP Contact Form Submission From " . $name; $_SESSION['name'] = $name; $_SESSION['email'] = $email; $_SESSION['phone'] = $phone; $_SESSION['cell'] = $cell; $_SESSION['method'] = $method; $_SESSION['comments'] = $comments; // Build the mail object $header = "From: " . $email . "\r\n"; $header .= "Reply-To: " . $email . "\r\n"; $header .= "Bcc: email@address.com\r\n"; $header .= "Content-type: text/html; charset=iso-8859-1\r\n"; $message = "Reason: " . $reason . "<br>"; $message .= "Name: " . $name . "<br>"; $message .= "Email: " . $email . "<br>"; $message .= "Phone: " . $phone . "<br>"; $message .= "Cell: " . $cell . "<br>"; $message .= "Method to contact: " . $method . "<br>"; $message .= "Comments/Questions: " . nl2br($comments) . "<br>"; $message .= "Language: " . lang($language); // Send it after checking that variables are set correctly if (isset($name) && isset($email) && isset($method) && isset($comments) && isset($header) && isset($message)) { mail($to, $subject, $message, $header); header("Location: ../contactcomplete.php?lang=" . $language); // Forward to completion page which displays what was sent } else { echo $contact_general_error; //Unknown error } ?> Warning: Cannot modify header information - headers already sent by (output started at /home1/supresen/public_html/configs/es.php:1) in /home1/supresen/public_html/configs/email.php on line 67 Thanks for the help!
  3. Hi all - I'm writing a little piece of blog software for the pastor of my church, and I'm wondering database-wise how to attack it. When it comes to performance, when you have a small amount of rows being returned from a relatively small dataset, is it more efficient to store everything in one table? id (PK) date (date) title-es (varchar) title-en (varchar) post-es (text) post-en (text) author (enum) category (varchar) active (bool) The main question I'm concerning myself with is to split the languages or not. Thanks!
  4. Security settings in at least some of the browsers (maybe works still in IE, haven't checked) prevent you from opening things with file:///c:/whatever.
  5. Have you tried applying it to the image rather than the UL? You can also try using line-height or a percentage (can be negative) instead of middle for vertical-align for more fine-tuned alignment.
  6. Hi all - I am building a site that needs to support multi-language with an iframe for content. The design has the language selector at the top outside of the iframe, and a music player at the bottom outside the iframe. The language files reside in includes that are accessed by checking $_COOKIE and/or $_GET switch statements. What I'm trying to figure out is if someone has chosen a language, navigated to a different content page than what loads by default in the iframe, then switches the language again, how can I reload the the index and the chosen content page in the new language? I'd hate to have them need to re-navigate to where they were in they switch languages. Maybe edge case and I'm worried over 1% of people who would select another language after clicking into a page, but it does need to be kind of newbie/oldie-proof. I'm also conflicted on where to post this - I'm working the language switch out in php, wondering about an html target and page reload, and guessing that maybe this might be accomplished with ajax. Apologies if I'm posting in the incorrect spot. Attached screenshot gives a better idea of my conundrum (I hope!) [attachment deleted by admin]
  7. You can use limited CSS in email, but it has to be inline, and you pretty much need to stay away from structural elements (position:absolute and whatnot). With structure you are pretty much limited to tables if you want to be safe.
  8. That'd be my inexperience rearing its ugly head! Thanks again to both of you.
  9. You sir - rock, and if I had a cannon I'd salute you. Thanks a ton!
  10. Thank you very much for the help! I'm going to go try that out... in the meantime, sorry for not showing the arrays - here they are. inputname array: Array ( [0] => V1_1 [1] => V1_2 [2] => V1_3 [3] => V1_4 [4] => V1_5 ) link array: Array ( [V1_1] => http://1.com [V1_2] => http://2.com [V1_3] => http://3.com [V1_4] => http://4.com [V1_5] => http://5.com ) Edit: Err there's a problem, now isn't there... $link is not an indexed array.
  11. I'm starting a new topic because I figured out my previous issue, now onto my next challenge! I have an array from a session, and an array from post. I'm trying nested foreach loops, but I can't seem to get it correct. The session array ($inputname) is storing a string that I am identifying the previous screen's text input with (name parameter), and the post is the value of the text input ($link). $inputname is also the name of each image I want to display minus the file extension. I want to cycle through each and use $link as the source for an anchor tag, and use $inputname to identify the image to display. What I initially tried was: foreach($inputname as $value) { foreach($link as $value1) { echo "<tr><td><a href=\"" . $value1 . "\"><img src=\"" . $value . ".jpg\" /></a></td></tr>"; } } I also tried using a for loop within the outer foreach and I haven't gotten that to work either. I've tried explode/implode/extract/pray_for_mercy on one or both of them to see if I can somehow split one into separate variables, but nothing has given me what I need. I hope someone has an idea on what to do! Thanks in advance for the assistance.
  12. Well I'm farther along... I got the session and post vars into an array, but now I need to figure out the nested loops to display the data correctly. I have the text input names ($inputname) in an array, and I have the text input value ($link) in an array. What I need to do is wrap each input name with each text input value, so a nested loop should (somehow) do it. The input name serves as the variable for the image to display, and the text input value serves as the src in the anchor tag around each image. I've tried things like: foreach($inputname as $value) { foreach($link as $value1) { echo $value $value1; } } and foreach($inputname as $value) { for($counter = 1; $counter = <= $imagecount; $counter++) { echo $value $volume . "-" . $counter } } and nothing has worked. I also tried the extract() command, but since I don't know beforehand how many images are going to be pulled, I don't know how many variables will be produced, so I'm not sure that's going to help. Any pointers?
  13. Well I got a little farther in that now I have an array to work with, but I still don't know how to assign each item in the array to a different session variable. From page 2 now: $url = array(); for ($counter = 1; $counter <= $imagecount; $counter++) { $url[$counter] = $volume . "-" . $counter; echo ("<tr><td valign=\"middle\"><img src=\"images/$volume-$counter.jpg\"></td><td><span style=\"font-weight:bold; color:red;\">$volume-$counter.jpg</span><br /><input type=\"text\" name=\"$url[$counter]\" size=\"50\" /><br />Enter link for image if required</td></tr>"); } echo "</p>"; $_SESSION['imagecount'] = $imagecount; $_SESSION['directory'] = $directory; var_dump($url); The var dump says: array(5) { [1]=> string(3) "1-1" [2]=> string(3) "1-2" [3]=> string(3) "1-3" [4]=> string(3) "1-4" [5]=> string(3) "1-5" } The input text name is now assigning out of the array as well. That's good, now if I can get each item in the array into a session variable we're cookin' with gas.
  14. Hi all, I'm stuck! Ok... let's see if I can explain this one... I have a series of three pages to build an HTML email. I'm about to work on the third one, and I need to assign the names of the text inputs to session variables on this page. The text input names are derived based in part on user input, and in part on counting the number of images in a directory with the number they assigned in the first page as part of the file name. I'll include what I have so far from all 3 pages for completeness. Page 1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Newsletter Builder Screen #1</title> </head> <body> <form action="newsletter1.php" method="post"> <input type="text" name="to" size="50" /> TO: address<br /> <input type="text" name="volume" size="5" /> Volume number<br /> <p>Are the last 3 images together on 1 line?<br /> <label> <input type="radio" name="multimage" value="1" /> Yes</label><br /> <label> <input type="radio" name="multimage" value="0" /> No</label> </p> <input type="submit" value="Submit" /> </form> </body> </html> Page 2: <?php session_start(); if($_POST['to'] != "") { $_SESSION['to'] = $_POST['to']; } else { die("<h3>Please press the back button and fill in the TO: address field</h3>"); } if($_POST['volume'] != "") { $_SESSION['volume'] = $_POST['volume']; } else { die("<h3>Please press the back button and fill in the Volume number field</h3>"); } if(isset($_POST['multimage'])) { $_SESSION['multimage'] = $_POST['multimage']; } else { die("<h3>Please press the back button and select if the last 3 images in the list display 3 across</h3>"); } $to = $_SESSION['to']; $directory = "images/"; $volume = $_SESSION['volume']; $multimage = $_SESSION['multimage']; $imagecount = count(glob($directory . $volume . "*")); if ($imagecount == 0) { die("<h3>No images were found for Volume number $volume</h3>"); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Newsletter Builder Screen #2</title> </head> <body> <form method="post" action="newsletter2.php"> <table> <?php echo "<p>The TO: address has been set to: " . "<span style=\"font-weight:bold; color:red;\">" . $to . "</span><br />"; echo "The Volume number for this newsletter has been set to: " . "<span style=\"font-weight:bold; color:red;\">" . $volume . "</span><br />"; echo "The following images have been selected to include in this newsletter:<br />"; $images = glob($directory . $volume . "*"); foreach($images as $image) { echo "<span style=\"font-weight:bold; color:red;\">" . $image . "</span><br />"; } echo "</p><p>"; for ($counter = 1; $counter <= $imagecount; $counter++) { echo ("<tr><td valign=\"middle\"><img src=\"images/$volume-$counter.jpg\"></td><td><span style=\"font-weight:bold; color:red;\">$volume-$counter.jpg</span><br /><input type=\"text\" name=\"$volume-$counter\" size=\"50\" /><br />Enter link for image if required</td></tr>"); } echo "</p>"; $_SESSION['imagecount'] = $imagecount; $_SESSION['directory'] = $directory; ?> </table> <input type="submit" value="submit" /> </form> </body> </html> Page 3 is the issue... Notice on page 2 I'm setting the name of the input text based on the volume code entered, and counting up to the total number of images that fit the description then cycling through that total count. <input type=\"text\" name=\"$volume-$counter\" size=\"50\" /> What I need to do is dynamically setup session variables based on the total amount of text inputs that have been posted from the previous page. In the test environment I have, there are 5 images in the directory (1-1.jpg through 1-5.jpg). Here is the code for page 3: <?php session_start(); $to = $_SESSION['to']; $volume = $_SESSION['volume']; $multimage = $_SESSION['multimage']; $directory = $_SESSION['directory']; $imagecount = $_SESSION['imagecount']; for($counter = 1; $counter <= $imagecount; $counter++) { $_SESSION['$volume-$counter'] = $_POST['$volume-$counter']; } var_dump($_SESSION); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Newsletter Builder Screen #3</title> </head> <body> </body> </html> For those wondering, no, what I did there did not work! heheh I'm thinking I should be able to iterate through an array somehow but I just can't get around how to do it. I appreciate any help!
×
×
  • 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.