473,394 Members | 1,878 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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_Validate.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($sql_code,$name_connect) or die(mysql_error());
$output = mysql_fetch_array($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("level", $sqlLVL, $hold);
setcookie("authorized", "yes", $hold);
// header("Location: ../SQL_User.php);
}
else
{
setcookie("user", "guest", $hold);
setcookie("level", "0", $hold);
setcookie("authorized", "no", $hold);
// header("Location: ../SQL_User_Validate.php);
}
}
?>

Any ideas?
Aug 6 '05 #1
2 1356
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("level", $sqlLVL, $hold);
setcookie("authorized", "yes", $hold);
// header("Location: ../SQL_User.php);
Double quote missing.
}
else
{
setcookie("user", "guest", $hold);
setcookie("level", "0", $hold);
setcookie("authorized", "no", $hold);
// header("Location: ../SQL_User_Validate.php);


Double quote missing.

<snip>
--
Dave <da**@REMOVEbundook.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
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,...
11
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...
60
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...
4
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...
0
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....
6
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...
4
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...
3
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
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...
1
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...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
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...

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.