Jump to content

atrum

Members
  • Posts

    184
  • Joined

  • Last visited

Everything posted by atrum

  1. You're missing a bunch of semi-colons at the end of your statements. Every php statement must end with a > ; <
  2. Can you describe in more detail about what you are trying to accomplish?
  3. why not just do this? array ( [0] => "http://mysite.com/filse/file.php" [1] => "http://mysite.com/files/file2.php" [2] => "http://mysite.com/files/file3.php" )
  4. This is about the most simple way I can think to explain this. <?php function add_tax ($amount) { $total = $amount * 1.09; return $total; } ?> Given the example you provided above. $total = $amount * 1.09 Lets say the $amount = 7 $total = 7 * 1.09 $total now = 7.63 return $total return when used in a function like the above poster stated makes the function = what was returned. So now add_tax (7) is equal to 7.63 Here is a another way you could use that function. $num = add_tax(7); $num2 = add_tax(2); $total = $num * $num2; echo add_tax($total); The above is just a useless example, but it illustrates a bit more on how it works.
  5. My advise is look up jquery ajax.post http://api.jquery.com/jQuery.post/ and php-json. http://www.php.net/manual/en/book.json.php Made my life easy for those types of issues.
  6. Thank you for clearing that up for me.
  7. I'll keep this short. I am making a registration class. I want to have a way to sanitize the input. I am wondering which is the best route to take on the object model. Should I make some method(s) inside of the registration class to sanitize the input, or should I create a separate class specifically for sanitation purposes? Which is better from a best practices stand point?
  8. The header runs before die, and tries to redirect to the URL. So die never runs. Also header will assume the hostname if a url is not specified. So something like this header("Location: /?p=UCP"); Should work just fine. but header("Location: ./?p=UCP"); Won't work.
  9. Good to know, thanks for the help.
  10. I have been trying to better understand how php works on a more in depth level, and recently I have been tinkering with arrays. Using print_r() I have been studying the $GLOBAL array, and I found something I can't seem to find an explanation for. In my $GLOBALS array there are variables I have set in a configuration file, but never actually made into globals. Take the following code, and its output for example. echo "<pre>"; echo print_r($GLOBALS); echo "</pre>"; The output: Array ( [GLOBALS] => Array *RECURSION* [_POST] => Array ( ) [_GET] => Array ( ) [_COOKIE] => Array ( [phpSESSID] => fai4rtfgdt6o6iaihh62d0pa15 ) [_FILES] => Array ( ) [_SERVER] => Array ( [HTTP_HOST] => DOMAIN [HTTP_USER_AGENT] => Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10 [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 [HTTP_ACCEPT_LANGUAGE] => en-us,en;q=0.5 [HTTP_ACCEPT_ENCODING] => gzip,deflate [HTTP_ACCEPT_CHARSET] => ISO-8859-1,utf-8;q=0.7,*;q=0.7 [HTTP_KEEP_ALIVE] => 115 [HTTP_CONNECTION] => keep-alive [HTTP_REFERER] => http://DOMAIN/test.php [HTTP_COOKIE] => PHPSESSID=fai4rtfgdt6o6iaihh62d0pa15 [HTTP_CACHE_CONTROL] => max-age=0 [CONTENT_TYPE] => application/x-www-form-urlencoded [CONTENT_LENGTH] => 67 [PATH] => /sbin:/usr/sbin:/bin:/usr/bin [sERVER_SIGNATURE] => [sERVER_SOFTWARE] => Apache [sERVER_NAME] => DOMAIN [sERVER_ADDR] => IPADDRESS [sERVER_PORT] => 80 [REMOTE_ADDR] => 198.65.168.24 [DOCUMENT_ROOT] => /home/USER/www/DOMAIN [sERVER_ADMIN] => webmaster@DOMAIN [sCRIPT_FILENAME] => /home/USER/www/DOMAIN/test.php [REMOTE_PORT] => 43272 [GATEWAY_INTERFACE] => CGI/1.1 [sERVER_PROTOCOL] => HTTP/1.1 [REQUEST_METHOD] => POST [QUERY_STRING] => [REQUEST_URI] => /test.php [sCRIPT_NAME] => /test.php [php_SELF] => /test.php [REQUEST_TIME] => 1286050077 ) [date] => October 2, 2010 [db_date] => 10/02/2010 [error] => Array ( ) ) 1 The 3 items at the bottom. [date] => October 2, 2010 [db_date] => 10/02/2010 [error] => Array Were set inside of a php config file. My question is, how did they end up in the $GLOBALS array?
×
×
  • 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.