Jump to content

JAY6390

Members
  • Posts

    825
  • Joined

  • Last visited

Everything posted by JAY6390

  1. Yes you use the MD5 function in php to get the hash which you then put in your database. As Mchl says you need to explain a little clearer
  2. You put the md5 hash into the database. The mysql_real_escape_string is pointless in the above and may as well be removed
  3. If the site runs through a bootstrap (ie all requests go through a single file) then you could save the ip's to a database, and check them against the db of banned ip's. If it's for individual pages, you can do something similar only you would need to include your checking code at the top of each page. If you want a server wide ban (that is from everything, webpages or not) then you would need to do this with a .htaccess file containing the list of banned ip's Check out this link http://blamcast.net/articles/block-bots-hotlinking-ban-ip-htaccess at the ban an ip address section You could dump the data into the htaccess file say every 5 mins from the database list of banned ip's using a cron job or something like that
  4. You should actually take some time to explain your question. Ban an IP from what? the server, your individual application? And where is the button from? A web form? Simple things but you need to put some time into your questions if you are going to ask them
  5. $result = mysql_query("SELECT sitename FROM sitelist WHERE id=". $_SESSION['id']) or die(mysql_error()); while($row = mysql_fetch_assoc($result)) { $sitename[] = $row['sitename']; } Each of the site names will then be in an array in the $sitename variable
  6. session_start(); include ('db.php'); if (isset($_POST['username'])) { $username = $_POST['username']; $password = $_POST['password']; //$username = mysqli_real_escape_string($_POST['username']); //$password = mysqli_real_escape_string($_POST['password']); // MySQL Query $result = mysqli_query($conn, "SELECT * FROM staff WHERE username = '$username' AND password = '$password' LIMIT 1 "); if (!$result || mysqli_num_rows($result) !== 1) { $_SESSION['error'] = '<span style="color: red">Login Failed</span>'; } else { // Mysql fetch row results $row = mysqli_fetch_assoc($result); $_SESSION['userid'] = $row['id']; $_SESSION['username'] = $username; $_SESSION['error'] = 'Login successful<br> Welcome, ' . $username; header('Location: ./template.php'); exit(); } } Try that
  7. When inserting it into the database, save it after running it through htmlentities()
  8. I don't see the reason for having both echo lines in the above code, since essentially it will do the same with just $i=1; while ($i<31) { echo date('Y-m-d', strtotime("+$i days")) . "<br>"; $i++; }
  9. If the file is accessible via browser then yes simply use file_get_contents() If it's only accessible via ftp then you will have to use php's ftp functions to do so http://www.php.net/ftp
  10. $days = 0; $maxdays = 30; while($days < $maxdays) { echo date('D m d', time() + $days * 86400).'<br />'; $days++; }
  11. Where exactly is "Dresses" Coming from?
  12. JavaScript is required. I would use AJAX for the dropdown update to save having to refresh the whole page
  13. You're chasing rainbows with this one sorry Rhodry. You will only get it OS specific and/or browser specific
  14. What version of cake are you using? I would suggest you put this on the Cake forums tbh, there are lots of experts there who would probably be able to assist you better
  15. $time = time() - 43200; $sql = "SELECT * FROM `$tbl_name` WHERE `last_voted` > '$time' AND `name` = '$myusername'"; That will return rows of any vote within the last 12 hours (43200 seconds)
  16. You need to loop for each result while($dp=mysql_fetch_array($isuser)) { echo $dp['cupID']; }
  17. This looks like an assignment to me. It's VERY easy. I'm sure if you just read the manual on functions you could do this yourself http://www.php.net/manual/en/functions.user-defined.php
  18. You've not shown how you are retrieving it, or even how the data is stored (flatfile, database etc). The radio is just as simple as <input type="radio" name="radio_group_id_here" value="<?php echo $value; ?>" /> Text here of radio button
  19. Personally I would use one database table per domain, making more than one table will become messy in the long run
  20. I would highly recommend the tutplus tutorial over zend, since I'm guessing you've not worked with zend before, and you would end up having to learn a whole lot more than you probably expect
  21. If you're building your application with Zend then they already have their own ACL class. http://framework.zend.com/manual/en/zend.acl.html
  22. You should set up ACL of some sort and verify on each landing page if that page is allowed to be accessed by the current user Check out ACL on wikipedia @ http://en.wikipedia.org/wiki/Access_control_list
  23. This function function replace_chars($text) { echo '<pre>'.print_r($text, true).'</pre>'; return str_repeat('*', strlen($text[0])); } runs on every word that doesn't have a # before it The variable you will need to manipulate is $text[0] Note that the echo is only there to demonstrate what is matched. You can remove that line. Once you've replaced the letters in the string with the ones you want you can return the string, which will then replace what the old word was. I would probably use str_replace myself, passing an array of letters to replace, and the letters to replace them with
×
×
  • 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.