Adobe Dreamweaver Forums



Last 10 THreads :         Context-Sensitive Neophyte Questions (Last Post : Drewster413 - Replies : 3 - Views : 4 )           »          HOW DO I CHANGE MY BOOK SIZE ON MY FLASH WEBSITE? (Last Post : Alix86 - Replies : 0 - Views : 1 )           »          enter fullscreen (Last Post : Graphic Graeme - Replies : 0 - Views : 1 )           »          cfif (Last Post : tclaremont - Replies : 4 - Views : 5 )           »          Final Resolution to the FW CS4 Install Problem (Last Post : jukkako - Replies : 2 - Views : 3 )           »          Help posting folder to server (Last Post : Dawgswrestler - Replies : 2 - Views : 3 )           »          Problems producing W3C-valid template-built pages (Last Post : hen3ry - Replies : 0 - Views : 1 )           »          PHP Server lets Cookies work but not Sessions! (Last Post : Rickideeuk - Replies : 8 - Views : 9 )           »          Question about filtering commas (Last Post : Ian Skinner - Replies : 1 - Views : 2 )           »          Error: ModuleManager.as:671 (Last Post : Amy Blankenship - Replies : 10 - Views : 11 )           »         


Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
User Info Statistics
Go Back   Adobe Dreamweaver Forums > Dreamweaver: Main > Dreamweaver Application Development
 
Tags: , , ,



Reply
  #1 (permalink)  
Old 04-13-2008, 02:51 AM
davecheet
 
Posts: n/a
Diggs:
Default Log in Set Cookie if field = 1

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");
}
}
?>



Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 09:08 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Inactive Reminders By Mished.co.uk