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; } }
  9. Is there a php function that does the same as htonl which is in C? Thanks in Advance, Will
  10. had not noticed these as my screen is 1440x900 (19") and I use firefox should be fixed soon though
  11. Please Would any body test my new *BETA* website www.willsmith.co.uk/willsmith Please post security flaws, bugs ,etc Thanks in advance Will
  12. mysql <?php $con = mysql_connect("server","username","password"); mysql_select_db("database"); mysql_query("SELECT * FROM items"); ?> ms access(only on MS Windows server does not mater) <?php $con = new COM("ADODB.Connection"); // MS Access 2003 or before $db = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". realpath("./db.mdb").";"; // MS Access 2007 //$db = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=". realpath("./db.accdb").";"; $db_conn->open($db); $rS = $db_conn->execute("SELECT * FROM items"); $f1 = $rS->Fields(1); $f2 = $rS->Fields(2); $f3 = $rS->Fields(3); $f4 = $rS->Fields(4); $f5 = $rS->Fields(5); $f6 = $rS->Fields(6); ?>
  13. Does not matter needed to change '$rs->Fields(1)' to '$rs->Fields(1)->value'
  14. [code]$text=str_replace($smilies, $images, $text);[/code]
  15. The code is: [code]<?php class conn{ var $db; var $tert; function connect($dbname){ $this->db = new COM("ADODB.Connection"); $connstr = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=". realpath("./".$dbname.".accdb").";"; $this->db->open($connstr); } function clear(){ $this->db->Execute('DELETE FROM `User`'); $this->db->Execute('DELETE FROM Chat'); } function checkusers(){ $rs = $this->db->Execute("SELECT * FROM `User`"); while(!$rs->EOF){ if(date('dHi')-$rs->Fields(3) > 5){ $this->db->Execute('DELETE FROM `User` WHERE Username = "'.$rs->Fields(1).'"'); $this->db->Execute("INSERT INTO Chat (Username,Message) VALUES('Xbgh54tr','<b>".$rs->Fields(1)."</b> has left the chat')"); $rs->MoveNext(); } } } function getmsg($user){ $this->db->Execute("UPDATE `User` SET Tim = '".date('dHi')."' WHERE Username='".$user."'"); $result = $this->db->Execute("SELECT * FROM Chat"); $msg=''; while(!$result->EOF){ if ($result->Fields(1)!='Xbgh54tr'){ $rs = $this->db->Execute("SELECT Color FROM `User` WHERE Username='".$user."'"); $bob = $rs->Fields(0); echo $result->Fields(1).' - <font color="#00FF00">'. $this->smilie($result->Fields(2)).'</font><br>'; } else{ echo '<font color="#FF00FF">'.$result->Fields(2).'</font><br>'; } $result->MoveNext(); } $this->checkusers(); } function sendmsg($user, $text){ $this->db->Execute("INSERT INTO Chat (Username, Message) VALUES('".$user."','".$text."')"); } function smilie($text){ $rs = $this->db->Execute("SELECT * FROM Smilies"); while(!$rs->EOF) { $smilies[] = $rs->Fields(1); $images[] = "<img src='smilies/" . $rs->Fields(2) . ".gif'>"; $rs->MoveNext(); } $text=str_replace($smilies, $images, $text); return $text; } function newuser($user, $color){ $this->db->Execute("INSERT INTO Chat (Username, Message) VALUES('Xbgh54tr','<b>".$user."</b> has joined the chat')"); $date=date('dHi'); $this->db->Execute("INSERT INTO `User` (Username, Color, Tim) VALUES('".$user."','".$color."','".$date."')"); } function changeuser($old, $new){ $this->db->Execute("UPDATE User SET user = '".$new."' WHERE user='".$old."'"); $this->db->Execute("INSERT INTO Chat VALUES('Xbgh54tr','<b>".$old."</b> has changed thier name to <b>".$new."</b>')"); } function query(){ $this->db->Execute("INSERT INTO `Smilies` (`Smilies`, `Image`) VALUES (':|', 's1')"); $this->db->Execute("INSERT INTO `Smilies` (`Smilies`, `Image`) VALUES (':S', 's4')"); $this->db->Execute("INSERT INTO `Smilies` (`Smilies`, `Image`) VALUES ('8)', 's2')"); $this->db->Execute("INSERT INTO `Smilies` (`Smilies`, `Image`) VALUES (':(', 's5')"); $this->db->Execute("INSERT INTO `Smilies` (`Smilies`, `Image`) VALUES (':@', 's6')"); $this->db->Execute("INSERT INTO `Smilies` (`Smilies`, `Image`) VALUES (':O', 's7')"); $this->db->Execute("INSERT INTO `Smilies` (`Smilies`, `Image`) VALUES (':)', 's8')"); $this->db->Execute("INSERT INTO `Smilies` (`Smilies`, `Image`) VALUES (':D', 's9')"); $this->db->Execute("INSERT INTO `Smilies` (`Smilies`, `Image`) VALUES (';)', 's11')"); $this->db->Execute("INSERT INTO `Smilies` (`Smilies`, `Image`) VALUES (':P', 's10')"); } } ?>[/code]
×
×
  • 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.