Jump to content

cyberRobot

Moderators
  • Posts

    3,145
  • Joined

  • Last visited

  • Days Won

    37

Everything posted by cyberRobot

  1. Are both of the pages hosted on the same server?
  2. When logging in, do you see the message echoed here: echo "You have been logged in as <b>$dbuser</b> <a href='./index.php'>Click here</a> to go back to home page"; If so, the SESSION variables should be set. To make sure, you can try displaying it: $_SESSION['username'] = $dbuser; echo "You have been logged in as <b>$dbuser</b> <a href='./index.php'>Click here</a> to go back to home page"; var_dump($_SESSION['username']);
  3. Based on the following code, it looks like you're comparing a hashed password against the raw version: $passwordFromPost = $_POST['pass']; $hashedPasswordFromDB = $row['password']; if ($passwordFromPost === $hashedPasswordFromDB) { //... Also, it doesn't look like $dbid is defined before the following line: $_SESSION['userid'] = $dbid;
  4. Also, in case it helps, the documentation for strpos() explains why you need to use the === or !== operator. http://php.net/manual/en/function.strpos.php See the pink Warning box in the Return Values section.
  5. Perhaps the following will help: http://php.net/manual/en/language.operators.comparison.php
  6. Are you seeing a broken image? If so, did you go into your browser window's source code to make sure the file name is coming through? If the name is fine, the problem is most likely due to the path being incorrect...or maybe the file names don't match the ones listed in the array.
  7. The code works fine for me. If you're just seeing a broken image, perhaps the file path isn't correct. Side note: you could use array_rand(). With rand(), you'll need to manually change the arguments every time the number of items in $images changes.
  8. Is PHP set up to display all errors and warnings? To do that, you can add the following to the top of your script: <?php error_reporting(E_ALL); ini_set('display_errors', 1); ?> Of course, you'll want to remove this code when you are done debugging. In the following for loop, it looks like $i is undefined: for ($i; $i < count($uname); ++$i) { Maybe try something like this: for ($i=0; $i < count($uname); ++$i) { Also, it looks like you're overwriting $i here: $i = $uname[$i]; Is that being done on purpose?
  9. Is PHP set to display all errors and warnings? To do that, you could add the following to the top of your script(s): <?php error_reporting(E_ALL); ini_set('display_errors', 1); ?> Of course, you'll want to remove this code once you're done debugging.
  10. There's even a sticky note : http://forums.phpfreaks.com/topic/273121-readme-php-resources-faqs/?do=findComment&comment=1428660
  11. No problem, glad to help!
  12. One uses curly / smart quotes. The other has straight quotes. Perhaps your server is set up differently, but when I try something like the following: <?php echo “<center>hello</center>”; ?> ...I get the following parse error:
  13. It looks like you are using smart / curly quotes. Try changing lines like this echo “<center>”; To this echo "<center>";
  14. For what it's worth: http://php.net/manual/en/faq.passwords.php#faq.passwords.fasthash
  15. Just in case you're not aware, the login query is susceptible to SQL injection attacks. You'll want to escape the values of $email and $password with mysql_real_escape_string(). More information can be found here: http://php.net/manual/en/function.mysql-real-escape-string.php Note the warning at the top about mysql_* function being deprecated. Also, it looks like you are storing passwords as plain text. You'll want to look at hashing those passwords at some point. More information can be found here: http://php.net/manual/en/faq.passwords.php
  16. Is your server set up to process .html files as PHP? If not, the page will need to be named with a .php extension.
  17. You'll want to review the documentation for the mysql_query() function: http://php.net/manual/en/function.mysql-query.php Basically, your queries should look more like the following: mysql_query("UPDATE `adocs_ar_cert` SET Current='N' WHERE AdviserCode='$aid'"); Note that I removed the dollar sign and number from the call to mysql_query(). Also note that your queries are vulnerable to SQL injection attacks. Since it looks like $aid is a string, you want to escape the value with the following function: http://php.net/manual/en/function.mysql-real-escape-string.php
  18. Perhaps this is a copy/paste issue, but your code is missing an open PHP tag. <?php //<<< missing this tag $user = JFactory::getUser(); $u = $user->username; //... Also, I would imaging the following <? $holiday['name'] ?> Should be <?= $holiday['name'] ?>
  19. Have you tried something like .tab-container #tab4 { /* your style declorations go here */ } Note that <div calss="tab-container"> Should be <div class="tab-container">
  20. If you post your existing code, we may be able to help.
  21. You could try the technique described here: http://www.cyberscorpion.com/2011-11/sorting-html-data-tables-part-2-dynamically-sort-in-ascending-and-descending-order/
  22. The link I provided earlier (http://php.net/manual/en/mysqlinfo.api.choosing.php) shows how to connect to a database with PDO, MySQLi, and MySQL.
  23. It looks like the form field names don't match the names used in the email script. Your email field, for example, is named "senderEmail". <input type="email" name="senderEmail" ... And the email script uses "email". $email = $_POST['email']; In case you're not aware, you can tell PHP to show all errors and warnings by adding the following to the top of your email script: <?php error_reporting(E_ALL); ini_set('display_errors', 1); ?> Of course you'll want to remove the error-reporting code once you're done debugging.
  24. The same goes for the </form> tag. As CroNiX suggested, pure HTML tags need to be outside of your PHP tags...or enclosed in a PHP string.
  25. My current preference for checking cookies is the Web Developer toolbar for Firefox: https://addons.mozilla.org/en-US/firefox/addon/web-developer/ It provides a quick way to view, edit, and manually remove cookies which is handy for testing. Note that the toolbar looks to be available for other browsers, but I haven't used those versions: http://chrispederick.com/work/web-developer/
×
×
  • 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.