Jump to content

Joshua F

Members
  • Posts

    205
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Joshua F's Achievements

Regular Member

Regular Member (3/5)

1

Reputation

  1. I looked at your code and you have an array containing two field names and you try to throw that into a $_POST[], (if (empty($_POST[$field_name]) || !isset($_POST[$field_name])) {). This should be if (empty($_POST[$field_name[0]]) || !isset($_POST[$field_name[1]])) { should it not? Otherwise you're seeing if $_POST has a key inside of it with the key as array('username', 'password'). You should also define your variables if they even have a chance of not being defined before being called. if (isset($_POST['submit'])) { $error = ''; // set a blank error message $field_name = array('username', 'password'); if (empty($_POST[$field_name[0]]) || !isset($_POST[$field_name[1]])) { $error = "Please enter a username or password"; } if (empty($error)) { $username = trim($_POST['username']); $password = trim($_POST['password']); $query = "SELECT username,password "; $query. = "FROM admin "; $query. = "WHERE username = '{$username}' "; $query. = "AND password = '{$password}' "; $query. = " LIMIT 1 "; $result = mysql_query($query); confirm_query($result); if (mysql_num_rows($result) == 1) { //Redirect // Success } else { $error = "Sorry your username or password is incorrect.<br />"; } } } else { $message = "Please enter your username and password to log in"; }
  2. I think this might help you with what you're wanting. It might not, though.
  3. Seems like you kind of got the idea of how I'd do it. Something like this should work.. Note that I added mysql_error() into the array it's self. <?php error_reporting(0); $a = $_POST['user']; $b = $_POST['name']; $c = $_POST['comment']; $link = mysql_connect('localhost', 'rot', 'joker1'); if (!$link) { $arr = array( 'error' => mysql_error() ); } header('Content-type: application/json'); echo json_encode($arr); ?>
  4. The only thing I could think of is an exploit somewhere, but if that's all they added I don't see the point of it since that wouldn't even really do anything.
  5. Why do you have two () here(confirmed_logged_in() ())?
  6. Actually, it's common practice to use single quotes if you're not putting any 'code' into them. (EG. $string = 'world'; echo "hello {$string}, how are you?"; echo "hello $string, how are you?";) A bit off-topic but I wanted to point that out.
  7. I found this script on a different site and it works fine for generating random letters/numbers. function get_random_string($valid_chars, $length) { // start with an empty random string $random_string = ""; // count the number of chars in the valid chars string so we know how many choices we have $num_valid_chars = strlen($valid_chars); // repeat the steps until we've created a string of the right length for ($i = 0; $i < $length; $i++) { // pick a random number from 1 up to the number of valid chars $random_pick = mt_rand(1, $num_valid_chars); // take the random character out of the string of valid chars // subtract 1 from $random_pick because strings are indexed starting at 0, and we started picking at 1 $random_char = $valid_chars[$random_pick-1]; // add the randomly-chosen char onto the end of our string so far $random_string .= $random_char; } // return our finished random string return $random_string; } Example $original_string = 'abcdefghi'; $random_string = get_random_string($original_string, 6);
  8. I think it would possibly be faster and easier to do with this. Just a suggestion.
  9. Usually this is due to a SQL error, replace $query = mysqli_query($db_conx, $sql); with $query = mysqli_query($db_conx, $sql) or die(mysqli_error($db_conx)); and see if it shows an error.
  10. "SEO Friendly URLs" will probably get you the best result form Google.
  11. Or even.. <?php $date = date('G'); if ($date >= 4 && $date <= 20): // $date is 24 hour format // Display 04:00AM and 08:00PM ?> <div id="right"> <ul id="nummern"> <li><a href="tel:+49220455555">0 22 04 / 55 5 55</a></li> <li><a href="tel:+49220231010">0 22 02 / 3 10 10</a></li> <li><a href="tel:+4922022518895">0 22 02 / 2 51 88 95</a></li> <li><a href="tel:+49220221482">0 22 02 / 21 4 82</a></li> <li><a href="tel:+49220453030">0 22 04 / 53 0 30</a></li> <li><a href="tel:+492202959000">0 22 02 / 95 90 00</a></li> <li><a href="tel:+492202982200">0 22 02 / 98 22 00</a></li> <li><a href="tel:+49220241144">0 22 02 / 4 11 44</a></li> <li><a href="tel:+492204867171">0 22 04 / 86 71 71</a></li> <li><a href="tel:+49220222022">0 22 02 / 22 0 22</a></li> <li><a href="tel:+4922029898011">0 22 02 / 98 98 011</a></li> <li><a href="tel:+49220232728">0 22 02 / 32 7 28</a></li> <li><a href="tel:+49220252841">0 22 02 / 52 8 41</a></li> <li><a href="tel:+492204911414">0 22 04 / 91 14 14</a></li> <li><a href="tel:+492202249450">0 22 02 / 24 94 50</a></li> <li><a href="tel:+49220435432">0 22 04 / 35 4 32</a></li> <li><a href="tel:+49220222222">0 22 02 / 22 2 22</a></li> <li><a href="tel:+49220422443">0 22 04 / 22 44 3</a></li> </ul> </div> <?php else: // Display 08:00PM and 04:00AM ?> <div id="right"> <ul id="nummern"> <li><a href="tel:+4922045866888">0 22 04 / 55 5 55</a></li> <li><a href="tel:+4922045866888">0 22 02 / 3 10 10</a></li> <li><a href="tel:+4922045866888">0 22 02 / 2 51 88 95</a></li> <li><a href="tel:+4922045866888">0 22 02 / 21 4 82</a></li> <li><a href="tel:+4922045866888">0 22 04 / 53 0 30</a></li> <li><a href="tel:+4922045866888">0 22 02 / 95 90 00</a></li> <li><a href="tel:+4922045866888">0 22 02 / 98 22 00</a></li> <li><a href="tel:+4922045866888">0 22 02 / 4 11 44</a></li> <li><a href="tel:+4922045866888">0 22 04 / 86 71 71</a></li> <li><a href="tel:+4922045866888">0 22 02 / 22 0 22</a></li> <li><a href="tel:+4922045866888">0 22 02 / 98 98 011</a></li> <li><a href="tel:+4922045866888">0 22 02 / 32 7 28</a></li> <li><a href="tel:+4922045866888">0 22 02 / 52 8 41</a></li> <li><a href="tel:+4922045866888">0 22 04 / 91 14 14</a></li> <li><a href="tel:+4922045866888">0 22 02 / 24 94 50</a></li> <li><a href="tel:+4922045866888">0 22 04 / 35 4 32</a></li> <li><a href="tel:+4922045866888">0 22 02 / 22 2 22</a></li> <li><a href="tel:+4922045866888">0 22 04 / 22 44 3</a></li> </ul> </div> <?php endif; ?> Either way they do the same thing.
×
×
  • 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.