Jump to content

pop up login form at my index.php

- - - - -

  • Please log in to reply
6 replies to this topic

#1
newphpcoder

newphpcoder

    Programming Professional

  • Members
  • PipPipPipPipPipPip
  • 477 posts
Hi..

i have a login page and it is separately in my index.php

now i need my login page become a pop up form when I open my index.php

here 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.php

here is the link of sample pop up form
http://www.nigraphic...p-center-screen

Thank you

#2
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts
  • Location:Karlstad, Sweden
  • Programming Language:C, Java, C++, C#, PHP, JavaScript, Pascal
  • Learning:Java, C#
It's more user friendly to push the login button before getting a popup thrown in your face when opening a web page. I would mistrust a site doing so.
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall

#3
newphpcoder

newphpcoder

    Programming Professional

  • Members
  • PipPipPipPipPipPip
  • 477 posts
its a suggestion of my superior.

How can I hide my index.php as the background of pop up login form

#4
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts
  • Location:Karlstad, Sweden
  • Programming Language:C, Java, C++, C#, PHP, JavaScript, Pascal
  • Learning:Java, C#
If so, I suggest to do an overlay in css instead
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall

#5
newphpcoder

newphpcoder

    Programming Professional

  • Members
  • PipPipPipPipPipPip
  • 477 posts
How is it?do you have any sample?

Thank you

#6
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts
  • Location:Karlstad, Sweden
  • Programming Language:C, Java, C++, C#, PHP, JavaScript, Pascal
  • Learning:Java, C#
With a small google search, something like this: jQuery Overlay @ jQuery TOOLS - Overlay your HTML with eyecandy
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall

#7
newphpcoder

newphpcoder

    Programming Professional

  • Members
  • PipPipPipPipPipPip
  • 477 posts
Thank you....




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users