473,587 Members | 2,263 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Php/MySQL Login - Can anyone give me suggestion as to why thiscode does not work ?

RT
I have followed the step by step instructions in the login manual

Created login page
Use LSC01

This works - login and get redirected to the proper page
My problem is the cookie variables donıt show up (created setsessions.php
page and readsessions.ph p to test - works)

On the page, Iıve applied LSC03 * Access by Cookie * this seems to work
since it allows my to enter the page I want

I then applied the LSC05 * User Details -
The correct rsUserDetails is set up

I then include Dynamic Text to the page that is suppose to show the
registered users information but it doesnıt

Have torn page apart 50 million times I know itıs one line or something
extremely simple but I canıt figure it out.

HELP HELP

Thanks

Code for login page

<?php require_once('. ./../Connections/reg.php'); ?>
<?php
// Buzz inet PHPLSC01 - Login & Set Cookie
$myUsername_rsL ogin = "0";
if (isset($HTTP_PO ST_VARS['email'])) {
$myUsername_rsL ogin = (get_magic_quot es_gpc()) ? $HTTP_POST_VARS['email']
: addslashes($HTT P_POST_VARS['email']);
}
$myPassword_rsL ogin = "0";
if (isset($HTTP_PO ST_VARS['password'])) {
$myPassword_rsL ogin = (get_magic_quot es_gpc()) ?
$HTTP_POST_VARS['password'] : addslashes($HTT P_POST_VARS['password']);
}
mysql_select_db ($database_reg, $reg);
// Verify Login is correct
$query_rsLogin = sprintf("SELECT email, password FROM parent WHERE email=
'%s' AND password = '%s'", $myUsername_rsL ogin,$myPasswor d_rsLogin);
$rsLogin = mysql_query($qu ery_rsLogin, $reg) or die(mysql_error ());
$row_rsLogin = mysql_fetch_ass oc($rsLogin);
$totalRows_rsLo gin = mysql_num_rows( $rsLogin);

// Buzz inet PHPLSC01 - Login & Set Cookie
// Check Login, Set Cookie and Redirect else show Error Message
if($HTTP_POST_V ARS['action']=="login"){
if($totalRows_r sLogin==0){
$errorMessage = "Please Try agin or Create a New Parent Account";
mysql_free_resu lt($rsLogin);
} else {
mysql_free_resu lt($rsLogin);
setcookie("PWlo gintest",$HTTP_ POST_VARS['email'],time() +
2592000,"/");
// Expire Date: 30
// Expire Time: 12:00:00
header("Locatio n: /pages/registrationtes t/registration.ph p");
}
}
?>

Code for page I want info on:

<?php require_once('. ./../Connections/reg.php'); ?>
<?php
// Buzz inet PHPLSC03 - Check User Cookie is set
if(!isset($HTTP _COOKIE_VARS['PWlogintest'])){
header("Locatio n: /pages/registrationtes t/welcomereg.php" );
}

// Buzz inet PHPLSC05 - User Details
?>
<?php
$varSearch_rsUs erDetails = "1";
if (isset($HTTP_CO OKIE_VARS['PWlogintest'])) {
$varSearch_rsUs erDetails = (get_magic_quot es_gpc()) ?
$HTTP_COOKIE_VA RS['PWlogintest'] :
addslashes($HTT P_COOKIE_VARS['PWlogintest']);
}
mysql_select_db ($database_reg, $reg);
$query_rsUserDe tails = sprintf("SELECT * FROM parent WHERE email = '%s'",
$varSearch_rsUs erDetails);
$rsUserDetails = mysql_query($qu ery_rsUserDetai ls, $reg) or
die(mysql_error ());
$row_rsUserDeta ils = mysql_fetch_ass oc($rsUserDetai ls);
$totalRows_rsUs erDetails = mysql_num_rows( $rsUserDetails) ;
?>
Jul 17 '05 #1
1 2785
Php/MySQL Login - Can anyone give me suggestion as to why this code does not work ?Your code is outputing something before calling setcookie:

<?php require_once('. ./../Connections/reg.php'); ?>[CR][LR] <---
<?php

Combine the two code blocks.
Uzytkownik "RT" <ro******@comca st.net> napisal w wiadomosci news:BC52AAFE.B B7A%ro******@co mcast.net...
I have followed the step by step instructions in the login manual

Created login page
Use LSC01

This works - login and get redirected to the proper page
My problem is the cookie variables don't show up (created setsessions.php page and readsessions.ph p to test - works)

On the page, I've applied LSC03 - Access by Cookie - this seems to work since it allows my to enter the page I want

I then applied the LSC05 - User Details -
The correct rsUserDetails is set up

I then include Dynamic Text to the page that is suppose to show the registered users information but it doesn't

Have torn page apart 50 million times I know it's one line or something extremely simple but I can't figure it out.

HELP HELP

Thanks

Code for login page

<?php require_once('. ./../Connections/reg.php'); ?>
<?php
// Buzz inet PHPLSC01 - Login & Set Cookie
$myUsername_rsL ogin = "0";
if (isset($HTTP_PO ST_VARS['email'])) {
$myUsername_rsL ogin = (get_magic_quot es_gpc()) ? $HTTP_POST_VARS['email'] : addslashes($HTT P_POST_VARS['email']);
}
$myPassword_rsL ogin = "0";
if (isset($HTTP_PO ST_VARS['password'])) {
$myPassword_rsL ogin = (get_magic_quot es_gpc()) ? $HTTP_POST_VARS['password'] : addslashes($HTT P_POST_VARS['password']);
}
mysql_select_db ($database_reg, $reg);
// Verify Login is correct
$query_rsLogin = sprintf("SELECT email, password FROM parent WHERE email= '%s' AND password = '%s'", $myUsername_rsL ogin,$myPasswor d_rsLogin);
$rsLogin = mysql_query($qu ery_rsLogin, $reg) or die(mysql_error ());
$row_rsLogin = mysql_fetch_ass oc($rsLogin);
$totalRows_rsLo gin = mysql_num_rows( $rsLogin);

// Buzz inet PHPLSC01 - Login & Set Cookie
// Check Login, Set Cookie and Redirect else show Error Message
if($HTTP_POST_V ARS['action']=="login"){
if($totalRows_r sLogin==0){
$errorMessage = "Please Try agin or Create a New Parent Account";
mysql_free_resu lt($rsLogin);
} else {
mysql_free_resu lt($rsLogin);
setcookie("PWlo gintest",$HTTP_ POST_VARS['email'],time() + 2592000,"/");
// Expire Date: 30
// Expire Time: 12:00:00
header("Locatio n: /pages/registrationtes t/registration.ph p");
}
}
?>

Code for page I want info on:

<?php require_once('. ./../Connections/reg.php'); ?>
<?php
// Buzz inet PHPLSC03 - Check User Cookie is set
if(!isset($HTTP _COOKIE_VARS['PWlogintest'])){
header("Locatio n: /pages/registrationtes t/welcomereg.php" );
}

// Buzz inet PHPLSC05 - User Details
?>
<?php
$varSearch_rsUs erDetails = "1";
if (isset($HTTP_CO OKIE_VARS['PWlogintest'])) {
$varSearch_rsUs erDetails = (get_magic_quot es_gpc()) ? $HTTP_COOKIE_VA RS['PWlogintest'] : addslashes($HTT P_COOKIE_VARS['PWlogintest']);
}
mysql_select_db ($database_reg, $reg);
$query_rsUserDe tails = sprintf("SELECT * FROM parent WHERE email = '%s'", $varSearch_rsUs erDetails);
$rsUserDetails = mysql_query($qu ery_rsUserDetai ls, $reg) or die(mysql_error ());
$row_rsUserDeta ils = mysql_fetch_ass oc($rsUserDetai ls);
$totalRows_rsUs erDetails = mysql_num_rows( $rsUserDetails) ;
?>

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
863
by: Mark Adams | last post by:
I am a relative newbie to MySQL. I had a Postfix+Courier+MySQL mail server running for several months. It took me a week or so to get it up and running in September. Now, I did a clean upgrade to Mandrake 9.2 and am reinstalling everything. This thing is kicking my ass and I can't seem to get past it. I could really use some help if...
1
2821
by: Good Man | last post by:
Hi there I've noticed some very weird things happening with my current MySQL setup on my XP Laptop, a development machine. For a while, I have been trying to get the MySQL cache to work. Despite entering the required lines to "my.ini" (the new my.cnf) through notepad AND MySQL Administrator, the cache does not work. So, today I took a...
18
3381
by: Gleep | last post by:
I've searched google intensely on this topic and it seems noone really knows how to approch this. The goal I don't want clients to give out their usernames and passwords to friends, since the site relies on subscrption fees. Sessions ID's are matched between the browser and the server. So a users can login with same username and password...
5
5324
by: Frances | last post by:
a few days ago I installed XAMPP in my Windows 2000 machine, it completely messed my existing MySQL installation.. I've had it installed for over a year now (4.1) have never had any problems with it whatsoever (I connect to it from Tomcat and from stand-alone Java classes), now since I installed XAMPP I cannot connect to it at all, cannot...
4
5354
by: Richard | last post by:
Hi All, I've been trying to build a Ruby-on-Rails plus MySQL application. I'm running Ruby 1.8.2, Rails 1.1.4 and MySQL 5.0.15-nt over WinXP-Pro/SP2. I run under an Administrative account. I tried building the first example from Agile Web Development with Rails, 1st ed. Somehow the DB got corrupted and I couldn't recover. Instead of...
6
3339
by: AppleBag | last post by:
I'm having the worst time trying to login to myspace through code. Can someone tell me how to do this? Please try it yourself before replying, only because I have asked this a couple of times in the past in other places, and while the help was much appreciated, it seemed everyone just wanted to 'theoretically' explain how to do it, but when I...
19
3283
by: klenwell | last post by:
Another request for comments here. I'd like to accomplish something like the scheme outlined at this page here: http://tinyurl.com/3dtcdr In a nutshell, the form uses javascript to hash (md5) the password field using a random one-time salt (nonce) -- generated by php and pasted in the form -- that is then posted with the hashed...
13
2285
by: Richard Brooks | last post by:
Does anyone here open a second MySQL database and use that as a straight IDX type file that points to the record number in the main database, for speed's sake? Some time ago I'd set up a standard php login routine and hit a brick wall as then found out that my host didn't allow external login's (at that time) with MySQL (true!) so I got...
6
38484
Atli
by: Atli | last post by:
This is an easy to digest 12 step guide on basics of using MySQL. It's a great refresher for those who need it and it work's great for first time MySQL users. Anyone should be able to get through this without much trouble. Programming knowledge is not required. Index What is SQL? Why MySQL? Installing MySQL. Using the MySQL...
0
8339
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7967
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5712
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3840
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3872
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2347
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.