Skip to content
Permalink
Browse files Browse the repository at this point in the history
Fix sql injection in add.php file
  • Loading branch information
bongtrop committed Dec 8, 2014
1 parent d91c648 commit b92451e
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions module/frontend/add.php
Expand Up @@ -61,10 +61,10 @@
}
else if ($table_name=="PHOTO") {
$caotion = clean($_POST["caption"]);
$owner = $m_id;
$loc_id = $_POST["loc_id"];
$timing_id = $_POST["timing_id"];
$pos_id = $_POST["pos_id"];
$owner = intval($m_id);
$loc_id = intval($_POST["loc_id"]);
$timing_id = intval($_POST["timing_id"]);
$pos_id = intval($_POST["pos_id"]);

$sql = "insert into PHOTO values (member_seq.nextval, '$caption', $owner, $loc_id, $timing_id, $pos_id, systimestamp)";
$stid = oci_parse($db_conn, $sql);
Expand Down Expand Up @@ -128,8 +128,8 @@
}
}
else if ($table_name=="COMMENT") {
$msg = $_POST["msg"];
$p_id = $_POST["p_id"];
$msg = clean($_POST["msg"]);
$p_id = intval($_POST["p_id"]);

$sql = "insert into COMMENT_PHOTO values (comment_photo_seq.nextval, $m_id, $p_id, '$msg', systimestamp)";
$stid = oci_parse($db_conn, $sql);
Expand All @@ -144,7 +144,7 @@
}
}
else if ($table_name=="LIKE") {
$p_id = $_POST["p_id"];
$p_id = intval($_POST["p_id"]);
$sql = "insert into LIKE_PHOTO values ($m_id, $p_id, systimestamp)";
$stid = oci_parse($db_conn, $sql);
$r = oci_execute($stid);
Expand All @@ -158,8 +158,8 @@
}
}
else if ($table_name=="MESSAGE") {
$to = $_POST["to"];
$msg = $_POST["msg"];
$to = intval($_POST["to"]);
$msg = clean($_POST["msg"]);
$sql = "insert into MESSAGE values (message.nextval, $m_id, $to, msg, systimestamp)";
$stid = oci_parse($db_conn, $sql);
$r = oci_execute($stid);
Expand Down

0 comments on commit b92451e

Please sign in to comment.