User edit topic

Started on the old forum in February 2010 · view the original in the archive · old links redirect here

4 replies · 575 views · started 16 years ago · 1 min read

3 participants
riderz Lead · 975 posts #1

create page usertpc.php

<?php
include("xhtmlfunctions.php");
header("Content-type: text/html; charset=ISO-8859-1");
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
?>
<?php
include("config.php");
include("core.php");
connectdb();
$action = $_GET["action"];
$sid = $_GET["sid"];
$uid=getuid_sid($sid);

if(islogged($sid)==false)
 * *{
 * * * *$pstyle = gettheme($sid);
 * * *echo xhtmlhead("$stitle",$pstyle);
 * * *echo "<p align=\"center\">";
 * * *echo "You are not logged in<br/>";
 * * *echo "Or<br/>Your session has been expired<br/><br/>";
 * * *echo "<a href=\"index.php\">Login</a>";
 * * *echo "</p>";
 * * * echo xhtmlfoot();
 * * *exit();
 * *}
 * *addonline(getuid_sid($sid),"editing Topic","");
	
	
if($action=="rentpc")
{
 *$tid = $_GET["tid"];
 *$tname = $_POST["tname"];
 *$fid = getfid_tid($tid);
 $pstyle = gettheme($sid);
 * * *echo xhtmlhead("$stitle",$pstyle);
 *echo "<p align=\"center\">";
 *$otname = gettname($tid);
 * $tinfo= mysql_fetch_array(mysql_query("SELECT name,fid, authorid, text, pinned, closed *FROM ibwf_topics WHERE id='".$tid."'"));
if($tinfo[2]==getuid_sid($sid))
 *{
 *if(trim($tname!=""))
 *{
 * *$not = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE name LIKE '".$tname."' AND fid='".$fid."'"));
 * *if($not[0]==0)
 * *{
 *$res = mysql_query("UPDATE ibwf_topics SET name='".$tname."' WHERE id='".$tid."'");
 *if($res)
 * * * * *{
 * * * * * *//mysql_query("INSERT INTO ibwf_mlog SET action='topics', details='<b>".getnick_uid(getuid_sid($sid))."</b> Renamed The thread ".mysql_escape_string($otname)." to ".mysql_escape_string($tname)." at the forum ".getfname($fid)."', actdt='".time()."'");
 * * * * * *echo "<img src=\"images/ok.gif\" alt=\"O\"/>Topic *Renamed";
 * * * * *}}
		 *else
		 *{
 * * * * * *echo "<img src=\"images/notok.gif\" alt=\"X\"/>Topic Name already exist";
 * * * * *}
 *}
 *else
 *{
 * *echo "<img src=\"images/notok.gif\" alt=\"X\"/> You must specify a name for the topic";
 *}
 * *
 *}
 *else{
 * *echo "<img src=\"images/notok.gif\" alt=\"X\"/> *Wata shame! Dont be an Ass hole to rename others topic!! **** u off from $stitle b4 $stitle kick u out!!";
	$wintext = "".getnick_uid($uid)." Tried to Rename others topic!!";
	$res = mysql_query("INSERT INTO ibwf_private SET text='".$wintext."', byuid='".$uid."', touid='1', timesent='".time()."'");
 *}
 *echo "<br/><br/>";
 *echo "<a href=\"index.php?action=viewtpc&sid=$sid&tid=$tid\">";
echo "View Topic</a><br/>";
$fname = getfname($fid);
 * * *echo "<a href=\"index.php?action=viewfrm&sid=$sid&fid=$fid\">";
echo "$fname</a><br/>";
 *echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
 *echo "</p>";
 * *echo xhtmlfoot();
 * *exit();
 * *}
