This is a discussion on "[SOLVED] php Login page" within the PHP Forum section. This forum, and the thread "[SOLVED] php Login page are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
[SOLVED] php Login page
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
[SOLVED] php Login page
Hi Fellows!
I have a login page that check the database userid and password filed before log in. If match it allow them to log in and redirect that to a welcome page. It is working fine. Now what I want is ....it should check the table 'active' filed to verify whether user's activated or not their account. If it activated the field is empty. so if it was not activated they will get an messaga saying account is not activated. If the account is activated then it will check the userid and password filed. Iknow it sould very easy but I am kind of stuck. Here is my working login page code..........
Last edited by karinne; Oct 16th, 2007 at 14:05. Reason: Changed the [ code ] to [ php ] for readability |
|
|
|
#2
|
|||
|
|||
|
Re: php Login page
Just change your SQL query:
Last Blog Entry: 10 Reasons Why My Laptop Is Better Than Your Girlfriend (Dec 15th, 2007)
|
|
#3
|
|||
|
|||
|
Re: php Login page
Hi c010depunkk,
Could u pls show me the code for the query, I am kind of novice ther? |
|
#4
|
|||
|
|||
|
Re: php Login page
see the bold
|
|
#5
|
|||
|
|||
|
Re: php Login page
Hi C010,
Thanks for our quick reponse but you are not giving me the corrected code that it should be you just showed me where to change but I need to know the changed code to incorporate my objective. Thanks |
|
#6
|
||||
|
||||
|
Re: php Login page
He did change it Dhossai.
He changed:
to:
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
#7
|
|||
|
|||
|
Re: php Login page
Hi alexgeek,
where it got change? I don't see where it check the 'active' filed from the table to verify whether it was activated or not? Pls explain a bit. |
|
#8
|
|||
|
|||
|
Re: php Login page
Oh dear!
See the green part in alexgeek's code |
|
#9
|
|||
|
|||
|
Re: php Login page
Hi Karinne,
Could u pls check my original post and check the code, I do not see any changes it is exactly same as I had. Pls let me know. |
|
#10
|
|||
|
|||
|
Re: php Login page
In your code you have
SELECT * FROM tbl_login WHERE userid='$userid' AND password = '$password' and c010depunkk added AND active != '' at the end Now ... if you don't understand this ... I don't know how else to explain the simplicity of this thread. |
|
#11
|
|||
|
|||
|
Re: php Login page
Hi Karrine,
Thanks for this. Now I can see the text but I still can not see any text on Alexe's post anywhere. I don't know it might be my browser is not allowing me to see this or what? It is interesting!!!!! Anyway, How to echo the notice if account was not activated. In my database it it was activated the 'active' field would be empty. Thanks |
|
#12
|
|||
|
|||
|
Re: php Login page
What platform and browser are you in?
Quote:
|
|
#13
|
|||
|
|||
|
Re: php Login page
OK, back for round two. Here's your code, modified. This should work:
Last Blog Entry: 10 Reasons Why My Laptop Is Better Than Your Girlfriend (Dec 15th, 2007)
|
|
#14
|
|||
|
|||
|
Re: php Login page
Hi karrine,
In the table field active is populated with number, with this new code I still can log in. User should only be allowed to if the active filed is empty. If the field active is populated I should not be allowed to log in and should get the error messase account is not activated. I am using MySql database. I am using this.... if($rec=mysql_fetch_array(mysql_query("SELECT * FROM tbl_login WHERE userid='$userid' AND password = '$password' AND active !=' '"))){ if(($rec['userid']==$userid)&&($rec['password']==$password)){ include "include/newsession.php"; if($rec=mysql_fetch_array(mysql_query("SELECT * FROM tbl_login WHERE userid='$userid' AND password = '$password'"))){ if(($rec['userid']==$userid)&&($rec['password']==$password)){ include "include/newsession.php"; |
|
#15
|
|||
|
|||
|
Re: php Login page
Hi C010,
Thanks for the code. I tried but user can still log in if the active filed still populated means user did not activate the account. My active field is a m5f enrypted filed which is hidden and generate automatically when user register to the site using " $a = md5(uniqid(rand(), true)); " this. Hope this will help to solve it. |
|
#16
|
|||
|
|||
|
Re: php Login page
I've provided two methods so far.... Both could work, but you are also going to have to try and understand the code or all the help we give you is useless!
Or try wording your question a bit more coherently and provide a bit more info about what you are exactly trying to do....
Last Blog Entry: 10 Reasons Why My Laptop Is Better Than Your Girlfriend (Dec 15th, 2007)
|
|
#17
|
|||
|
|||
|
Re: php Login page
Hi c010,
Well I don't know how much i have to explain to get it out. Ok, here I go again, in my 'tbl_login' table i have a field called "ctive". If the filed is empty that means user have activated the account. How user activate it? When user signup, active field in tbl_login got populated with random number whis is md5 encrypted using ----$a = md5(uniqid(rand(), true)); --- this methond. user get an email with activation link. When user click that link account is activated and active field in tbl_login become empty. So I want to make sure that user can not log on to unless they activate the account and if they try they will get an error message saying account is not activated. And if account is activated then it will check the userid and password. I hope I was able to explain so that you understand. Thanks for your time. |
|
#18
|
|
|
|