The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 304 Weeks Ago, 3 Days Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
How can i make this php page starting page http://www.bit4444.bit.vt.edu/group7/login.php so that when i put in the url my php comes up?
I attached the php page.<? session_start(); ?>
<? ob_start() ?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Refresh" content="0; url=http://www.bit4444.bit.vt.edu/group7/login.php">
<link rel="stylesheet" type="text/css" href="/projstyle.css" />
<title>Piedmont Furnishings</title>
</head>
<h1>Piedmont Furnishings<br />Sales Order Analysis and Reporting System</h1>
<hr />
<br /><br /><br />
<?
   $db = mysqli_connect("localhost", "student", "student", "furnish") or die("I cannot connect to the database because: " . mysqli_connect_error()); // connect to the database server
?>Â Â Â
<? if (isset($_REQUEST['page1_submit'])) {
// __________________________________________________ DISPLAY PAGE 2 Â
 if (isset($_POST['user']) && isset($_POST['pword'])){ Â
   $user = $_POST['user'];
   $pword = $_POST['pword'];
   $strSQL = ("SELECT * FROM employee WHERE emp_username='$user' AND emp_pword='$pword'");
  Â
   $rs = mysqli_query($db, $strSQL) or die("Error in SQL statement: " . mysqli_error());
  Â
   if(mysqli_num_rows($rs) > 0) {
      $strSQL1 = ("SELECT job_id FROM employee WHERE emp_username='$user'");
     Â
      $rs = mysqli_query($db, $strSQL1) or die("Error in SQL statement: " . mysqli_error());
      $row = mysqli_fetch_assoc($rs);
     Â
         if ($row["job_id"] == 1 || $row["job_id"] == 2){  Â
            $strSQL2 = ("SELECT emp_fname, emp_lname FROM employee WHERE emp_username='$user'");
           Â
            $rs = mysqli_query($db, $strSQL2) or die("Error in SQL statement: " . mysqli_error());
            $row = mysqli_fetch_assoc($rs);
            $_SESSION["empname"] = $row["emp_fname"] . " " . $row["emp_lname"];
           Â
            $strSQL3= ("SELECT emp_id FROM employee WHERE emp_username='$user'");
           Â
            $rs = mysqli_query($db, $strSQL3) or die("Error in SQL statement: " . mysqli_error());
            $row = mysqli_fetch_assoc($rs);
            $_SESSION["emp_id"] = $row["emp_id"];
            header("Location: manager.php");}
           Â
         elseif ($row["job_id"] == 3 || $row["job_id"] == 4){
            $strSQL2 = ("SELECT emp_fname, emp_lname FROM employee WHERE emp_username='$user'");
           Â
            $rs = mysqli_query($db, $strSQL2) or die("Error in SQL statement: " . mysqli_error());
            $row = mysqli_fetch_assoc($rs);
            $_SESSION["empname"] = $row["emp_fname"] . " " . $row["emp_lname"];
     Â
            $strSQL3= ("SELECT emp_id FROM employee WHERE emp_username='$user'");
           Â
            $rs = mysqli_query($db, $strSQL3) or die("Error in SQL statement: " . mysqli_error());
            $row = mysqli_fetch_assoc($rs);
            $_SESSION["emp_id"] = $row["emp_id"];
            header("Location: employee.php");}
         }else{ ?>  Â
<h2>Wrong Password or Username! Try again.</h2>
      <form method="POST" action="login.php">
<h2>Username:
<input type="text" name="user" /><br /><br />
Password:
<input type="password" NAME="pword" /><br /><br />
<input type="submit" name="page2_submit" value="SUBMIT" />
<input type="reset" value="RESET" /><br />
</h2>
      </form>
   <? } ?>
   <? } ?>
<? } elseif (isset($_REQUEST['page2_submit'])) {
// __________________________________________________ DISPLAY PAGE 3Â ?>
<? if (isset($_POST['user']) && isset($_POST['pword'])){
   $user = $_POST['user'];
   $pword = $_POST['pword'];
   $strSQL = ("SELECT * FROM employee WHERE emp_username='$user' AND emp_pword='$pword'");
  Â
   $rs = mysqli_query($db, $strSQL) or die("Error in SQL statement: " . mysqli_error());
  Â
   if(mysqli_num_rows($rs) > 0) {
      $strSQL1 = ("SELECT job_id FROM employee WHERE emp_username='$user'");
     Â
      $rs = mysqli_query($db, $strSQL1) or die("Error in SQL statement: " . mysqli_error());
      $row = mysqli_fetch_assoc($rs);
     Â
         if ($row["job_id"] == 1 || $row["job_id"] == 2){  Â
            $strSQL2 = ("SELECT emp_fname, emp_lname FROM employee WHERE emp_username='$user'");
           Â
            $rs = mysqli_query($db, $strSQL2) or die("Error in SQL statement: " . mysqli_error());
            $row = mysqli_fetch_assoc($rs);
            $_SESSION["empname"] = $row["emp_fname"] . " " . $row["emp_lname"];
           Â
            $strSQL3= ("SELECT emp_id FROM employee WHERE emp_username='$user'");
           Â
            $rs = mysqli_query($db, $strSQL3) or die("Error in SQL statement: " . mysqli_error());
            $row = mysqli_fetch_assoc($rs);
            $_SESSION["emp_id"] = $row["emp_id"];
            header("Location: manager.php");}
           Â
         elseif ($row["job_id"] == 3 || $row["job_id"] == 4){
            $strSQL2 = ("SELECT emp_fname, emp_lname FROM employee WHERE emp_username='$user'");
           Â
            $rs = mysqli_query($db, $strSQL2) or die("Error in SQL statement: " . mysqli_error());
            $row = mysqli_fetch_assoc($rs);
            $_SESSION["empname"] = $row["emp_fname"] . " " . $row["emp_lname"];
     Â
            $strSQL3= ("SELECT emp_id FROM employee WHERE emp_username='$user'");
           Â
            $rs = mysqli_query($db, $strSQL3) or die("Error in SQL statement: " . mysqli_error());
            $row = mysqli_fetch_assoc($rs);
            $_SESSION["emp_id"] = $row["emp_id"];
            header("Location: employee.php");}
   }else{ ?>
<h2>Wrong Password or Username! This was your second try.</h2>
<form method="POST" action="login.php">
<h2>Username:
<input type="text" name="user" /><br /><br />
Password:
<input type="password" NAME="pword" /><br /><br />
<input type="submit" name="page3_submit" value="SUBMIT" />
<input type="reset" value="RESET" /><br />
</h2>
</form>
   <? } ?>
   <? } ?>
<? } elseif (isset($_REQUEST['page3_submit'])) {
// ________________________________________________ DISPLAY FINAL PAGEÂ ?>
<? if (isset($_POST['user']) && isset($_POST['pword'])){
   $user = $_POST['user'];
   $pword = $_POST['pword'];
   $strSQL = ("SELECT * FROM employee WHERE emp_username='$user' AND emp_pword='$pword'");
  Â
   $rs = mysqli_query($db, $strSQL) or die("Error in SQL statement: " . mysqli_error());
  Â
   if(mysqli_num_rows($rs) > 0) {
      $strSQL1 = ("SELECT job_id FROM employee WHERE emp_username='$user'");
     Â
      $rs = mysqli_query($db, $strSQL1) or die("Error in SQL statement: " . mysqli_error());
      $row = mysqli_fetch_assoc($rs);
     Â
         if ($row["job_id"] == 1 || $row["job_id"] == 2){  Â
            $strSQL2 = ("SELECT emp_fname, emp_lname FROM employee WHERE emp_username='$user'");
           Â
            $rs = mysqli_query($db, $strSQL2) or die("Error in SQL statement: " . mysqli_error());
            $row = mysqli_fetch_assoc($rs);
            $_SESSION["empname"] = $row["emp_fname"] . " " . $row["emp_lname"];
           Â
            $strSQL3= ("SELECT emp_id FROM employee WHERE emp_username='$user'");
           Â
            $rs = mysqli_query($db, $strSQL3) or die("Error in SQL statement: " . mysqli_error());
            $row = mysqli_fetch_assoc($rs);
            $_SESSION["emp_id"] = $row["emp_id"];
            header("Location: manager.php");}
           Â
         elseif ($row["job_id"] == 3 || $row["job_id"] == 4){
            $strSQL2 = ("SELECT emp_fname, emp_lname FROM employee WHERE emp_username='$user'");
           Â
            $rs = mysqli_query($db, $strSQL2) or die("Error in SQL statement: " . mysqli_error());
            $row = mysqli_fetch_assoc($rs);
            $_SESSION["empname"] = $row["emp_fname"] . " " . $row["emp_lname"];
     Â
            $strSQL3= ("SELECT emp_id FROM employee WHERE emp_username='$user'");
           Â
            $rs = mysqli_query($db, $strSQL3) or die("Error in SQL statement: " . mysqli_error());
            $row = mysqli_fetch_assoc($rs);
            $_SESSION["emp_id"] = $row["emp_id"];
            header("Location: employee.php");}
   }else{ ?>
<h2>Wrong Password or Username Again! You're out of luck.</h2>
   <? } ?>
   <? } ?>
<? } else {
// ____________________________________________________________ DEFAULTÂ ?>
<!-- This is the first pass for the user – page 1 -->
<h2>Please enter your username and password to access this site!</h2><br />
<form method="POST" action="login.php">
<h2>Username:
<input type="text" name="user" /><br /><br />
Password:
<input type="password" name="pword" /><br /><br />
<input type="submit" name="page1_submit" value="SUBMIT" />
<input type="reset" value="RESET" /><br />
</h2>
</form>
<?
}
//mysqli_free_result($rs);Â // release the recordset memory resources
mysqli_close($db);Â Â // close the database
?>
</body>
</html>
----------- Â ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly