Curious to know if all this Code PHP is necessary

PHP Newbie question:

The attached code was made with php-msql DW CS3 Server behaviors - recordset pull down of...

I'm curious to know if all this code is necessary? Some of it seems to make things more difficult to work with... For example:

1 - Why does the DW decide to take ['xVARx'] form variables and convert them to the $Vars? -Why not just use the GET ['xVARx']?

2 - Why use sprintf in the $query_test: instead of something more direct as:

SELECT * directory WHERE firstname LIKE $_GET ['firstname'] % and lastname LIKE $_GET ["lastname"] % - etc...

Just curious why they chose these methods... Any idea would be appreciated...


.oO (revdave)

> PHP Newbie question:
>
> This attached code was done with DW CS3 php-msql - Recordset server behaviors
> pull-down...
>
> I'm curious to know whether all this code? Some of it seems to make things
> difficult to work with... For example:
>
> 1 Why does the DW decide to GET ['xVARx'] form variables and convert them to
> $Vars? -Why not just use the GET ['xVARx']?

You cannot rely on the existence of $_GET ['xVARx']. You should always test
with the isset() function if the URL parameter is set, before you can use it or load
It's in a local variable. If it does not exist, you must initialize
the variable with a default value. DW code does this, so that you can then
use safely $xVARx - it contains the value of $_GET ['xVARx']
or a usable default.

> 2 - Why use sprintf in the $query_test: instead of something more
> directly as:
>
> SELECT * directory WHERE firstname LIKE $_GET ['firstname'] % and lastname
> LIKE $_GET ["lastname"] % - etc...

Such a code is much harder to read and maintain, and more prone to error
(Look at the quotes, for example). When you want to incorporate several
variable in a string using sprintf() function is the most flexible way.

You also missed a bit of detail. DW does not directly use the data
the values in the string, but call first GetSQLValueString() on them.
A correct management of the values submitted by users is very important to avoid
Injection of SQL code. Your example above does not prevent this kind of attack.

HTH
Micha

Tags: Dreamweaver

