Update references mysql_* to mysqli_*
parent
8cdd450705
commit
98fece9d37
|
@ -39,15 +39,15 @@ if (isset($_POST["txt"]) && isset($_POST["tim"])) {
|
|||
include "../connect.php";
|
||||
|
||||
$mysql_table = MYSQL_TABLE;
|
||||
$qry = "INSERT INTO `$mysql_table` (`id`, `txt`, `tim`) VALUES (NULL, '".mysql_escape_string(nl2br($txt.$extrl))."', '".mysql_escape_string($tim)."')";
|
||||
$result = mysql_query($qry);
|
||||
$qry = "INSERT INTO `$mysql_table` (`id`, `txt`, `tim`) VALUES (NULL, '".mysqli_escape_string(nl2br($txt.$extrl))."', '".mysqli_escape_string($tim)."')";
|
||||
$result = mysqli_query($qry);
|
||||
|
||||
if (!$result) {
|
||||
die("Error! ".mysql_error());
|
||||
die("Error! ".mysqli_error());
|
||||
} else {
|
||||
$allok = 1;
|
||||
}
|
||||
mysql_close($link);
|
||||
mysqli_close($link);
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
<?php
|
||||
$link = mysql_connect(MYSQL_HOST, MYSQL_USERNAME, MYSQL_PASSWORD);
|
||||
if(!$link) {
|
||||
die("Failed to connect to mysql server. ");
|
||||
}
|
||||
$db = mysql_select_db(MYSQL_DATABASE);
|
||||
$link = mysqli_connect(MYSQL_HOST, MYSQL_USERNAME, MYSQL_PASSWORD, MYSQL_DATABASE);
|
||||
if(!$db) {
|
||||
die("Unable to select database. ");
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
12
detail.php
12
detail.php
|
@ -5,11 +5,11 @@ include 'checklogin.php';
|
|||
include "connect.php";
|
||||
|
||||
$mysql_table = MYSQL_TABLE;
|
||||
$qry="SELECT * FROM `$mysql_table` WHERE `id`='".mysql_escape_string($_GET["id"])."'";
|
||||
$result=mysql_query($qry);
|
||||
$qry="SELECT * FROM `$mysql_table` WHERE `id`='".mysqli_escape_string($_GET["id"])."'";
|
||||
$result=mysqli_query($qry);
|
||||
if($result) {
|
||||
if(mysql_num_rows($result) == 1) {
|
||||
$row = mysql_fetch_array($result);
|
||||
if(mysqli_num_rows($result) == 1) {
|
||||
$row = mysqli_fetch_array($result);
|
||||
?>
|
||||
<div class="t tp">
|
||||
<?php
|
||||
|
@ -29,5 +29,5 @@ if($result) {
|
|||
<?php
|
||||
}
|
||||
}
|
||||
mysql_close($link);
|
||||
?>
|
||||
mysqli_close($link);
|
||||
?>
|
||||
|
|
10
get.php
10
get.php
|
@ -5,15 +5,15 @@ include 'checklogin.php';
|
|||
include "connect.php";
|
||||
|
||||
$mysql_table = MYSQL_TABLE;
|
||||
$qry="SELECT * FROM `$mysql_table` ORDER BY `$mysql_table`.`id` ASC LIMIT ".mysql_escape_string($_GET["lastid"])." , 1000";
|
||||
$result=mysql_query($qry);
|
||||
$qry="SELECT * FROM `$mysql_table` ORDER BY `$mysql_table`.`id` ASC LIMIT ".mysqli_escape_string($_GET["lastid"])." , 1000";
|
||||
$result=mysqli_query($qry);
|
||||
$newlastid=$_GET["lastid"];
|
||||
$jspo=array();
|
||||
while ($row = mysql_fetch_array($result)) {
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$newlastid=$newlastid+1;
|
||||
array_push($jspo, array("txt"=>stripslashes($row["txt"]), "tim"=>$row["tim"], "id"=>$row["id"]));
|
||||
}
|
||||
echo json_encode(array("posts"=>$jspo, "lastid"=>$newlastid));
|
||||
|
||||
mysql_close($link);
|
||||
?>
|
||||
mysqli_close($link);
|
||||
?>
|
||||
|
|
|
@ -43,9 +43,9 @@ include 'checklogin.php';
|
|||
include "connect.php";
|
||||
$mysql_table = MYSQL_TABLE;
|
||||
$qry="SELECT * FROM `$mysql_table` ORDER BY `$mysql_table`.`id` DESC LIMIT 0, 30 ";
|
||||
$result=mysql_query($qry);
|
||||
$result=mysqli_query($qry);
|
||||
$iffirst=0;
|
||||
while ($row = mysql_fetch_array($result)) {
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$postlinked = stripslashes($row["txt"]);
|
||||
echo '<span class="post postid'.$row["id"].'"><div class="t"><span class="loadingh"></span>'.$postlinked.'</div><div class="i">'.$row["tim"].'</div></span>';
|
||||
if ($iffirst==0) {
|
||||
|
@ -53,7 +53,7 @@ include 'checklogin.php';
|
|||
$iffirst=1;
|
||||
}
|
||||
}
|
||||
mysql_close($link);
|
||||
mysqli_close($link);
|
||||
?>
|
||||
</div><!--
|
||||
<br /><br /> -->
|
||||
|
@ -221,4 +221,4 @@ animationIn: 'bubble'
|
|||
</script>
|
||||
<script type="text/javascript" src="plugins/add2home.js" charset="utf-8"></script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
14
like.php
14
like.php
|
@ -8,11 +8,11 @@ $stars=0;
|
|||
$starred="";
|
||||
|
||||
$mysql_table = MYSQL_TABLE;
|
||||
$qrya="SELECT * FROM `$mysql_table` WHERE `id`='".mysql_escape_string($_GET["id"])."'";
|
||||
$resulta=mysql_query($qrya);
|
||||
$qrya="SELECT * FROM `$mysql_table` WHERE `id`='".mysqli_escape_string($_GET["id"])."'";
|
||||
$resulta=mysqli_query($qrya);
|
||||
if($resulta) {
|
||||
if(mysql_num_rows($resulta) == 1) {
|
||||
$rowa = mysql_fetch_array($resulta);
|
||||
if(mysqli_num_rows($resulta) == 1) {
|
||||
$rowa = mysqli_fetch_array($resulta);
|
||||
$stars=$rowa["pluses"];
|
||||
}
|
||||
}
|
||||
|
@ -20,8 +20,8 @@ if($resulta) {
|
|||
$stars=$stars+1;
|
||||
|
||||
if (isset($_GET["plusone"])) {
|
||||
$qryb="UPDATE `$mysql_table` SET `pluses`='".($stars)."' WHERE `id`='".mysql_escape_string($_GET["id"])."'";
|
||||
$resultb=mysql_query($qryb);
|
||||
$qryb="UPDATE `$mysql_table` SET `pluses`='".($stars)."' WHERE `id`='".mysqli_escape_string($_GET["id"])."'";
|
||||
$resultb=mysqli_query($qryb);
|
||||
if($resultb) {
|
||||
$starred="Thanks for a ★! ";
|
||||
} else {
|
||||
|
@ -46,4 +46,4 @@ if (isset($_GET["plusone"])) {
|
|||
<?php echo $starred; ?><input type="submit" name="plusone" class="btn" value="+1 ★" /><span class="btnm"><?php echo $stars; ?></span>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue