Jump to content

Leaderboard

  1. Barand

    Barand

    Moderators


    • Points

      7

    • Content Count

      20,907


  2. requinix

    requinix

    Administrators


    • Points

      2

    • Content Count

      12,409


  3. kicken

    kicken

    Gurus


    • Points

      2

    • Content Count

      3,763


  4. mac_gyver

    mac_gyver

    Staff Alumni


    • Points

      2

    • Content Count

      4,445



Popular Content

Showing content with the highest reputation since 07/06/2020 in all areas

  1. 1 point
    It tells you exactly what to do on that page you linked. For a simple http to https redirect, just create a http vhost with a simple Redirect statement. For example, from my site's configuration: <VirtualHost *:80> ServerName aoeex.com ServerAlias www.aoeex.com Redirect permanent / https://aoeex.com/ </VirtualHost>
  2. 1 point
    When you use <label for="xxx"> then the xxx should be the id of the object being labelled. This is useful with radio buttons or checkboxes and enables the user to click either the object or the label to check or uncheck. In your examples, <label for="yes"> is wrong since "yes" is not an id of anything.
  3. 1 point
    When you get a keyboard that adds indenting and line breaks I'll read your code.
  4. 1 point
    code that unconditionally (always) outputs the raw database statement errors for the connection, query, prepare, and execute statements, only helps hackers when they intentionally trigger errors, since these errors contain things like the database hostname/ip address, database username, if a password is being used or not, part of the sql syntax, and web server path information. the only time you should output the raw database statement errors is when learning, developing, or debugging code/query(ies) and you are viewing the site as the developer/programmer. at all other times, you should log these errors. the simple way of doing this is to use exceptions for errors and in most cases let php catch and handle the exception, where php will use its error related settings to control what happens with the actual error information (database statement errors will 'automatically' get displayed/logged the same as php errors.) you would then remove any discrete error handling logic, since it doesn't add any value for a legitimate visitor to your site, and it will no longer get executed when there is an error (execution transfers to the nearest exception handler for the type of exception or to php if there is none.) the line that Barand posted enables exceptions for errors for the mysqli extension.
  5. 1 point
    It's fine. Though you ideally shouldn't have a bunch of spaces everywhere like you do. Just put a space between attributes, not around the =. Using <input type="button"> creates a simple button that effectively does nothing. It will NOT submit your form. This type of button is mostly used in combination with javascript. Using <input type="submit"> creates a simple button that will submit the form and is a standard practice for submitting forms. Using <input type="reset"> creates a simple button that just resets the form's fields to their default values, it does NOT submit the form. Using <button> allows you to create nicer button because it allows more than just text. For example, you can combine text and an image. <button type="submit"> <img src="/images/search.png" alt=""> Search </button> With <button> you also have type="button", type="submit", and type="reset" which have the same semantics as on <input>. It doesn't really matter, though I personally find double-quotes on attribute values to be more correct and causes fewer issues. Use which ever one you want, but be consistent and use the same one everywhere. This is an artifact of the days when XHTML was popular and the thing to use. It's called a self-closing tag and is necessary in XHTML as everything must have an open and close tag to be XML compatible. These days it's best to stick to plain HTML which does not use XHTML specific things like self-closing tags. First of all, it is <label for="">, there's no underscore in there anywhere. Second, no you do not provide labels for each option in a select. The label is to describe the input as a whole, your options are labeled by their text content. They are both correct. It's mostly a matter of preference, or sometimes dictated by your layout. <label> can be be associated with an input either with the for attribute, or by having the input enclosed within it. Enclosing the input is convenient, but it may not always be possible when considering layout requirements.
  6. 1 point
    I prefer option 4. EG mysqli_report(MYSQLI_REPORT_ALL|MYSQLI_REPORT_STRICT); $conn = mysqli_connect('localhost', 'someuser', 'wrong_password', 'test');
  7. 1 point
    You actually have choice of mysqli or PDO to replace your mysql.* functions. Don't be fooled into thinking the easier route must mysqli because it's spelt almost the same. PDO is the simpler of the two interfaces.
  8. 1 point
    And I agree that conf-available is not the right place for your RewriteRules. But you shouldn't be creating a new file in sites-available either and for basically the same reason: if you look through sites-available you'll find websites, and your RewriteRules are not websites. But they are used for a website, so put them in your site's configuration. As in inside the VirtualHost block. Alternatively, you could put the rules in a separate file somewhere (like within your application) and include it from inside the site configuration.
  9. 1 point
    This is an environmental issue between your local server and your Production one, i.e. something is set up differently between the two. That require() statement is telling PHP to go and read the contents of some file and to fail if it cannot find that file. The file is specified in the variable, $view. To what value is this variable set to on your local server? Where does the PHP code set that value? Regards, Phill W.
  10. 1 point
    Is the div in the DOM on page load or is it added dynamically later? You may have to use .on() to bind the event to the element.
  11. 1 point
    the main reason requinix stated that is because you are not validating input data before using it (which i have mentioned doing multiple times in this thread.) someone can cause your code to execute any php function, like phpinfo(), by simply setting $_GET['form_type'] to phpinfo when they request your page. do you really want someone to be able to see the phpinfo output from your site or execute any php function? your code needs to have direct, positive control over what gets executed on any page request.
  12. 1 point
    ... also, make sure to have mySQL error reporting on (if you don't have them on already).
  13. 1 point
    I created an extra table to define which category the values were in mysql> select * from catval; +-----+------+ | val | cat | +-----+------+ | 1 | 4 | | 2 | 4 | | 3 | 4 | | 4 | 4 | | 5 | 3 | | 6 | 3 | | 7 | 2 | | 8 | 2 | | 9 | 1 | | 10 | 1 | +-----+------+ then $sql = "SELECT a.cat as cata , b.cat as catb FROM datatb d JOIN catval a ON d.grpa = a.val JOIN catval b ON d.grpb = b.val "; $result = $db->query($sql); //categories $cat = [ 4 => ['name'=>'1:4', 'recs'=>[]], 3 => ['name'=>'5:6', 'recs'=>[]], 2 => ['name'=>'7:8', 'recs'=>[]], 1 => ['name'=>'9:10','recs'=>[]] ]; $n = 0; while ($row = $result->fetch_assoc()) { $cat[$row['cata']]['recs'][$n][] = $row['cata']; $cat[$row['catb']]['recs'][$n][] = $row['catb']; $n++; } // the output echo "<table border='1' style='width:500px; border-collapse:collapse;'>"; foreach ($cat as $c) { echo "<tr><th>{$c['name']}</th>"; for ($i=0; $i<$n; $i++) { echo '<td style="text-align:center;">' . (isset($c['recs'][$i]) ? join(',', $c['recs'][$i]) : '&ndash;') . "</td>"; } echo "</tr>\n"; } echo "</table>\n";
  14. 1 point
    I enjoy the challenge when someone posts a problem I can get my teeth into.
  15. 1 point
    One way is... $secs = 350000; $dt1 = new DateTime(); $dt2 = (clone $dt1)->add(new DateInterval('PT'.$secs.'S')); $diff = $dt1->diff($dt2); echo $diff->days . ' : ' . $diff->format('%h : %i : %s').'<br>'; //-> 4 : 1 : 13 : 20
This leaderboard is set to New York/GMT-04:00
  • Newsletter

    Want to keep up to date with all our latest news and information?
    Sign Up
×
×
  • 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.