//////////////////////////////////
else if($action=="edttpc")
{
$uid=getuid_sid($sid);
 *$tid = $_GET["tid"];
 *$ttext = $_POST["ttext"];
 *$fid = getfid_tid($tid);
 $pstyle = gettheme($sid);
 * * *echo xhtmlhead("$stitle",$pstyle);
 *echo "<p align=\"center\">";
 *$tinfo= mysql_fetch_array(mysql_query("SELECT name,fid, authorid, text, pinned, closed *FROM ibwf_topics WHERE id='".$tid."'"));
if($tinfo[2]==getuid_sid($sid))
 *{
 *$res = mysql_query("UPDATE ibwf_topics SET text='"
 *.$ttext."' WHERE id='".$tid."'");
 *if($res)
 * * * * *{
 * * * * * *//mysql_query("INSERT INTO ibwf_mlog SET action='topics', details='<b>".getnick_uid(getuid_sid($sid))."</b> Edited the text Of the thread ".mysql_escape_string(gettname($tid))." at the forum ".getfname($fid)."', actdt='".time()."'");
 * * * * * *echo "<img src=\"images/ok.gif\" alt=\"O\"/>Topic Message Edited";
 * * * * *}}else{
 * * * * * *echo "<img src=\"images/notok.gif\" alt=\"X\"/>Wata shame! Dont be an Ass hole to edit others topic!! **** u off from $stitle b4 $stitle kick u out!";
			$wintext = "".getnick_uid($uid)." Tried to edit others topic!!";
	$res = mysql_query("INSERT INTO ibwf_private SET text='".$wintext."', byuid='".$uid."', touid='1', timesent='".time()."'");
 * * * * *}
 *echo "<br/><br/>";
 *echo "<a href=\"index.php?action=viewtpc&sid=$sid&tid=$tid\">";
echo "View Topic</a><br/>";
$fname = getfname($fid);
 * * *echo "<a href=\"index.php?action=viewfrm&sid=$sid&fid=$fid\">";
echo "$fname</a><br/>";
 *echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
 *echo "</p>";
 * *echo xhtmlfoot();
 * *exit();
 * *}
//////////////////////////////////
else if($action=="delt")
{

 *$tid = $_GET["tid"];
 *$fid = getfid_tid($tid);
 $pstyle = gettheme($sid);
 * * *echo xhtmlhead("$stitle",$pstyle);
 *echo "<p align=\"center\">";
 *$tname=gettname($tid);
 *$tinfo= mysql_fetch_array(mysql_query("SELECT name,fid, authorid, text, pinned, closed *FROM ibwf_topics WHERE id='".$tid."'"));
if($tinfo[2]==getuid_sid($sid))
 *{
 *$res = mysql_query("DELETE FROM ibwf_topics WHERE id='".$tid."'");
 *if($res)
 * * * * *{
 * * * * * *mysql_query("DELETE FROM ibwf_posts WHERE tid='".$tid."'");
 * * * * * *//mysql_query("INSERT INTO ibwf_mlog SET action='topics', details='<b>".getnick_uid(getuid_sid($sid))."</b> Deleted The thread ".mysql_escape_string($tname)." at the forum ".getfname($fid)."', actdt='".time()."'");
 * * * * * *echo "<img src=\"images/ok.gif\" alt=\"O\"/>Topic Deleted";
 * * * * *}}else{
 * * * * * *echo "<img src=\"images/notok.gif\" alt=\"X\"/>Wata shame! Dont be an Ass hole to Delete others topic!! **** u off from $stitle b4 $stitle kick u out!";
			$wintext = "".getnick_uid($uid)." Tried to delete others topic!!";
	$res = mysql_query("INSERT INTO ibwf_private SET text='".$wintext."', byuid='".$uid."', touid='1', timesent='".time()."'");
 * * * * *}
 *echo "<br/><br/>";
 *
$fname = getfname($fid);
 * * *echo "<a href=\"index.php?action=viewfrm&sid=$sid&fid=$fid\">";
echo "$fname</a><br/>";
 *echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
 *echo "</p>";
 * *echo xhtmlfoot();
 * *exit();
 * *}
/////////////////////////////////////////////////////////////////////////Edit Post

