Jump to content

Zane

Administrators
  • Posts

    4,362
  • Joined

  • Last visited

  • Days Won

    11

Posts posted by Zane

  1. put the article id number within the rewrite as well.

     

    In other words,

    RewriteRule /articles/(.*)_article_name /view.php?article_id=$1 [L]

    The rule of thumb is that unless you are searching for rows that are similar and alike, never search using a string.  The purpose of indices is to keep an index.  If you know the index number there is not point in searching by the name of the article.  It would be like searching through a literal library for a book by its name and not its ISBN.

  2. I attempt to login into that user on the webpage, it doesn't go through, but if I go into my database and copy the column with the password that's been encrypted and paste it into the password field on the webpage, it works.

     

     

    This only is a dead giveaway, without even looking at your code, that you are not comparing the input password with the database stored password correctly.

     

    You say that in order to login successfully you have to use the HASHED (not encrypted) password stored in the database.  That can only mean that you are not hashing the input password before making the comparison.

  3. After further inspection of the code [that you] provided, I realize that you are outputting to the browser before your header call.

    Not to mention that fact that ginerjim pointed out

    You are throwing some js code in the middle of your php code. 


    I'll admit, overlooking the noscript tag was an ignorant thing to do, but forgetting to use the tag is pretty ironic.

    Surely you must have received a header redirect error? Straight from the manual it tells you:

    Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include, or require, functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file.

     

  4. He means that in order for $_POST['submit'] to be set, the user would have to click on it. In your case, the form submits on change so it's assumable that no one will ever be clicking the submit button.

  5. $timeVar = explode(":", "02:15:37.5");
    $totalSeconds = 0;
    foreach( $timeVar as $s) {
        switch( key($timeVar ) {
            case 0:  //Hours   --- 3600 secs in an hour
                 $totalSeconds += ($s * 3600);
            break;
            case 1:  //Minutes -- 60 secs in a minute
                 $totalSeconds += ($s *60);
            break;
            case 2:  //Seconds.milliseconds  1000 ms in a second
                  list($a, $b) = each( explode( '.', $s) );
                  $totalSeconds += $a + ($b / 1000)
            break;
        }
    }
    echo $totalSeconds . "
    \n";
    echo "Rounded up" . ceil( $totalSeconds ) . "
    \n";
    echo "Rounded down" . floor( $totalSeconds ) . "
    \n";
  6. The biggest question is time.  Do you have the time to learn C?  If you're just an unemployed teenager who like programming, I would take the free time that you have an learn C.  In short, it will not hurt you to know C

     

    As Kevin mentioned earlier though, it all depends on your needs.  If you're just bored, I would go with C.  if you're looking for a language that you can create a certain application with, learn C++ or C# or Java...

     

    Think of it like a vehicle.  C++ would be your ability to add things to the car.  New engine, new stereo system, new alternator, new upholstery , etcetera, etcetera, etcetera...

     

    Knowing C would be your ability to tweak of fix these things without even needing a "new" thing.  For instance, say your alternator goes but you just happen to know exactly how to take it apart, change the brushes, make new brushes, whatever.  Battery goes out and you know exactly which chemicals to get to renovate it.  If you get into a fender bender and part of the body of your car is ripped off, leaving a gaping whole, then you would how to weld some old metal to the point that it looks brand new.

  7. For the sake of a better understanding I have tried Zanes approach but  I get 

    Notice: Undefined variable: typecount in /path/to/webroot/php/report3.php on line 46 Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in /path/to/webroot/php/report3.php on line 46
    

    Which I understand is referencing this block of code

    echo "<tr>\n";
    while( $row = mysqli_fetch_array($typecount))
    {
    echo "<td><center>" . $row['thecount'] . "</center></td>\n";
    }
    echo "</tr></table>";

    $typecount should be $typeCount

     

    variables are case-sensitive.

     

    So, while( $row = mysqli_fetch_array($typeCount))

     

     

    Barrands suggestion is the most ideal and most flexible solution.  It only requires though that you re-organize your table structure.  If you are willing to do that, then I would definitely go for it.  If you cannot, then reference my above solution.

  8. Try using one query instead of five, especially since all of the queries you have are only different in that they have a different type.

    • $typeCount = mysqli_query($con, "
    • SELECT actcaseld, type, encdate, COUNT(*) AS thecount FROM `Stats`
    • WHERE type IN ("Type 1", "Type 2 diet", "Type 2 ADA", "Type 2 ADA and Insulin", "Type 2 Insulin")
    • AND actcaseld='New Client' AND encdate BETWEEN
    • (SELECT bdate FROM `ReportRange` WHERE cf_id=1)
    • AND
    • (SELECT edate FROM `ReportRange` WHERE cf_id=1")
    • GROUP BY type");

    That should give you four rows, each with a thecount field of the count.

    echo "<table border='1' align='center'>
    <tr>
    <th></th>
    <th></th>
    <th>Type 1</th>
    <th>Type 2 Diet</th>
    <th>Type 2 ADA</th>
    <th>Type 2 ADA + Insulin</th>
    <th>Type 2 Insulin</th>
    </tr>\n";
    echo "<tr>\n";
    while( $row = mysqli_fetch_array($typecount) ) {
    echo "<td><center>{$row['thecount']}</center></td>\n";
    }
    echo "</tr></table>";
  9. I went to google and searched for "undetermined entity reference" and the first result, which was the PHP manual,  was this


    6 years ago
    To avoid warning message "unterminated entity reference" you may use htmlentities() for escaping supplied value:
    <?php
    //...
    $dom->createElement('name'htmlentities($text))
    //...
    ?>

     

    Omit the fact that it shows up at the very bottom of the page.  Ctrl+F is your best friend in searching for information.

  10. You are getting the non-object error because of this line

    echo array_to_xml($xml_page_info,$wall)->asXML();

    You have your parameters backwards... According to this line

     function array_to_xml($student_info, &$xml_page_info)

    $xml_page_info goes at the end.

  11. So you don't really need \n then? Unless it's for cleaning up the source code?

    Exactly.  But they also come in handy for writing source code for things such as email headers. By putting \r\n after each mail header you allow sendmail to distinguish the characteristics of that message and display them accordingly.

  12. \n Newlines will only ever "appear" in the source code.  The same goes for \r RETURN;

     

    the
    tag is for HTML formatting and thus only functions in a browser.  If you check the source code on something you are echoing
    , then you will clearly see it.

×
×
  • 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.