|
|
|
|
![]() ![]() |
Oct 30 2006, 05:58 PM
Post
#1
|
|
|
Member [Level 1] ![]() ![]() ![]() ![]() Group: Members Posts: 62 Joined: 22-December 05 From: Sandefjord,Norway Member No.: 16,078 |
Hello,
I am currently working on EvilBoard 0.1.1, for those who know about this project versjon 0.1b can be downloaded from http://www.evilservices.com Well over to the reason why i am posting this, I am currently experincing a problem with my new posting code wich has been rewrited in version 0.1.1, You see, it is double posting by an error, i thouht i could fix that myself, but no, so i just thought, Trap17 is perfect, they problety know how to fix this, Here is the code: CODE <? /* * @Name: Post Topic * @Author: Arne-Christian Blystad * @Copyright: Copyright 2006 EvilServices * * @ID: $i29-10-06-eb011 */ session_start(); global $template; include("source/lib/eb.php"); include("smarty/smarty.class.php"); $template = new Smarty; $post = new post; if(isset($_POST['Submit'])) { echo $post->post(); $x = $post->get_last_topic(); $f = $_GET['forumid']; @header("location: redirect.php?url=index.php?act=showtopic_t={$x}_forumid={$f}"); } else { echo $post->post_new(); } //=========================== // Class: Post // Desc: Required for posting new topics, and replies //=========================== class post { function post_new() { include("lang/en/lang_en.php"); $template = new smarty; $eb = new eb; $eboard = new eboard; $forumname = $eboard->forum_name(); $template = new smarty; $name = $_SESSION['user_name']; if($name) { $template->assign("name","$name"); } $template->assign("lvl","{$_SESSION[user_level]}"); $menu = $_SESSION['user_name']; if($menu) { $template->assign("menu","true"); } $lvl = $_SESSION['user_level']; if($lvl == "3") { $template->assign("lvl","3"); } if($_GET['do'] == "post_new") { $title = "Post new topic"; } else { $title = "Post reply"; } $template->assign("title","{$title} - {$forumname}"); $template->assign("forum_name","{$forumname}"); $template->template_dir = "/Themes/Default/"; $template->compile_dir = "cache/"; if($_GET['do'] == "post_new") { $template->assign("post_new","true"); } else { } $template->display("post.tpl"); } function post() { // Connect to DB $db = new db; $db->connect(); // Check if topic is submited // Defines variables for title, description and post message $title = $_POST['t_title']; $desc = $_POST['t_desc']; $msg = $_POST['writer']; // Conencts to DB $db = new db; $db->connect(); // Check if t_title or writer is null if($_GET['do'] == "post_new") { if(empty($title)) { $err = "102 - Could not post - Title is null"; } } if(empty($msg)) { $err = "103 - Could not post - Message is null"; } // If something is null, cancel the sending! if($err) { $template = new smarty; // this is smarty stuff required for the first page $name = $_SESSION['user_name']; if($name) { $template->assign("name","$name"); } $template->assign("lvl","{$_SESSION[user_level]}"); $menu = $_SESSION['user_name']; if($menu) { $template->assign("menu","true"); } $lvl = $_SESSION['user_level']; if($lvl == "3") { $template->assign("lvl","3"); } // Sets title to Post new topic ,or port reply if($_GET['do'] == "post_new") { $title = "Post new topic"; } else { $title = "Post reply"; } // Asigns title and forum name $template->assign("title","{$title} - {$forumname}"); $template->assign("forum_name","{$forumname}"); // Sets folders for template and cache dir. $template->template_dir = "/Themes/Default/"; $template->compile_dir = "cache/"; // If were posting a new topic, we need to show the Title: and Description:. if($_GET['do'] == "post_new") { $template->assign("post_new","true"); } $template->assign("err","{$err}"); $template->display("post.tpl"); exit(); } else { // Ok here we are, now it is going to send the info to DB, because we know its error free. // Defines variables. $this->userid = $_SESSION['userid']; $this->title = $_POST['t_title']; $this->desc = $_POST['t_desc']; $this->usrn = $_SESSION['user_name']; $this->forumid = $_GET['forumid']; $this->ip_addrs = $_SERVER['REMOTE_ADDR']; $this->is_sticky = $_POST['is_sticky']; $this->is_closed = $_POST['is_closed']; $this->msg = $_POST['writer']; $this->time = time(); // If this is a new topic, create the topic! if($_GET['do'] == "post_new") { $db->query("INSERT INTO `eb_topic` ( `UserID` , `title` , `TopicID` , `replies` , `desc` , `Username` , `ForumID`, `is_sticky`, `is_closed` ) VALUES ('$this->userid', '$this->title', NULL , '0', '$this->desc', '$this->username', '$this->forumid','$this->is_sticky','$this->is_closed');") or die("MySQL Error: " . mysql_error()); } else { // * If this isn't a topic, simply don't create the topic! } // Get the last topic from the database $this->last = $this->get_last_topic(); // Inserts Reply $post = $db->query("INSERT INTO `eb_post` ( `message` , `postdate` , `UserID` , `Username` , `PostID` , `TopicID` , `ForumID` , `title` , `user_ip` ) VALUES ( '$this->msg', '$this->time' , '$this->userid', '$this->username', '' , '$this->last', '$this->forumid', '$this->title', '$this->ip_addrs');") or die("MySQL Error: " . mysql_error()); } // End Error free inserting. } function get_last_topic() { $db = new db; $db->connect(); $topic = $db->query("SELECT * FROM `eb_topic` ORDER BY `TopicID` DESC LIMIT 0,1"); $topic = $db->fetch_array($topic); $topic = $topic['TopicID']; return $topic; } } ?> I hope any of you can help me, The one who helps me can get added to * Special Thanks to: [USERNAME HERE] in the file, and trap17 is allready added to the special thanks to file Arne-Chrisitan Blystad - EvilBoard Devloper |
|
|
|
Oct 31 2006, 01:22 AM
Post
#2
|
|
|
$p4m 0n j00 $h4m3 m3 0nc3 $p4m 0n m3 $h4m3 m3 7\/\/1c3 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 6,305 Joined: 21-September 04 From: 9r33|\| 399$ 4|\|D 5P4/\/\ Member No.: 1,218 ![]() |
Although I can't see it right now, but I would think you have an extra line possibly an echo that makes the 2 posts try your search around that conclusion.
|
|
|
|
Oct 31 2006, 04:31 PM
Post
#3
|
|
|
Member [Level 1] ![]() ![]() ![]() ![]() Group: Members Posts: 62 Joined: 22-December 05 From: Sandefjord,Norway Member No.: 16,078 |
Although I can't see it right now, but I would think you have an extra line possibly an echo that makes the 2 posts try your search around that conclusion. Thanks, that fixed it, i just changed $post->post(); to $post->post_topic(); and including changing the name, that fixed it all |
|
|
|
Oct 31 2006, 05:38 PM
Post
#4
|
|
|
$p4m 0n j00 $h4m3 m3 0nc3 $p4m 0n m3 $h4m3 m3 7\/\/1c3 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 6,305 Joined: 21-September 04 From: 9r33|\| 399$ 4|\|D 5P4/\/\ Member No.: 1,218 ![]() |
ROCK ON!!! I solved it without even trying
|
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 25th July 2008 - 10:12 AM |