Jump to content

Recommended Posts

I belive this will give you what you need.

if ($page == "Forum" && $section > "0")
{
echo "<h3 align='center'>Forums Topics</h3><br />";
echo "<table border='1' align='center'><tr><th>Topic Name</th><th>Last Post</th></tr>";
$result = mysql_query("SELECT * FROM forumtopics WHERE catparent=$section ORDER BY id DESC");
while($row = mysql_fetch_array($result))
{
echo "<tr><td><a href=index.php?page=Forum&section=$section&topicid=".$row['id'].">".$row['name']."</a></td><td>".$row['lastpost']."</td></tr>";
}
echo "</table>";
echo "<center><a href=index.php?page=Forum&section=$section&action=newtopic>Post a new Topic</a></center>";
}

if ($page == "Forum" && $section > "0" && $action == "newtopic")
{
echo " <form action='index.php?page=Forum&section=$section&action=postnewtopic' method='post'>
<table><tr><td>Title: </td><td><input type='text' name='title' /></td></tr>
<tr><td>Message: </td><td><textarea rows='20' cols='40' name='message'>Message Here</textarea></td></tr>
<tr><td><input type='submit' value='Post Topic' /></td></tr></table>
</form>";
}

if ($page == "Forum" && $section > "0" && $action == "postnewtopic")
{
$poster = $_SESSION[username];
$name = mysql_real_escape_string($_POST[title]);
$message = mysql_real_escape_string($_POST[message]);

mysql_query("INSERT INTO forumtopics (catparent, name) VALUES ('$section', '$name')");
mysql_query("INSERT INTO forumposts (topicid2, poster, posterip, postedon, message, lastpost) VALUES ('$topicid','$poster', '$_SERVER[REMOTE_ADDR]', NOW(), '$message', NOW())");
echo "Topic Posted, <a href=index.php?page=Forum&section=$section>Continue</a>";
}

Link to comment
https://forums.phpfreaks.com/topic/65414-sessions-problem/#findComment-326660
Share on other sites

if ($page == "Login")
{
echo "<center><h3>$page</h3></center>";
echo "<form action='index.php?page=Login&action=Check' method='post'>";
echo "<table align='center'><tr><td>Username: </td><td><input type='text' name='user' /></td></tr><br />";
echo "<tr><td>Password: </td><td><input type='password' name='pass' /></td></tr><br />";
echo "<table align='center'><tr><td><input type='submit' value='Login' /></td></tr></table>";
echo "</form>";
echo "<br />";
echo "<center><a href=index.php?page=Register>Register</a> || <a href=index.php?page=ForgotPassword>Forgot Password?</a></center>";
}

if ($page == "Login" && $action == "Check")
{
$username = mysql_real_escape_string($_POST[user]);
$password = mysql_real_escape_string($_POST[pass]);
$passwordmd5 = md5($password);

$sql="SELECT * FROM users WHERE username='$username' and password='$passwordmd5'";
$result = mysql_query($sql);

$count = mysql_num_rows($result);

if($count==1){
session_register("username");
session_register("userid");
echo "<center>Logged in Succesfully, <a href=index.php>Continue</a></center>";
}
else {
echo "<center>Wrong Username or Password</center>";
}
}

Link to comment
https://forums.phpfreaks.com/topic/65414-sessions-problem/#findComment-326674
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.