Similar Questions

  • Inserting a SWF... should I really all this code?

    Hello

    as you know, Dreamweaver adds tons of code when you insert a Flash object.

    I was wondering, being a phenomenon of optimization, how much it you actually need, especially if you take the Internet Explorer out of the picture.

    For example, how about this:

    <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-555553540000" 
    WIDTH="550" HEIGHT="400" id="Example" ALIGN="">
        <PARAM NAME=movie VALUE="Example.swf"> 
        <PARAM NAME=quality VALUE=high> 
        <PARAM NAME=bgcolor VALUE=#FFFFFF>
    
        <EMBED src="Example.swf" quality=high 
        bgcolor=#FFFFFF  WIDTH="550" HEIGHT="400" 
        NAME="Example" ALIGN="" TYPE="application/x-shockwave-flash" 
        PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">
        </EMBED>
    </OBJECT>
    

    Looking forward to your comments!

    Try this online tool

    http://validifier.com/

    Nancy O.
    ALT-Web Design & Publishing
    Web | Graphics | Print | Media specialists
    www.Alt-Web.com/
    www.Twitter.com/ALTWEB
    www.Alt-Web.blogspot.com

  • Why all this code extra?

    Hello

    To INSERT data db2 uses my code

    < cfqueryparam

    value =' #UCASE (arguments.myData) # ' cfsqltype ="CF_SQL_CHAR" maxlength ="40">,

    However

    (#UCASEarguments.myData #)

    is just as effective and the debugger shows the final result of code instead of? where it becomes necessary to match the arguments to get the final result.

    What, if any, advantage is the provide cfqueryparam tag?

    Can someone enlighten me pleasse?

    Thank you in advance.

    Do you need more information than is already presented in the documentation?

    http://help.Adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7F 6f.html

    --

    Adam

  • Moving from XP to Windows 7, the recently installed Access 2007 on the pc, I'm curious to know regarding if I upgrade will I lose this software?

    Upgrade XP to Windows 7

    I'm struggling on upgrading my software from Windows XP to Windows 7.  I recently installed Access 2007 on the pc, I'm curious to know regarding if I upgrade will I lose this software? I am required to install Office on my computer and think that it may be better to update before I do, but I don't want free access.

    Back up all your data files to external media, round all your multimedia installation and key products, as all compatible applications will need to be reinstalled (this applies to Access 2007). Also suggest to create an Ougghta to backup your hard drive Windows XP (for an external USB disk) before you begin (for more information, see the last part of my answer).

    Here are some utilities, which will display your product keys:

    Belarc Advisor: http://www.belarc.com/free_download.html
    (He did a good job of providing a wealth of information.
    However may not detect a key to office, then try one of the other two below)

    Also: http://www.magicaljellybean.com/keyfinder.shtml
    and: http://www.nirsoft.net/utils/product_cd_key_viewer.html

    13 keyfinder programs:
    http://pcsupport.about.com/od/productkeysactivation/TP/topkeyfinder.htm

    Windows 7 Upgrade Advisor:
    Download and run the Windows 7 Upgrade Advisor to see if your PC is ready for Windows 7.
    It scans your hardware, devices, and installed programs for known compatibility issues
    gives you tips on how to fix any problems,
    and recommends what to do before upgrade you.
    http://www.Microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=1b544e90-7659-4BD9-9e51-2497c146af15

    Windows 7 Compatibility Center:
    http://www.Microsoft.com/Windows/compatibility/en-us/default.aspx

    Windows XP to Windows 7 Migration Guide
    http://TechNet.Microsoft.com/en-us/Windows/ee150430.aspx

    Here are answers to some common questions about the 32-bit versions and 64-bit Windows.
    http://www.Microsoft.com/Windows/Windows-7/compare/32-bit-64-bit-FAQ.aspx

    Upgrade Windows XP to Windows 7
    http://Windows.Microsoft.com/en-us/Windows7/help/upgrading-from-Windows-XP-to-Windows-7

    How to move from XP to Windows 7 in 4 easy steps
    http://www.MakeUseOf.com/tag/how-to-upgrade-from-XP-to-Windows-7-in-4-easy-steps/

    ========================= Image Backups ================================

    Acronis True Image 2011 - has a fully functional trial version of 30 days available.
    (Note: install Acronis and then create a bootable media restoration/rescue CD before you start creating your first image backup)
    http://www.Acronis.com/homecomputing/products/TrueImage/
    The version comparison: http://www.acronis.com/homecomputing/products/trueimage/comparison.html
    True Image User Guides and documentation:
    http://www.Acronis.com/homecomputing/download/docs/

    Free alternatives:
    EASEUS Todo Backup home V2
    (Note: Todo Install, then create a diskette "emergency" before you start creating your first image backup)
    http://www.TODO-backup.com/

    J W Stuart: http://www.pagestart.com

  • When trying to update, I get this code 0x8024400A. I tried all the recommended fixes.

    When trying to update, I get this code 0x8024400A.  I tried all the recommended fixes.

    Hello

    (1) what is the description of the update that does not happen?

    (2) what are the troubleshooting steps you tried to solve the problem?

    I suggest you try the steps from the link below and check if it helps.

    http://support.Microsoft.com/kb/836941

    Hope this information is useful.

  • Hello! I am a fashion design student and my school offer us a wide range of Adobe programs. I asked the Redemption Code and I have but when I try to enter it know this code is already in use however the Photoshop and Illustrator that I already

    Hello! I am a fashion design student and my school offer us a wide range of Adobe programs. I asked the Redemption Code and I, but when I try to enter on behalf of the school know that this code has already been used however the Photoshop and Illustrator that I already have on my Mac do not work. Before you begin the school pack, I used a free version and so now I see that my free version is over but I can't use the pack of the school that gave me. How can I start using it?

    Hello

    Please see redemption code help

    You will need to contact support by calling/chat for this request.

    Contact the customer service

    * Be sure to stay connected with your Adobe ID before accessing the link above *.

    Kind regards

    Sheena

  • How to cancel my account on adobe? I forgot my code. I've notified on a monthly subscription. Still, they take the money on my bank account. How can I stop all this please?

    How to cancel my account on adobe? I forgot my code. I've notified on a monthly subscription. Still, they take the money on my bank account. How can I stop all this please?

    Cancel your membership creative cloud

  • Hello team, I'm NBNCo and we trueup contract with adobe. Please let me know what all software can be downloaded and used under this contract

    Hello team, I'm NBNCo and we trueup contract with adobe. Please let me know what all software can be downloaded and used under this contract.

    Hey Ashok,

    Please contact support for details of the software, as the same cannot be provided without any detail of the Ordinance on public forums.

    Contact the customer service

    Kind regards

    Sheena

  • I can´t know pass this code AS1 to AS2

    Hello! =]

    I have can´t manage to run this code in flash8(actionscript 2)
    I mean, it works when I put a 'flash version 6' or less

    but, im sure this is an Actionscript 1 code (although I publish in flash 8 AS1 and continues to do not work only in version 6)

    and I REALLY need in my swf file is main witch is an 8 flash (actionscript 2)

    * I tried so many things to get this working thing... but I failed

    can anyone SAVE me?



    in the enterFrame clipevent, you use the vx and vy without first initializing them variables. put the following two lines in your clipevent of load:

    VX = 0;
    Vy = 0;

  • Am curious to know why XP Pro crashed and reinstall the will does not activate

    Have a system that ran XP Pro for a couple of years without problem. Software and license (product key) was purchased online, downloaded and burned to CD. Once installed, OS signals like SP3 XP Pro Version 2002. First installation and activation years was fine. Reinstalling/reactivating later a year later due to a failure of the drive was fine. System had presented a Genuine Advantage test and been patched now with no problems. Last week we had errors saying the OS was not authentic and we could be a victim of a counterfeit. System crashed and when restarting it gets to the login screen, but if the connection is attempted the desktop and in a minute or 2 the system restarts and goes in a loop of reboot, never load the new OS. Start in safe mode gets through the initial steps, but after the start of files loading the system restarts and loops. No configuration of the software/hardware/don't change in recent months and no unusual entry in case do not connect up to 2 days before the accident. No indication of hardware problem and no cases of virus or malware of MS Security Essentials. I tried repair OS, no help. Now have wiped the hard drive and tried to reinstall the operating system (computer, no change) and it will reinstall correctly by using the original product key, but will not activate. Reports as not a valid product key. Activation of the phone I tried and it will activate not there either; reports as invalid product. Considered we could have actually gotten pirated OS, but I'm puzzled why, if the software was fake, the system would work very well for if long including product activation earlier and passes test Genuine Advantage, then suddenly crash, cause errors 'potential infringement' and do not allow for reactivation. Thought at some point, the system has had virus/malware issue, but this does not explain why the relocation after the failure of the drive fails to activate. System critical to the needs of companies and has been replaced so no urgency to correct but I'm very curious to know what might happen. Comments or suggestions would be welcome. Thank you!!

    I checked the key used, and here's the information that my tool tells me about the key:
    (1) version of Windows XP Pro MSDN
    (2) is blocked Activation (reason: abuse)
    (3) no Validation blocked
    (4) shows no sign that it is a basic time license (TBL)
    (5) 31 attempts to activation
    (6) 17 total Activations
    (7) first activation on 2010-08-03
    (7) last Activation successful 13/04/2010
    (8) date of the first activation has been blocked 13/01/2011 (note: this is not necessarily the day, the block has been applied, just the first attempt of activation which is refused due to the block)

    It is d ' attribute of strangeness between this key and "information" which include the Genuine Advantage you said.

    First of all, it's a MSDN license which means that someone can not use the key unless you have an MSDN subscription.

    Then, the key is blocked but not blocked Activation Validation.  It's unusual because usually, if an MSDN key is proved have been hacked (sold outside it's allowed) would be blocked the key activation and Validation.

    In this particular case, it seems that the key has been blocked because of too many activations Activation (on computers with different hardware ID, which usually means different computers) in a short period of time.

    As for the key being a limited time license, which makes no sense.
    (1) I don't see that a MSDN key would be time limited.
    (2) if the key has been blocked due to it having expired, then the reason for the block would be expired are not abusing.
    (3) the key was first activated in March 2010 and the person you talked to said that the key expired a week (i.e. 2011) there. Limited time Licenses are generally used to try before you buy things and I don't know any license based on the time that a period of over one year (16 months to be exact).

    I am convinced that the person that you talked to was wrong that this key was a limited time license.

    My assessment of the information I have available suggests that the key was actually blocked in 2010 due to excessive activation in a short period of time.  I say this because, shows the history of activation:
    (1) first activation in 08/03/2010
    (2) last activation successful 13/04/2010
    (3) 17 total Activations

    This shows that the key has been used 17 times, on 16 different computers, in a little over a period of a month. This does not seem excessive. and strongly suggests that the key has been blocked for this reason, in April 2010. You just didn't notice the block until the end of 2011.

    However, even if the current issue was caused probably by a number excessive activations (which can be fixed by asking that the key be unlocked) the real problem comes from the fact that the key is a licensed MSDN.  The permits required that any key from an MSDN subscription (what to do with all the MSDN keys) can be used by the owner of the MSDN subscription. If you do not have the MSDN subscription that come from this key, you are not allowed to use this key.

    Thank you
    Darin

  • Need help with this code to update the user interface example

    I'm triying to understand the differences between the three methods to manage UI interactions.
    I'm really confused with these three terms when triying them figure out in a real case.
    Basically, I know that I should use invokeLater, invokeAndWat, or getEventLock() to avoid
    This exception: java.lang.illegalStateException: engine access UI without holding the lock on the event

    The code below illustrates the function of the invokeAndWait method, but if I replace it with
    invokeLater or getEventLock() the program will work exactly the same way.
    Could you please change the code to show the differences between the three
    methods of updating the user interface?

    / public final class HelloWorldMainScreen extends form {}

    private LabelField labelField;
    public HelloWorldMainScreen() {}
    labelField = new LabelField ("Hello World");
    Add (labelField);
    Thread MainScreenUpdaterThread = new MainScreenUpdaterThread (this);
    thread. Start();
    }

    {} public void appendLabelText (String text)
    labelField.setText(labelField.getText()+"\n"+text);
    }

    }

    SerializableAttribute public class MainScreenUpdaterThread extends Thread {}
    HelloWorldMainScreen screen;

    public MainScreenUpdaterThread (screen HelloWorldMainScreen) {}
    this.mainScreen = screen;
    }

    public void run() {}
    for (int i = 0; i)< 10;="" i++)="">
    try {}
    Thread.Sleep (5000);
    } catch (InterruptedException ex) {};
    UiApplication.getUiApplication () .invokeAndWait (new Runnable() {}
    public void run() {}
    mainScreen.appendLabelText ("Update");
    }
    });

    }
    }
    }

    These three concepts are very confusing for a lot from people so all explanatory source code
    describing their functions will be highly useful for everyone, I think.

    Thanks in advance!

    With respect to the effect, there is no difference between methods.  The difference is the way in which the result is achieved.  So we can't change the code to show you the difference.

    As we are unable to demonstrate the difference, you have to do with an explanation.  To understand the explanation, you'll need to understand the thread of events, so if you have not already, please consider this:

    http://supportforums.BlackBerry.com/T5/Java-development/what-is-the-event-thread/Ta-p/446865

    If the three options are differentiated by the processing order:

    (a) invokeLater executes the update on the thread of events.  The transformation takes place at a later stage and the code which is in order after the invokeLater will actually run before the code within the invokeLater.

    (b) invokeAndWait also manages the update on the thread of events, which means that all other events that await on the thread of events will be run before this code.  But any code after the invokeAndWait will not be executed.

    (c) the synchronized option, like invokeAndWait, runs the update of the UI before moving on to the following code.  The difference is that the code to run on the event Thread is not executed before code in the synchronized block.

    If this is meaningless, so that probably does not matter too much.  in general, you should use invokeLater, except if you need to update the user interface occur in the order with your background processing.  If so, use invokeAndWait. It has synced are very few occasions where you must use the block, and it should be very small updates to the user interface and you should understand the implications this could have on the wire events.

  • Help with this code please...

    Hi all

    I have a repeating line in a table (+ \-bouton on each line to add / remove). On each line, the user selects a value in a list drop-down down (drop-down list is filled with a literal JavaScript object if it has no chance)

    What I have to do is to check the duplicate drop-down selections on different lines and warn the user that they have selected a value twice.

    I currently have this code in the change event of the ComboBox that works very well, but for the first line only -how to twist it works for all instances of the repeated line "FullRowSubForm"?

    If (xfa.event.newText is form1. WorkforceDepSubForm.WorkforceLineSubform.FullRowSubForm.RepeatableRow.WorkforceRow1. WorkforceNameTextField.rawValue)

    {

    xfa.host.messageBox ("BEWARE you have already selected" + xfa.event.newText + "\n" + "\n" + "that one instance of dependencies should be chosen - please choose another addiction or delete.");

    }


    Thanks in advance

    Ellis

    Hello

    Your repetitive element is FullRowSubForm, don't know if that's right... it maybe too .parent is in the code to add

    In any case, it should work.

    If (form1. WorkforceDepSubForm.WorkforceLineSubform.resolveNodes ("FullRowSubForm. [RepeatableR OE. WorkforceRow1.WorkforceNameTextField ==------"" + xfa.event.newText + "\"]").length > 0) {}

    Concerning

    Bruce

  • All editable code yellow highlighted

    Hello
    I don't know what happened, but recently all my code not locked by the models is highlighted yellow. The only time wherever it occurs, is usually when I add in a .lbi from the active panel. Now, however, all my code is yellow on some pages and I get funky errors when it is not yellow. For example, when I start coding immediately after a designated area editable on a page, the code turns gray as the code that is not editable. Anyone have any ideas? \
    ktpardue

    Hello
    Never mind - I found the problem. I had worked in a web development environment some of this set up and code was always pointing to it. Some code, too, was rest of remove a library item. As soon as I cleaned these, the code returned to normal.
    Thank you!
    ktpardue

  • How to optimize this code?

    Hi all

    The function I want to achieve is very simple. The reading of data from data acquisition, play the sound file if a rising edge is detected and stop playing if a front down is detected.

    Attachment is my code, it works, but if I stop the program and restart it, the program will be somewhat stuck (but), so all I can do is to put an end to the task and to reopen the program. I put two structures case for each channel, I believe that the problem is caused by the second case structure.

    I am a beginner of labview, could someone optimize me this code?

    Thank you!

    First, use the charts to your advantage.  You can do this fairly simple dynamic conversion of the Data Type in a table of waveforms.  Trigger detection can treat an array of waveforms.  You can then process all detections of relaxation in a loop, updated what trigger (and level), that you are looking for dynamically.

  • create the code with this code snippet

    I'm curious...

    I can't create a snippet of code with this code. (located in the first post)

    http://forums.NI.com/T5/LabVIEW/event-structure-with-value-changes/m-p/1937505#M646059

    However, I can create excerpts of its subsections.

    Tried different versions of LabVIEW with the same result.

    Can someone create a snippet?  Just curious.

    I'm not stuck or anything... just curious...  Maybe I should have posted the breakpoint...

Maybe you are looking for