| | |
php login page problem
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: May 2008
Posts: 2
Reputation:
Solved Threads: 0
Hi. I'm a newbie to php and have created a login form that does not use an sql database. After inputing all the code I've tested it in IE and it doesn't work properly. If I leave the username and password blank but hit the submit button, it takes me to the page that is suppose to be restricted to those who put in the correct username and password. Even if I put in the wrong username and password, it takes me to the restricted page. I can't figure out if i've left out something or if I should just give up and go with using the sql database. Below is my code. Please help.
Thanks
Thanks
PHP Syntax (Toggle Plain Text)
<?php ?> $username = "admin"; $password = "adminpass"; if(isset($_post['user'])&&isset($_post['password'])) { if($username == $_post['user'] && $password == $_post['password']) { ?> <form name="form" action="membersonly-content.html" method="post"> <?php } else { die("your login information was incorrect"); } } else ?> <h1>Login</h1> <label for="txtusername">Username:</label> <input type="text" title="enter your username" name="textusername"/> </p> <label for="txtpassword">Password:</label> <input type="password" title="enter your password" name="txtpassword"/> </p> <input type="submit" name="submit" value="login"/></p> </form> <?php } else { ?> </php>
•
•
Join Date: Aug 2007
Posts: 4
Reputation:
Solved Threads: 1
accha tell me u have done the whole coding in one page only....in the same page u have post the form and there u r accessing the value .....
1) first make the login page with form and post , post it to some php page
2) in the php page then access the value of the textboxes(login name and password) from the php page and do the necessary query.
3) make the button as button type only not submit type and on clicking the button write one function in javascript which will check the field checking like empty or characters....there in the function use one FLAG which will prevent the page when there is some validation problem from submission......
reply me with all the details.
1) first make the login page with form and post , post it to some php page
2) in the php page then access the value of the textboxes(login name and password) from the php page and do the necessary query.
3) make the button as button type only not submit type and on clicking the button write one function in javascript which will check the field checking like empty or characters....there in the function use one FLAG which will prevent the page when there is some validation problem from submission......
reply me with all the details.
•
•
Join Date: Aug 2007
Posts: 4
Reputation:
Solved Threads: 1
sorry, i have taken that point by mistake, since you are not using any database then you dont need toh follow the instruction in line 2. you can simply follow number 3.
but in case of login page why dont u use a database, because if you are not using any databases how the login name and password values are verified?
please give me the update regularly
thanks
but in case of login page why dont u use a database, because if you are not using any databases how the login name and password values are verified?
please give me the update regularly
thanks
![]() |
Similar Threads
- Simple ASP.Net Login Page using C# (C#)
- To create a registration page and login page (HTML and CSS)
- Linking from the login page to other pages (PHP)
- login page problem again (PHP)
- PHP for login authentication (PHP)
- PHP sessions/$_POST problem. Too Stressed today! (PHP)
Other Threads in the PHP Forum
- Previous Thread: help with code
- Next Thread: variable values
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary body broken cakephp checkbox class cms code cron curl database date date/time directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link list login loop mail menu mlm mod_rewrite msqli_multi_query multiple mycodeisbad mysql oop parse paypal pdf php problem query radio random recursion regex remote script search send seo server sessions sms soap source space sql static structure syntax system table tutorial update upload url validation validator variable video web webdesign wordpress xml youtube





