Author Topic: ajax login panel..doesnt work...  (Read 1037 times)

luvrockz

  • Regular Member
  • **
  • Posts: 64
  • Karma: +1/-0
    • View Profile
ajax login panel..doesnt work...
« on: July 07, 2010, 01:18:13 AM »
i have this ajax login panel which can be downloaded from http://www.coolajax.net/preview/download/accor/11.html   

now i dnt knw how to make it work with my user management system... here is the user login page that i use now.... i thought this might help...


PHP Code: [Select]
<?
    
require_once(dirname(__FILE__) . "/globals.php");

    
$ffForm = new FfForm();
    
    
$ffForm->addField(new UsernameField("user""Username"REQUIRED));
    
$ffForm->addField(new EnterPasswordField("pwd""Password"REQUIRED));
    
$ffForm->addField(new SubmitField("submit""Login"));
    
$ffForm->setEnterTabs(false);
    
    
$ffForm->getParameters();
    
    if (
$ffForm->getValue("submit")) {
        if (
$ffForm->checkValues()) {
            
$user getSimpleValues
                
"SELECT user_id,status from " SECURE_TABLE_PREFIX "users "
                
"WHERE username=" $ffForm->getDbValue("user") . " "
                    
"AND password=MD5(" $ffForm->getDbValue("pwd") . ")"
            
);
            
$userId $user["user_id"];
            if (
$userId != null && $user["status"] === "Active") {
                
login($userId$ffForm->getValue("user"));
                if (
$_REQUEST["goTo"]) {
                    
header("Location: " $_REQUEST["goTo"]);
                } else {
                    
// GET 1st start_url
                    
$db = &FfDb::s();
                    
$startUrl $db->getSimpleValue("
                        SELECT start_url
                        FROM " 
SECURE_TABLE_PREFIX "group_members as group_members," SECURE_TABLE_PREFIX "groups as groups
                        WHERE group_members.user_id='" 
$userId "'
                            AND group_members.group_id=groups.group_id
                    "
);
                    if (!
$startUrl)
                        
$startUrl "user/index.php";
                    
header("Location: " $startUrl);
                }
            } else {
                
$ffForm->clearValue("pwd");
            }
        }
    }

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SciCom - Login</title>
<? require_once(dirname(__FILE__) . "/section1.php"); ?>
<style type="text/css">
<!--
.style1 {
    color: #37511E
}
-->
</style>
<link rel="stylesheet" type="text/css" href="../new/screen.css" media="screen" />

