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
Programming Q&A
NEed help asap with PHP
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="reinoreiska" data-source="post: 370380" data-attributes="member: 67146"><p>Hi, i'am trying to make a login script without mysql and i am using this code on the security.php file that i found on this site.</p><p><?php</p><p>session_start();</p><p> </p><p>$user["admin1"] = "password";</p><p>$user["admin2"] = "password";</p><p>$user["admin3"] = "password";</p><p> </p><p>if (!isset($_SESSION['logged_in']))</p><p>{</p><p> echo '<h1>Login</h1>';</p><p> if ($_SERVER['REQUEST_METHOD'] == 'POST')</p><p> {</p><p> if (empty($_POST['username']) || empty($_POST['password']))</p><p> {</p><p> echo '<span style="color:red; font-weight: bold">Please fill in all fields!</span>';</p><p> }</p><p> elseif ($user[$_POST['username']] != $_POST['password'])</p><p> {</p><p> echo '<span style="color:red; font-weight: bold">Your username/password is wrong!</span>';</p><p> }</p><p> else</p><p> {</p><p> header("Refresh: 1");</p><p> $_SESSION['ingelogd'] = true;</p><p> echo '<span style="color:green; font-weight: bold">You are now logged in!</span>';</p><p> }</p><p> }</p><p> else</p><p> {</p><p> exit('You need to log-in to view this page.<br /><br /></p><p> <form method="POST" action=""><p></p><p> Username:<br /></p><p> <input type="text" name="username" /><br /><br /></p><p> Password:<br /></p><p> <input type="password" name="password" /><br /><br /></p><p> <input type="submit" value="Login" /> <input type="reset" value="Empty fields" /></p><p> </form>');</p><p> }</p><p>}</p><p>?></p><p></p><p>but everytime i log in with wrong account details it still lets me to view the contet, so how do i fix it ?</p></blockquote><p></p>
[QUOTE="reinoreiska, post: 370380, member: 67146"] Hi, i'am trying to make a login script without mysql and i am using this code on the security.php file that i found on this site. <?php session_start(); $user["admin1"] = "password"; $user["admin2"] = "password"; $user["admin3"] = "password"; if (!isset($_SESSION['logged_in'])) { echo '<h1>Login</h1>'; if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (empty($_POST['username']) || empty($_POST['password'])) { echo '<span style="color:red; font-weight: bold">Please fill in all fields!</span>'; } elseif ($user[$_POST['username']] != $_POST['password']) { echo '<span style="color:red; font-weight: bold">Your username/password is wrong!</span>'; } else { header("Refresh: 1"); $_SESSION['ingelogd'] = true; echo '<span style="color:green; font-weight: bold">You are now logged in!</span>'; } } else { exit('You need to log-in to view this page.<br /><br /> <form method="POST" action=""><p> Username:<br /> <input type="text" name="username" /><br /><br /> Password:<br /> <input type="password" name="password" /><br /><br /> <input type="submit" value="Login" /> <input type="reset" value="Empty fields" /> </form>'); } } ?> but everytime i log in with wrong account details it still lets me to view the contet, so how do i fix it ? [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Programming Q&A
NEed help asap with PHP
Top