steviemac Posted September 4, 2007 Share Posted September 4, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/67952-solved-point-me-in-the-right-direction/ Share on other sites More sharing options...
roopurt18 Posted September 4, 2007 Share Posted September 4, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/67952-solved-point-me-in-the-right-direction/#findComment-341517 Share on other sites More sharing options...
steviemac Posted September 4, 2007 Author Share Posted September 4, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/67952-solved-point-me-in-the-right-direction/#findComment-341528 Share on other sites More sharing options...
roopurt18 Posted September 4, 2007 Share Posted September 4, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/67952-solved-point-me-in-the-right-direction/#findComment-341548 Share on other sites More sharing options...
steviemac Posted September 4, 2007 Author Share Posted September 4, 2007 Sorry, I'm not sure how to code the login script username =$username, and password=$password where status=1 if status = 1 redirect whatever.php else echo Not yet authorized Does that seem right? Quote Link to comment https://forums.phpfreaks.com/topic/67952-solved-point-me-in-the-right-direction/#findComment-341579 Share on other sites More sharing options...
steviemac Posted September 5, 2007 Author Share Posted September 5, 2007 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'); } } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/67952-solved-point-me-in-the-right-direction/#findComment-342031 Share on other sites More sharing options...
xyn Posted September 5, 2007 Share Posted September 5, 2007 where is $submit coming from? Quote Link to comment https://forums.phpfreaks.com/topic/67952-solved-point-me-in-the-right-direction/#findComment-342036 Share on other sites More sharing options...
steviemac Posted September 5, 2007 Author Share Posted September 5, 2007 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!! Quote Link to comment https://forums.phpfreaks.com/topic/67952-solved-point-me-in-the-right-direction/#findComment-342053 Share on other sites More sharing options...
xyn Posted September 5, 2007 Share Posted September 5, 2007 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"); } } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/67952-solved-point-me-in-the-right-direction/#findComment-342081 Share on other sites More sharing options...
steviemac Posted September 5, 2007 Author Share Posted September 5, 2007 I tried it and still nothing Quote Link to comment https://forums.phpfreaks.com/topic/67952-solved-point-me-in-the-right-direction/#findComment-342096 Share on other sites More sharing options...
xyn Posted September 5, 2007 Share Posted September 5, 2007 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'); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/67952-solved-point-me-in-the-right-direction/#findComment-342104 Share on other sites More sharing options...
steviemac Posted September 5, 2007 Author Share Posted September 5, 2007 I'm still getting a blank screen. My password is stored as MD5 (). Do I have to make the form password convert to md5 also. I think that is my problem. Quote Link to comment https://forums.phpfreaks.com/topic/67952-solved-point-me-in-the-right-direction/#findComment-342123 Share on other sites More sharing options...
steviemac Posted September 5, 2007 Author Share Posted September 5, 2007 Thanks for the help. The problem was I was not encripting the password Quote Link to comment https://forums.phpfreaks.com/topic/67952-solved-point-me-in-the-right-direction/#findComment-342147 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.