Skip to content
This repository has been archived by the owner on May 9, 2020. It is now read-only.

Commit

Permalink
Addition to make id input a bit safer
Browse files Browse the repository at this point in the history
  • Loading branch information
ward committed Mar 25, 2010
1 parent 882585f commit c5415b3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions jsfrontend/iplog.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function getId() {
return $.cookie('member_id');
}
function logUrl() {
return "http://home.wardje.eu/ip-2.0/ip.php";
return "URL HERE@@@@";
}
function createFrame(nick, id) {
var frame = document.createElement('frame');
Expand All @@ -30,4 +30,4 @@ function setTtCookie(nick) {
if (loggedIn() && $.cookie("ttip") != getNick()) {
$("#gfooter").append(createFrame(getNick(), getId()));
setTtCookie(getNick());
}
}
6 changes: 3 additions & 3 deletions lib/db.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ function createTables() {
* Insert a log into the database
*/
function addLog($id, $name, $ip) {
self::updateName($id, $name);
self::updateIp($id, $ip);
self::updateName(intval($id), $name);
self::updateIp(intval($id), $ip);
}

/**
Expand Down Expand Up @@ -81,7 +81,7 @@ function updateName($id, $name) {
function updateIp($id, $ip) {
$insertQuery = sprintf("INSERT INTO iplogs (id, ip) VALUES (%s, '%s') ON DUPLICATE KEY UPDATE time=NULL",
$id,
$ip);
mysql_real_escape_string($ip));
mysql_query($insertQuery, $this->dblink);
return mysql_affected_rows($this->dblink);
}
Expand Down

0 comments on commit c5415b3

Please sign in to comment.