Jump to content

blackcell

Members
  • Posts

    439
  • Joined

  • Last visited

Posts posted by blackcell

  1. All the matters pertaining to ajax that I have encountered don't usually provide good errors to troubleshoot. Just me. All I know if that it isn't working and I have copied the code from the example that worked and tried to re-write the asp script to php and it didn't work but did not give me any errors.

     

    You know what thorpe, it's not that big of a deal, i will "SOLVE" the topic to shut the thread down.

  2. I basically have an almost forum system that users enter text. I want to prevent them from creating huge scrolling marquees and savascript hijacking. I used htmlentities and it seems it replaced ' with /// (not for sure). I just need to know what function to use for html to store data as close as possible and prevent malacious or annoying input. 

     

    Thank for the great input guys.

     

    If you want an example of what I am sterilizing check out this thread:

    http://www.phpfreaks.com/forums/index.php/topic,201172.msg909800.html#msg909800

     

    I have a function:

    <?php
    function CleanFormData($input){
       $input = htmlentities($input);
       $input = mysql_real_escape_string()($input);
       return $input;
    }
    >?
    

    Should I use strip_tags()?

  3. What functions should be used to sterilize user submitted form data and protect against html injection, sql injection and javascript hijacking? Basically similar to a forum protection function.

     

    Thanks in advance.

  4. Then I am doing something else with the ajax....

    index.php
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    
    <head>
      <title></title>
    
    <script type="text/javascript">
    function ajaxFunction()
    {
    var xmlHttp;
    try
      {
      // Firefox, Opera 8.0+, Safari
      xmlHttp=new XMLHttpRequest();
      //alert("Firefox");
      }
    catch (e)
      {
      // Internet Explorer
      try
        {
        xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        //alert("IE");
        }
      catch (e)
        {
        try
          {
          xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
          //alert("?");
          }
        catch (e)
          {
          //alert("Your browser does not support AJAX!");
          return false;
          }
        }
      }
    }
    
    
    xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {
      document.myForm.time.value=xmlHttp.responseText;
      }
      xmlHttp.open("GET","ajaxfunction.php",true);
      xmlHttp.send(null);
    }
    </script>
    
    </head>
    
    <body>
    
    <form name="myForm">
    Name: <input type="text" onkeyup="ajaxFunction();" name="username" />
    Time: <input type="text" name="time" />
    </form>
    
    </body>
    </html>
    
    ajaxfunction.php
    <?php
      header("Expires: Thu, 01 Dec 1994 16:00:00 GMT");
      echo date('g:i:s');
    ?>
    

  5. Of course, apologies...

        <style type="text/css">
            table.HeadRow
            {
                background-color: #EEEEEE;
                border-collapse: collapse; border: 1px solid #ccc;
            }
         </style>
    <?php
    
    $panelBottom =
        "
        <table class='HeadRow' bgcolor='#EEEEEE' align='center' width='100%' height='100%' border='1'>
          <tr >
            <td width='64%' align='center' colspan='3'><b><big>My Priorities</big></b></td>
            <td width='1%'  align='center' colspan='3'> </td>
            <td width='34%' align='center' colspan='3'><b><big>System Overview</big></b></td>
          </tr>
        </table>
    
    
        <iframe width='64%' height='265' frameborder='no' src='panel_main_assigned.php'></iframe>
          
        <iframe width='34%' height='265' frameborder='no' src='panel_main_overview.php'></iframe>
    
        <hr></hr>
    
        <table class='HeadRow' align='center' width='100%' height='100%' border='1'>
          <tr valign='top'>
            <td width='100%' align='center' colspan='3'><b><big>Recently Closed</big></b></td>
          </tr>
        </table>
    
         <iframe width='99%' height='180' frameborder='no' src='panel_main_recent.php'></iframe>
    
        <hr></hr>
    
        <table class='HeadRow' bgcolor='#EEEEEE' align='center' width='100%' height='100%' border='1'>
          <tr valign='top'>
            <td width='15%' align='left'>$reportBug </td>
            <td width='70%' align='center'><b><big> Bugs and Updates </big></b></td>
            <td width='15%' align='right'> $quickUpdate</td>
          </tr>
        </table>
    
         <iframe width='99%' height='70' frameborder='no' src='panel_main_development.php'></iframe>
    
        ";
    
    ?>
    

    I am still seeing vertical borders between rows. I want to think it is a bug with css/html because if you look here:

    http://www.w3schools.com/css/tryit.asp?filename=trycss_table_border-collapse

    at the example and remove the top table from the code and update, it totally screws up the good table. I have more instances of this too. ???

     

  6. I am trying to get a simple ajax function to work but can't find a good example of how to write the remote script to work because it is in asp and I don't know what it does.

    The asp script is

    <%
    response.expires=-1
    response.write(time)
    %>
    

    and I need to know how to do something similar in php.

     

    Thanks for any help.

  7. I want to completely collapse any borders on a table so that gaps do not appear between cells but I want to maintain the outside border of the table. I have worked with many examples and none are working. Is this impossible to do?

     

    Also, I know I should use css tables but I am not converting because I don't have the time now.

  8. I see...

    I found something interesting and I have a theory as to why it happens.

    I have a report that will query all records with field1 containing the char Y.

    The possibilities for this field are Y or N.

    This sql query takes FOREVER to run:

    <?php
    $sqlQuery = "SELECT * FROM `table` WHERE `field1` != 'N'";
    ?>
    

    This sql query takes 20 seconds to rip through 4000+ records:

    <?php
    $sqlQuery = "SELECT * FROM `table` WHERE `field1` = 'Y'";
    ?>
    

    I have an index on field1

     

    Why is there such a time difference? Is it because when looking for != 'N' it leaves the possibility for everything else where looking for ='Y' will know what record to start on the index and rule all other possibilities out?

     

  9. I can create indexes but, how do you utilize them to optimize look-ups? Is it something that happens behind the scenes or do you have to tailor your queries to utilize them?

     

    <?php
    $sqlQuery = "SELECT * FROM `sqlTable` WHERE `userDepartment` = 'ENG'";
    ?>
    

    Would I need to modify the example query above to optimize the look-up when there are 5000+ records?

     

    Thanks for any 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.