energysuperstore09 Posted March 30, 2009 Share Posted March 30, 2009 I have built a login page where distributors can register for there own username and password to access important informtion. Problem is that anybody can register and view this information, which is not for everyone to see. Is there a way that when users register that I can approve that user and also send a email motifying the user that there login is pending approval? And how I would go about doing this? As this is a request at my job and in need of help as I am new to php. The following is a link to my login page and below is my table structure in my database. HELP? PLEASE CREATE TABLE IF NOT EXISTS `accounts` ( `repnumber` text NOT NULL, `fname` text NOT NULL, `lname` text NOT NULL, `cname` text NOT NULL, `phone` text NOT NULL, `email` text NOT NULL, `username` text NOT NULL, `password` text NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; Quote Link to comment Share on other sites More sharing options...
dadamssg Posted March 30, 2009 Share Posted March 30, 2009 add a column in you db called 'approved' and set its default to 0. youll have to look more into the sending emails...just google it, not hard. and then after they register send them to a page that says your account is under review. then you can review their account and then replace that 0 with a 1 using an UPDATE query. have the login script pull up the approved column and check to see what value it contains...if approved=0 send them to that 'youre being reviewed page'...if approved=1 log them in Quote Link to comment Share on other sites More sharing options...
energysuperstore09 Posted March 30, 2009 Author Share Posted March 30, 2009 what would the script look like as far as checking too see if the column approved value is changed? Quote Link to comment Share on other sites More sharing options...
chronister Posted March 30, 2009 Share Posted March 30, 2009 In your table, you don't have an ID column that is primary key & autoIncrement. That would be key to being able to pull information from a particular user. <?php // run query to get data for particular user $sql = "SELECT * FROM accounts WHERE repnumber='$id'"; $result = mysql_query($sql); while($row = mysql_fetch_assoc($result)){ if($row['approved'] == 1){ echo 'approved'; }else{ echo 'not Approved'; } } ?> That would be a basic example. Quote Link to comment Share on other sites More sharing options...
energysuperstore09 Posted March 30, 2009 Author Share Posted March 30, 2009 would this script go on the webpage where they login? Quote Link to comment Share on other sites More sharing options...
chronister Posted April 2, 2009 Share Posted April 2, 2009 You would include this sort of script in the page where the login takes place. Part of it needs to be in the registration script. In the reg script, you would set the field to 0 or have it default to 0. Then in your login script when you pull the data for the user that is trying to login, you would check to see if this field is set to 1 or 0. If it is 1, then proceed with login, if it is 0 then display message saying they don't have permission or something to that effect. Nathan Quote Link to comment 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.