Jump to content

Pop Up Login Form Inside Index.php


newphpcoder

Recommended Posts

Hi..i have a login page and it is separately in my index.phpnow i need my login page become a pop up form when I open my index.phphere is my login.php

<?php  include 'config.php';   session_start();   //if (isset($_SESSION['logged_in'])) {   //  header('Location:index.php');  //   die(); // }   if (isset($_POST['submit'])) {    $username=$_POST['username'];    $password=($_POST['password']);   	 $sql = "SELECT username, password FROM pay_login WHERE username='$username' AND password='$password'";	 $rs = $conn2->Execute($sql);		 if($rs==1){ 	    $_SESSION['logged_in'] = true;	    header("location:index.php");    }    else {    echo "<center>";    echo "Wrong Username or Password";    echo "</center>";    }  }$smarty->display('login.tpl'); ?>

and here is my index.php

<?php session_regenerate_id(true);/*include 'config.php';if (!isset($_SESSION['empID'])) {$sql = "SELECT EMP_ID FROM PERSONAL";$recPersonal = $conn->Execute($sql);if (!$recPersonal->BOF) {    $recPersonal->MoveFirst();}session_register('empID');$_SESSION['empID'] = $recPersonal->fields['EMP_ID'];}   */include 'config.php';$currentEmpID = $_SESSION['empID'];if (!isset($_SESSION['empID'])) {$sql = "SELECT EMP_ID, CONCAT(LNAME, ', ' , FNAME, ' ', MI) AS FULLNAME FROM PERSONAL ORDER BY LNAME ASC";$recPersonal = $conn->Execute($sql);session_register('empID');$_SESSION['empID'] = $recPersonal->fields['EMP_ID'];}$sql = "SELECT EMP_ID, CONCAT(LNAME, ', ' , FNAME, ' ', MI) AS FULLNAME FROM PERSONAL ORDER BY LNAME ASC"; $recPersonalNav = $conn->GetAll($sql);$smarty->assign('personalAll', $recPersonalNav);// ========================================================================================================================$sql = "SELECT EMP_ID, CONCAT(LNAME, ', ',  FNAME, ' ', MI, '.') AS FULLNAME FROM PERSONAL		 WHERE EMP_ID='$currentEmpID'";		  $recPersonalHead = $conn->Execute($sql);$fullName = $recPersonalHead->fields["FULLNAME"];$smarty->assign('empid', $currentEmpID);$smarty->assign('fullname', $fullName);session_write_close(); $smarty->display('header.tpl'); $smarty->display('left.tpl');$smarty->display('empPayroll.tpl');	  $smarty->display('footer.tpl'); exit();?>

and I found a sample pop up code in internet but this pop needs a button befre it was displayed..I want is it will display when i run my index.phphere is the link of sample pop up formhttp://www.nigraphic.com/blog/java-script/how-open-new-window-popup-center-screenThank you

Link to comment
Share on other sites

You can move the Javascript function to show the popup from the onclick event on a link to the onload event on the body. The only problem with that is that most popup blockers will block popups that the user didn't click to open.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...