Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Login Behavior Using CS3

New Here ,
Apr 09, 2008 Apr 09, 2008
I created a page and put the "Restrict Access to Page" behavior on it that point to a log in page. That works fine and it does redirect to the "login" page when I try it. Now on the "login" page I added the "Log in User" behavior. I have a mysql database tied into it an the page sees that fine.

But when I go online and try to login I fill out the form, hit submit and nothing happens. The page thinks for awhile but just sits there. No errors appear, it just stays on the same page.

Any help would be greatly appreciated.

TOPICS
Server side applications
569
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 10, 2008 Apr 10, 2008
TC5Racer wrote:
> But when I go online and try to login I fill out the form, hit submit and
> nothing happens. The page thinks for awhile but just sits there. No errors
> appear, it just stays on the same page.

The problem is almost certainly caused by output being sent to the
browser before the script gets to this line:

header("Location: " . $MM_redirectLoginSuccess );

As the following page in the PHP manual explains: "It is a very common
error to read code with include(), or require(), functions, or another
file access function, and have spaces or empty lines that are output
before header() is called."

http://docs.php.net/manual/en/function.header.php

You need to remove any spaces or empty lines outside the PHP tags in
both the login page and the page that contains the database connection.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 12, 2008 Apr 12, 2008
Hi,

I tried this. Removed all extra spaces before and after the PHP tags and it is still not working. What should I try next?

Thanks...
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 13, 2008 Apr 13, 2008
TC5Racer wrote:
> I tried this. Removed all extra spaces before and after the PHP tags and it is still not working. What should I try next?

Try putting this at the top of your page:

<?php ini_set('display_errors', '1') ; ?>

See if the page outputs any error messages.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 13, 2008 Apr 13, 2008
Hi David,

I added the code you gave me on the top of the index.php page which is the page that has the "Restrict Access"behavior on it. The errors are listed below.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 14, 2008 Apr 14, 2008
Hi David,

Here are the errors I get when I add the code to the login page.

Thanks,
Art
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 14, 2008 Apr 14, 2008
TC5Racer wrote:
> Warning: Unknown(): Failed to write session data (files). Please verify that
> the current setting of session.save_path is correct (/var/php_sessions) in
> Unknown on line 0

There's your answer: there's a problem with the way sessions are set up
on the server. Contact your hosting company to get it sorted out.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 20, 2008 Apr 20, 2008
Hi David,

SO I contacted my hosting company and they are saying that they have fixed the sessions save path. But when I got to try and login I am still experiencing the same error as before. The login page just sits there.

I added the code that you gave me before on top of the page to see what error messages I get and none show up at all. Help...
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 21, 2008 Apr 21, 2008
LATEST
TC5Racer wrote:
> I am still experiencing the
> same error as before. The login page just sits there.

Locate the following section of code:

$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {

$loginStrGroup = mysql_result($LoginRS,0,'admin_priv');

//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;

Temporarily amend it like this:

$loginFoundUser = mysql_num_rows($LoginRS);
// find out if user was found
echo "User found: $loginFoundUser<br />";

if ($loginFoundUser) {

$loginStrGroup = mysql_result($LoginRS,0,'admin_priv');

//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;

// see if session variables OK
echo $_SESSION['MM_Username'] . '<br />';
echo $_SESSION['MM_UserGroup'];

After adding those temporary changes, you definitely won't be able to
log in, but you should be able to tell what's happening. The first
message should display "User found: 1", and the others should display
the value of the session variables.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 10, 2008 Apr 10, 2008
This is probably obvious, but if you accidentally placed a Restrict Access behavior on the login page, redirecting the disallowed access back to the login page, then this is what you will get.

Been there
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines