ajax login panel..doesnt work...

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]<?
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");
        }
    }
}

?>

SciCom - Login <? require_once(dirname(__FILE__) . "/section1.php"); ?>
                  <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>

Need a user account?

">Sign Up

Forgot your password or username?

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

[/php]

pls help…

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]

<? 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"); } } } ?>
<!-- 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 -->
SciCom - Login <? require_once(dirname(__FILE__) . "/section1.php"); ?>
<div id="login">
    <div class="loginContent">
        <!-- secure login -->
        
        <form action="" method="post">
                    
              <table width="100%" style="text-align:left;">
              <tr style="vertical-align:center;">
                  <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>

Need a user account?

">Sign Up

Forgot your password or username?

        <!-- 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"); ?>
[/php]

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.

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 [b]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…??
[/b]

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

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

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…

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.

and is there a way to correct the viewing problem with internet explorer…

Sponsor our Newsletter | Privacy Policy | Terms of Service