else if($action=="edtpst")
{
 *$pid = $_GET["pid"];
 *$ptext = $_POST["ptext"];
 *$tid = gettid_pid($pid);
 *$fid = getfid_tid($tid);
 $pstyle = gettheme($sid);
 * * *echo xhtmlhead("$stitle",$pstyle);
 *echo "<p align=\"center\">";
 * $pinfo= mysql_fetch_array(mysql_query("SELECT uid,tid, text *FROM ibwf_posts WHERE id='".$pid."'"));
 *if($pinfo[0]==getuid_sid($sid))
 *{
 *$res = mysql_query("UPDATE ibwf_posts SET text='"
 *.$ptext."' WHERE id='".$pid."'");
 *if($res)
 * * * * *{
 * * * * * *$tname = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_topics WHERE id='".$tid."'"));
 * * * * * *//mysql_query("INSERT INTO ibwf_mlog SET action='posts', details='<b>".getnick_uid(getuid_sid($sid))."</b> Edited Post Number $pid Of the thread ".mysql_escape_string($tname[0])." at the forum ".getfname($fid)."', actdt='".time()."'");
 * * * * * *echo "<img src=\"images/ok.gif\" alt=\"O\"/>Post Message Edited";
 * * * * *}}else{
 * * * * * *echo "<img src=\"images/notok.gif\" alt=\"X\"/>Wata shame! Dont be an Ass hole to Delete others Posts!! **** u off from $stitle b4 $stitle kick u out!";
			$wintext = "".getnick_uid($uid)." Tried to delete others posts!!";
	$res = mysql_query("INSERT INTO ibwf_private SET text='".$wintext."', byuid='".$uid."', touid='1', timesent='".time()."'");
 * * * * *}
 *echo "<br/><br/>";
 *echo "<a href=\"index.php?action=viewtpc&sid=$sid&tid=$tid\">";
echo "View Topic</a><br/>";
$fname = getfname($fid);
 * * *echo "<a href=\"index.php?action=viewfrm&sid=$sid&fid=$fid\">";
echo "$fname</a><br/>";
 *echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
 *echo "</p>";
 * *echo xhtmlfoot();
 * *exit();
 * *}
//////////////////////////////////
else if($action=="clot")
{
 *$tid = $_GET["tid"];
 *$tdo = $_GET["tdo"];
 *$fid = getfid_tid($tid);
 $pstyle = gettheme($sid);
 * * *echo xhtmlhead("$stitle",$pstyle);
 *echo "<p align=\"center\">";
 *$tinfo= mysql_fetch_array(mysql_query("SELECT name,fid, authorid, text, pinned, closed *FROM ibwf_topics WHERE id='".$tid."'"));
if($tinfo[2]==getuid_sid($sid))
 *{
 *$res = mysql_query("UPDATE ibwf_topics SET closed='"
 *.$tdo."' WHERE id='".$tid."'");
 *if($res)
 * * * * *{
 * * * * * *if($tdo==1)
 * * * * * *{
 * * * * * * *$msg = "Closed";
 * * * * * *}else{
 * * * * * * * *$msg = "Opened";
 * * * * * *}
 * * * * * *//mysql_query("INSERT INTO ibwf_mlog SET action='topics', details='<b>".getnick_uid(getuid_sid($sid))."</b> Closed The thread ".mysql_escape_string(gettname($tid))." at the forum ".getfname($fid)."', actdt='".time()."'");
 * * * * * *echo "<img src=\"images/ok.gif\" alt=\"O\"/>Topic $msg";
			$tpci = mysql_fetch_array(mysql_query("SELECT name, authorid FROM ibwf_topics WHERE id='".$tid."'"));
			$tname = htmlspecialchars($tpci[0]);
			$msg = "your thread [topic=$tid]$tname"."[/topic] is $msg"."[br/][small][i]p.s: this is an automatic pm[/i][/small]";
			autopm($msg, $tpci[1]);
 * * * * *}}else{
 * * * * * *echo "<img src=\"images/notok.gif\" alt=\"X\"/>Wata shame! Dont be an Ass hole to close others topic!! **** u off from $stitle b4 $stitle kick u out!";
			$wintext = "".getnick_uid($uid)." Tried to close others topic!!";
	$res = mysql_query("INSERT INTO ibwf_private SET text='".$wintext."', byuid='".$uid."', touid='1', timesent='".time()."'");
 * * * * *}
 *echo "<br/><br/>";
 *
$fname = getfname($fid);
 * * *echo "<a href=\"index.php?action=viewfrm&sid=$sid&fid=$fid\">";
echo "$fname</a><br/>";
 *echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
 *echo "</p>";
 * *echo xhtmlfoot();
 * *exit();
 * *}

?>

then in else if($action=="pstopt") look for this

