Jump to content

Recommended Posts

I have members area that people can sign up for.  What I need is before they can log on they have to be approved by a central administrator.  I under stand the status in the table.  What I'm looking for is a tutorial to point me in the right direction.

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/67952-solved-point-me-in-the-right-direction/
Share on other sites

Create a page that lists all the people not approved with a check box by their entry.  The person doing the approval checks the boxes and clicks a button to approve or delete them.

 

Exactly what are you having trouble with?  Accessing data in MySQL?  HTML forms?

This is what I feel should happen.  When they sign up they are inserted into the table and I believe they would be given a status of 0=not approved and 1=approved.

I want the central admin to get a email that there is someone pending (not a problem).  They would either accept or delete.  One form would update and one form would delete from table.  Once done it would generate email to new user stating they have been accepted or denied.  Not really a problem.

 

When they log in how would I show their status is =1 approved?

You just pull the data out of the database and use PHP logic to say "Approved" or "Not Approved."  You seem to have a handle on what you're doing, so again, what exactly are you stuck with?

 

Do you have a registration form?  Does it insert into the database?  Does it send the e-mail? Have you created any forms to list the people awaiting approval?

I am trying to query a table where the column status=0 they are not authorized to view and if status=1 they are authorized to view.  The problem is the code is not executing.  I am getting a blank page.

 

This is my code.  I am new to the PHP world and I'm not sure whar I am doing wrong.  Thank you in advance

<?PHP include 'dbmembers.php' ?>
<?php

$userName = $_POST['userName'];
$userPass = $_POST['userPass'];


?>
<?PHP 
ini_set('display_errors', 1) ;
error_reporting(E_ALL);
if(isset ($submit)) {

$data = "SELECT * FROM table WHERE  userName = '$userName' AND userPass = '$userPass'"; //this is user name and password
$result = mysql_query($data) or die(mysql_error());


while($record = mysql_fetch_array($result)) {

if ($record['status'] = 0) //they are waiting approval
{
echo "<P>You are not authorized<br>";
}
elseif ($record['status'] = 1)//they have been approved
{

redirect('members/index.php');
}
}
}
?>

From the form

<form action="loginck.php" method="POST">

         <P> Username 
          <input type="text" name="userName">
          Password 
          <input type="password" name="userPass"></P>


<P><input type="submit" value="Login" name="submit"></P>
</form> 

 

I also changed the isset to

if(isset ( $_POST['submit']));

 

I'm still not "reading" the table!!

Ok 1. i would use MD5() to encrypt password as you can be sql injected

very easily!

 

2. redirect() doesnt exist.

 

3. try this coding

<?php
include_once("dbmembers.php");
#	Define POST vars
$user = $_POST['username'];
$pass = $_POST['password'];

#	Login?
if(isset($_POST['submit']))
{
$sql = mysql_query("SELECT * FROM `table` WHERE  `userName` = '".$userName."' AND userPass = '".$userPass."'") or die(mysql_error());
while($record = mysql_fetch_array($sql))
{
	if($record['status'] == "0")
	{
		die("You are not yet approved.");
	}
	else
	{
		header("Location: members/index.php");
	}
}
}

?>

try this :)

 

<?php
include_once("dbmembers.php");
#	Define POST vars
$user = $_POST['username'];
$pass = $_POST['password'];

#	Login?
if(isset($_POST['submit']))
{
$sql = mysql_query("SELECT * FROM `table` WHERE  `userName` = '".$userName."' AND userPass = '".$userPass."'") or die(mysql_error());
while($record = mysql_fetch_array($sql))
{
	if($record['status'] == "0")
	{
		die("You are not yet approved.");
	}
	else
	{
		header("Location: members/index.php");
	}
}
}
else
{
echo('no submit pressed');
}
?>

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.