Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. This is explain in the manual. However, basically it prevents users from accessing any directory by default.
  2. myql_real_escape_string escapes harmful characters in a string, this function requires a connection to mysql as the escaping is handled by MySQL rather than PHP
  3. You assign the message for your email in the $message variable, however on this line: mail($to,$subject,$emailmessage,$headers); You're using a variable called $emailmessage, which doesn't exist and thus your code doesn't work.
  4. That article assumes you already have a server setup and is configured with PHP. When installing Apache and PHP always install Apache first followed by PHP. However, it is much easier to install PHP without the installer, just download the zipped binaries package instead from php.net and extract the contents of the zip to C:\php Once You have Apache and PHP installed, Apache will need to be configured with PHP. To do so first add PHP to the PATH Environment Variable. Then open Apache's httpd.conf file and add the following lines LoadModule php5_module "C:/php/php5apache2_2.dll" PHPIniDir "C:/php" AddType application/x-httpd-php .php Save the httpd.conf and restart Apache. That's it Apache and PHP are now ready to use. Save all your php files in Apaches htdocs folder and go to http://localhost to run them.
  5. yes that is fine. Functions have their own variable scope.
  6. This is achieved by using mod_rewrite.
  7. You can only use PHP code within .php files, not .html files. However if you have access to your servers configuration, then you can configure the server so it parses .html files as PHP. If not, then there is no other option to have php code running in .html files. If you are concerned with having to change all your links from path/file.html to path/file.php then don't worry, you can use mod_rewrite. This option will save you from having to change your links, here is an example: RewriteRule ^(.*)\.html$ $1.php [L] With the above any request for a file called filename.html will call filename.php instead.
  8. Use $_SERVER['DOCUMENT_ROOT'] instead. set_include_path is not what you need. Eg: include $_SERVER['DOCUMENT_ROOT'] . '/hypheader.php' PHP will always include hypheader.php from the root of your website, no matter how far down the directory tree the include command is taking place.
  9. Depends on the browser you use, I use Firefox, to clear the cache I go to Tools > Clear Private Data. On IE you go to Tools > Internet Options > Browsing History
  10. $_GET['name'] and $_GET['fields'] should be $_POST['name'] and $_POST['fields']
  11. Try to clear your browsers cache, or try a hard refresh (Ctrl-F5). Make sure you have changed the changes to the correct file.
  12. Thats why I suggested jithavijayan to read up on HTTP Headers, so s/he knew what the commands meant.
  13. That just tells the browser what data type to expect, in this case XML.
  14. Where are you running the code from? From your website? If so, the server your site is hosted on is most probably in a different timezone than you. The date/time PHP outputs is in relation to the servers timezone.
  15. That code is used to prevent a web browser from caching the requested page. In order to understanding the code, you'll need to read up on HTTP Headers.
  16. It would be better if this is handled by PHP instead, what you want to do doesn't require a redirect. // check 'page' is set in to the url if(isset($_GET['page']) && is_numeric($_GET['page'])) { // set $page variable $page = $_GET['page']; } else { // set page to 1 by default. $page = 1; }
  17. wildteen88

    How

    I'm no regex expert so cant give you any feedback on the efficiency of your regex. However you could modify you regex abit so it finds tags automatically, like: function get_info($content) { $content = preg_replace('@\{([a-z]+)\}(.+)\{\/\1\}@is', "$1 = $2<br />", $content); return $content; } $str = '{title}lala{/title} {body}hello world{/body}'; echo get_info($str);
  18. wildteen88

    How

    You'll need to understand regex in order to use any of the ereg_* or preg_* functions. Here are some resources on regex
  19. The variables Goldeneye wants to be global are defined in the function, so pass by reference wont work.
  20. Use $_GET['id'] to grab if from the url, then use the comparison operator (==) to see if it matches your internal id if(isset($_GET['id']) && is_numeric($_GET['id'])) { $id = $_GET['id']; if($id == '1234') { // match } else { // no match } } else { // invalid id }
  21. $_GET is a global variable, so why not use that. Or use return instead.
  22. wildteen88

    How

    You'll have to use regex for that. Check out the regex forum for similar posts.
  23. Alternatively Convert the the date to a unix timestamp (using strtotime()), then use date() like so: $date = '12/09/2008'; $utime = strtotime($date); echo date('S', $utime);
  24. Again this is down to HTML (and CSS) not PHP. To apply a background color to an HTML element on a page with CSS do: <style type="text/css"> /* CSS syntax html_tag_name { attribute: value }*/ /* REAL EXAMPLE */ form { background-color: #FFCC00; } The above CSS will give your form an orange background color. There are many CSS tutorials onlines, have a look at the tutorials over at w3school.com
  25. I believe other languages abide by this rule, such as Perl. Its not just PHP. EDIT: A Heredoc article. Its pretty much a standard thing for the closing delimiter be on its own.
×
×
  • 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.