wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
This is explain in the manual. However, basically it prevents users from accessing any directory by default.
-
[SOLVED] mysql_real_escape_string() issue?
wildteen88 replied to Solarpitch's topic in PHP Coding Help
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 -
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.
-
PHP not installing
wildteen88 replied to Whitestripes9805's topic in PHP Installation and Configuration
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. -
Is using the same variable name within two different functions ok?
wildteen88 replied to webref.eu's topic in PHP Coding Help
yes that is fine. Functions have their own variable scope. -
no php file entension in the URL...how?
wildteen88 replied to TempleDMDKrazd's topic in PHP Coding Help
This is achieved by using mod_rewrite. -
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.
-
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.
-
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
-
$_GET['name'] and $_GET['fields'] should be $_POST['name'] and $_POST['fields']
-
Try to clear your browsers cache, or try a hard refresh (Ctrl-F5). Make sure you have changed the changes to the correct file.
-
Thats why I suggested jithavijayan to read up on HTTP Headers, so s/he knew what the commands meant.
-
That just tells the browser what data type to expect, in this case XML.
-
Date Format - Mon Jul 28 04:16:22 +0000 2008 - What is this?
wildteen88 replied to JSHINER's topic in PHP Coding Help
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. -
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.
-
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; }
-
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);
-
You'll need to understand regex in order to use any of the ereg_* or preg_* functions. Here are some resources on regex
-
Globalizing variables inside of a function
wildteen88 replied to Goldeneye's topic in PHP Coding Help
The variables Goldeneye wants to be global are defined in the function, so pass by reference wont work. -
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 }
-
Globalizing variables inside of a function
wildteen88 replied to Goldeneye's topic in PHP Coding Help
$_GET is a global variable, so why not use that. Or use return instead. -
You'll have to use regex for that. Check out the regex forum for similar posts.
-
[SOLVED] Formatting a date other than today's?
wildteen88 replied to kernelgpf's topic in PHP Coding Help
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); -
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
-
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.