I want to make option to approve users before they can login or to ban them, here is code

<HTML><HEAD><TITLE>Fakultet informacionih tehnologija</TITLE> </HEAD>

<BODY TEXT="#ffffff" BACKGROUND="fakultet/Assets/bg.jpg" LINK="#FFFF00" VLINK="#CDCD00" BGCOLOR="#000000">



<CENTER><TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH="700">





<CENTER>

  <FONT SIZE=+4 FACE="arial,helvetica">

    Fakultet informacionih tehnologija

   
    <HR>

</CENTER>

<?php
session_start();
// dBase file
include "dbConfig.php";
 
if ($_GET["op"] == "login")
 {
 if (!$_POST["username"] || !$_POST["password"])
  {
	header("Refresh: 3;login.php");
  die("You need to provide a username and password.");
	}


	
 // Create query
 $q = "SELECT * FROM `dbUsers` "
  ."WHERE `username`='".$_POST["username"]."' "
  ."AND `password`=PASSWORD('".$_POST["password"]."') "
  ."LIMIT 1";

 // Run query
 $r = mysql_query($q);
 
 
 if ( $obj = @mysql_fetch_object($r) )
  {
  // Login good, create session variables
  $_SESSION["valid_id"] = $obj->id;
  $_SESSION["valid_user"] = $_POST["username"];
  $_SESSION["valid_time"] = time();
  
  // Redirect to member page
  Header("Location: index.php");
  }
 else
  {
// Login not successful
header('Refresh: 3;login.php');
die("Sorry, could not log you in. Wrong login information.");

	}
	}
else
 {
//If all went right the Web form appears and users can log in
 echo "<form action=\"?op=login\" method=\"POST\">";
 echo "Username: <input name=\"username\" size=\"15\"><br />";
 echo "Password: <input type=\"password\" name=\"password\" size=\"16\"><br />";
 echo "<input type=\"submit\" value=\"Login\"><br />";
 echo "<a href=\"register.php\">Register</a>";
 echo "</form>";
 }
?>

<br><FONT SIZE=+3>Coded by Filip ^_^</A></FONT>

</BODY></HTML>

and in sql dbusers I have tabs id,user,password,email,approved and banned. So what code I need to add into php to make check for approved/banned?

Thanks in advance

BUMP!

no one knows code like if approved =0 die or something?

in your Database make another column called approved and make it a tinyint and the default would be 0.

If you want to check if they are approved/banned you add "WHERE approved = '1'" to see if they are active or not.

The tinyint is a boolean so 1 = yes , 0 = no.

Hope that helped

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.