Jump to content

flyhoney

Members
  • Posts

    846
  • Joined

  • Last visited

    Never

About flyhoney

  • Birthday 12/13/1985

Contact Methods

  • AIM
    pifantastic
  • Website URL
    http://pifantastic.com

Profile Information

  • Gender
    Male
  • Location
    Austin, TX

flyhoney's Achievements

Member

Member (2/5)

0

Reputation

  1. If a user is behind a proxy, the only way for you to get their IP is if the proxy explicitly forwards that information to you. There is a convention for proxies to pass that information a long in an X-Forwarded-For header. Reverse proxies like Varnish can do that.
  2. To change the maximum upload size you have to edit your php.ini. I think the parameter you want to edit is post_max_size or something like that. As for checking the file type, you should just do: print_r($_FILES); And see what it's spitting out, and then you can make sure you're checking the right thing.
  3. Oops! Sorry, I just wasn't paying attention, you really need the month, day AND year. So, a comprehensive example: <?php function star_sign($month, $day, $year) { $time = mktime(0, 0, 0, $month, $day, $year); $day_of_year = date("z", $time); if (date("L", $time) && ($day_of_year > 59)) $day_of_year -= 1; switch ($day_of_year) { case $day_of_year > 356: return "Capricorn"; case $day_of_year > 326: return "Sagittarius"; case $day_of_year > 296: return "Scorpio"; case $day_of_year > 266: return "Libra"; case $day_of_year > 235: return "Virgo"; case $day_of_year > 203: return "Leo"; case $day_of_year > 172: return "Cancer"; case $day_of_year > 140: return "Gemini"; case $day_of_year > 111: return "Taurus"; case $day_of_year > 78: return "Aries"; case $day_of_year > 51: return "Pisces"; case $day_of_year > 20: return "Aquarius"; default: return "Capricorn"; } } $month = $_POST['user_month']; $day = $_POST['user_day']; $year = $_POST['user_year']; echo "Your star sign is " . star_sign($month, $day, $year);
  4. 12-1985 are just test numbers I used to demonstrate: <?php // include the function I showed you somewhere echo "Your star sign is " . star_sign($_POST['user_month'], $_POST['user_day']);
  5. Your host must be missing a PHP extension that you need.
  6. Your UPDATE statement updates every row in the database. I don't think there is a way to LIMIT an UPDATE statement. LIMITS are only for SELECTs.
  7. <?php $month = 12; $year = 1985; function star_sign($month, $year) { $time = mktime(0, 0, 0, $month, 0, $year); $day_of_year = date("z", $time); if (date("L", $time) && ($day_of_year > 59)) $day_of_year -= 1; switch ($day_of_year) { case $day_of_year > 356: return "Capricorn"; case $day_of_year > 326: return "Sagittarius"; case $day_of_year > 296: return "Scorpio"; case $day_of_year > 266: return "Libra"; case $day_of_year > 235: return "Virgo"; case $day_of_year > 203: return "Leo"; case $day_of_year > 172: return "Cancer"; case $day_of_year > 140: return "Gemini"; case $day_of_year > 111: return "Taurus"; case $day_of_year > 78: return "Aries"; case $day_of_year > 51: return "Pisces"; case $day_of_year > 20: return "Aquarius"; default: return "Capricorn"; } } die(star_sign(12, 1985));
  8. Just remember that you can store arrays in $_SESSION. Anytime you find yourself with variables like var1, var2, var3 in PHP you are definitely doing things wrong Arrays are WIN.
  9. It can't locate "contact.html". Check your file paths.
  10. This solves your problem, but to be honest, I think you're probably going about this the wrong way. I don't know enough about what you're doing to say for sure, but this is not really the best way to solve things in PHP. If you describe the problem in more detail I might be able to guide you towards a more elegant solution. In the mean time: <?php $foo = array ( (object) array("Label" => "Street", "Line" => "Stanley Road"), (object) array("Label" => "Town", "Line" => "Manchester"), (object) array("Label" => "Number of Rules", "Line" => "2"), (object) array("Label" => "Rule", "Line" => "X014"), (object) array("Label" => "Rule Text", "Line" => "Rule text for X014"), (object) array("Label" => "Rule", "Line" => "X015"), (object) array("Label" => "Rule Text", "Line" => "Rule text for X015") ); $rules = array(); $rule_texts = array(); foreach ($foo as $bar) { if ($bar->Label == "Rule") { $rules[] = $bar->Line; } else if ($bar->Label == "Rule Text") { $rule_texts[] = $bar->Line; } else { $_SESSION[$bar->Label] = $bar->Line; } } for ($x = 1; $x <= count($rules); $x++) { $_SESSION["Rule$x"] = $rules[$x - 1]; $_SESSION["RuleText$x"] = $rule_texts[$x - 1]; } print_r($_SESSION); exit; *EDIT* fixed a typo
  11. Maybe this will help clear things up: <?php $sql_f = " SELECT reg_id, count(bid_price) as cnt, min(bid_price) as low FROM `bidding_details` WHERE bid_id = '$bid_id' AND sortbid = '1' GROUP BY reg_id HAVING COUNT(reg_id) > 9 LIMIT 50 "; $results = mysql_query($sql_f) or die(mysql_error()); echo mysql_num_rows($results) . " rows returned <br />"; while ($row = mysql_fetch_assoc($results)) { $num = $row['low']; $cnt = $row['cnt']; if ($cnt > 9) { $sql_u = " UPDATE bidding_details SET sortbid = '0', rank = '0' WHERE bid_id = '$bid_id' AND bid_price='$num' "; mysql_query($sql_u) or die(mysql_error()); } }
  12. This works for me: <?php class FormValidator { public function filterStr($foo) { return $foo; } } class CoursesManager { protected $validator; public function __construct() { $this->validator = new FormValidator(); } } class NewCourse extends CoursesManager { function useValidator() { $var = $this->validator->filterStr($_GET['somevar']); } } $newcourse = new NewCourse(); print_r($newcourse); exit; NewCourse Object ( [validator:protected] => FormValidator Object ( ) )
  13. Try something like this: <?php $dirs = scandir("images/"); foreach ($dirs as $dir) { if ($dir == '.' or $dir == '..') continue; if (is_dir($dir)) { $images = scandir("images/$dir"); foreach ($images as $image) { echo '<img src="images/'.$dir.'/'.$image.'" />'; } } }
  14. http://php.net/manual/en/function.openssl-pkcs7-encrypt.php
  15. http://snipplr.com/view/5812/inverse-hex-color/
×
×
  • 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.