Jump to content

Drummin

Members
  • Posts

    1,003
  • Joined

  • Last visited

Everything posted by Drummin

  1. Thank you SO MUCH requinix. The script as it was worked when I did a stand alone test in a plain text email. I had then converted the email to send both plain and html versions and that's when I ran into trouble. The boundary at the bottom of the loop was the major problem and I also changed the sans-boundaries as you suggested and everything works great. Thanks again for your help.
  2. I'm using a foreach loop to attach an array of images to email. Emails are being sent with attachments however I am short one attachment every time. I'm thinking it has to be the $mime_boundary (dashes) and I've tried many combinations and the commented out IF statement to no avail. Can someone spot the problem? The attachment section is as follows. # Attachments would go here $x = 0; foreach($files as $thefile){ $file = fopen($thefile,"rb"); $data = fread($file,filesize($thefile)); fclose($file); $data = chunk_split(base64_encode($data)); $body .= "Content-Type: {\"image/png\"};\n" . " name=\"$thefile\"\n" . "Content-Disposition: attachment;\n" . " filename=\"$thefile\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n"; $body .= "--$mime_boundary\n"; /* if($x == (count($files)-1)) { $body .= "--$mime_boundary--\n"; } else { $body .= "-–$mime_boundary\n"; } $x++; */ } # End email $body .= "--$mime_boundary--\n"; # <-- Notice trailing --, required to close email body for mime's
  3. DUH. Sorry I didn't see that. Thanks for your help and quick response. Worked perfectly.
  4. I'm not sure if this problem is related to the query style or my JOIN. Tried LEFT JOIN and straight JOIN. The following works fine. $sql_statement = <<<END_OF_SQL SELECT DISTINCT(`rr`.`GuestID`) AS `Guest ID`, `rr`.`FromDate` AS `Check In Date`, `rr`.`ToDate` AS `Check Out Date`, `g`.`firstname` AS `First Name`, `g`.`lastname` AS `Last Name`, `g`.`email` AS `Email`, `g`.`phone` AS `Phone`, `g`.`address` AS `Address`, `g`.`city` AS `City`, `g`.`state` AS `State`, `g`.`country` AS `Country`, `g`.`zip` AS `Zip`, `g`.`user_id` AS `User ID` FROM `room_reservations` as `rr` LEFT JOIN `guests` AS `g` ON `g`.`user_id` = `rr`.`GuestID` END_OF_SQL; I however wish to add a date filter to this query and adding WHERE `rr`.`FromDate`>=$specstart AND `rr`.`ToDate`<=$specend doesn't work. $sql_statement = <<<END_OF_SQL SELECT DISTINCT(`rr`.`GuestID`) AS `Guest ID`, `rr`.`FromDate` AS `Check In Date`, `rr`.`ToDate` AS `Check Out Date`, `g`.`firstname` AS `First Name`, `g`.`lastname` AS `Last Name`, `g`.`email` AS `Email`, `g`.`phone` AS `Phone`, `g`.`address` AS `Address`, `g`.`city` AS `City`, `g`.`state` AS `State`, `g`.`country` AS `Country`, `g`.`zip` AS `Zip`, `g`.`user_id` AS `User ID` FROM `room_reservations` as `rr` LEFT JOIN `guests` AS `g` ON `g`.`user_id` = `rr`.`GuestID` WHERE `rr`.`FromDate`>=$specstart AND `rr`.`ToDate`<=$specend END_OF_SQL; I've alse tried using AND instead of WHERE, which doesn't give me the correct results. Thank you for your time and help.
  5. OK, so in other words, valid markup would be full echo then, correct? <?php echo $aset['SiteDescription']; ?> OR <?php echo "{$aset['SiteDescription']}"; ?> ... and there no valid "notation" type formatting with the equal sign for this and all lines like this would need to be replaced, correct? Note: it's not my site or code so testing isn't all that easy. Just wanted to understand if there was in fact notation type scripting and if so, the correct way to write it. Thanks for the feedback.
  6. Never been real good with terminology but an unquoted name in brackets [name] would be a constant, right? And I understand that the "name" in brackets should be quoted ['name']. I do that all the time. But what is that called? Also can I get an answer if the code posted above is valid?
  7. Thanks. Just seemed odd <?= Would this be valid? <?php=$aset['SiteDescription']?> Personally I've always echoed anything that need to be rendered to the page. Just want to understand it, thanks.
  8. Looking at some code from post http://forums.phpfreaks.com/index.php?topic=364299.0 and was wondering if this is even php? Anyone seen this before with the equal sign after the question mark? <?=$aset[siteDescription]?>"
  9. What I find very odd is you can go to your site in a fresh browser and you don't see any styling, yet clicking any link and styling will show, even if you click a back button to the page that was missing styling it would now have styling. On any working page, you click Ctrl-F5 and styling goes away. So it seems to be that style sheet is being downloaded to the browser but being blocked initially when the page loads. It might be something as simple as the order of your tags but can't be sure as I can't duplicate the problem locally. Note: most Tags should be lower case and a charset=utf-8 is probably more common so I would try changing the order to have any links after meta tags. Also note I added "type" attributes to both css and javascript tags. Not sure about that license meta tag but in didn't look right without ="" so added as such. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html> <head> <title><?php if (isset($aset['SiteTitle'])) echo "{$aset['SiteTitle']}"; ?></title> <meta dcb="" license="123456789"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="DESCRIPTION" content="Find the world's greatest classic cars for sale here today. Your dream car is waiting."> <meta name="KEYWORDS" content="classic cars, sales, for sale, Pittsburgh, PA"> <!--[if lt IE 7]> <script defer type="text/javascript" src="pngfix.js"></script> <![endif]--> <link href="css/style.css" rel="stylesheet" type="text/css"> <style type="text/css"> .BlackLink {font-family:verdana; font-size:22; color:black; font-weight:bold; text-decoration:none} a.BlackLink:hover {text-decoration: underline} .BlueLink {font-family:verdana; font-size:11; color:blue; font-weight:bold; text-decoration:underline} a.BlueLink:hover {text-decoration: underline} .RedLink {font-family:verdana; font-size:11; color:red; font-weight:bold; text-decoration:none} a.RedLink:hover {text-decoration: underline} a.CatLinks {font-family:verdana; font-size:11; color:black; font-weight:bold; text-decoration:none} a.CatLinks:hover {text-decoration:underline} a.SubCatLinks {font-family:verdana; font-size:11; color:blue; font-weight:bold; text-decoration:none} a.SubCatLinks:hover {text-decoration:underline} a.TitleLinks {font-family:verdana; font-size:12; color:black; font-weight:bold; text-decoration:none} a.TitleLinks:hover {text-decoration:underline} .ItemText {font-family:verdana; font-size:11; color:black; font-weight:regular; text-decoration:none} .sm {font-family:verdana; font-size:11} </style> <script language="JavaScript" type="text/javascript">
  10. Possible problem... What does pngfix.js do? Link to a different style sheet?
  11. I downloaded the html found on your link in the first post. Made a css page called style.css and put it in a folder called css relative to the page. Checked in four different browsers including Chrome and I see a black background with expected page styling. Not sure why it's not working for you. You really need to fix some of those markup errors though.
  12. Looks like you found your style sheet. Still a good 24 errors on the page but I'm sure if you go through it with a validator you'll fix those issues. Be sure to fix all those <? short tags as your host may turn (allowing short tags) off.
  13. Also note there are a good number of nesting or other errors in your html markup such as an </div> tag after the </form> tag. </form> </div> </td></tr></table> Get Tidy validator for firefox or use another validator to check your page.
  14. You have a single quote at the end of your "<link>" line. Also don't use short tags, i.e. <? Use full php start tags, <?php. Also I added isset() to your title php code but I don't see any includes where this title might be set. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html> <head> <!--[if lt IE 7]> <script defer type="text/javascript" src="pngfix.js"></script> <![endif]--> <link href="css/style.css" rel="stylesheet" type="text/css"> <title><?php if (isset($aset['SiteTitle'])) echo "{$aset['SiteTitle']}"; ?></title>
  15. If you are talking about AS you put each number in, it would update the count of numbers, no, not with php. You'd need some Javascript for that. As for duplicates in original main list not being removed, they are everytime I've tested it. I put in 1 2 1 4 ...and then filter out 1, I'm left with 2 4 Can you give me any example of numbers where it hasn't worked?
  16. You can always use count(). <?php if (isset($_POST['listnumbers'])){ $Newlist = explode(PHP_EOL, trim($_POST['listnumbers'])); $before_count = count($Newlist); $Searchlist = explode(PHP_EOL, trim($_POST['searchnumbers'])); $Newlist = array_diff($Newlist,$Searchlist); $after_count = count($Newlist); $phone_number_list = implode("<br />",$Newlist); } echo "Before: $before_count After: $after_count"; ?>
  17. Huh? You put in these number into the first textarea and 6 into the second textarea and it pulls that six out. What are you talking about? can you give me some examples? 12345 1234576 6 564476 3433243 66655434
  18. Copy that isset echo line I have between the textarea tags an place where you want it. If you are going to use it for display, you'll probably want to change that last line to implode with a break tag. $phone_number_list = implode("<br />",$Newlist);
  19. I had grabbed this off the web some time ago and used in in several situations like this. Might work for you. <?php //Generate a random $min=6; // minimum length of keycode $max=8; // maximum length of keycode $kcode=""; // to store generated keycode for($i=0;$i<rand($min,$max);$i++){ $num=rand(48,122); if(($num > 97 && $num < 122)){ $kcode.=chr($num); } else if(($num > 65 && $num < 90)){ $kcode.=chr($num); } else if(($num >48 && $num < 57)){ $kcode.=chr($num); } else if($num==95){ $kcode.=chr($num); } else{ $i--; } } echo "$kcode"; ?>
  20. I'm not aware of limitations to array_diff but not tried it with a large list. Did you try it?
  21. This should do it. <?php if (isset($_POST['listnumbers'])){ $Newlist = explode(PHP_EOL, trim($_POST['listnumbers'])); $Searchlist = explode(PHP_EOL, trim($_POST['searchnumbers'])); $Newlist = array_diff($Newlist,$Searchlist); $phone_number_list = implode(PHP_EOL,$Newlist); } ?> <html> <body> <form method="post" action=""> <textarea name="listnumbers"><?php if (isset($phone_number_list)){echo "$phone_number_list";} ?> </textarea><br /> <textarea name="searchnumbers"></textarea><br /> <input type="submit" value="Check Number" /> </form> </body> </html>
  22. As pointed out, for single number removal a simple preg_replace will do the job. <?php if (isset($_POST['listnumbers'])){ $phone_number_list = trim($_POST['listnumbers']); $phone_number = trim($_POST['searchnumber']); $phone_number_list = preg_replace("/$phone_number/", "", $phone_number_list); $phone_number_list = str_replace(PHP_EOL.PHP_EOL, PHP_EOL, $phone_number_list); } ?> <html> <body> <form method="post" action=""> <textarea name="listnumbers"><?php if (isset($phone_number_list)){echo "$phone_number_list";} ?> </textarea><br /> <textarea name="searchnumber"></textarea><br /> <input type="submit" value="Check Number" /> </form> </body> </html> If however if your needing to remove a list of numbers from another list of numbers this approach won't work and you will probably need to build an array for each input and then filter out matches within a foreach loop.
  23. Maybe this is a little over the top, creating arrays etc. <?php if (isset($_POST['listnumbers'])){ $listnumbers = nl2br(trim($_POST['listnumbers'])); $listnumbers = explode('<br />', $listnumbers); $Newlist=array(); foreach ($listnumbers as $numbers){ $numbers = str_replace("\r", "", $numbers); $numbers = str_replace("\n", "", $numbers); $numbers = preg_replace('~^(\<br /\>,/\n)+~', '', $numbers); $Newlist[] = $numbers; } $searchnumber = trim($_POST['searchnumber']); if (in_array($searchnumber,$Newlist)){ $number_key = array_search($searchnumber,$Newlist); unset($Newlist[$number_key]); } } ?> <html> <body> <?php echo "<pre>"; echo "<br />listnumbers<br />"; print_r($listnumbers); echo "<br />Newlist<br />"; print_r($Newlist); echo "<br />POST<br />"; print_r($_POST); echo "</pre>"; ?> <form method="post" action=""> <textarea name="listnumbers"> <?php echo (isset($Newlist)? implode(' ', $Newlist):''); ?> </textarea><br /> <textarea name="searchnumber"></textarea><br /> <input type="submit" value="Check Number" /> </form> </body> </html>
  24. Of course, good spotting jazzman1. Unless you really need GET for some reason, change method to post.
×
×
  • 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.