Jump to content

schilly

Members
  • Posts

    870
  • Joined

  • Last visited

    Never

Everything posted by schilly

  1. couple errors <?php function days_between($day){ $daysin = array(31,28,31,30,31,30,31,31,30,31,30,31); $years = $day / 365; $years = floor($years); $removedays = $years * 365; $days = $day - $removedays; if($days <= 31){ $days = $days; $months = 0; }else{ for($i = 1; $i <= 12; $i++){ if($days >= $daysin[$i]){ //make sure its more than current month so you dont get negative days $days = $days - $daysin[$i]; $months = $months + 1; } else break; } //$days = $days + $daysin[$months]; } $days = $days != 0 ? "$days days" : ''; $months = $months != 0 ? "$months months, " : ''; $years = $years != 0 ? "$years years, " : ''; $time = $years.$months.$days; return $time; }?> think that looks better.
  2. you can use a robots.txt to stop bots from indexing your site. i'm not sure on the specifics. just google it.
  3. you want to do this on the fly? for certain users? or just permanent?
  4. grab the year,month,day from the string using substr then get the current year,month,day via date("",time()) and compare. see now if your doing manipulation on the date i find it easier to store it as an int. then you can get any date info from it via the date function instead of having to parse a string.
  5. just change '$day', '$month', '$year' to '$dob' because we made it one variable now.
  6. ya pretty much. if you're always going to be displaying the dob as mm/dd/yy then just store it like that in a string. if you need to manipulate it at all, i would use mktime and store it as an int but it's all preference.
  7. Put a print_r($_SESSION) on your access denied page to see if anything is in your session.
  8. clear any space at the end of the php tag as well (after ?> at the end of the file)
  9. Just concatenate your fields together $dob = $_POST['month'] . "/" . $_POST['day'] . "/" . $_POST['year']; can you edit your post so we can see your question better. the code tag is missing / at the bottom
  10. the problem here is that php function include and the html in header.php are treated differently. If you look at your header file <?php require_once'config.php'; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title><?php echo $config_blogname; ?></title> <link rel="stylesheet" href="../CSS/stylesheet.css" type="text/css" /> </head> <body> <div id="header"> <h1><?php echo $config_blogname; ?></h1> [<a href="index.php">home</a>] </div> <div id="main"> The php engine is only evaluating the php tags which is the include which operates from the directory in which the file calls if from (ie. includes directory b/c that's where header.php is). Nothing is done with the link tag to the css file. Now when you include the header file in the index that html in the header file is just passed into the index file and not evaluation. The browser will evaluate that html and see the link tag and then make a call for the css file. Browser is operating from the index dir so that is your relative dir, not includes. So to answer your question That will work if you include header.php in any file that is in your index dir. I'm not sure if all of the above is true with how the php engine and browser operates but the underlying idea is. Hope this makes sense.
  11. what file are you including images.php in? what file is your form in?
  12. when you include it in another file are you making sure to post the form to that new file?
  13. add echos at all of those if statements and see where it breaks.
  14. awesome. thanks for the quick help guys. so can you do <?= with a <?php tag?
  15. you can't use "../CSS/stylesheet.css" as header.php will load into index.php and then when the browser sees the link tag and calls the stylesheet, the path will be wrong as the browser is in the parent directory and not includes. I tested all your code and just changed "../CSS/stylesheet.css" to "./CSS/stylesheet.css" and works fine.
  16. always taken this for granted. i'm guessing it's a php.ini setting to allow for <? to be recognized as php. Which setting is it and is there a specific name for using <? ? ie. <?= etc. thx.
  17. here http://skyelights.com/maps/test_image.php or http://skyelights.com/maps/getDir.php?type=swell&deg=291 ?? at the test_image page the arrow always shows down with safari and firefox.
  18. I'm trying to rotate an image depending on what angle I give it. It's working but when I use it in my page it doesn't rotate. If I grab the image source link and open it up the image is rotated. I can't figure it out. test page: http://skyelights.com/maps/test_image.php Image link from that page: http://skyelights.com/maps/getDir.php?type=swell&deg=291 GD Source: <?php $type = $_GET['type']; $deg = $_GET['deg']; $base_dir = ''; if($type == 'swell') $default = '08.png'; else $default = '08.png'; $im = imagecreatefrompng($default); imagealphablending($im, true); // setting alpha blending on imagesavealpha($im, true); //rotate the image $white = imagecolorallocate($im, 255, 255, 255); imagecolortransparent($im, $white); $im_rotated = imagerotate($im,$deg, $white); imagealphablending($im_rotated, true); // setting alpha blending on imagesavealpha($im_rotated, true); //flip the image $size_x = imagesx($im_rotated); $size_y = imagesy($im_rotated); $temp = imagecreatetruecolor($size_x, $size_y); $white_temp = imagecolorallocate($temp, 255, 255, 255); imagefilledrectangle($temp, 0, 0, $size_x, $size_y, imagecolorallocate($temp, 255, 255, 255)); imagecolortransparent($temp, $white_temp); $x = imagecopyresampled($temp, $im_rotated, 0, 0, 0, ($size_y-1), $size_x, $size_y, $size_x, 0-$size_y); if ($x) { $im_rotated = $temp; } else { die("Unable to flip image"); } //echo $deg; // Content type header('Content-type: image/png'); imagepng($im_rotated); imagedestroy($im); imagedestroy($im_rotated); ?> Any help is appreciated. Thanks.
  19. Well I switched it to the CSV response and got it working. Not sure what was going on with the xml response.
  20. stripslashes() and htmlentities() as per Ken ex. stripslashes(htmlentities($var))
×
×
  • 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.