ok I have inserted the print_r statements just above the code I printed out in the last message. Its returning:
Array
(
)
I presume values are supposed to be shown? I have used print_r($GLOBALS) which does return the whole scripting environment (can paste in if easier?). My code now looks like:
<?php require_once('../Connections/MARTIN.php'); ?>
<?php
if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form3"

) {
$insertSQL = sprintf("INSERT INTO loggedindetails (ClientID) VALUES (%s)",
GetSQLValueString($HTTP_POST_VARS['ClientID'], "text"

);
mysql_select_db($database_MARTIN, $MARTIN);
$Result1 = mysql_query($insertSQL, $MARTIN) or die(mysql_error());
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
$colname_Recordset1 = "1";
if (isset($HTTP_GET_VARS['ClientID'])) {
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['ClientID'] : addslashes($HTTP_GET_VARS['ClientID']);
}
mysql_select_db($database_MARTIN, $MARTIN);
$query_Recordset1 = sprintf("SELECT ClientID FROM clientinfo WHERE ClientID = '%s'", $colname_Recordset1);
$Recordset1 = mysql_query($query_Recordset1, $MARTIN) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
print "<pre>";
print_r($_POST);
print_r($_SESSION);
print "</pre>";
//print_r($GLOBALS);
# check if not logged in
if (!isset($_SESSION['ClientID'])&& isset($_POST['ClientID'])){
$SQL = "SELECT ClientID, cpassword FROM clientinfo
WHERE ClientID ='".$_POST['$ClientID']."'
AND cpassword = '".$_POST['$fpassword']."'";
$result = mysql_query($SQL) OR die("Error: MySQL said ".mysql_error());
$row = mysql_fetch_assoc($result);
// if num is 1 -> go ahead, 0 -> wrong pw/user
if ($row['num'] == 1)
header("location:
Logged In/WelcomeUserPage.php?ClientID=".$HTTP_POST_VARS['ClientID'].""

;
// ... redirect to destination ...
} else {
print "Details either incorrect or not submitted";
// ... error message, try again ...
} // $_SESSION['ClientID'] = $_POST['ClientID'];
// ... database code here ...
# if user ok
$_SESSION['ClientID'] = $_POST['ClientID'];
# now redirect
# form was not posted -> draw it
//print "<html><body>\n";
//print '<form name="login" action="'.$_SERVER[PHP_SELF].'" method="post">';
//print 'Username : <input type="text" name="ClientID"><br>';
//print 'Password : <input type="password" name="fpassword"><br>';
//print '<input type="submit" value="Submit"></form></body></html>';
//elseif ($num ==1)
//header ("location: User Section/UserHomePage.php"

;
// else
// $message = "<i>The details you have entered are incorrect";
//}
//$sql = "SELECT password FROM clientinfo // 26
// WHERE password=password('$fpassword')";
// $result2 = mysql_query($sql)
// or die("Couldn't execute query."

;
// $num2 = mysql_num_rows($result2);
// if ($num2 > 0)
// header("location: AccessHomePage (user)/test1.htm"

{
$auth="yes";
$logname=$fusername;
$today = date("Y-m-d h:m:s"

;
$sql = "INSERT INTO Login (ClientID,LoginTime)
VALUES ('$logname','$today')";
mysql_query($sql) or die("Can't execute query."

;
}
// else
// {
// unset($do); // 44
//$message="The Login Name, '$fusername' exists, // 45
// but you have not entered the correct
// password! Please try again.<br>";
// }
// }
// elseif ($num == 0) // login name not found // 51
// {
// unset($do); // 53
// $message = "The Login Name you entered does not
// exist! Please try again.<br>";
// }
//break; // 58
?>
<html>
<head>
<!-- TemplateBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<!-- TemplateEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- TemplateBeginEditable name="head" -->
<!-- TemplateEndEditable -->
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_displayStatusMsg(msgStr) { //v1.0
status=msgStr;
document.MM_returnValue = true;
}
//-->
</script>
</head>
<body>
<p><img src="Sites%20Title%20Border.png" width="799" height="89"></p>
<p align="justify">Welcome to the new IT Help-Online web site. In order to process
your request quickly and efficiently could you please enter your details in
below. If you are a new user please click <a href="New User Details/NewUserDetails.php" target="_top">here</a>.</p>
<p align="justify"> </p>
<p align="justify"> </p>
<form method="post" name="form3" onReset="MM_displayStatusMsg('Please enter your ClientID and Password');return document.MM_returnValue">
<table border="0" align="center">
<?php // 23
if (isset($message))
echo "<tr><td colspan='2'>$message </td></tr>";
?>
<tr>
<td align=right><b>ClientID</b></td>
<td><input name="ClientID" type="text" id="ClientID" onFocus="MM_displayStatusMsg('Please enter your ClientID and Password');return document.MM_returnValue" onSelect="MM_displayStatusMsg('Please enter your ClientID and Password');return document.MM_returnValue" size="20" maxlength="100" maxsize="20">
</td>
</tr>
<tr>
<td width="120" align="right"><b>Password</b></td>
<td><input name="fpassword" type="password"
size="20" maxlength="100" maxsize=" `20"></td>
</tr>
<tr>
<td align="center" colspan="2"> <br> <input type="submit" name="log" value="Submit">
<input type="reset" name="Reset" value="Reset"></td>
</tr>
</table>
</form>
<p align="justify"> </p>
<p align="justify"> </p>
<p align="justify"> </p>
<p>Administrators log on <a href="Staff&Admin%20Login%20Page/Staff&Admin%20Login%20Page.php">here</a></p>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
This is the whole thing!