![]() |
![]() |
||||||
|
|||||||
| Tags: cookie, field, log, set |
![]() |
|
|||
|
Can anyone help me with this please.
I have a log in page which issues a cookie and seems to work brilliantly but now need to add the ability to activate/deactivate a user. I've added an 'active' field to the database where active can only equal 1 or zero. So what I'd like to do now is edit the login script to deny login if the 'active' field = 0. I'm sure it's quite straightforward but I'm afraid it's proving a bit beyond me. I've attached the existing code in case anyone has the time to help me out. Cheers Dave <?php $myUsername_rsLogin = "0"; if (isset($HTTP_POST_VARS['username'])) { $myUsername_rsLogin = (get_magic_quotes_gpc()) ? $HTTP_POST_VARS['username'] : addslashes($HTTP_POST_VARS['username']); } $myPassword_rsLogin = "0"; if (isset($HTTP_POST_VARS['password'])) { $myPassword_rsLogin = (get_magic_quotes_gpc()) ? $HTTP_POST_VARS['password'] : addslashes($HTTP_POST_VARS['password']); } mysql_select_db($database_con_dcc, $con_dcc); $query_rsLogin = sprintf("SELECT dcc_user, dcc_password FROM dcc_users WHERE dcc_user= '%s' AND dcc_password = '%s'", $myUsername_rsLogin,$myPassword_rsLogin); $rsLogin = mysql_query($query_rsLogin, $con_dcc) or die(mysql_error()); $row_rsLogin = mysql_fetch_assoc($rsLogin); $totalRows_rsLogin = mysql_num_rows($rsLogin); if($HTTP_POST_VARS['action']=="login"){ if($totalRows_rsLogin==0){ $errorMessage = "Password or Username Incorrect"; mysql_free_result($rsLogin); } else { mysql_free_result($rsLogin); setcookie("dccphpbb3",$HTTP_POST_VARS['username'],time() + 1200,"/"); header("Location: log-in-successful.php"); } } ?> |
| Sponsored Links |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
- Contact Us
-|-
Adobe Dreamweaver Forums -|-
Archive -|-
Top -|-Rules/Disclaimer-|-Help/Support-|-Advertise