Jump to content

ninjeh

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ninjeh's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Oops, forgot to add return $httpcode; to the last line of the function.
  2. On the https page, you are most likely requesting external resources (stylesheets, images, javascript widgets etc) using the plain http protocol. On a https page all of the external requests have to be handled through https.
  3. You definitely would want a local solution instead of having to make 100 requests per page unless this is for some script that is used as a cron once in a while etc. You could use curl to grab the http header of the resource. <?php function get_headers($url_to_check) { $ch = curl_init($url_to_check); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HEADER, TRUE); curl_setopt($ch, CURLOPT_NOBODY, TRUE); curl_exec($ch); $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); } ?> <table border="1"> <tr> <th>ID</th> <th>Image</th> </tr> <?php for($i=0; $i<=100; $i++) { $url = 'http://localhost/images/icon_'.$i.'_64x64.jpg'; if (get_headers($url) == 200) { echo "<tr><td>".$i."</td><td><img src='".$url."' /></td></tr>"; } } ?> </table> Alternatively, if it is really localhost, reference the image through the file structure instead of using a URL. Then use is_file as it would be much quicker than making the aforementioned http requests.
  4. Your NOT operator, exclamation point, is on the wrong side of the parentheses. Also there is no space between the session_start(); and the initial php tag, but I am guessing that's the way it was copied and pasted. Also, you can eliminate one of the parentheses as there are not multiple logic scenarios in your if statement. Before: <?PHPsession_start();if (!(isset($_SESSION['login']) && $_SESSION['login'] != '')) {header ("Location: /login/main.php");}?>() After <?PHP session_start(); if (!isset($_SESSION['login']) && $_SESSION['login'] != '') {header ("Location: /login/main.php");}?>()
×
×
  • 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.