Jump to content

WebStyles

Members
  • Posts

    1,216
  • Joined

  • Last visited

Everything posted by WebStyles

  1. instead of this: echo "$num1 * $num2 === $answer <br />"; use this: if($num1 * $num2 != $answer) echo "$num1 * $num2 === $answer <br />";
  2. add a trim to both before applying strcmp and test again. maybe there's an invisible character somewhere.
  3. apparently sleeping is the order of the day... who are all these people suddenly sleeping in front of the computer?
  4. well there's your answer... that silly website is 'uppercassing' the result.
  5. Can you post the script that was used originally to encrypt the password when it was first stored?
  6. what's in contact.php ?
  7. You can convert both to seconds with strtotime then substract one from the other...
  8. set an incativity timeout and force them to logout if there's no activity for x minutes.
  9. just load the appropriate user's information when they login. after a successful login, on the same page, you can grab all other relevant info from the database before they proceed (name, permissions, etc...), then you'll always have that info available.
  10. You can also delete the actual session file if you know exactly where it is (you can set the path where the session files are stored in php.ini). I use this on my intranets when I want to force a user to be logged out. when they login I store their session id: session_start(); $sid = 'sess_'.session_id(); and to force logout I use something like this: $file = '/phpsessions/'.$sid; if(is_file($file)){ unlink($file); }
  11. mysql_fetch_array allows you to fetch a numeric array, an associative one or both at the same time. mysql_fetch_assoc only fetches the associative one. Your example will produce the same result. According to the manual on php.net mysql_fetch_assoc was only introduced in php 4.0.3, but it makes things easier to fetch associative results (most commonly used, less typing involved now) EDIT: quote from the manual:
  12. ucwords will only affect the first letter of each word, so if you have other uppercase letters, they will remain so unless you transform everything to lowercase, and then apply ucwords: combine ucwords with strtolower: $ven_name = ucwords(strtolower(mysql_prep(trim($_POST['ven_name']))));
  13. did you check the file permissions ?
  14. I run my own servers, so I have access to everything. since you're on godaddy, you should read up on their instructions about php CLI and cron jobs. maybe they're even adding that line automatically to your scripts (some hosts do)... They have a lot of support documentation, so you're bound to find the answer. did you also check the file permissions like I mentioned before?
  15. the path must be to your PHP INTERPRETER There's no way your interpreter is called html and there's no way it's in your home directory.
  16. started by The Little Guy, solved By The Little Guy. Coolness!
  17. they shouldn't... the CLI extension (Command Line Interface) is what allows you to execute php files in a standalone environment. Because you're calling a file on it's own, the system needs to know where the interpreter for that specific language is. Also make sure the file permissions allow it to be executed by the appropriate user (the user you've defined in the cron job) : maybe the fact that some run and some don't is based on different permissions.
  18. keep in mind that /usr/local/bin/php is the path to MY php instalation, yours may be slightly differtent
  19. Hi kamal213 Use something like: date("Y-m-d",strtorime($yourDate)); to convert before inserting in database, and date("m/d/Y",strtorime($yourDate)); to convert to your original format when displaying You can check out all the options here: date
  20. I'm betting you're using a text field (or a varchar) to store the dates... you should be using the date type, which will have this format: YYYY-MM-DD
  21. for use with cron jobs, you should have the path to php inserted into the top of the file, like this: (also confirm that you have php CLI installed and running) #!/usr/local/bin/php -q <?php ... (rest of script)
  22. $manager = preg_replace('#[^A-Za-z0-9]#i',"," , $_POST["username"]); ( , separating $_POST['username'] instead of . )
  23. took me 5 seconds to find dozens on google.
  24. it would be easier if you define start and end for each rank, so the database would look like this: start | end | rank ----------------- 0 | 9 | Noob 10 | 49 | Member 50 | 99 | Metal 100 | 199 | Silver 200 | 9999999 | Gold then all you need is: $user_post="120"; $query_rank = mysql_query("select `rank` from `rank` where `start` <= '$user_post' and `end` >= '$user_post' limit 1") or die ("Error"); $row=mysql_fetch_assoc($query_rank); echo $row['rank']; the only problem is you'll need to define an ending number for Gold users, but you can use an absurdly large number that no one will ever reach. p.s. having a field named `rank` in a table also named `rank` can cause confusion. Since the table holds all ranks, why not call it `ranks` (plural) ?
  25. here's a page explainig permutations, in this case with letters instead of words, but easy to adapt to your case. http://cogo.wordpress.com/2008/01/08/string-permutation-in-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.