Search
Left Quote    Treat your password like your toothbrush. Don't let anybody else use it, and get a new one every six months.
- Clifford Stoll    
Right Quote
 
[login] | [Register]
Forum Index » PHP and mySQL » Viewing Topic and Replies
Post Reply


        Viewing Topic: comment system
  This user is online  Guest
  Subject: "comment system" Posted: @ 9:48 pm on Sep 24 2006   
Unregistered
hi all,

iam now editing a php script (torrent listing script). there is no comment giving opting. iam trying to add that option, but it doesn't work. anyone know a easy way.

this is the table structure


--
-- Tabel structuur voor tabel `categories`
--

CREATE TABLE `categories` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(30) NOT NULL default '',
`image` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT= 24 ;

-- --------------- --------------- --------------- -----------

--
-- Tabel structuur voor tabel `namemap`
--

CREATE TABLE `namemap` (
`info_hash` varchar(40) NOT NULL default '',
`filename` varchar(250) character set utf8 collate utf8_bin NOT NULL default '',
`url` varchar(250) NOT NULL default '',
`info` varchar(250) NOT NULL default '',
`data` datetime NOT NULL default '0000-00-00 00:00:00',
`size` bigint(20) NOT NULL default '0',
`comment` mediumtext,
`category` int(10) unsigned NOT NULL default '6',
`subcategory` int(11) NOT NULL default '0',
`announce_url` varchar(100) NOT NULL default '',
`uploader` varchar(40) NOT NULL default 'Guest',
`lastupdate` datetime NOT NULL default '0000-00-00 00:00:00',
`anonymous` enum('true','fa lse') NOT NULL default 'false',
`autoupdater` varchar(100) NOT NULL default '0',
`seeds` int(10) default '0',
`leechers` int(10) default '0',
`finished` int(10) default '0',
`registration` enum('true','fa lse') NOT NULL default 'false',
`sum` varchar(50) NOT NULL default '1',
`image` varchar(255) NOT NULL default '',
PRIMARY KEY (`info_hash`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1;

-- --------------- --------------- --------------- -----------

--
-- Tabel structuur voor tabel `news`
--

CREATE TABLE `news` (
`news_id` mediumint(8) unsigned NOT NULL auto_increment,
`title` tinytext NOT NULL,
`content` text NOT NULL,
`author` varchar(16) NOT NULL default '',
`email` varchar(50) default NULL,
`date` varchar(10) NOT NULL default '',
`time` varchar(8) NOT NULL default '',
PRIMARY KEY (`news_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT= 4 ;

-- --------------- --------------- --------------- -----------

--
-- Tabel structuur voor tabel `reacties`
--

CREATE TABLE `reacties` (
`id` int(11) NOT NULL auto_increment,
`door` varchar(150) NOT NULL default '',
`email` varchar(150) default NULL,
`msg` text NOT NULL,
`at` varchar(10) NOT NULL default '',
`tid` varchar(40) NOT NULL default '0',
`ip` varchar(20) NOT NULL default '',
`fid` int(11) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT= 3 ;

-- --------------- --------------- --------------- -----------

--
-- Tabel structuur voor tabel `subcategories`
--

CREATE TABLE `subcategories` (
`id` int(10) NOT NULL auto_increment,
`catid` int(10) NOT NULL default '0',
`name` varchar(30) NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT= 151 ;

-- --------------- --------------- --------------- -----------

--
-- Tabel structuur voor tabel `users`
--

CREATE TABLE `users` (
`id` int(10) unsigned NOT NULL auto_increment,
`userName` varchar(40) NOT NULL default '',
`password` varchar(40) NOT NULL default '',
`privilege` varchar(10) NOT NULL default '',
`email` varchar(30) NOT NULL default '',
`joined` datetime NOT NULL default '0000-00-00 00:00:00',
`lastconnect` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
UNIQUE KEY `userName` (`userName`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT= 3 ;



(table REACTIE is for comments)

torrent details are saved in table NAMEMAP. in that table is no ID, but info_hash is primerykey. i found a script that is looking for a ID, but in my case it has to look for info_hash. hereunder u can find php script.


Code:
<?
// set all needed variables to connect with MySQL database
$user = "root" ;;
$pass = ""; $host = "localhost ";
$dbdb = "wtcom&quo t;;

// connect to MySQL database
if (!mysql_select_ db($dbdb, mysql_connect($ host, $user, $pass)))

// give error message if the connection could not be established
echo "Sorry, de database kan niet geopend worden.";< br />
// unset all variables
unset($user); unset($pass); unset($host); unset($dbdb);
$table = "reacties& quot;;

//-- insert reaction to database
if ($_POST['at'] && ($_POST['door'] && $_POST['msg']))
{
$sql3 = "INSERT INTO " . $table . " (id, door, email, msg, at, tid, ip, fid) VALUES ('', '" . stripslashes($_ POST['door']) . "', '" . stripslashes($_ POST['email']) . "', '" . stripslashes($_ POST['msg']) . "', '" . $_POST['at'] . "', '" . $_POST['id'] . "', '" . $_SERVER['$REMO TE_ADDR'] . "', '" . $fid . "')";
$res3 = mysql_query($sq l3);

if ($res3)
{
if ($fid)
$insert = "<p> <span class=here>B edankt voor het reageren!</s pan></p&g t;";
else
$insert = "<p> <span class=here>B edankt voor het reageren $door!</span ></p>& quot;;
}
else
{
$insert = "<p> <span class=here>S orry, je reactie is niet opgeslagen, probeer het opnieuw of neem contact met ons op.</span> ;</p>&quo t;;
}
$fid = ""; $door = ""; $email = ""; $msg = ""; }
//-- not enough data
elseif ($_POST['at'])< br /> {
$insert = "<p> <span class=kopje> Je bent je naam of bericht vergeten.</s pan></p&g t;";
}

//-- recieve reacties from database
$sql2 = "SELECT * FROM " . $table . " WHERE tid = " . $id . " order by id";
$res2 = mysql_query($sq l2);

echo "<BR> ;<BR>& ;gt;&gt; <b>Reacti es</b>< ;P><BR> ;<BR>&quo t;;

echo "<table width=\"94 %\" border=\"1 \" cellpadding=\&q uot;5\" cellspacing=\&q uot;0\" bordercolor=\&q uot;#597E90\&qu ot;>";< br /> echo "<tr> ;";
echo "<td bgcolor=\" #496979\"& gt;";
echo $insert;

//-- show reactions
if (mysql_num_rows ($res2) >= 1)
{
while ($row2 = mysql_fetch_arr ay($res2))
{
if ($row2[fid])
{
$fsql = "SELECT id, name FROM $table WHERE id = $row2[fid]" ;;
$fres = mysql_query($fs ql);
$frow = mysql_fetch_arr ay($fres);
}

$row2['door'] = htmlentities($r ow2['door']); $row2['email'] = htmlentities($r ow2['email']);< br /> $row2['msg'] = htmlentities($r ow2['msg']);
$row2['msg'] = nl2br($row2['ms g']);

if ($row2[email])< br /> echo "<b> Reactie door <a href=mailto:&qu ot; . $row2['email'] . ">" ; . $row2['door'] . "</a> ; @ " . $row2['at'] . "</b> ; <span class=small> <i>(" ; . $row2['ip'] . "</i ></span&g t;<br>&qu ot;;
else
echo "<b> Gepost door " . $row2['door'] . " @ " . $row2['at'] . "</b> ; <span class=small> <i>(" ; . $row2['ip'] . "</i ></span&g t;<br>&qu ot;;
echo "$row2[msg ]<P>" ;;
}
}
else
{
echo "<b> Er zijn nog geen reacties.</b >";
}

echo "<hr> ;";

echo "<p> ";

// door email at tid
$at = date('d-m-Y');< br />
//echo "<cente r>";
echo "<form method=post action=" . $_SERVER['PHP_S ELF'] . ">" ;;

if ($_GET['id']) echo "<input type=hidden name=id value=\"&q uot; . $_GET['id'] . "\"&g t;";
else
echo "<input type=hidden name=id value=\"&q uot; . $_POST['id'] . "\"&g t;";

echo "<input type=hidden name=at value=\"&q uot; . $at . "\"&g t;";

echo "<b> Naam</b>& lt;br>" ;
echo "<input type=text name=door value=\"&q uot; . htmlentnties($_ POST['door']) . "\" size=25>< BR><BR> ;";

echo "<b> Email</b> <br>" ;;
echo "<input type=text name=email value=\"&q uot; . htmlentnties($_ POST['email']) . "\" size=25>< BR><BR> ;";

echo "<b> Reactie</b&g t;<br>&qu ot;;
echo "<texta rea name=msg cols=80 rows=6>" ; . htmlentnties($_ POST['msg']) . "</text area><BR& gt;<BR>&q uot;;

echo "<input type=submit name=submit value=\"Re ageren!\"& gt;";
echo "</form >";
//echo "</cent er>"; echo "</p> ;";

echo "<hr> ;";


echo "<p> &nbsp;</ p>";

echo "</td&g t;";
echo "</tr&g t;";
echo "</tabl e><P>& quot;;
?>



PLEASE HELP ME OUT OF THIS PROBLEM PLEASE.

thanQ

    Viewed: 4,908 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: comment system" Posted: @ 11:23 pm on Sep 24 2006    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

Quick simple answer, use our Comments Script!< /a>




-bs0d | AllSyntax.com

    Viewed: 4,902 Times | Reply to This | To top
  This user is online  Guest
  Subject: "re: comment system" Posted: @ 10:36 am on Sep 25 2006    
Unregistered

i know, but they r working with id as primerykey, but in my case i have to work with "info_has h" as primery key.



    Viewed: 4,893 Times | Reply to This | To top
Viewing Page: 1 of 1


1 |

You must be logged in to post on the forums. Login or Register








"AllSyntax.com" Copyright © 2002-2018; All rights lefted, all lefts righted.
Privacy Policy  |  Internet Rank