Web designing newb. Creating a PHP forum from scratch!

I've just ran into a another problem. I'm creating a form for members to register. I've created a number of files such as registeration form > create user > registration success > check login details form > login user > login success.

I'm experiencing problems with my create user, I have the following:

Code:
$sql="INSERT INTO $tbl_name(myusername, mypassword, email)VALUES('$myusername', '$mypassword', '$email')"; 
$result=mysql_query($sql);

if($result){
echo "Successful<BR>";
echo "<a href=resgistrationsuccess.php>Your Registration Was Successful!</a>";
}
else {
echo "ERROR: The SQL Server said:<br />" . mysql_error();
}
mysql_close();
?>

I did originally have 'username' and 'password' variables but that kept inserting my own MySql details. So I changed it myusername mypassword. However, when I check my table the data entered is empty. It will have a new ID number with no details inserted :confused:
 
I've now done a large amount on the member database.

How would I read from the session so the user can only see the topic and detail, but once the user has posted it would be like:

Name: <Insert username from session>
Topic:
Detail:

Would it be something along the lines of?:

Code:
session_start();
$username=$_GET['username'];
$_SESSION['username']=$username;

Something I fail to understand, how would it pass information back and forth between pages? Would I have to insert something in all my php files?
 
Last edited:
I've now come to a halt. Complete failure. Everything has crashed burnt and died.

Everything was going really well, I managed to register users, log in and allowed threaded responses. I decided to add sessions and remove the name field so that when a user posts it uses sessions to recall their username and allow the user to post that. It's gone all downhill from there.

When a user successfully logged in, it redirected them to a successful login page. The page just contained:

Code:
<?php
session_start();
$_SESSION['myusername']=$myusername;
<html>
<body>
Login Successful
</body><br />
<a href=main_forum.php>Return to Main forum</a>
</html>

And on top of the relevant pages it's had the rest of the code:

Code:
<?php
session_start();
$myusername = $_SESSION['myusername'];

Now I had 3 tables; Making threads, replies and members.

The name fields I had were name, a_name and myusername.

I've just made a complete mess and confused the hell out of me. as I renamed them to myusername, a_myusername and myusername.

All I want it to do is just display the user name.

I'd appreciate any help :(

Edit: I also forgot to add, I also get this error:

Warning: Unknown(): Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0
 
Last edited:
Have just spent over 8 hours and I've been focusing design and it's worked out fairly well. However, I've found a bug I can't seem to sort out.

When a user who hasn't registered tries to create a topic they get a message asking their to either login or register. However, when an unregistered user tries to post a reply they also get the same error but the message somehow still posts without a user :confused:

Code:
if ($myusername == ""){
echo "In order to post you must login or register<BR>";
echo "<a href=login.php>Click here to login<BR></a>";
echo "<a href=register.php>Click here to register<BR></a>";}
elseif ($result2){
echo "Successful<BR>";
echo "<a href='view_thread.php?id=".$id."'>View your reply</a>";

// If added new reply, add value +1 in reply column
$tbl_name2="create_thread";
$sql3="UPDATE $tbl_name2 SET reply='$Max_id' WHERE id='$id'";
$result3=mysql_query($sql3);
}
else {
echo "ERROR: The SQL Server said:<br />" . mysql_error();
}
 
I've redesigned how I want it to look for 2 reasons: i) It looks far better ii) Should be easier to implement.

This is the part I'm struggling with a lot.

72606632zf4.jpg


The tables are just a bit tarded when it comes to formatting them. For example, I added a border and this is how it looks:

gbordermq5.jpg


I'd appreciate any help on how I can start to make it look like that. For an experienced user it's a matter of minutes knowing where to start. With me it's a lost cause and hours :\
 
Thank you James :)

CSS is pretty damn good!

35462198mw4.jpg


I can't seem to figure out to create a new instance of a table header. The first table is spot on. However, the second navigation bar, I want it like my design. I've tried creating a class/instance but its not working.

For example I have:

Code:
table
{
background-color: #000000;
border: 2px solid #f39707;
width: 70%;
border-collapse: collapse;
}

Could I say create a table2? How do I create individual styles of each table?
 
Thanks once again marc :)

Regarding background images, I have the following defined:

Code:
body
{
background: #000000 url(images/bg.jpg);
background-attachment: fixed;
background-repeat: no-repeat;
background-position: top right;
}

Yet the image appears in the centre of the page.

Edit: I've also been reading up on aligning stuff, how would I align all my tables on every page the way I want it? Can I just explicitly state where I can my tables? Also, is there a method where I can use percentage like I've done with most of tables, to state for example how much percent of a person web browser I want the table to be positioned instead of stating an absolute value or similar?

Edit 2: Solved the image problem, used xpos and ypos :)
 
Last edited:
loginlj2.jpg


How can I add a small space in between the password and the login button?

Code:
<td><input class="smallfont" size="10%" name="mypassword" type="password" id="mypassword">
<input class="button" type="submit" name="Submit" value="Login"></td>

And finally, how can shorten the distance between the login form and the orange navigation bar? I have <br> tags and when I remove one it all goes dodgy :confused:
 
I tried that before but in the wrong place :o

I think I'm going to save the messing around on how it looks and work on some advance features.

> Administrative Functionality
> Users are table edit their own posts
> Users are able to quote other messages in their posts.
> Users are able to add an avatar to their messages.

I'm going to struggle on these. I have a very vague idea on how to tackle administrative and quoting messages. Any advice?
 
What's wrong with me? :(

I should be revising for my exam, but I'm actually enjoying this :confused:

I'v got 2 issues:
1) Where the username will go I have create a table and when I alter the position of left in CSS either 15/16%, it's goes a couple of pixels either side​
2) I have outlined the 2 white boxes, that I intend to add. Surely there must be a way to group all 3 tables and make one container per post, so that it doesn't all go balls up?​

poststructurerq3.jpg


Code:
table.t4
{
position: absolute;
border: 1px solid #f39707;
width: 15%;
height: 25%;
left: 15%;
}

Thanks once again.
 
Back
Top Bottom