473,574 Members | 3,137 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Header problem

I am using code to validate a user against a database and then if they are
valid, redirecting the page to the working page. I copied the code from
another application I have where it works, but it doesn't work here. What
happens is if the Header is included, a blank page appears with the URL of
the validation page (SQL_User_Valid ate.php). If the Header is commented
out, the form appears and you can enter the data and see the results, but
not with a redirection.

Most likely is I've made an obvious (to everyone else) mistake that you will
see in 20 seconds. And that I have not seen in the past hour of working on
it. Here is the code (to the Header):

<?php
include("SQL_A_ Connect.inc");
$name_table = "User";

// error_reporting (E_ALL & ~E_NOTICES);
error_reporting (E_ALL);

// testing *************** **********
$testcode0 = "valid: " . isset($_POST['uservalid']);
$testcode1 = "";
$testcode2 = "";

if ((isset($_POST['uservalid'])) && ($_POST['uservalid'] == "yes"))
{
$frmID = $_POST["frmID"];
$frmPWD = $_POST["frmPWD"];

$sql_code = "SELECT Password, Level FROM " . $name_table . " ";
$sql_code .= "WHERE UserID = '$frmID'";

// testing only *************** ********
$testcode1 = "query: " . $sql_code;

$sql_result = mysql_query($sq l_code,$name_co nnect) or die(mysql_error ());
$output = mysql_fetch_arr ay($sql_result) ;

$sqlPWD = $output["Password"];
$sqlLVL = $output["Level"];

// testing only *************** ***********
$testcode2 = "sql pwd: '" . $sqlPWD . "'<br>sql lvl: '" . $sqlLVL .
"'<br>rows: '" . mysql_num_rows( $sql_result) . "'<br>post pwd: '" . $frmPWD
.. "'<br>post id: '" . $frmID . "'<br>";

$hold = time() + 60 * 60 * 24 * 180;
if ($sqlPWD == $frmPWD)
{
// validated user - write cookie and continue
setcookie("user ", $frmID, $hold);
setcookie("leve l", $sqlLVL, $hold);
setcookie("auth orized", "yes", $hold);
// header("Locatio n: ../SQL_User.php);
}
else
{
setcookie("user ", "guest", $hold);
setcookie("leve l", "0", $hold);
setcookie("auth orized", "no", $hold);
// header("Locatio n: ../SQL_User_Valida te.php);
}
}
?>

Any ideas?
Aug 6 '05 #1
2 1369
On Fri, 05 Aug 2005 23:11:20 -0500, Lee David decided we needed to hear:
<snip>
if ($sqlPWD == $frmPWD)
{
// validated user - write cookie and continue setcookie("user ",
$frmID, $hold);
setcookie("leve l", $sqlLVL, $hold);
setcookie("auth orized", "yes", $hold);
// header("Locatio n: ../SQL_User.php);
Double quote missing.
}
else
{
setcookie("user ", "guest", $hold);
setcookie("leve l", "0", $hold);
setcookie("auth orized", "no", $hold);
// header("Locatio n: ../SQL_User_Valida te.php);


Double quote missing.

<snip>
--
Dave <da**@REMOVEbun dook.com>
(Remove REMOVE for email address)

Aug 6 '05 #2
Thank you. I was sure it was something stupid I was doing, but I just
couldn't see it. I'll fix that after the morning meeting.

Lee
Aug 6 '05 #3

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

Similar topics

1
2689
by: Massimiliano Alberti | last post by:
My program is heavily template based, and I use the VC++, so I have to keep the templates in the header file. My .cpp files are quite empty (they are more a connection between header files). Now, my "problem" is that I can't put the body of classless functions in the header files. I normally "solve" this problem using the "inline" keyword...
11
2742
by: Steven T. Hatton | last post by:
In the past there have been lengthy discussiions regarding the role of header files in C++. People have been very adamat about header files serving as in interface to the implementation. I do understand the objective. This example may represent an interface in need of a bit of refactoring, but it goes to demonstrate the basic idea as I...
60
8235
by: Derrick Coetzee | last post by:
It seems like, in every C source file I've ever seen, there has been a very definite include order, as follows: - include system headers - include application headers - include the header associated with this source file For example, in a file hello.c: #include <stdio.h>
4
2509
by: Andrew Ward | last post by:
Hi All, I was wondering if it is possible to use precompiled headers without having to include a <stdafx.h> or whatever in every source file. My problem is that I have a project that makes heavy usage of a large third party library which means after pre-processing each translation unit is around 1meg in size. There are reasons though why I...
0
3923
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen. It is almost like it is trying to implement it's own COM interfaces... below is the header, and a link to the dll+code: Zip file with header,...
6
43004
by: Peter van der veen | last post by:
Hi I have the following problem. I'm calling a webservice from within a VB.net 2005 Windows program. For this i got a WSDL file and loaded that in VB. Until now i just call the webservice and everything works OK. Now i need to add an extra attribute/header element to the SOAP header before i contact the webservice.
4
2470
by: Joseph Geretz | last post by:
We use a Soap Header to pass a token class (m_Token) back and forth with authenticated session information. Given the following implementation for our Logout method, I vastly prefer to simply code m_Token = null in order to destroy the session token when the user logs out. However, I'm finding that setting class instance to null results in no...
3
1859
by: jszczepankiewicz | last post by:
Witam, mam nastepujacy problem: XSLT 2.0, Hi, i've got following problem with xslt 2: my xml doc looks something linke: <manual>
16
2068
by: wdh3rd | last post by:
Hi everyone. I'm new to C and I have a few questions: I am making files for permutations and combinations. Files to be made are perm.c, perm.h, combo.c, and combo.h. Since both combinations and permutations use factorial to solve their problems, factorial is supposed to be in both perm.c and combo.c, and declared private. (1) You...
1
8007
by: Proogeren | last post by:
I have a problem with a httpwebrequest that I am creating. The request in itself looks correct but using fiddler I see that a www-authentication header is sent along as well. The code is pasted below. I do not add any www-authentication header here so I was wondering if anyone knows how to remove it. I have used almost 2 days trying to figure...
0
7760
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8101
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8271
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
7858
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
6511
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5654
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
5335
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
3793
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1099
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.