revraz Posted November 30, 2007 Share Posted November 30, 2007 So where is Cust coming from? Change $_SESSION['type'] = ($row['user']==1)?"Cust":"Emp"; to $_SESSION['type'] = ($row['user']==1)?"admin":"user"; Then echo those out. Quote Link to comment https://forums.phpfreaks.com/topic/79553-solved-loging-problems-cant-set-it-up/page/2/#findComment-403078 Share on other sites More sharing options...
mikebyrne Posted November 30, 2007 Author Share Posted November 30, 2007 the sql for the table is: CREATE TABLE `users` ( `id` int(4) NOT NULL auto_increment, `name` varchar(65) NOT NULL default '', `address` varchar(65) NOT NULL default '', `address1` varchar(65) NOT NULL default '', `address2` varchar(65) NOT NULL default '', `address3` varchar(65) NOT NULL default '', `address4` varchar(65) NOT NULL default '', `county` varchar(25) NOT NULL default '', `zip` varchar(65) NOT NULL default '', `telephone` varchar(25) NOT NULL default '', `email` varchar(25) NOT NULL default '', `username` varchar(65) NOT NULL default '', `password` varchar(15) NOT NULL default '', `User` int(1) default '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=36 DEFAULT CHARSET=latin1; The users field will always be 0 and any additional entry from the confirmation email wiil have a 1 in the users column So 1= Users 0=Admin Therefor when a user logs in they will have 1 in the user column and when an admin logs in they will have a 0 in the users column Quote Link to comment https://forums.phpfreaks.com/topic/79553-solved-loging-problems-cant-set-it-up/page/2/#findComment-403082 Share on other sites More sharing options...
MadTechie Posted November 30, 2007 Share Posted November 30, 2007 Cap the U on User <?php $row = mysql_fetch_assoc($result); // Register $myusername, $mypassword and redirect to file "login_success.php" $_SESSION['myusername'] = $row['username']; $_SESSION['mypassword'] = $row['password']; $_SESSION['type'] = ($row['User']==1)?"Emp":"Cust"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/79553-solved-loging-problems-cant-set-it-up/page/2/#findComment-403085 Share on other sites More sharing options...
mikebyrne Posted November 30, 2007 Author Share Posted November 30, 2007 I've just tried that and still getting the same results Quote Link to comment https://forums.phpfreaks.com/topic/79553-solved-loging-problems-cant-set-it-up/page/2/#findComment-403097 Share on other sites More sharing options...
mikebyrne Posted November 30, 2007 Author Share Posted November 30, 2007 Is there another way round this?? Quote Link to comment https://forums.phpfreaks.com/topic/79553-solved-loging-problems-cant-set-it-up/page/2/#findComment-403173 Share on other sites More sharing options...
mikebyrne Posted December 1, 2007 Author Share Posted December 1, 2007 I've fixed it but could you explain what the following line does? $_SESSION['type'] = ($row['User']==1)?"Cust":"Emp"; Quote Link to comment https://forums.phpfreaks.com/topic/79553-solved-loging-problems-cant-set-it-up/page/2/#findComment-403274 Share on other sites More sharing options...
revraz Posted December 1, 2007 Share Posted December 1, 2007 The : acts as a Else. So if row user =1 then its a Cust, otherwise it's a Emp. Quote Link to comment https://forums.phpfreaks.com/topic/79553-solved-loging-problems-cant-set-it-up/page/2/#findComment-403278 Share on other sites More sharing options...
mikebyrne Posted December 1, 2007 Author Share Posted December 1, 2007 Aaaaahhhh OK. So what does the $_SESSION['type'] do? Quote Link to comment https://forums.phpfreaks.com/topic/79553-solved-loging-problems-cant-set-it-up/page/2/#findComment-403281 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.