Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   Template Shares (http://www.bvlist.com/forumdisplay.php?f=26)
-   -   Problem with shoutbox (http://www.bvlist.com/showthread.php?t=12637)

Floky123 26th December 2022 16:21

Problem with shoutbox
 
Hi i have problem with shoutbox when i try to write something i become this error:

SQL Error
Incorrect integer value: 'id' for column `admin_infire`.`shoutbox`.`id` at row 1
in /home/admin/domains/******/public_html/shoutbox.php, line 61

My shoutbox.php:


Quote:

require_once("include/bittorrent.php");
dbconn(false);
loggedinorreturn();
parked();
iplogger();
if (isset($_GET['del']))
{
if (is_valid_id($_GET['del']))
{
if ( (get_user_class() >= UC_MODERATOR) ) {
sql_query("DELETE FROM shoutbox WHERE id=".mysql_real_escape_string($_GET['del']));
}
}
}
?>

ShoutBox






mysql_query("UPDATE users SET chat_access='" . get_date_time() . "' WHERE id=" . mysql_real_escape_string($CURUSER["id"]));// or die(mysql_error());
/*
if ($CURUSER["chatpost"] == 'no')
{
print("


You are banned.

");
exit;
}
else
{
*/

if($_GET["sent"]=="yes")
if(!$_GET["shbox_text"])
{
$userid=0+$CURUSER["id"];
}
else
{
$userid=0+$CURUSER["id"];
$username=htmlspecialchars(trim($CURUSER["username"]));
$date=sqlesc(time());
$text=trim($_GET["shbox_text"]);

sql_query("INSERT INTO shoutbox (id, userid, username, date, text) VALUES ('id'," . sqlesc($userid) . ", " . sqlesc($username) . ", $date, " . sqlesc($text) . ")") or sqlerr(__FILE__, __LINE__);
print "";
}

$res = sql_query("SELECT * FROM shoutbox ORDER BY date DESC LIMIT 70") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) == 0)
print("\n");
else
{
print("\n");

while ($arr = mysql_fetch_assoc($res))
{
$res2 = sql_query("SELECT username,class,avatar,donor, title,enabled,warned FROM users WHERE id=$arr[userid]") or sqlerr(__FILE__, __LINE__);
$arr2 = mysql_fetch_assoc($res2);
$resowner = sql_query("SELECT id, username, class FROM users WHERE id=$arr[userid]") or print(mysql_error());
$rowowner = mysql_fetch_array($resowner);


if ($rowowner["class"] == "8")
$usercolor= "" .htmlspecialchars($rowowner["username"]). "";
if ($rowowner["class"] == "7")
$usercolor= "" .htmlspecialchars($rowowner["username"]). "";
if ($rowowner["class"] == "6")
$usercolor= "" .htmlspecialchars($rowowner["username"]). "";
elseif ($rowowner["class"] == "5")
$usercolor= "" .htmlspecialchars($rowowner["username"]). "";
elseif ($rowowner["class"] == "4")
$usercolor= "" .htmlspecialchars($rowowner["username"]). "";
elseif ($rowowner["class"] == "3")
$usercolor= "" .htmlspecialchars($rowowner["username"]). "";
elseif ($rowowner["class"] == "2")
$usercolor= "" .htmlspecialchars($rowowner["username"]). "";
elseif ($rowowner["class"] == "1")
$usercolor= "" .htmlspecialchars($rowowner["username"]). "";
elseif ($rowowner["class"] == "0")
$usercolor= "" .htmlspecialchars($rowowner["username"]). "";

if (get_user_class() >= UC_MODERATOR) {
$del="[del]";
}

print("\n");
}
print("
[".strftime("%d.%m %H:%M",$arr["date"])."]
$del

$usercolor" .
($arr2["donor"] == "yes" ? "DONOR" : "") .
($arr2["warned"] == "yes" ? "Warned" : "") .
" ".format_comment($arr["text"], 0)."
");
}
?>



BamBam0077 27th December 2022 06:50

Firstly replace
PHP Code:

sql_query("INSERT INTO shoutbox (id, userid, username, date, text) VALUES ('id'," sqlesc($userid) . ", " sqlesc($username) . ", $date, " sqlesc($text) . ")") or sqlerr(__FILE____LINE__);
print 
"<script type="text/javascript">parent.document.shbox.shbox_text.value ='';</script>";


With;:

PHP Code:

sql_query("INSERT INTO shoutbox (id, userid, username, date, text) VALUES (".$id."," sqlesc($userid) . ", " sqlesc($username) . ", $date, " sqlesc($text) . ")") or sqlerr(__FILE____LINE__);
print 
"<script type="text/javascript">parent.document.shbox.shbox_text.value ='';</script>";


Next step:
Replace:
PHP Code:

$arr2 mysql_fetch_assoc($res2);
$resowner sql_query("SELECT id, username, class FROM users WHERE id=$arr[userid]") or print(mysql_error());
$rowowner mysql_fetch_array($resowner);


if (
$rowowner["class"] == "8"

With::

PHP Code:

$arr2 mysql_fetch_assoc($res2);
$resowner sql_query("SELECT id, username, class FROM users WHERE id=$arr2[userid]") or print(mysql_error());
$rowowner mysql_fetch_array($resowner);


if (
$rowowner["class"] == "8"

Try That G8 work dude :ok:

Floky123 27th December 2022 20:02

Quote:

Originally Posted by BamBam0077 (Post 56569)
Firstly replace
PHP Code:

sql_query("INSERT INTO shoutbox (id, userid, username, date, text) VALUES ('id'," sqlesc($userid) . ", " sqlesc($username) . ", $date, " sqlesc($text) . ")") or sqlerr(__FILE____LINE__);
print 
"<script type="text/javascript">parent.document.shbox.shbox_text.value ='';</script>";


With;:

PHP Code:

sql_query("INSERT INTO shoutbox (id, userid, username, date, text) VALUES (".$id."," sqlesc($userid) . ", " sqlesc($username) . ", $date, " sqlesc($text) . ")") or sqlerr(__FILE____LINE__);
print 
"<script type="text/javascript">parent.document.shbox.shbox_text.value ='';</script>";


Next step:
Replace:
PHP Code:

$arr2 mysql_fetch_assoc($res2);
$resowner sql_query("SELECT id, username, class FROM users WHERE id=$arr[userid]") or print(mysql_error());
$rowowner mysql_fetch_array($resowner);


if (
$rowowner["class"] == "8"

With::

PHP Code:

$arr2 mysql_fetch_assoc($res2);
$resowner sql_query("SELECT id, username, class FROM users WHERE id=$arr2[userid]") or print(mysql_error());
$rowowner mysql_fetch_array($resowner);


if (
$rowowner["class"] == "8"

Try That G8 work dude :ok:

Thank you for time and help, but that don't work :(

DND 30th December 2022 15:32

have you looked in the database at the auto_increment for that table field?
:coffee:

Floky123 5th January 2023 00:01

Quote:

Originally Posted by DND (Post 56574)
have you looked in the database at the auto_increment for that table field?
:coffee:

yep, all looks ok its working normal with php 5.3 but 5.6 have i this error

DND 5th January 2023 01:23

old code.. need updating

Floky123 5th January 2023 15:59

Quote:

Originally Posted by DND (Post 56577)
old code.. need updating

Yep i think its too many work to make it updated :D

iseeyoucopy 6th January 2023 13:58

I think you are using old version of php and newer version of mysql server, newer versions of mysql have set SQL_MODE to strict...

check your mysql version

mogo 14th January 2023 02:45

I don't know why guys like bigjoos, iseeyoucopy, antimidas, son, asterix, darkalchemy and ets and etc working on this greath source gave up
But maybe it was meant to be
Thank you for everything guys :)


All times are GMT +2. The time now is 23:49.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.