/    Sign up×
Community /Pin to ProfileBookmark

Problem with login page.

Hello everyone!

I have this login script that works perfectly on my local testing server but it will not work on my live server.

[code=php]<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}

$loginFormAction = $_SERVER[‘PHP_SELF’];
if (isset($_GET[‘accesscheck’])) {
$_SESSION[‘PrevUrl’] = $_GET[‘accesscheck’];
}
if (isset($_POST[‘customer_email’])) {
$loginUsername=$_POST[‘customer_email’];
$password=$_POST[‘customer_password’];
$MM_fldUserAuthorization = “customer_userGroup”;
$MM_redirectLoginSuccess = “image_uploader.php”;
$MM_redirectLoginFailed = “login_failed.php”;
$MM_redirecttoReferrer = true;
mysql_select_db($database_online_photos, $online_photos);

$LoginRS__query=sprintf(“SELECT customer_email, customer_password, customer_userGroup FROM customers WHERE customer_email=’%s’ AND customer_password=’%s'”,
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));

$LoginRS = mysql_query($LoginRS__query, $online_photos) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {

$loginStrGroup = mysql_result($LoginRS,0,’customer_userGroup’);

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

if (isset($_SESSION[‘PrevUrl’]) && true) {
$MM_redirectLoginSuccess = $_SESSION[‘PrevUrl’];
}
header(“Location: ” . $MM_redirectLoginSuccess );
}
else {
header(“Location: “. $MM_redirectLoginFailed );
}
}
?>[/code]

When login is successful the user should be directed from /login.php to /image_uploader.php. But on the live server, the URL gets changed to
/login.php?accesscheck=%2Fimage_uploader.php and the user just gets sent back to login.php!

print_r($_SESSION) returns nothing on my local testing server but on the live server it returns:
[MM_Username] => [email][email protected][/email]
[MM_UserGroup] => vistor
[PrevUrl] => /image_uploader.php

Many Thanks!!! This has been driving me crazy since Wed night!

Chris

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYFeb 17.2006 — are magic quotes set to off on the server?
Copy linkTweet thisAlerts:
@tripodkidauthorFeb 17.2006 — magic_quotes_gpc is = ON on both servers

magic_quotes_runtime = OFF on both servers

magic_quotes_sybase = OFF on both servers

On the local server Configure Command is:

cscript /nologo configure.js "--enable-snapshot-build" "--with-gd=shared"

But on the live server it is:

'./configure' '--with-apxs=/usr/local/apache/bin/apxs' '--prefix=/usr' '--with-xml' '--enable-bcmath' '--enable-calendar' '--with-curl' '--with-dom' '--with-dom-xslt' '--with-dom-exslt' '--enable-ftp' '--with-gd' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr' '--with-xpm-dir=/usr/X11R6' '--with-gettext' '--with-imap' '--with-imap-ssl' '--with-kerberos' '--enable-mbstring' '--enable-mbstr-enc-trans' '--enable-mbregex' '--with-mcrypt' '--with-mhash' '--enable-magic-quotes' '--with-mysql=/usr' '--with-openssl' '--enable-discard-path' '--with-pear' '--enable-sockets' '--enable-track-vars' '--with-ttf' '--with-freetype-dir=/usr' '--enable-gd-native-ttf' '--enable-versioning' '--with-zlib'

I have no idea what all that means!

Also, I just noticed that my local testing server is ver 5.1.1 but the live server is 4.3.11. Would that be a problem?

Many thanks!
Copy linkTweet thisAlerts:
@NogDogFeb 17.2006 — header() redirects may not work if you don't give the full URI, so try setting the variables used for that to the full URI (i.e.: "http://[host]/[dir]/[file]") instead of just the file name.
Copy linkTweet thisAlerts:
@tripodkidauthorFeb 17.2006 — Duh! problem caused by a typo in my db!
×

Success!

Help @tripodkid spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...