Bravo List
Register
Go Back   > Bravo List > P2P > Forum > Community Cafe
Reply
Thread Tools
  #1  
Old 20th December 2008, 16:50
tunad tunad is offline
Senior Member
 
Join Date: Oct 2008
Posts: 57
Default edit.php problem
my edit.php is not working......is not updating my data,what can i do?



this is it:
PHP Code:
<?

require_once("include/bittorrent.php");

if (!
mkglobal("id"))
        die();

$id $id;
if (!
$id)
        die();

dbconn();

loggedinorreturn();

$res mysql_query("SELECT * FROM torrents WHERE id = $id");
$row mysql_fetch_array($res);
if (!
$row)
        die();

stdhead("Edit torrent \"" $row["name"] . "\"");

if (!isset(
$CURUSER) || ($CURUSER["id"] != $row["owner"] && get_user_class() < UC_MODERATOR)) {
        print(
"<h1>Can't edit this torrent</h1>\n");
        print(
"<p>You're not the rightful owner, or you're not <a href=\"login.php?returnto=" urlencode($_SERVER["REQUEST_URI"]) . "&amp;nowarn=1\">logged in</a> properly.</p>\n");
}
else {
        print(
"<form name=editupload method=post action=takeedit.php enctype=multipart/form-data>\n");
        print(
"<input type=\"hidden\" name=\"id\" value=\"$id\">\n");
        if (isset(
$_GET["returnto"]))
                print(
"<input type=\"hidden\" name=\"returnto\" value=\"" htmlspecialchars($_GET["returnto"]) . "\" />\n");
        print(
"<table border=\"1\" cellspacing=\"0\" cellpadding=\"10\">\n");
        
tr("Torrent name""<input type=\"text\" name=\"name\" value=\"" htmlspecialchars($row["name"]) . "\" size=\"80\" />"1);
        
tr("Small Description""<input type =\"text\" name=\"description\" size=\"80\" value=\"" .htmlspecialchars($row["description"]). "\"><br>Short description of the file you are uploading (I.E. Great action movie from the 90's)<br>This is shown in the browse.php below the torrent name."1);
        
tr("NFO file""<input type=radio name=nfoaction value='keep' checked>Keep current<br>".
        
"<input type=radio name=nfoaction value='update'>Update:<br><input type=file name=nfo size=80>"1);
if ((
strpos($row["ori_descr"], "<") === false) || (strpos($row["ori_descr"], "&lt;") !== false))
  
$c "";
else
  
$c " checked";
        print(
"<tr><td class=rowhead style='padding: 10px'>Description</td><td align=center style='padding: 3px'>");
 
textbbcode("editupload","descr","$row[ori_descr]");
        print(
"</td>\n");

        
$s "<select name=\"type\">\n";

        
$cats genrelist();
        foreach (
$cats as $subrow) {
                
$s .= "<option value=\"" $subrow["id"] . "\"";
                if (
$subrow["id"] == $row["category"])
                        
$s .= " selected=\"selected\"";
                
$s .= ">" htmlspecialchars($subrow["name"]) . "</option>\n";
        }

        
$s .= "</select>\n";
        
tr("Type"$s1);
        
tr("Visible""<input type=\"checkbox\" name=\"visible\"" . (($row["visible"] == "yes") ? " checked=\"checked\"" "" ) . " value=\"1\" /> Visible on main page<br /><table border=0 cellspacing=0 cellpadding=0 width=420><tr><td class=embedded>Note that the torrent will automatically become visible when there's a seeder, and will become automatically invisible (dead) when there has been no seeder for a while. Use this switch to speed the process up manually. Also note that invisible (dead) torrents can still be viewed or searched for, it's just not the default.</td></tr></table>"1);

        if (
$CURUSER["admin"] == "yes")
                
tr("Banned""<input type=\"checkbox\" name=\"banned\"" . (($row["banned"] == "yes") ? " checked=\"checked\"" "" ) . " value=\"1\" /> Banned"1);

        print(
"<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value='Edit it!' style='height: 25px; width: 100px'> <input type=reset value='Revert changes' style='height: 25px; width: 100px'></td></tr>\n");
        print(
"</table>\n");
        print(
"</form>\n");
        print(
"<p>\n");
        print(
"<form method=\"post\" action=\"delete.php\">\n");
  print(
"<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\">\n");
  print(
"<tr><td class=embedded style='background-color: #F5F4EA;padding-bottom: 5px' colspan=\"2\"><b>Delete torrent.</b> Reason:</td></tr>");
  print(
"<td><input name=\"reasontype\" type=\"radio\" value=\"1\">&nbsp;Dead </td><td> 0 seeders, 0 leechers = 0 peers total</td></tr>\n");
  print(
"<tr><td><input name=\"reasontype\" type=\"radio\" value=\"2\">&nbsp;Dupe</td><td><input type=\"text\" size=\"40\" name=\"reason[]\"></td></tr>\n");
  print(
"<tr><td><input name=\"reasontype\" type=\"radio\" value=\"3\">&nbsp;Nuked</td><td><input type=\"text\" size=\"40\" name=\"reason[]\"></td></tr>\n");
  print(
"<tr><td><input name=\"reasontype\" type=\"radio\" value=\"4\">&nbsp;TB rules</td><td><input type=\"text\" size=\"40\" name=\"reason[]\">(req)</td></tr>");
  print(
"<tr><td><input name=\"reasontype\" type=\"radio\" value=\"5\" checked>&nbsp;Other:</td><td><input type=\"text\" size=\"40\" name=\"reason[]\">(req)</td></tr>\n");
        print(
"<input type=\"hidden\" name=\"id\" value=\"$id\">\n");
        if (isset(
$_GET["returnto"]))
                print(
"<input type=\"hidden\" name=\"returnto\" value=\"" htmlspecialchars($_GET["returnto"]) . "\" />\n");
  print(
"<td colspan=\"2\" align=\"center\"><input type=submit value='Delete it!' style='height: 25px'></td></tr>\n");
  print(
"</table>");
        print(
"</form>\n");
        print(
"</p>\n");
}

