Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
[PHP] Membership system.
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="TesoMayn" data-source="post: 154498" data-attributes="member: 8605"><p>Or you can change your index/login page to this:</p><p></p><p>[PHP]<?php</p><p>session_start();</p><p> </p><p>include 'config.php';</p><p> </p><p>$username = $_POST['username'];</p><p>$password = $_POST['password'];</p><p>if(isset($_POST['submit']))</p><p>{</p><p>if($username&&$password)</p><p>{</p><p> $query = mysql_query("SELECT * FROM users WHERE username='$username'");</p><p> $id1 = mysql_query("SELECT id FROM users WHERE username='$username'");</p><p> $numrows = mysql_num_rows($query);</p><p> </p><p> while ($row = mysql_fetch_array($id1))</p><p> {</p><p> $id = $row['id'];</p><p> }</p><p> </p><p> </p><p> if($numrows!=0)</p><p> {</p><p> while ($row = mysql_fetch_assoc($query))</p><p> {</p><p> $user = $row['username'];</p><p> $pass = $row['password'];</p><p> }</p><p> </p><p> if($username==$user&&md5($password)==$pass)</p><p> {</p><p> $_SESSION['user']=$username;</p><p> $_SESSION['user_id']=$id;</p><p> header("location: me.php");</p><p> </p><p> }</p><p> else</p><p> echo "Your password is incorrect, please try again.";</p><p> </p><p> }</p><p> else</p><p> echo "The user $username does not exist";</p><p> </p><p>}</p><p>else</p><p> echo "Please enter your username and password.";</p><p> </p><p>}</p><p> </p><p>if($_SESSION['user'])</p><p>{</p><p> header("location: me.php");</p><p>}</p><p>else</p><p>{</p><p>?></p><p><html></p><p> <head></p><p> <title>Login page</title></p><p> </head></p><p> </p><p> <body></p><p> <form action='index.php' method='POST'></p><p> Username : <input type='text' name='username'></p><p> Password : <input type='password' name='password'></p><p> <input type='submit' name='submit' value='Login'></p><p> </form></p><p> </p><p> </body></p><p></html></p><p><?php } ?>[/PHP]</p></blockquote><p></p>
[QUOTE="TesoMayn, post: 154498, member: 8605"] Or you can change your index/login page to this: [PHP]<?php session_start(); include 'config.php'; $username = $_POST['username']; $password = $_POST['password']; if(isset($_POST['submit'])) { if($username&&$password) { $query = mysql_query("SELECT * FROM users WHERE username='$username'"); $id1 = mysql_query("SELECT id FROM users WHERE username='$username'"); $numrows = mysql_num_rows($query); while ($row = mysql_fetch_array($id1)) { $id = $row['id']; } if($numrows!=0) { while ($row = mysql_fetch_assoc($query)) { $user = $row['username']; $pass = $row['password']; } if($username==$user&&md5($password)==$pass) { $_SESSION['user']=$username; $_SESSION['user_id']=$id; header("location: me.php"); } else echo "Your password is incorrect, please try again."; } else echo "The user $username does not exist"; } else echo "Please enter your username and password."; } if($_SESSION['user']) { header("location: me.php"); } else { ?> <html> <head> <title>Login page</title> </head> <body> <form action='index.php' method='POST'> Username : <input type='text' name='username'> Password : <input type='password' name='password'> <input type='submit' name='submit' value='Login'> </form> </body> </html> <?php } ?>[/PHP] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
[PHP] Membership system.
Top