-
Posts
3,145 -
Joined
-
Last visited
-
Days Won
37
Everything posted by cyberRobot
-
Are both of the pages hosted on the same server?
-
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']);
-
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;
-
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.
-
Perhaps the following will help: http://php.net/manual/en/language.operators.comparison.php
-
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.
-
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.
-
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?
- 4 replies
-
- php app
- calculations
-
(and 1 more)
Tagged with:
-
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.
-
No problem, glad to help!
-
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:
-
It looks like you are using smart / curly quotes. Try changing lines like this echo “<center>”; To this echo "<center>";
-
SHA1 password + salt problem - passwords not matching
cyberRobot replied to Jax2's topic in PHP Coding Help
For what it's worth: http://php.net/manual/en/faq.passwords.php#faq.passwords.fasthash -
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
-
Is your server set up to process .html files as PHP? If not, the page will need to be named with a .php extension.
-
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
-
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'] ?>
-
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">
-
If you post your existing code, we may be able to help.
-
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/
-
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.
-
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.
-
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.
-
Madly new to PHP and a noob in need of discussion and help!
cyberRobot replied to achan99's topic in PHP Coding Help
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/