Jump to content

Notify user pending Approval


Recommended Posts

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;

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.