acctman Posted February 9, 2009 Share Posted February 9, 2009 can someone help me with the if (isset($_GET statement below where I echo $type; when I first echo the it shows imgPvt which is correct but after I do a check to see if "sec" is 2 or 3 its changing the $type to imgPub when its actually imgPvt. Why is it changing the $type when I'm just checking to see if there is a 2 or 3 value? the sending url looks like this /files/pvtexp.php?mid=<%mm_id%>&iid=$row[i_id]&idat=$en[m_uimg]&sec=1 <?php session_start(); $userid = $_SESSION['userid']; if($userid == '') { header("Location: http://www..com"); exit; } ob_start(); //hold output require_once '../password.php'; if (isset($_GET['mid']) && isset($_GET['iid']) && isset($_GET['idat'])) { $mid = $_GET['mid']; $iid = $_GET['iid']; $date = $_GET['idat']; if (isset($_GET['sec']) == '1') { $type = "imgPvt"; $allowed = 0; if (isset($_SESSION['userid']) && $_SESSION['userid'] > 0) { $sql = "select p_id from rate_private where p_from='$mid' and p_to='" .$_SESSION['userid']. "'"; $result = mysql_query($sql); if (mysql_num_rows($result) > 0 || $mid == $_SESSION['userid'] || $_SESSION['userid'] == '39') { $allowed = 1; } elseif ($allowed == 0 && isset($_GET['sec']) == 1) { header("Location: http://www..com"); exit; } } } echo $type; //at this point its saying imgPvt if (isset($_GET['sec']) == '2') { $type = "imgExp"; } if (isset($_GET['sec']) == '3') { $type = "imgPub"; } echo $type; //now its telling me imgPub header("Content-type: image/jpeg"); if (isset($_GET['tmb']) == 1) { $im = imagecreatefromjpeg('/'.$date.'/'.$mid.'/'.$type.'/imgTmb/'.$mid.'-'.$iid.'.jpg'); } else { $im = imagecreatefromjpeg('/'.$date.'/'.$mid.'/'.$type.'/'.$mid.'-'.$iid.'.jpg'); } imagejpeg($im); imagedestroy($im); } $buf = ob_get_contents(); ob_end_clean(); print $buf; ?> Quote Link to comment Share on other sites More sharing options...
metrostars Posted February 9, 2009 Share Posted February 9, 2009 if (isset($_GET['sec']) == '2') { $type = "imgExp"; } if (isset($_GET['sec']) == '3') { $type = "imgPub"; } isset only can only == 1 or 0, not 2 and 3. isset only checks if $_GET has a value set, not what that value actually is. You should have it as if ($_GET['sec'] == '2') { $type = "imgExp"; } if ($_GET['sec'] == '3') { $type = "imgPub"; } and the same for the one further up. Quote Link to comment Share on other sites More sharing options...
acctman Posted February 9, 2009 Author Share Posted February 9, 2009 if (isset($_GET['sec']) == '2') { $type = "imgExp"; } if (isset($_GET['sec']) == '3') { $type = "imgPub"; } isset only can only == 1 or 0, not 2 and 3. isset only checks if $_GET has a value set, not what that value actually is. You should have it as if ($_GET['sec'] == '2') { $type = "imgExp"; } if ($_GET['sec'] == '3') { $type = "imgPub"; } and the same for the one further up. i spent 2hrs trying to figure out if it was a cache or buffer causing the problem. thanks for fixing my error Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.