Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

pop up login form at my index.php

login form login

  • Please log in to reply
6 replies to this topic

#1 newphpcoder

newphpcoder

    CC Devotee

  • Senior Member
  • PipPipPipPipPipPip
  • 527 posts

Posted 07 December 2011 - 12:45 AM

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
  • 0

#2 Orjan

Orjan

    CC Mentor

  • Moderator
  • 2918 posts
  • Location:Karlstad, Sweden
  • Programming Language:C, Java, C++, C#, PHP, JavaScript, Pascal
  • Learning:Java, C#

Posted 07 December 2011 - 01:07 AM

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.
  • 0

I'm a System developer at XLENT Consultant Group mainly working with SugarCRM.
Please DO NOT send mail or PM to me with programming questions, post them in the appropriate forum instead, where I and others can answer you.


#3 newphpcoder

newphpcoder

    CC Devotee

  • Senior Member
  • PipPipPipPipPipPip
  • 527 posts

Posted 07 December 2011 - 01:22 AM

its a suggestion of my superior.

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

#4 Orjan

Orjan

    CC Mentor

  • Moderator
  • 2918 posts
  • Location:Karlstad, Sweden
  • Programming Language:C, Java, C++, C#, PHP, JavaScript, Pascal
  • Learning:Java, C#

Posted 08 December 2011 - 06:31 PM

If so, I suggest to do an overlay in css instead
  • 0

I'm a System developer at XLENT Consultant Group mainly working with SugarCRM.
Please DO NOT send mail or PM to me with programming questions, post them in the appropriate forum instead, where I and others can answer you.


#5 newphpcoder

newphpcoder

    CC Devotee

  • Senior Member
  • PipPipPipPipPipPip
  • 527 posts

Posted 11 December 2011 - 04:08 PM

How is it?do you have any sample?

Thank you
  • 0

#6 Orjan

Orjan

    CC Mentor

  • Moderator
  • 2918 posts
  • Location:Karlstad, Sweden
  • Programming Language:C, Java, C++, C#, PHP, JavaScript, Pascal
  • Learning:Java, C#

Posted 15 December 2011 - 11:26 AM

With a small google search, something like this: jQuery Overlay @ jQuery TOOLS - Overlay your HTML with eyecandy
  • 0

I'm a System developer at XLENT Consultant Group mainly working with SugarCRM.
Please DO NOT send mail or PM to me with programming questions, post them in the appropriate forum instead, where I and others can answer you.


#7 newphpcoder

newphpcoder

    CC Devotee

  • Senior Member
  • PipPipPipPipPipPip
  • 527 posts

Posted 18 December 2011 - 04:20 PM

Thank you....
  • 0





Also tagged with one or more of these keywords: login form, login

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download