Forums
This topic is locked
sessions and recordsets
Posted 01 Aug 2001 16:55:28
1
has voted
01 Aug 2001 16:55:28 Keith Slater posted:
I have a recordset that looks like this:<font size=1>?php
$Recordset1__MMColParam = "1";
if (isset($HTTP_SESSION_VARS["KT_Username"]))
{$Recordset1__MMColParam = $HTTP_SESSION_VARS["KT_Username"];}
?></font id=size1>
So I have it filtered by the session variable KT_Username. If I through <font size=1>?php echo $HTTP_SESSION_VARS["KT_Username"]?></font id=size1> onto the page it works and returns the right information. But when I try to put one of the columns from the record set on there it won't return anything. I dont get any errors or anything. anyone know what might be causing this??
thanks
Keith Slater
Word Pro Systems
www.wordprosys.com
Replies
Replied 01 Aug 2001 18:28:17
01 Aug 2001 18:28:17 Tim Green replied:
What is happening is the recordset is being returned blank by the look of things.
Is the seesion variable being initialised before the recordset is created ?
To test this put a bit of text on the page, highlight it and use the 'Show if recordset is Empty' behaviour. When you view the page if the recordset is indeed empty then you will see the text.
Tim Green
Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Edited by - rawveg on 08/01/2001 18:30:17
Is the seesion variable being initialised before the recordset is created ?
To test this put a bit of text on the page, highlight it and use the 'Show if recordset is Empty' behaviour. When you view the page if the recordset is indeed empty then you will see the text.
Tim Green
Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Edited by - rawveg on 08/01/2001 18:30:17
Replied 01 Aug 2001 20:19:17
01 Aug 2001 20:19:17 Keith Slater replied:
I don't get any text when I do show region if record set is empty and i still get nothing from the recordset... Im not sure whats wrong, I start the session at the very top of the page so it's before the recordset. thanks for all the help
Keith Slater
Word Pro Systems
www.wordprosys.com
Keith Slater
Word Pro Systems
www.wordprosys.com
Replied 01 Aug 2001 22:05:23
01 Aug 2001 22:05:23 Tim Green replied:
This is one of those times when I can probably only help more if I see the code. Provided that everything is OK with the database, this is the only alternative I can think of.
Tim Green
Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Tim Green
Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Replied 01 Aug 2001 22:41:50
01 Aug 2001 22:41:50 Keith Slater replied:
Heres all the scripts on the page I didn't know what you needed.. thanks
<font size=2>
?php
session_start();
// Copyright (c) Interakt Online 2001
// www.interakt.ro/
require("./adodb/adodb.inc.php"
require("./Connections/CaricaturePHP.php"
?><?php
// *** Edit Operations: declare Tables
$MM_editAction = $PHP_SELF;
if ($QUERY_STRING) {
$MM_editAction = $MM_editAction . "?" . $QUERY_STRING;
}
$MM_abortEdit = 0;
$MM_editQuery = "";
?><?php
// Copyright (c) Interakt Online 2001
// www.interakt.ro/
require("./adodb/adodb.inc.php"
require("./Connections/CaricaturePHP.php"
?><?php
# PHP Upload File v1.07
# Copyright 2001. Tim Green. All rights reserved.
# With many thanks to Massimo Foti and Waldo Smeets
if (isset($file)) {
# System Check Variables
$tgCHeader=getenv("CONTENT_LENGTH"
$tgRefPage=getenv("HTTP_REFERER"
$tg_FileSize=1*1024;
# Flags
$tg_OptionCheckSize=false;
$tg_UseRedirects=true;
$tg_UseErrorMsgs=true;
$tg_UpCopySuccess=false;
$tg_StatusMsg=false;
if ($tg_UseErrorMsgs) {
# Error Messages
$tg_ErrPrefix="?msg=";
$tg_OrigFileOver=$tg_ErrPrefix."Duplicate File Detected and Overwritten.";
$tg_UploadOpAbort=$tg_ErrPrefix."Duplicate Filename Encountered. Upload Aborted.";
$tg_CopyOpFailed=$tg_ErrPrefix."Unable to Copy File. Check Permissions of Target Directory.";
$tg_InvalidMIMEType=$tg_ErrPrefix."The Uploaded File was of an unknown, or unacceptable file type. Upload aborted.";
$tg_FileTooBig=$tg_ErrPrefix."The file exceeded the maximum allowable file size. Upload Aborted.";
$tg_MaliciousUpload=$tg_ErrPrefix."File Discrepancy Encountered. Upload Aborted.";
$tg_SuccessUpload=$tg_ErrPrefix."File Upload Successful.";
}
if (is_uploaded_file($file)) {
if (($tgCHeader <= $tg_FileSize)&&(filesize($file_name) <= $tg_FileSize)||(!$tg_OptionCheckSize)) {
$tg_Root=dirname($HTTP_SERVER_VARS["PATH_TRANSLATED"])."/";
$tg_Dir="images/";
if ($tg_Dir=="/" {
$tg_Dir="";
}
$tg_File="$file_name";
$tg_OrigFile=$file;
$tg_Path="$tg_Root"."$tg_Dir"."$tg_File";
$tg_OptionCheckMIME=true;
$tg_cMimeVals="";
tg_OpenWin();
# Specifies the action to be taken if the file exists. overwrite, rename, abort
$tg_ExistsAction="rename";
# Check MIME type of file
if ($tg_OptionCheckMIME) {
$tgMIME="image/bmp|image/cgm|image/cmu-raster|image/g3fax|image/gif|image/ief|image/jpeg|image/naplps|image/pjpeg|image/png|image/targa|image/tiff|image/vnd.dwg|image/vnd.dxf|image/vnd.fpx|image/vnd.net.fpx|image/vnd.svf|image/x-cmu-raster|image/x-emf|image/x-jg|image/x-pict|image/x-png|image/x-portable-anymap|image/x-portable-bitmap|image/x-portable-graymap|image/x-portable-pixmap|image/x-rgb|image/x-tiff|image/x-win-bmp|image/x-xbitmap|image/x-xbm|image/x-xpixmap|image/x-wmf|image/x-windowdump";
if ($tgMIME!="custom" {
$acceptMIME=explode("|",$tgMIME);
} else {
$acceptMIME=explode(",",$tg_cMimeVals);
}
$testMIME=false;
for ($k=0; $k < count($acceptMIME); $k++) {
if ($acceptMIME[$k]==$file_type) {
$testMIME=true;
}
}
} else {
</font id=size2>
Keith Slater
Word Pro Systems
www.wordprosys.com
<font size=2>
?php
session_start();
// Copyright (c) Interakt Online 2001
// www.interakt.ro/
require("./adodb/adodb.inc.php"
require("./Connections/CaricaturePHP.php"
?><?php
// *** Edit Operations: declare Tables
$MM_editAction = $PHP_SELF;
if ($QUERY_STRING) {
$MM_editAction = $MM_editAction . "?" . $QUERY_STRING;
}
$MM_abortEdit = 0;
$MM_editQuery = "";
?><?php
// Copyright (c) Interakt Online 2001
// www.interakt.ro/
require("./adodb/adodb.inc.php"
require("./Connections/CaricaturePHP.php"
?><?php
# PHP Upload File v1.07
# Copyright 2001. Tim Green. All rights reserved.
# With many thanks to Massimo Foti and Waldo Smeets
if (isset($file)) {
# System Check Variables
$tgCHeader=getenv("CONTENT_LENGTH"
$tgRefPage=getenv("HTTP_REFERER"
$tg_FileSize=1*1024;
# Flags
$tg_OptionCheckSize=false;
$tg_UseRedirects=true;
$tg_UseErrorMsgs=true;
$tg_UpCopySuccess=false;
$tg_StatusMsg=false;
if ($tg_UseErrorMsgs) {
# Error Messages
$tg_ErrPrefix="?msg=";
$tg_OrigFileOver=$tg_ErrPrefix."Duplicate File Detected and Overwritten.";
$tg_UploadOpAbort=$tg_ErrPrefix."Duplicate Filename Encountered. Upload Aborted.";
$tg_CopyOpFailed=$tg_ErrPrefix."Unable to Copy File. Check Permissions of Target Directory.";
$tg_InvalidMIMEType=$tg_ErrPrefix."The Uploaded File was of an unknown, or unacceptable file type. Upload aborted.";
$tg_FileTooBig=$tg_ErrPrefix."The file exceeded the maximum allowable file size. Upload Aborted.";
$tg_MaliciousUpload=$tg_ErrPrefix."File Discrepancy Encountered. Upload Aborted.";
$tg_SuccessUpload=$tg_ErrPrefix."File Upload Successful.";
}
if (is_uploaded_file($file)) {
if (($tgCHeader <= $tg_FileSize)&&(filesize($file_name) <= $tg_FileSize)||(!$tg_OptionCheckSize)) {
$tg_Root=dirname($HTTP_SERVER_VARS["PATH_TRANSLATED"])."/";
$tg_Dir="images/";
if ($tg_Dir=="/" {
$tg_Dir="";
}
$tg_File="$file_name";
$tg_OrigFile=$file;
$tg_Path="$tg_Root"."$tg_Dir"."$tg_File";
$tg_OptionCheckMIME=true;
$tg_cMimeVals="";
tg_OpenWin();
# Specifies the action to be taken if the file exists. overwrite, rename, abort
$tg_ExistsAction="rename";
# Check MIME type of file
if ($tg_OptionCheckMIME) {
$tgMIME="image/bmp|image/cgm|image/cmu-raster|image/g3fax|image/gif|image/ief|image/jpeg|image/naplps|image/pjpeg|image/png|image/targa|image/tiff|image/vnd.dwg|image/vnd.dxf|image/vnd.fpx|image/vnd.net.fpx|image/vnd.svf|image/x-cmu-raster|image/x-emf|image/x-jg|image/x-pict|image/x-png|image/x-portable-anymap|image/x-portable-bitmap|image/x-portable-graymap|image/x-portable-pixmap|image/x-rgb|image/x-tiff|image/x-win-bmp|image/x-xbitmap|image/x-xbm|image/x-xpixmap|image/x-wmf|image/x-windowdump";
if ($tgMIME!="custom" {
$acceptMIME=explode("|",$tgMIME);
} else {
$acceptMIME=explode(",",$tg_cMimeVals);
}
$testMIME=false;
for ($k=0; $k < count($acceptMIME); $k++) {
if ($acceptMIME[$k]==$file_type) {
$testMIME=true;
}
}
} else {
</font id=size2>
Keith Slater
Word Pro Systems
www.wordprosys.com
Replied 01 Aug 2001 22:42:58
01 Aug 2001 22:42:58 Keith Slater replied:
$testMIME=true;
}
if ($testMIME) {
# Now we need to check if the file exists in it's path
$testExists=file_exists($tg_Path);
if ($testExists) {
switch ($tg_ExistsAction) {
case "overwrite":
# Delete the original and copy over
unlink($tg_Path);
$tg_copyStatus=true;
$tg_StatusMsg=$tg_OrigFileOver;
break;
case "rename":
# Rename the Uploaded File and copy over
$unid=uniqid(rand(1,5));
$tg_NewName=$unid.$tg_File;
$tg_Path="$tg_Root"."$tg_Dir"."$tg_NewName";
$tg_copyStatus=true;
if ($tg_UseErrorMsgs) {
# $tg_File - contains original File Name
# $tg_NewName - contains New File Name
$tg_FileRenamed=$tg_ErrPrefix."File Upload Successful.";
} else {
$tg_FileRenamed="";
}
$tg_StatusMsg=$tg_FileRenamed;
break;
case "abort":
# stop processing upload
$tg_copyStatus=false;
$tg_StatusMsg=$tg_UploadOpAbort;
break;
}
} else {
$tg_copyStatus=true;
}
if ($tg_copyStatus) {
# Now we need to track the copy operation
$copyStatus=@copy("$tg_OrigFile","$tg_Path"
if(!$copyStatus) {
# Failed Copy Operation
if (!$tg_StatusMsg) {
$tg_StatusMsg=$tg_CopyOpFailed;
}
tg_CloseWin();
tg_RedirFail($tg_StatusMsg);
$tg_UpCopySuccess=false;
} else {
$tg_UpCopySuccess=true;
}
} else {
tg_CloseWin();
tg_RedirFail($tg_StatusMsg);
$tg_UpCopySuccess=false;
}
} else {
tg_CloseWin();
tg_RedirFail($tg_InvalidMIMEType);
$tg_UpCopySuccess=false;
}
} else {
# File is too big, go back to the referring page.
$tg_StatusMsg=$tg_FileTooBig;
$tg_ReferringPage=$tgRefPage.$tg_StatusMsg;
if ($tg_UseRedirects) {
header("Location: $tgReferringPage"
}
}
} else {
# If this part of the code has been reached then a possibly malicious upload has occurred
tg_RedirFail($tg_MaliciousUpload);
$tg_UpCopySuccess=false;
}
}
function tg_CloseWin() {
echo "script language=\"Javascript\">\n";
Keith Slater
Word Pro Systems
www.wordprosys.com
}
if ($testMIME) {
# Now we need to check if the file exists in it's path
$testExists=file_exists($tg_Path);
if ($testExists) {
switch ($tg_ExistsAction) {
case "overwrite":
# Delete the original and copy over
unlink($tg_Path);
$tg_copyStatus=true;
$tg_StatusMsg=$tg_OrigFileOver;
break;
case "rename":
# Rename the Uploaded File and copy over
$unid=uniqid(rand(1,5));
$tg_NewName=$unid.$tg_File;
$tg_Path="$tg_Root"."$tg_Dir"."$tg_NewName";
$tg_copyStatus=true;
if ($tg_UseErrorMsgs) {
# $tg_File - contains original File Name
# $tg_NewName - contains New File Name
$tg_FileRenamed=$tg_ErrPrefix."File Upload Successful.";
} else {
$tg_FileRenamed="";
}
$tg_StatusMsg=$tg_FileRenamed;
break;
case "abort":
# stop processing upload
$tg_copyStatus=false;
$tg_StatusMsg=$tg_UploadOpAbort;
break;
}
} else {
$tg_copyStatus=true;
}
if ($tg_copyStatus) {
# Now we need to track the copy operation
$copyStatus=@copy("$tg_OrigFile","$tg_Path"
if(!$copyStatus) {
# Failed Copy Operation
if (!$tg_StatusMsg) {
$tg_StatusMsg=$tg_CopyOpFailed;
}
tg_CloseWin();
tg_RedirFail($tg_StatusMsg);
$tg_UpCopySuccess=false;
} else {
$tg_UpCopySuccess=true;
}
} else {
tg_CloseWin();
tg_RedirFail($tg_StatusMsg);
$tg_UpCopySuccess=false;
}
} else {
tg_CloseWin();
tg_RedirFail($tg_InvalidMIMEType);
$tg_UpCopySuccess=false;
}
} else {
# File is too big, go back to the referring page.
$tg_StatusMsg=$tg_FileTooBig;
$tg_ReferringPage=$tgRefPage.$tg_StatusMsg;
if ($tg_UseRedirects) {
header("Location: $tgReferringPage"
}
}
} else {
# If this part of the code has been reached then a possibly malicious upload has occurred
tg_RedirFail($tg_MaliciousUpload);
$tg_UpCopySuccess=false;
}
}
function tg_CloseWin() {
echo "script language=\"Javascript\">\n";
Keith Slater
Word Pro Systems
www.wordprosys.com
Replied 02 Aug 2001 13:58:41
02 Aug 2001 13:58:41 Tim Green replied:
Keith,
If that is all the scripting from the page in question, then I'm not surprised that the recordset isn't returning any kind of value. The code you just posted doesn't have a recordset defined in it.
Tim Green
Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
If that is all the scripting from the page in question, then I'm not surprised that the recordset isn't returning any kind of value. The code you just posted doesn't have a recordset defined in it.
Tim Green
Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>