Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. Your scripts should still work fine if you upgrade PHP to the latest version of PHP4. Keep a backup copy of your current PHP configuration (php.ini) before upgrading. Once PHP is upgraded replace the new php.ini with your old version. Your PHP setup should now be the same (before the upgrade) and your scripts should still work. NOTE: Before upgrading PHP make sure you remove all existing PHP related libraries/files (.dll or .so files) from your hard drive. This will help to minimise problems when installing a newer version of PHP. If your scripts fail to work then you will need to get down and dirty to sort out the problems. There shouldn't be too much work involved though. Depends on the size of the script and how it was coded.
  2. If you use FF then perhaps consider installing the HTML Validator extension. I believe you can use it offline. Alternatively you could read this guide for installing the W3C Validator on your PC (Windows).
  3. When you change the DocumentRoot you will also have to change the main <Directory /></Directory> directive too (this should be located a few lines down from where you set DocumentRoot.
  4. How are you running the php script in the browser? Make sure you wamp is running and you are going to http://locahost/ to run your script. Also make sure you save your script in C:/wamp/www/ (change the to path of where WAMP is installed to). You can not run your PHP scripts directly through the browser, like you can with HTML files for example.
  5. When you run that script right click and select view source, do you see your PHP source code? If you do then either WAMP is not configured correctly or you are not using the write file extension in order for WAMP to parse your PHP scripts. I can confirm its a configuration issue as if I change the start php tag (<?php) to <? I get bar(); ?>. If I enabled short_open_tags then the code words as expected.
  6. Have a read of the References documentation here. In PHP5 $val =& new val(); is the same as $val = new val();
  7. Did I not explain that above?
  8. W3C is the only validator I know off. However I do know some HTML editors do have inbuilt HTML/CSS validators however they are not the same as W3C's. You should always validate your html/css using W3C's online validators.
  9. If you have installed wamp from wampserver.com then not really, it'll probably is possible but not easy as Uninstall/Reinstall Apache. This is why I always install AMP (Apache, PHP and MySQL) manually. This allows you to upgrade a component without having to wait for a newer distribution of WAMP (or whatever your pre-configured package is) to come available.
  10. use substr prehaps? or preg_match for more search power
  11. Not all browsers send the referral url. Perhaps IE uses a different variable for sending the referral url.
  12. When you return a variable from a function, it will not mean that you can use that function outside of the function. Instead what will happen is PHP will return the value of that variable. In order to catch to the returned value you will need to assign your function to variable, eg: $myvar = check_duplicate(); $myvar will hold the value returned from the that function. So in order to use $row_league outside of the function change this line: if (check_duplicate()) { // is it TRUE, uh OH ! YES! Better make them aware! To: if ($row_leagues = check_duplicate()) { // is it TRUE, uh OH ! YES! Better make them aware! Now you should be able to use $row_leagues outside of the function.
  13. I'm sure there is an inbuilt setting for this within FF itself. However I use an extension called Tabbed Browser Preferences which gives you much more control over how tabs behave compared to FF's very few standard options.
  14. Doesn't DW already have this? I know in Dreamweaver 8 in the Files Panel there was a tab called snippets where can add your code snippets as well as define a shortcut for that code snippet. I assume CS3 has this.
  15. These are used when echo'ing an array within a string. Without those braces PHP will get confused. You can add these into code to help PHP out.
  16. Changed your code: <?php // if there is a cookie redirect to required page if(isset($_COOKIE['user']) && !empty($_COOKIE['user'])) { header('Location: http://admin.fsma.co.uk/login2.php'); echo "cookie set"; exit; } // login elseif(isset($_GET['action']) && $_GET['action'] == "Login") { // check if username field is field in. If it doesn't set an error message if(!isset($_POST['Username']) || empty($_POST['Username'])) { $error[] = 'Please provide a username'; } // check if passwoord field is field in if(!isset($_POST['Password']) || empty($_POST['Password'])) { $error[] = 'Please provide a password'; } // check to see if there is any validation errors from above. If there is display the errors. if(isset($error) && is_array($error)) { echo "Please correct the following errors:\n<ul>\n<li>" . implode("</li>\n<li>", $error) . "</li>\n</ul>"; include 'login.php'; exit; } // validation passed continue to login user with supplies details $user = mysql_real_escape_string($_POST['Username']); $password = md5($_POST['Password']); $refer = (isset($_POST['Refer']) && !empty($_POST['Refer'])) ? $_POST['Refer'] : 'index.php'; require 'db_connect.php'; $query = "SELECT * FROM users WHERE user='$user' AND `password`='$password'"; $result = mysql_query($query) or die("Error" . mysql_error()); if(mysql_num_rows($result) == 1) { //if login successful. set cookie & go to referrer. setcookie('user', $user); /* Expires when browser closes */ header('Location: http://' . $refer); exit; } else { // Not authenticated header('Location: http://admin.fsma.co.uk/login2.php?refer='.$refer); exit; } } // no cookie or action found else { echo 'cookie or action not found!'; } ?>
  17. Post more info about the script. Such as what is it supposed to do, whats happens when you run the script etc. Don't just dump the code on us.
  18. No only the port number. Which is port 3306. You'll need to add 192.168.0.3 to mysql's user privileges though.
  19. If your MYSQL server is located on 192.168.0.3 then you specify that ip in mysql_connect rather than localhost. Apaches doesn't need to know where MySQL is.
  20. Are you sure functions.php exists in C:\hshome\tipa-mu\mu-anime.com\ make sure you have spelt the name correctly. Also you can use relative paths in Windows boxes too. You don't have to specify absolute paths.
  21. Helps if you use valid html. The html is sloppy and I am not surprised it doesn't work.
  22. Just use /[^0-9]/ as the pattern. That expression means match (replace) all non numeric characters.
  23. I'd do it this way: // setup the counter $i = 0; $max_i = mysql_num_rows($sqlresult); while ($row = mysql_fetch_assoc($sqlresult)) { // first if($i == 0) { echo '<b>' . $row['value'] . "</b><br>\n"; } // not last or the first elseif($i < $max) { echo '<i>' . $row['value'] . "</i><br>\n"; } // last else { echo '<u>' . $row['value'] . "</u><br>\n"; } // increment counter $i++; } EDIT: Nevermind beaten to it.
  24. No not really. The browser doesn't pass the type of field the data has come from. All data entered in a form is treated as text.
  25. If you searched this forum with that error message you would of gotten the answer adam291086 has just came up with. There is even a sticky titled as the error message you are getting within the PHP Help board!
×
×
  • 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.