<style type="text/css">
<!--
.style11 {color: #F0F0F0}
.style103 {
    font-size: 24px
}
.style104 {font-family: Geneva, Arial, Helvetica, sans-serif}
-->
</style>
</head>

<body class="thrColLiqHdr">

<div id="container">
 <div id="header"><iframe id="IFrame2" frameborder="0" scrolling="No" src="../new/header.php" align="middle" width="100%" height="210px"></iframe>
   
   <!-- end #header -->
 </div>
  <div id="sidebar1">
    <iframe src="../new/left frame.php" width="100%" height="950px" align="middle" scrolling="No" frameborder="0" class="style11" id="IFrame1"></iframe>

  <!-- end #sidebar1 --></div>
  <div id="sidebar2">
    <iframe src="../new/right frame.php" width="100%" height="950px" align="middle" scrolling="No" frameborder="0" class="style11" id="IFrame1"></iframe>
  <!-- end #sidebar2 --></div>
  <div class="style1" id="mainContent">
  
  
  
  
  
  <body onload="setFocus();">
    <center>
        <div style="border-bottom:1px solid #BACBDB;width:97%;margin-top:15px;margin-bottom:5px;"></div>
        <table width="100%" style="text-align:left;width:100%;">
<tr style="vertical-align:top;">
                <td>
                    <center>
                      <div style="font-weight:bold;font-size:9px;"></div>
                  </center>                </td>
            </tr>
            <tr>
                <td>
                    <form action="" method="post">
                        <center>
                            <table width="100%" style="text-align:left;">
                  <tr style="vertical-align:center;">
<td width="51%" style="width:50%;">
                                        
                      <h2 class="style1">SciCom Login                      </h2>
                      <p>
                        <? if ($ffForm->getValue("submit") && !$ffForm->isError && !isLoggedIn()) { ?>
                      </p>
                                        <div class="pageErrors">
                                                <?= ($user["status"] === "Disabled" "This User Account Has Been Disabled!" "Invalid Username or Password!"?>
                      </div>
                                        <? ?>
                                        <?= $ffForm->getTableTag() ?>                    </td>
  <td width="49%" style="padding-left:20px;">
                    <h4 class="secure style1">Need a user account?</h4>
                            <a href="signUp.php<?= ($_REQUEST["goTo"] ? "?goTo=" urlencode($_REQUEST["goTo"]) : ""?>">Sign Up</a>
                                        <h4 class="secure style1">Forgot your password or username?</h4>
<div>
                                            <ul style="margin-top:0px;">
                                                <li><a href="forgotPwd.php">I forgot my password</a></li>
                                                <li><a href="forgotUsername.php">I forgot my username</a></li>
                                            </ul>
                      </div>                    </td>
                              </tr>
                            </table>
                      </center>
                    </form>
                    <div style="text-align:center;">
                        <a href="contactUs.php">Contact Us</a>                    </div>                </td>
            </tr>
        </table>
      <? require_once(dirname(__FILE__) . "/section3.php"); ?>
    </center>
  </div>
  <!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats --><br class="clearfloat" />
  <div id="footer"><iframe id="IFrame1" frameborder="0" scrolling="No" src="../new/footer.php" align="middle" width="100%" height="130px"></iframe>
    
  <!-- end #footer --></div>
<!-- end #container --></div>
</body>
</html>




pls help...

daveismyname

  • Senior Member
  • ****
  • Posts: 204
  • Karma: +1/-0
  • PHP Helper
    • View Profile
    • Dave is my name
Re: ajax login panel..doesnt work...
« Reply #1 on: July 07, 2010, 03:14:09 PM »
the sliding login panel is a simply sliding div all you need to do to use it is make merge the demo page with your login page.

I'd put all the css,javascript files in the same folder as your login page or change your paths to where you store the files.

Here's a sample of mergin the two files:

PHP Code: [Select]

<?
    require_once(
dirname(__FILE__) . "/globals.php");

    
$ffForm = new FfForm();
    
    
$ffForm->addField(new UsernameField("user""Username"REQUIRED));
    
$ffForm->addField(new EnterPasswordField("pwd""Password"REQUIRED));
    
$ffForm->addField(new SubmitField("submit""Login"));
    
$ffForm->setEnterTabs(false);
    
    
$ffForm->getParameters();
    
    if (
$ffForm->getValue("submit")) {
        if (
$ffForm->checkValues()) {
            
$user getSimpleValues
                
"SELECT user_id,status from " SECURE_TABLE_PREFIX "users "
                
"WHERE username=" $ffForm->getDbValue("user") . " "
                    
"AND password=MD5(" $ffForm->getDbValue("pwd") . ")"
            
);
            
$userId $user["user_id"];
            if (
$userId != null && $user["status"] === "Active") {
                
login($userId$ffForm->getValue("user"));
                if (
$_REQUEST["goTo"]) {
                    
header("Location: " $_REQUEST["goTo"]);
                } else {
                    
// GET 1st start_url
                    
$db = &FfDb::s();
                    
$startUrl $db->getSimpleValue("
                        SELECT start_url
                        FROM " 
SECURE_TABLE_PREFIX "group_members as group_members," SECURE_TABLE_PREFIX "groups as groups
                        WHERE group_members.user_id='" 
$userId "'
                            AND group_members.group_id=groups.group_id
                    "
);
                    if (!
$startUrl)
                        
$startUrl "user/index.php";
                    
header("Location: " $startUrl);
                }
            } else {
                
$ffForm->clearValue("pwd");
            }
        }
    }

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!-- The main style sheet -->
      <link rel="stylesheet" href="style.css" type="text/css" media="screen" />

    <!-- START Fx.Slide -->
    <!-- The CSS -->
      <link rel="stylesheet" href="fx.slide.css" type="text/css" media="screen" />
    <!-- Mootools - the core -->
    <script type="text/javascript" src="js/mootools-1.2-core-yc.js"></script>
    <!--Toggle effect (show/hide login form) -->
    <script type="text/javascript" src="js/mootools-1.2-more.js"></script>
    <script type="text/javascript" src="js/fx.slide.js"></script>
    <!-- END Fx.Slide -->
<title>SciCom - Login</title>
<? require_once(dirname(__FILE__) . "/section1.php"); ?>
<style type="text/css">
<!--
.style1 {
    color: #37511E
}
-->
</style>
<link rel="stylesheet" type="text/css" href="../new/screen.css" media="screen" />

<style type="text/css">
<!--
.style11 {color: #F0F0F0}
.style103 {
    font-size: 24px
}
.style104 {font-family: Geneva, Arial, Helvetica, sans-serif}
-->
</style>
</head>

<body class="thrColLiqHdr">

<!-- Login -->
    <div id="login">
        <div class="loginContent">
            <!-- secure login -->
            
            <form action="" method="post">
                        
                  <table width="100%" style="text-align:left;">
                  <tr style="vertical-align:center;">
<td width="51%" style="width:50%;">
                                        
                      <h2 class="style1">SciCom Login                      </h2>
                      <p>
                        <? if ($ffForm->getValue("submit") && !$ffForm->isError && !isLoggedIn()) { ?>
                      </p>
                                        <div class="pageErrors">
                                                <?= ($user["status"] === "Disabled" "This User Account Has Been Disabled!" "Invalid Username or Password!"?>
                      </div>
                                        <? ?>
                                        <?= $ffForm->getTableTag() ?>                    </td>
  <td width="49%" style="padding-left:20px;">
                    <h4 class="secure style1">Need a user account?</h4>
                            <a href="signUp.php<?= ($_REQUEST["goTo"] ? "?goTo=" urlencode($_REQUEST["goTo"]) : ""?>">Sign Up</a>
                                        <h4 class="secure style1">Forgot your password or username?</h4>
<div>
                                            <ul style="margin-top:0px;">
                                                <li><a href="forgotPwd.php">I forgot my password</a></li>
                                                <li><a href="forgotUsername.php">I forgot my username</a></li>
                                            </ul>
                      </div>                    </td>
                              </tr>
                            </table>
                      </center>
                    </form>
            
            <!-- end secure login -->            
        </div>
        <div class="loginClose"><a href="#" id="closeLogin">Close Panel</a></div>
    </div> <!-- /login -->
    
    
    <div id="container">
        <div id="top">
        <!-- login -->
            <ul class="login">
                <li class="left">&nbsp;</li>
                <li>Hello Guest!</li>
                <li>|</li>
                <li><a id="toggleLogin" href="#">Log In</a></li>
            </ul> <!-- / login -->
        </div> <!-- / top -->

        <div class="clearfix"></div>


        <div id="content"><p>Page content goes here</p></div><!-- / content -->
        <div class="clearfix"></div>
    </div><!-- / container -->

      <? require_once(dirname(__FILE__) . "/section3.php"); ?>
   
</body>
</html>


All I've done is copy the paths to the js and css and copy the login div and place the secure login form inside the div.

luvrockz

  • Regular Member
  • **
  • Posts: 64
  • Karma: +1/-0
    • View Profile
Re: ajax login panel..doesnt work...
« Reply #2 on: July 07, 2010, 09:27:26 PM »
here is the error code i get.....


  Warning:  session_start() [function.session-start]:   Cannot send session cookie - headers already sent by (output started at   /home/content/86/5984986/html/new/loginpanel/loginpanel.php:2) in /home/content/86/5984986/html/secure/accounts.php   on line 8
 
  Warning:  session_start() [function.session-start]:   Cannot send session cache limiter - headers already sent (output   started at   /home/content/86/5984986/html/new/loginpanel/loginpanel.php:2) in /home/content/86/5984986/html/secure/accounts.php   on line 8



and also it doesnt show correclty on firefox... but for internet explorer it works well... so i was wondering is there a way that it cud be done with the same style in the original demo page... other than puting the whole login div that i used before...??

daveismyname

  • Senior Member
  • ****
  • Posts: 204
  • Karma: +1/-0
  • PHP Helper
    • View Profile
    • Dave is my name
Re: ajax login panel..doesnt work...
« Reply #3 on: July 08, 2010, 03:18:28 PM »
I don't see why your getting errors all your doing is taking the login page and adding some js and html nothing php related

luvrockz

  • Regular Member
  • **
  • Posts: 64
  • Karma: +1/-0
    • View Profile
Re: ajax login panel..doesnt work...
« Reply #4 on: July 09, 2010, 11:39:31 AM »
yeah that was my mistake... that works now... but i found a new version of this thin and ur method doesnt work with the new version.... u can see the new version from
http://www.coolajax.net/preview/download/form/55.html

luvrockz

  • Regular Member
  • **
  • Posts: 64
  • Karma: +1/-0
    • View Profile
Re: ajax login panel..doesnt work...
« Reply #5 on: July 09, 2010, 02:38:32 PM »
hey bro thankzz for your help... now after a long time of work i was able to figure out a way how i can do this.... now i have uploaded it ... the problem is that ... i have an iframe on top of each page.... and here is the problem i face when the script is loaded..... pls goto http://www.scicomonline.com/new/   and then u click that login button on top of the page.... u will see whats wrong.. i dnt knw hw to explain this... its kinda gone inside.... is there a way i can solve the problem other than changing iframe....?? pls help...

daveismyname

  • Senior Member
  • ****
  • Posts: 204
  • Karma: +1/-0
  • PHP Helper
    • View Profile
    • Dave is my name
Re: ajax login panel..doesnt work...
« Reply #6 on: July 09, 2010, 05:06:18 PM »
I see the problem but I don't know of a solution without removing the iframes, if you were to consider it you could use includes to includes sections  into the page.

luvrockz

  • Regular Member
  • **
  • Posts: 64
  • Karma: +1/-0
    • View Profile
Re: ajax login panel..doesnt work...
« Reply #7 on: July 10, 2010, 04:41:12 AM »
and is there a way to correct the viewing problem with internet explorer....