Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Strange PHP code generated

Guest
Nov 15, 2007 Nov 15, 2007

Copy link to clipboard

Copied

I am attached a some generated code from DW CS3 using PHP. I'm not a PHP expert but just looking at the code you can see the same function "GetSQLValueString" declared over and over again. On one page I saw this defined 5 times, removed 4 of the definitions and then my page was able to display. I know that's not a full explanation, maybe I deleted some brackets that were causing problems, but the point is that it's all DW generated code. Please see the attached code if you're a PHP expert and can maybe shed some light for us pedestrians. Are there any Adobe experts out there on this board? There used to be but it's looking like a deserted board lately.
TOPICS
Server side applications

Views

313
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Nov 15, 2007 Nov 15, 2007
"davidbarrackphoto" <webforumsuser@macromedia.com> wrote in message
news:fhi56c$pfi$1@forums.macromedia.com...
> I am attached a some generated code from DW CS3 using PHP. I'm not a PHP
> expert but just looking at the code you can see the same function
> "GetSQLValueString" declared over and over again. On one page I saw this
> defined 5 times, removed 4 of the definitions and then my page was able to
> display. I know that's not a full explanation, maybe I deleted some
> brackets
> that were...

Votes

Translate
LEGEND ,
Nov 15, 2007 Nov 15, 2007

Copy link to clipboard

Copied

"davidbarrackphoto" <webforumsuser@macromedia.com> wrote in message
news:fhi56c$pfi$1@forums.macromedia.com...
> I am attached a some generated code from DW CS3 using PHP. I'm not a PHP
> expert but just looking at the code you can see the same function
> "GetSQLValueString" declared over and over again. On one page I saw this
> defined 5 times, removed 4 of the definitions and then my page was able to
> display. I know that's not a full explanation, maybe I deleted some
> brackets
> that were causing problems, but the point is that it's all DW generated
> code.
> Please see the attached code if you're a PHP expert and can maybe shed
> some
> light for us pedestrians. Are there any Adobe experts out there on this
> board?
> There used to be but it's looking like a deserted board lately.

That code was added to prevent SQL injection problems with the previous PHP
MySQL implementation,
why on earth they chose to include it over and over again instead of using
an include or putting it in the connection file is beyond me..


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Nov 15, 2007 Nov 15, 2007

Copy link to clipboard

Copied

Well after wasting a day I found that this block of code keeps getting added whenever I touch a recordset (open and close it for example). For whatever reason this is causing my page to display a blank page each time DW adds another repetition. I then go in and delete it and alas my page works again. This must be a bug and I'm not sure why I am just now seeing my pages not display. For those looking at this, here is the code that I have to keep removing:

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . date("Y-m-d",strtotime($theValue)) . "'" : "NULL";
break;
case "time":
$theValue = ($theValue != "") ? "'" . date("H:i:s",strtotime($theValue)) . "'" : "NULL";
break;
case "datetime":
$theValue = ($theValue != "") ? "'" . date("Y-m-d H:i:s",strtotime($theValue)) . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 15, 2007 Nov 15, 2007

Copy link to clipboard

Copied

"davidbarrackphoto" <webforumsuser@macromedia.com> wrote in message
news:fhi8d8$8h$1@forums.macromedia.com...
> Well after wasting a day I found that this block of code keeps getting
> added
> whenever I touch a recordset (open and close it for example). For
> whatever
> reason this is causing my page to display a blank page each time DW adds
> another repetition. I then go in and delete it and alas my page works
> again.
> This must be a bug and I'm not sure why I am just now seeing my pages not
> display. For those looking at this, here is the code that I have to keep
> removing:

Somehow the code isn't identified as a Serverbehavior's participant and gets
added again and again when the serverbehavior is applied, did you change the
dreamweaver generated code in any way?
Installed any extensions that might have changed the edml files?
Created custom serverbehaviors that may interfere with the standard
dreamweaver ones?



Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 15, 2007 Nov 15, 2007

Copy link to clipboard

Copied

LATEST
> Well after wasting a day I found that this block of code keeps getting
> added
> whenever I touch a recordset (open and close it for example). For
> whatever
> reason this is causing my page to display a blank page each time DW adds
> another repetition. I then go in and delete it and alas my page works
> again.
> This must be a bug and I'm not sure why I am just now seeing my pages not
> display. For those looking at this, here is the code that I have to keep
> removing:

I think you're slowly learning why not to depend on software to write code
for you. ;o)

-Darrel


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines