Jump to content

fred12ned

Members
  • Posts

    20
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

fred12ned's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. It is the line $current = gmdate("Y-m-d", strtotime("+1 day", strtotime($current))); change it to $current = gmdate("d/m/Y", strtotime("+1 day", strtotime($current)));
  2. If you changed the SQL to SELECT STR_TO_DATE(date, '%j/%M/%Y') AS date_formatted FROM `orders` WHERE... You could have nicer looking array keys $r['date_formatted']
  3. $ipp = mysql_query("SELECT * FROM ips WHERE ip='$ip'"); $ipf = mysql_fetch_assoc($ipp); if ($ipf['id']!==$ippage) $query = mysql_query("INSERT INTO ips SET ip='$ippage'"); to $ipp = mysql_query("SELECT * FROM ips WHERE ip='$ippage'"); $ipnum = mysql_num_rows($ipp); if (!$ipnum) $query = mysql_query("INSERT INTO ips VALUES('$ippage')");
  4. Firstly, you might want to move "<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>" Out of the loop and put it in the <head> share_url="http://localhost/mysite/coupons.php?product_section_id=<?php echo $_GET['product_section_id'];?>&section=<?php echo $_GET['section'];?>#<?php echo $row_Recordset1['product_id']; ?>" changing that to share_url="http://localhost/mysite/coupons.php?product_section_id=<?php echo $row_Recordset1['product_section_id'];?>&section=<?php echo $row_Recordset1['section'];?>#<?php echo $row_Recordset1['product_id']; ?>" should fix it
  5. Try making a new page and outputting the whole session variables, check if $_SESSION['logged_in'] is set. <?php session_start(); echo "<pre>"; var_dump($_SESSION); echo "</pre>"; ?>
  6. $musicfile = $fullpath; fopen($fullpath, 'r'); $musicfile is set to a string and the resource from fopen isn't assigned to a variable $musicfile = fopen($fullpath, 'r'); $musicfile is set to the file resource that can be used with fseek and fread
  7. The PHP session system only works for that browser session, so when you close the browser it ends. The code I posted is trying to be a secure way of storing data in a cookie so that a user can stay logged in across sessions.
  8. Is the following code secure when it is set to a cookie for cross-session authentication? private function GenerateAuthKey($userid){ $ip = $_SERVER['REMOTE_ADDR']; $user_agent = !empty($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ""; $authkey = base64_encode(sha1(md5($this->GetDBPassword($userid) . $ip . $user_agent . time()))); $query = $this->db->buildquery("INSERT INTO member_session VALUES(%USERID%, '%AUTHKEY%', '%IP%', '%USERAGENT%', %EXPIRES%)", array("USERID" => $userid, "AUTHKEY" => $authkey, "IP" => $ip, "USERAGENT" => $user_agent, "EXPIRES" => time() + 30*24*60*60); $this->db->query($query); return $authkey; } private function ValidAuthKey($userid, $authkey){ $query = $this->db->buildquery("SELECT * FROM member_session WHERE user_id = %USERID% AND session_key = '%SESSION_KEY%'", array("USERID" => $userid, "AUTHKEY" => $authkey); $result = $this->db->query($query); if($result->num_rows){ $ip = $_SERVER['REMOTE_ADDR']; $user_agent = !empty($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ""; $row = $result->fetch_assoc(); if($row['ip'] != $ip){ return false; }elseif($row['user_agent'] != $user_agent){ return false; }elseif($row['expires'] < time()){ return false; }else{ return true; } }else{ return false; } }
×
×
  • 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.