![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Programmer
Join Date: May 2007
Posts: 52
Rep Power: 2
![]() |
login system
ok im making a simple login. And im wondering how to make one besides using php. here's the code:
HTML file: <html> <head> <title> </title> </head> <body> <form action="login.php" method="post"> Username: <input type="username" name="username" /><br/> Password: <input type="password" name="password" /><br/> <input type="submit" value="Login" /> </form> </body> </html> <html> <body> <?php if ($_POST["username"]&&$_POST["password"]=="admin") echo "Login Successful"; else echo "Username and password are incorrect. Please try again"; ?> </body> </html> |
|
|
|
|
|
#2 |
|
Professional Programmer
|
Re: login system
Besides PHP??? You mean storing usernames and passwords in a database?
__________________
JG-Webdesign |
|
|
|
|
|
#3 |
|
Programmer
Join Date: May 2007
Posts: 52
Rep Power: 2
![]() |
Re: login system
|
|
|
|
|
|
#4 |
|
PFO Founder
![]() ![]() |
Re: login system
if you are doing this in javascript then anyone can see what the username and password is suppose to be. And then there really isn't any point to the login.
__________________
BIG K aka Kyle Programming Forums Kyle K Online Please do not PM or email me programming questions. Post them in the forums instead. |
|
|
|
|
|
#5 |
|
Battle Programmer
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 747
Rep Power: 3
![]() |
Re: login system
The problem with a JavaScript login system is that anyone can see the JavaScript. They can also turn it off. They can also overwrite it to return whatever they want. That's the problem with trusting the client - you can't.
Using PHP on the other hand, the user has to input values and those are validated on the server - which the user [hopefully] has no control over. This is why PHP logins are more secure. With PHP (or another server-side language), you can also use a database to store login information, so it's a ton more scalable as well. That said, your PHP code is incorrect. You need to make the comparison for both strings, not just one. The if statement will probably work with any username so long as the password is "admin".
__________________
<insert disclaimer here> <insert shameless plug for Visual Studio here> |
|
|
|
|
|
#6 |
|
Programmer
Join Date: May 2007
Posts: 52
Rep Power: 2
![]() |
Re: login system
well the thing is its suppose to be for the psp and its not going to be hosted or anything its just a simple login. so it wont matter who can see the username or password because the person wont be connected to the internet. and the reason im not doing PHP is because PHP isnt installed on the PSP. And thanks for the mistake i didnt see that before.
also then what should i put instead of if? |
|
|
|
|
|
#7 |
|
Programmer
Join Date: May 2007
Posts: 52
Rep Power: 2
![]() |
Re: login system
ok corrected the php file to this. and it works:
<html> <body> <?php if ($_POST["username"]=="admin"&&$_POST["password"]=="admin") echo "Login Successful"; else echo "Username and password are incorrect. Please try again"; ?> </body> </html> |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Php Login System | MikeC | PHP | 17 | Dec 17th, 2005 10:11 AM |
| PHP system commands | ktsirig | PHP | 6 | Oct 4th, 2005 1:24 AM |
| Why shouldn't we use System(); | Shapeless | C++ | 7 | Jul 19th, 2005 6:10 AM |
| how to login computers with same login and password | Tiger | Java | 5 | Jan 31st, 2005 7:53 PM |
| How to write a login system? | uman | C++ | 2 | Jan 13th, 2005 1:33 AM |