stdfoot();

?>
Bump: abd this is my takeedit.php

PHP Code:
<?

require_once("include/bittorrent.php");

function 
bark($msg) {
        
genbark($msg"Edit failed!");
}

if (!
mkglobal("id:name:descr:type"))
        
bark("missing form data");

$id $id;
if (!
$id)
        die();

dbconn();

loggedinorreturn();

$res mysql_query("SELECT owner, filename, save_as FROM torrents WHERE id = $id");
$row mysql_fetch_array($res);
if (!
$row)
        die();

if (
$CURUSER["id"] != $row["owner"] && get_user_class() < UC_MODERATOR)
        
bark("You're not the owner! How did that happen?\n");

$updateset = array();

$fname $row["filename"];
preg_match('/^(.+)\.torrent$/si'$fname$matches);
$shortfname $matches[1];
$smalldescr $_POST["description"];
$dname $row["save_as"];

$nfoaction $_POST['nfoaction'];
if (
$nfoaction == "update")
{
  
$nfofile $_FILES['nfo'];
  if (!
$nfofile) die("No data " var_dump($_FILES));
  if (
$nfofile['size'] > 65535)
    
bark("NFO is too big! Max 65,535 bytes.");
  
$nfofilename $nfofile['tmp_name'];
  if (@
is_uploaded_file($nfofilename) && @filesize($nfofilename) > 0)
    
$updateset[] = "nfo = " sqlesc(str_replace("\x0d\x0d\x0a""\x0d\x0a"file_get_contents($nfofilename)));
}
else
  if (
$nfoaction == "remove")
    
$updateset[] = "nfo = ''";
$updateset[] = "free = '".($_POST["free"]=='yes' 'no')."'";
$updateset[] = "name = " sqlesc($name);
$updateset[] = "description = " sqlesc($smalldescr);
$updateset[] = "search_text = " sqlesc(searchfield("$shortfname $dname $torrent"));
$updateset[] = "descr = " sqlesc($descr);
$updateset[] = "ori_descr = " sqlesc($descr);
$updateset[] = "category = " . ($type);
if (
$CURUSER["admin"] == "yes") {
        if (
$_POST["banned"]) {
                
$updateset[] = "banned = 'yes'";
                
$_POST["visible"] = 0;
        }
        else
                
$updateset[] = "banned = 'no'";
}
$updateset[] = "visible = '" . ($_POST["visible"] ? "yes" "no") . "'";

mysql_query("UPDATE torrents SET " join(","$updateset) . " WHERE id = $id");

write_log("Torrent $id ($name) was edited by $CURUSER[username]");

$returl "details.php?id=$id&edited=1";
if (isset(
$_POST["returnto"]))
        
$returl .= "&returnto=" urlencode($_POST["returnto"]);
header("Refresh: 0; url=$returl");


?>


help me please
Reply With Quote
Reply

Tags
editphp , problem


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Edit this style please.. evaldas40 Yuna Scatari Edition (YSE) 0 1st November 2009 02:57
how to edit this? dopeboy xBTiT 1 8th October 2009 16:34
Edit ts 1.3.9 codedash Template Shares 4 19th February 2009 01:30
edit details.php torrentim2 Template Shares 0 6th January 2009 00:08
How to edit this part trilious Template Shares 2 27th August 2008 15:41



All times are GMT +2. The time now is 16:59. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.