Jump to content
php.lv forumi

nezinams mainigais


Mighty

Recommended Posts

<?
require "include/bittorrent.php";
dbconn();
loggedinorreturn();
stdhead("Bilžu spēles administrēšana");
$bildesid = $_GET["id"];


if (get_user_class() < UC_ADMINISTRATOR)
stderr("".Error."", "".Access_denied.".");
if ($_SERVER["REQUEST_METHOD"] == "POST")
{

$checked = $_POST["checked"];
$accepted = $_POST["accepted"];
$accept_comment = $_POST["accept_comment"];
$next = $_POST["next"];
$id = $_POST["id"];
$adminid = $CURUSER['id'];
$laiks = get_date_time();


$updateset[] = "checked = " . sqlesc($checked);
$updateset[] = "accepted = " . sqlesc($accepted);
$updateset[] = "next = " . sqlesc($next);
$updateset[] = "accept_comment = " . sqlesc($accept_comment);
$updateset[] = "accepted_at = " . sqlesc($laiks);
$updateset[] = "accepted_by = " . sqlesc($adminid);

mysql_query("UPDATE bilzu_spele SET " . implode(", ", $updateset) . " where id=$bildesid") or sqlerr(__FILE__, __LINE__);	
die;
}













$res = mysql_query("SELECT userid, links, added, checked, accepted, accepted_by, comment, accept_comment, accepted_at, next FROM bilzu_spele where id=$bildesid");

while($arr = mysql_fetch_array($res))

{

$links = htmlspecialchars($arr['links']);
$userid = htmlspecialchars($arr['userid']);
$comment = htmlspecialchars($arr['comment']);
$next = htmlspecialchars($arr['next']);
$added = htmlspecialchars($arr['added']);


$checked = $arr["checked"] == 'yes';
$accepted = $arr["accepted"] == 'yes';

if ($accepted == 'yes')
{
$accepted2 = '<font color=green><strong>Jā</font></strong>';
}
else
{
$accepted2 = '<font color=red><strong>Nē</font></strong>';
}


if ($checked == 'yes')
{
$checked2 = '<font color=green><strong>Jā</font></strong>';
}
else
{
$checked2 = '<font color=red><strong>Nē</font></strong>';
}



print("<table>");

print("<TR><TD class=rofl4><center>Bildes nr.</center></td><td class=rofl3 align=left><font color=red>$id</font></TD></tr>");
print("<TR><TD class=rofl4><center>Bildi Pievienoja</center></td><td class=rofl3 align=left><A href=\"userdetails.php?id=" . $userid . "\">" . get_user_name($userid) . "</A></TD></tr>");
print("<TR><TD class=rofl4><center>Bilde</center></td><td class=rofl3 align=left><img width=\"400\" src=$links></TD></tr>");
print("<TR><TD class=rofl4><center>Pievienota</center></td><td class=rofl3 align=left>$added</TD></tr>");
print("<TR><TD class=rofl4><center>Komentars</center></td><td class=rofl3 align=left>$comment</TD></tr>");
print("<TR><TD class=rofl4><center>Nakamais uzdevums</center></td><td class=rofl3 align=left>Nofotogrāfē $next</TD></tr></br><br>");
print("<TR><TD class=rofl4><center>Parbaudita?</center></td><td class=rofl3 align=left>$checked2</TD></tr></br><br>");
print("<TR><TD class=rofl4><center>Akcepteta?</center></td><td class=rofl3 align=left>$accepted2</TD></tr></br><br>");


print("<form method=post action=bilzu_spele_edit.php>");




print("<tr><td class=rowhead>Checked</td><td colspan=2 align=left><input name=checked value='yes' type=radio" . ($checked ? " checked" : "") . ">Yes <input name=checked value='no' type=radio" . (!$checked ? " checked" : "") . " >No</td></tr>\n");
print("<tr><td class=rowhead>Accepted</td><td colspan=2 align=left><input name=accepted value='yes' type=radio" . ($accepted ? " checked" : "") . ">Yes<input name=accepted value='no' type=radio" . (!$accepted ? " checked" : "") . " >No</td></tr>\n");
print("<tr><td class=rowhead>Comment</td><td><input type=text name=accept_comment size=40></td></tr>\n");
print("<tr><td class=rowhead>Nākamā bilde</td><td colspan=2 align=left><textarea cols=80 rows=10 name=next>$next</textarea></td></tr>\n");


print("<tr><td colspan=3 align=center><input type=submit class=btn value='Okay' ></td></tr>\n");


?></TABLE><?
}
stdfoot();

?>

 

 

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

in C:\xampp\htdocs\bilzu_spele_edit.php, line 30

 

Kur ir kļūda?

Saprotu, ka viņš neatrod $id vērtību, bet viņa tak ir jau norādīta.

Kods pats par sevi strādā, izvācot to "where id =$id" viss notiek (apdeitojas viss).

Edited by Mighty
Link to comment
Share on other sites

Loģiski, ka to id nevar iegūt, jo nav korekta šī rindiņa

 

print("<form method=post action=bilzu_spele_edit.php>");

 

ja būtu šādi, tad arī iegūtu to id vērtību no GET

print("<form method=post action=bilzu_spele_edit.php?id=$id>");

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...