if(ismod(getuid_sid($sid)))
 *{

 * * echo "<form method=\"post\" action=\"mprocpl.php?action=edtpst&sid=$sid&pid=$pid\">";
 * * echo "Text: <input name=\"ptext\" value=\"$ptext\" maxlength=\"500\"/> ";
 * * echo "<input type=\"submit\" name=\"Submit\" value=\"Edit\"/><br/>";
 * * echo "</form>";

echo "<br/><a href=\"mprocpl.php?action=delp&sid=$sid&pid=$pid\">»DELETE</a><br/>";
 *}

add this after it

if(ismod(getuid_sid($sid)))
 *{

 * * echo "<form method=\"post\" action=\"mprocpl.php?action=edtpst&sid=$sid&pid=$pid\">";
 * * echo "Text: <input name=\"ptext\" value=\"$ptext\" maxlength=\"500\"/> ";
 * * echo "<input type=\"submit\" name=\"Submit\" value=\"Edit\"/><br/>";
 * * echo "</form>";

echo "<br/><a href=\"mprocpl.php?action=delp&sid=$sid&pid=$pid\">»DELETE</a><br/>";
 *}
 *else if($pinfo[0]==getuid_sid($sid))
 *{
 *echo "<form method=\"post\" action=\"usertpc.php?action=edtpst&sid=$sid&pid=$pid\">";
 * * echo "Text: <input name=\"ptext\" value=\"$ptext\" maxlength=\"500\"/> ";
 * * echo "<input type=\"submit\" name=\"Submit\" value=\"Edit\"/><br/>";
 * * echo "</form>";
	 }

also in else if($action=="tpcopt") add this

else if($tinfo[2]==getuid_sid($sid))
 *{
 * echo "<form method=\"post\" action=\"usertpc.php?action=rentpc&sid=$sid&tid=$tid\">";
 * *echo "<br/>Title: <input name=\"tname\" value=\"$tname\" maxlength=\"25\"/>";
 * *echo "<br/><input type=\"submit\" name=\"Submit\" value=\"Rename\"/><br/>";
 * *echo "</form>";

 * *echo "<form method=\"post\" action=\"usertpc.php?action=edttpc&sid=$sid&tid=$tid\">";
 * *echo "<br/>Text: <input name=\"ttext\" value=\"$ttext\" maxlength=\"500\"/> ";
 * *echo "<br/><input type=\"submit\" name=\"Submit\" value=\"Edit\"/><br/>";
 * *echo "</form>";

echo "<a href=\"usertpc.php?action=delt&sid=$sid&tid=$tid\">»DELETE</a><br/>";
 * *echo "<br/>";
 * *if($tinfo[5]=='1')
 * *{
 * * *$ctxt = "Open";
 * * *$cact = "0";
 * *}else{
 * * * *$ctxt = "Close";
 * * *$cact = "1";
 * *}
 * *echo "<a href=\"usertpc.php?action=clot&sid=$sid&tid=$tid&tdo=$cact\">»$ctxt</a><br/>";

 * }
 *echo "</p>";

this will allow u to edit the topic also

Please if u can make this code where users can subscribe to the topic before edit it


Jacques jacques@gw-designs.co.za http://coding.biz.tm Come join and lets make it a place to learn all the noobies how to code


NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

Vayne Developer · 106 posts #2

i`ve creat simplier version+ with time limit, 5 minutes after posting user can edit his post/comment 🙂

Nous Ne Dansos Pas, Nous Sommes Le Danse.!

ewanz Developer · 187 posts #3

Vayne wrote: i`ve creat simplier version+ with time limit, 5 minutes after posting user can edit his post/comment :)

can u share it? i can share what u want mate..

our lfe is simple words.... 😌 http://mygenkz.net ewanz06@yahoo.com

$output="i am NOoob....";
$newfile="ewanz.txt";
$file = fopen ($newfile, "w");
fwrite($file, $output);
fclose ($file); 
Vayne Developer · 106 posts #4

if((time()-$posttime)<600)

thats all you need.

Nous Ne Dansos Pas, Nous Sommes Le Danse.!

ewanz Developer · 187 posts #5

Vayne wrote: if((time()-$posttime)<600)

thats all you need.

nice sharing mate...

our lfe is simple words.... 😌 http://mygenkz.net ewanz06@yahoo.com

$output="i am NOoob....";
$newfile="ewanz.txt";
$file = fopen ($newfile, "w");
fwrite($file, $output);
fclose ($file); 

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close