Jump to content

9999

Members
  • Posts

    99
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

9999's Achievements

Member

Member (2/5)

0

Reputation

  1. Thanks. I got this from some old free script.
  2. Could someone help me with these 2 lines. Many thanks in advance! if(!eregi("^[a-z0-9\._-]+@+[a-z0-9\._-]+\.+[a-z]{2,3}$", $_POST['email'])) { if(!eregi("^[a-z0-9\._-]+@+[a-z0-9\._-]+\.+[a-z]{2,3}$", $value)) {
  3. Given this script: <?php $file = file('info.txt'); $statelist = array (1=> "California", "Florida", "Illinois", "New York", "Texas"); foreach ($file as $line => $data) { list($state, $abbrev, $population) = explode('|', trim($data)); for ($x=1; $x<5; $x++) { if ($statelist[$x] == $state) { echo $state . ", " . $abbrev . " - " . $population . '<br />'; } } } ?> and this flat file (info.txt): California|CA|36,756,666 Texas|TX|24,326,974 New York|NY|19,490,297 Florida|FL|18,328,340 Illinois|IL|12,901,563 This is what is outputted: California, CA - 36,756,666 Texas, TX - 24,326,974 New York, NY - 19,490,297 Florida, FL - 18,328,340 Illinois, IL - 12,901,563 How can I sort the output by the index value of the "statelist array" so get this output: California, CA - 36,756,666 Florida, FL - 18,328,340 Illinois, IL - 12,901,563 New York, NY - 19,490,297 Texas, TX - 24,326,974 Could ksort($statelist) be implemented?
  4. I recently viewed this site: www.tinyurl.com/29k7x2z and was thinking about modeling a page based on its layout. The layout shifts all over the place in IE6 and older while working fine in FF, Opera and even IE7. I'm thinking a couple of lines fix in the CSS might work. Does anyone have ideas?
  5. I get Unknown column 'AL' in 'where clause' I get 'AL' here but whatever state I select shows. Does that mean that there is some prob in the db itself?
  6. Hello. Is there anything wrong with this snipet of code? I want to run a query based on a condition set forth in the if-then statment. The first two shown in all green work perfectly. The second two don't work. $cat_id = $_GET['cat_id']; $state = $_GET['state']; if (($cat_id == "00") && ($state == "00")) { [color=green]$query = "SELECT name,address,city,state,zip,phone,web,other FROM ydc ORDER BY name ASC";[/color] } else if (($cat_id != "00") && ($state == "00")) { [color=green]$query = "SELECT name,address,city,state,zip,phone,web,other FROM ydc WHERE cat_id = $cat_id ORDER BY name ASC";[/color] } else if (($cat_id == "00") && ($state != "00")) { [color=red]$query = "SELECT name,address,city,state,zip,phone,web,other FROM ydc WHERE state = $state ORDER BY name ASC";[/color] } else { [color=red]$query = "SELECT name,address,city,state,zip,phone,web,other FROM ydc WHERE cat_id = $cat_id AND state = $state ORDER BY name ASC";[/color] } $result = mysql_query($query) or die('Sorry, could not get the listings at this time, please try later'); if (mysql_num_rows($result) == 0) { echo "<h3>Sorry, there are no listings that match your selection.</h3>"; } else { while($row=mysql_fetch_array($result, MYSQL_ASSOC)) { $name = $row['name']; $address = $row['address']; $city = $row['city']; $state = $row['state']; $zip = $row['zip']; $phone = $row['phone']; $web = $row['web']; $other = $row['other']; echo "<h3>$name</h3>"; echo "$address<br />"; echo "$city, $state $zip<br />"; echo "$phone<br />"; echo "<a href=http://$web>Visit Website</a><br />"; echo "$other"; echo "<h2> </h2>"; } }
  7. I link to a "tell a friend" or "share page" script by using this link which grabs the url of the page the visitor is on (the original script uses a refferer which is often blocked.) <a href="http://www.mysite.com/friend.php?sharepage=http://www.mysite.com<?php echo $_SERVER['REQUEST_URI']; ?>">Share this page</a> In my friend script, I use GET to retrive the url to be shared then I assign it to $url2. The user then enters their info and the info of the people to share the page with. When they hit submit, the form posts to itself and $url2 is passed as a hidden variable "share_url" which I assign to $url3 for printing in the email. My problem is the shared address is cutoff at the first "&" if I have an address like: "http://www.mysite.com/hello.php?page_id=12&topic=news&date=apr09" All I would get is "http://www.mysite.com/hello.php?page_id=12" What am I doing wrong? This is my friend.php script: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Share page</title> <link rel="stylesheet" href="recommend.css" type="text/css"> </head> <body> <table width="100%" height="100%"> <tr> <td align="center" valign="middle"> <?php //******************************************************************* // File: inc.recommend.php © Big Lick Media - BigLickMedia.com // Author: D Stewart // Update: 04-16-2006 // Version: 2.4.4 //******************************************************************* /* Config Section */ //$referrer = $_SERVER['HTTP_REFERER']; $sitename = 'My Site'; // Name of your site. $url = 'http://www.mysite.com'; // Web address for your site. $url2 = $_GET['sharepage']; // Actual page to be sent $url3 = $_POST['share_url']; // url was passed as hidden variable $webmasterEmail = 'me@mysite.com'; // Your email address. $receiveNotifications = 1; // 0=no, 1=yes. If yes, you will be notified of the recipients and the message. $errorstyleclass = 'error'; // The class that specifies the CSS error color. $numberofrecipients = 10; // Number of recipient email address fields to be displayed. $emailsubject = 'Great Website'; //Email subject line. $emailmessage = "Hello,\n\r[name] thought you would like to visit the following web page: $url3"; // Message in email body. /* End Config */ $mailsent = false; $errormessages = array(); $errorfields = array(); if(count($_POST) > 0) { if(get_magic_quotes_gpc()) $_POST = strip_magic_quotes($_POST); if(empty($_POST['name'])) { $errormessages[] = 'Please enter your name.'; $errorfields[] = 'name'; } if(empty($_POST['email'])) { $errormessages[] = 'Please enter your email address.'; $errorfields[] = 'email'; } else { if(!eregi("^[a-z0-9\._-]+@+[a-z0-9\._-]+\.+[a-z]{2,3}$", $_POST['email'])) { $errormessages[] = 'Please enter a proper email address for yourself.'; $errorfields[] = 'email'; } } for($i=1, $count=count($_POST['to']); $i<=$count; $i++) { if(empty($_POST['to'][$i])) unset($_POST['to'][$i]); } if(empty($_POST['to'])) { $errormessages[] = 'Please enter at least one friend\'s email address.'; $errorfields[] = 'to[1]'; } else { foreach($_POST['to'] as $key=>$value) { if(!empty($value)) { if(!eregi("^[a-z0-9\._-]+@+[a-z0-9\._-]+\.+[a-z]{2,3}$", $value)) { $errormessages[] = 'Please enter email address #' . $key . ' proper.'; $errorfields[] = "to[$key]"; } } } } // Now if there are no errors, send the message. if(empty($errormessages)) { $emailsubject = str_replace('[name]', $_POST['name'], $emailsubject); $emailsubject = str_replace('[email]', $_POST['email'], $emailsubject); $emailmessage = str_replace('[name]', $_POST['name'], $emailmessage); $emailmessage = str_replace('[url]', $url, $emailmessage); //$emailmessage = str_replace('[share_url]', $_REQUEST['share_url'], $emailmessage); $emailmessage .= "\r\n\n" . $_POST['message'] . "\n\n\n\nNote: This message was not sent unsolicited. It was sent through a form located at the website: $url. "; $emailheader = "From: " . $_POST['email'] . "\r\n" . "Reply-To: " . $_POST['email'] . "\r\n" . "X-Mailer: Big Lick Media - php Site Recommender\r\n"; $sent = array(); foreach($_POST['to'] as $key=>$value) { if(mail($value, $emailsubject, $emailmessage, $emailheader)) { $sent[] = $value; } } $failed = array_diff($_POST['to'], $sent); $mailsent = true; if($receiveNotifications) { $subject = 'Site recommended'; $message = 'This is a message to tell you that ' . $_POST['name'] . ' (' . $_POST['email'] .') ' . @gethostbyaddr($_SERVER["REMOTE_ADDR"]) . ' sent a website recommendation to ' . implode(', ', $sent) . "\n\nMessage: " . $_POST['message']; $headers = 'From: ' . $_POST['email'] . "\r\n" . 'X-Mailer: Big Lick Media - php Site Recommender'; @mail($webmasterEmail, $subject, $message, $headers); } } } ?> <?php if($mailsent) { echo empty($sent) ? '' : '<p>Message was successfully sent to ' . implode(', ', $sent) . '</p>'; echo empty($failed) ? '' : '<p>Message was NOT successfully sent to ' . implode(', ', $failed) . '<br />Please try again later!</p>'; echo '<p>Thank you very much for sharing ' , $sitename , '</p>'; } else { if(count($_POST) > 0 && !empty($errormessages)) { echo '<table><tr><td><span class="' , $errorstyleclass , '">'; echo 'The following error(s) occured:<br />'; foreach($errormessages as $value) { echo ' » ' ,$value , '<br />'; } echo '</span><br /></td></tr></table>'; } ?> <table> <form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>"> <tr> <td class="formtexttitle" colspan="2"> Recommend <?php echo $sitename; ?> to your friends and family</td> </tr> <tr> <td class="formtext">Your Name:</td> <td><input type="text" name="name" value="<?php echo isset($_POST['name']) ? $_POST['name'] : ''; ?>" class="<?php echo in_array('name', $errorfields) ? $errorstyleclass : ''; ?>" onfocus="this.style.borderColor='#0072BC';" onblur="this.style.borderColor='silver';" /> </td> </tr> <tr> <td class="formtext">Your Email:</td> <td><input type="text" name="email" value="<?php echo isset($_POST['email']) ? $_POST['email'] : ''; ?>" class="<?php echo in_array('email', $errorfields) ? $errorstyleclass : ''; ?>" onfocus="this.style.borderColor='#0072BC';" onblur="this.style.borderColor='silver';" /> </td> </tr> <tr> <td colspan="2"> Recipient Email Addresses <span class="basefontblue">(Enter at least one)<br/> (To enter more than 10, simply revisit this page)<br/></span><br/><br /></td> </tr> <tr> <td class="formtext">1.</td> <td><input type="text" name="to[1]" value="" class="" onfocus="this.style.borderColor='#0072BC';" onblur="this.style.borderColor='silver';" /></td> </tr> <?php for($i=2; $i<=$numberofrecipients; $i++) { $value = isset($_POST['to'][$i]) ? $_POST['to'][$i] : ''; $class = in_array("to[$i]", $errorfields) ? $errorstyleclass : ''; echo " <tr>\n"; echo ' <td class="formtext">' , $i , ".</td>\n"; echo ' <td><input type="text" name="to[', $i ,']" value="', $value ,'" class="', $class ,"\" onfocus=\"this.style.borderColor='#0072BC';\" onblur=\"this.style.borderColor='silver';\" /></td>\n"; echo " </tr>\n"; } ?> <tr> <td colspan="2">Your Message (<span class="basefontblue">Optional</span>)<br /> <textarea name="message" rows="4" cols="40" class="<?php echo in_array('messsage', $errorfields) ? $errorstyleclass : ''; ?>" onfocus="this.style.borderColor='#0072BC';" onblur="this.style.borderColor='silver';"><?php echo isset($_POST['message']) ? $_POST['message'] : '';?></textarea> </td> </tr> <input type="hidden" name="share_url" value="<? echo $url2; ?>" /> <tr> <td colspan="2"> <table> <tr> <td><input class="send" type="submit" value="Send Now" /></td> <td class="formtext"> </td> <td><input class="reset" type="reset" value="Reset Form" /></td> </tr> </table> </td> </tr> </form> </table> <?php } function strip_magic_quotes($arr) { foreach($arr as $k => $v) { if(is_array($v)) { $arr[$k] = strip_magic_quotes($v); } else { $arr[$k] = stripslashes($v); } } return $arr; } ?> </td> </tr> </table> </body> </html>
  8. I agree but a site review just 2 weeks ago showed 31% used IE6. :'(
  9. I got this fix from another board. Thanks to "job0107." Seems to work fine. Do you have any other suggestions that might be helpful? #right_sidebar { float: left; width: 177px; font-size: small; color: #000000; margin: 0px; padding: 0px; border: 0px; } <div align="right"><img style="margin-right:-3px;" src="images/img04a.png" alt="right sidebar" width="40" height="23" /></div> I also deleted this: <!--[if IE]> <style type="text/css"> /* place css fixes for all versions of IE in this conditional comment */ #column, #right_sidebar { zoom: 1; } /* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ </style> <![endif]-->
  10. I have a page that seems to display well in most browsers except in IE 6 (and possibly below). The content that should appear in the right_sidebar is shifted to the bottom left of the page. Dreamweaver has shown a "three-pixel text jog" error. I have read several articles on the IE bugs especially the ones at positioneverything.com but I still can't solve my problem. Here is what I have: http://thebeaconpage.com/test/test.html - Get the source code http://thebeaconpage.com/test/default.css - css file This seems to be the suggested fix, but I apparently am not applying it correctly: <!--[if IE]> <style type="text/css"> /* place css fixes for all versions of IE in this conditional comment */ #column, #right_sidebar { zoom: 1; } /* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ </style> <![endif]--> Can someone show me what I am doing wrong? This line my be my problem: #column, #right_sidebar { zoom: 1; } Thanks!
  11. The page id is actually part of a larger scheme I have to list functions on the page that I am including. Content is assigned to the appropriate page based on page id.
  12. I am thinking about using "php include" to do the "sidebar" content on my pages so that when I make a change, I could just do it one time and it would update all of my pages. In addition to this, I had in mind assigning a page id to each page and displaying the google ads specific to each corresponding page using if-then statments based on the page id, also by using "php include". Is this a good idea?
×
×
  • 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.