I have problems with my forum started from some simple tutorial. Its made from begining not SMF or vbulletin.
First problem is that I have login script but I would like that after loged it will show user panel instead of login form. Like here on this forum.
Second problem is that I have only option to add topics. I need to add forums and groups. I made already page but I cant add another group of forum. Also posts/replys arent counting(so its 0/0).
And third, I dont know how to draw text on image to hide those numbers on the left(ID).
I made picture of site is on bottom of the topic, becose I dont whant to have spam.
Well I made two pages with adding forum. First page is forum view, second function of it. I know name files are stupid but I will change that. Heres files code:
**forumadd.php
**
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<title>Nazwa forum</title>
<link REL="SHORTCUT ICON" HREF="images/favicon.ico">
<head>
<link rel="stylesheet" href="default.css" type="text/css" media="screen">
<?php
$host="-------"; // Host name
$username="--------"; // Mysql username
$password="--------"; // Mysql password
$db_name="----------"; // Database name
$tbl_name="---------"; // Table name
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$sql="SELECT * FROM $tbl_name ORDER BY id ASC";
// OREDER BY id DESC is order result by descending
// OREDER BY id ASC is order result by ascending
$result=mysql_query($sql);
?>
<div id="header">
<p><img src="images/header.jpg" width="800" height="200"></p>
</div>
<div id="bodymenu">
<div align="right" class="user"><p class=" ">
<?php
print date("j F Y, \ g.i a", time());
?>
</p>
</div>
<div id="menucontent">
</div>
<div class="clear">
</div>
</div>
<?php
//include 'login.php';
?>
<!-- <div id="menu">
</div>
<!--<img src="images/counter.jpg">-->
<?php
//include 'counter.php';
?>
<td> </td>
<div id="menu">
<?php
include 'header.php';
?>
</div>
<div id="body_forum">
<div class="bodymenu"><p class="data1">Forum</p></div>
<div class="clear">
</div>
<?php
while($rows=mysql_fetch_array($result)){ // Start looping table row
?>
<div class="post_id tlo_tresc"><p><? echo $rows['id']; ?></p></div>
<div class="temat tlo_tresc text_dolewej"><p><a href="main_forum.php?id=<? echo $rows['id']; ?>"><? echo $rows['forum']; ?></a></p></div>
<div class="temat tlo_tresc text_dol"><p><? echo $rows['description']; ?></p></div>
<div class="odwiedziny tlo_tresc"><p><? echo $rows['reply']; ?></p></div>
<div class="odpowiedzi tlo_tresc"><p><? echo $rows['posts']; ?></p></div>
<div class="tlo_tresc data"><p class="data1"><? echo $rows['datetime']; ?></p></div>
<div class="clear"></div>
<?php
// Exit looping and close connection
}
mysql_close();
?>
</div>
<div class="clear"></div>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="1" class="style1">
<tr>
<form id="form1" name="form1" method="post" action="add_forum.php" class="style1">
<td><br>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#6B4248">
<tr>
<td colspan="3" background="images/bottombar.jpg" style="height: 26px"><strong>Create New Forum</strong>
</td>
</tr>
<tr>
<td width="14%"><strong>Forum</strong></td>
<td width="2%">:</td>
<td width="84%">
<input name="forum" type="text" id="forum" size="50"></td>
</tr>
<tr>
<td valign="top"><strong>Description</strong></td>
<td valign="top">:</td>
<td><textarea name="description" cols="50" rows="8" id="description"></textarea></td>
</tr>
<td> </td>
<td> </td>
<td><input type="submit" name="Submit" value="Submit">
<input type="reset" name="Submit2" value="Reset"></td>
</tr>
</table>
</td>
</form>
</table>
</div>
add_forum.php
<?php
$host="-------"; // Host name
$username="--------"; // Mysql username
$password="--------"; // Mysql password
$db_name="----------"; // Database name
$tbl_name="---------"; // Table name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// get data that sent from form
$forum=$_POST['forum'];
$description=$_POST['description'];
$reply=$_POST['reply'];
$posts=$_POST['posts'];
$datetime=date("d/m/y h:i:s"); //create date time
$sql="INSERT INTO $tbl_name(forum, description, reply, posts, datetime)VALUES('$forum', '$description', '$reply', '$posts', '$datetime')";
$result=mysql_query($sql);
if($result){
echo "Successful! In few seconds you will back to topic or just click:<BR>";
echo "<a href=main_forum.php>View your topic</a>";
}
else {
echo "ERROR";
}
mysql_close();
?>
I know why it looks like that and it will change. I just need the proper fucionality.
