|
||||||
| PHP Forum Use this forum to discuss all aspects of PHP Development. PHP is a server-side, cross-platform, HTML embedded scripting language that lets you create dynamic web pages. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||||
|
Look at your login.php file, particularly the mysql query. I'm not sure if this is it, but I never call php functions inside queries. I doubt this is it, but it could be the problem. Also try explicitly defining * in the query to return only row_id since you only require that value.
As for logging out, I don't think you want $_SESSION = array(); in your code, I've never used that and don't know why its there. If you are still having problems, I will attempt to run it and look more closely at it. |
|
|||||
|
Quote:
What do you mean by php functions inside queries? Do u mean md5 hash? I'd really appreceate if you could run it, and really sorry for noobish questions and problems ![]() Also the DB is Code:
CREATE TABLE `omeragic_rebus`.`rebus_users` ( `id` MEDIUMINT( 8 ) UNSIGNED NOT NULL , `username` VARCHAR( 255 ) NOT NULL , `password` VARCHAR( 40 ) NOT NULL , `email` VARCHAR( 100 ) NOT NULL , `group_id` MEDIUMINT( 8 ) UNSIGNED NOT NULL ) |
|
|||||
|
The reason why your login doesn't work is because you are never submitting a variable by the name of login for $_GET to actually get. Removing that line worked fine. If you want to keep this, perhaps add ?logout=true to the end of logout.php.
The reason why your login doesn't work is because there is ALWAYS a result unless the database doesn't exist. Therefore you needed an additional if/else clause inside the main else. I also changed the md5 to be up in the real escape. So here is my code, customized to fit my live testing database (you will need to change tables back). Also I did not fix the error outputting system, but it doesn't work correctly. index.php PHP Code:
PHP Code:
PHP Code:
|
|
|||||
|
Quote:
PHP Code:
I would like to point out something morefood2001 said. mysql_query doesnt always return a result. According to the php manual if *should* return false if there is an error with the query. In light of that, does your query return an error or an empty result set? I believe it is the latter which is why your method is not the best. However, two of our members have written tutorials retarding the creation of a login/logoff system. Both are great examples, but I would lean toward the latter as it uses a method more similar to mine (checking if the number of rows returned by mysql_query is one). Simple Register-Login-Logoff System Simple Login/Register/Main Script
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall |
| Sponsored Links |
|
|
|
|||||
|
Quote:
Quote:
|
|
|||||
|
I have worked a bit with this and have concluded to this part to be loaded on every page, if you want the system to log users off automatically after a certain time.
the session name thing is not necesary, but if there are many homepages within the same domain, it is safer to have it so anyone else within the same domain elaborates with your cookies. it does not take much execution time, and makes the code a little bit more secure. PHP Code:
hope this part can help aswell. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
| WingedPanther | ........ | 2753.6 |
| Xav | ........ | 2704 |
| Brandon W | ........ | 1702.32 |
| John | ........ | 1207.73 |
| marwex89 | ........ | 1175.24 |
| morefood2001 | ........ | 966.05 |
| dcs | ........ | 655.75 |
| Steve.L | ........ | 475.59 |
| orjan | ........ | 418.58 |
| Aereshaa | ........ | 383.54 |