Jump to content

dalecosp

Members
  • Posts

    471
  • Joined

  • Last visited

  • Days Won

    8

Posts posted by dalecosp

  1. Um, you didn't change it.  Not in the post above, anyway.  It still says:

     

    foreach($categories as $sub_cat_id => $row): 

     

    Of course, you may have a more insidious issue.  Your while() is overwriting $row, too.

    Something like:

    $x = 0;
    while($row = mysql_fetch_assoc($result))
    {
        $categories[$x][$row['sub_cat_id']] = array('name' => $row['sub_cat_name']);
        $categories[$x][$row['sub_cat_id']]['topics'][$row['sub_id']] = array('name' => $row['topic_title']);
        $x++;
    }


     

  2. The interaction of Flash and PHP occurs as follows: Once the client is logged in he can activate the flash movie page which is like a game. The game gets its stored values from a database so the flash connects to php and is fed from it the initialisation values for the movie to start. The movie plays and some values are generated during the game ( almost all integers & 1,2 dates). Once the game ends these values are stored back into the database by flash calling the php and POSTing data into the database through it (php).

     

    One question that i wanna ask is that since the program is generating the values, do i need to take the security measures on the posted data and validate and escape it before storing it into the Mysql database? Can these values also be intercepted by a malicious user and changed before the php stores them in the DB?

    Yes; I would do some securing of POST.  In particular, if POSTing can be allowed from anywhere (I'm assuming since the Flash is on the client side, it's coming from the WWW at large).  If someone can disassemble the SWF file, they can find out where to POST to.

     

    For that matter, anyone with a packet sniffer or riding tail on a proxy or firewall log can figure out where your Flash is POSTing to.

     

    That done, the door is open to send bogus POST data, and that's why you need to make sure all data coming from outside is sanitized...

  3. Are you using a debugger? I'd expect to see some feedback/error messages. Try this?

     

    <script type="text/javascript">
    
            var link = document.getElementById("CmtBox");
            link.onclick = function () {
               document.getElementById("comment").style.display = "none"; 
            };
    </script>
    Note that the name of the function is "onclick" ... in particular, "link.onclick". Don't try an give an anonymous function another name (like "link").
  4. Rather a mess with your brackets there!

    Is this better?

     

     

    $ip = gethostbyname('www.facebook.com');
    if ($ip == '46.123.70.198') { //this is the ns after dns filter for facebook.com
        echo "Smart DNS Is Set up ";
    } elseif ($ip == '193.123.9.65') { //this is true ns lookup
        echo "Smart DNS Is Not Set UP";
    }

    Not sure where those extra semicolons and colons came from ... :)
  5. All the error is saying is that "ereg()"  (and "eregi()", which is what this script is using) are now deprecated in PHP.  They will, one day, be removed and your script won't work when the language is updated to that version, whatever/whenever that is.

    So, logically, you should update the script to use the PCRE functions instead.

  6. Our company has a "designer" whose background is actually in print and print layout, graphic design, etc.

     

    So "page development" here is taking printed documents and turning them into WWW docs according to the "blueprint".

     

    I also complete other programming tasks (related to functionality), as requested by the head of the I.T. department ... for example, I've taken web sites that were based on a certain platform and planned and executed a switch to a different platform. This required knowledge of a couple of different database systems, a general concept of data management and mapping, scrupulous discipline for backups and tons of testing, network knowledge, and the creation of several "glue" scripts that help things together at critical junctures.

     

    When a bug surfaces, or something needs added to a web "page" ... yours truly is the "go to" guy.

     

    I have a degree, but it's not I.T. related. So, my perceived skill got me the job; the degree was simply assurance to them that I was, indeed, as smart as I said I was, more or less.

     

    Hopefully that helps. :)

  7. The checkboxes are showing up fine. Next what I do within the loop is set the $assetid variable equal to the asset_id of the current item within the loop. Then I perform a nested loop to loop through the 3 items that are selected within the intermediary table "standards_assets". In that table asset_id's 2, 3, and 5 are set. Within the loop I check to see if $assetid is equal to the asset_id value within that table. If it is, I set $selectedAsset to "checked". Finally I echo out the checkbox...hoping that the checked state would be set....but it is not. Any ideas?

    What exactly IS being output to the browser?

  8. In ASP.NET this is actually pretty easy. I would dump the table into a Dataset (a collection essentially). Use a For Each loop to loop through that collection. Then use a nested loop to loop through the collection of checkbox items in a CheckBoxList control and select the checkbox item if it's value matches the value in the row within the Dataset. Not sure how to go about doing this in PHP....any help would be greatly appreciated....

    1. "dump the table into a dataset" ... OK; in PHP, you probably have to setup an array to hold the data, and get your data into it. Show how you're doing that now?

     

    Here's an example from something I wrote recently:

     

    $x=0;
    $plist = array();
    
    while ($row=mysqli_fetch_assoc($res)) {
          $plist[$x]['model']=$row['model'];
          $plist[$x]['url']=$row['url'];
          $plist[$x]['brand']=$row['brand'];
          $x++;
       }//while
    2. "For Each loop" ... pretty standard in most any language.

     

    3. "Use a nested loop" ... again, pretty standard. I guess we *really* need to see your dataset code.

     

    Let me state that the examples we've been showing are using echo() to print the results immediately. There's not any reason it would *have* to be this way; you could certainly create a variable and repeatedly concatenate new text to it to use later or return if this was all wrapped up in a function/class whatever.

     

    I don't have any ASP experience in particular; it sounds like you just need to think a little "deeper" into what you actually want the software to do. And perhaps that's too easy for me to say; I've been used to doing PHP for years and grabbing a dataset as I did above is very plain, boring work for me these days. Maybe it isn't for you yet. I'm sure if I were thrust into a .NET project I'd be the one asking *you* for help ... :-)

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.