Jump to content

pendelton

Members
  • Posts

    20
  • Joined

  • Last visited

    Never

Everything posted by pendelton

  1. Thanks. I worked out that it was a pre-defined constant that has been sneaked in between PHP 4 and PHP 5. What I was wondering was what its strange value means.
  2. The follownig code works as expected in PHP 4, but not as expected in PHP 5.1.2. I have just been baffled for hours wondering why the following code prints "262145" instead of the UK pound sign. [code] define(CURRENCY_SYMBOL, '£'); print CURRENCY_SYMBOL; [/code] Initially I thought that I had got my HTML code '£' mixed up. Then I eventually tried the following which also prints 262145. [code] define(CURRENCY_SYMBOL, 'hello'); print CURRENCY_SYMBOL; [/code] If I use CURRENCY_SYMBOL_1 for the define then everything works as expected. It seems that CURRENCY_SYMBOL must be defined in PHP's core somewhere and also their is no way to override its value (not that I want to now that I know what is going on). Can anyone tell me what CURRENCY_SYMBOL is, and why its value is 262145 (at least on my server with my local)?
  3. Some additional basic coding standards would help you find these problems much quicker. 1. Indent you nested latin braces (using tabs), e.g. [code] foreach ($_POST as $key => $value) {   $value = urlencode(stripslashes($value));   $req .= "&$key=$value"; } [/code] (see how the opening and closing braces now match up?) 2. Don't spread open quotes over mutiple lines, e.g. [code] $message = "Hello,\nCongratulations!\nYou have won auction ....\nBest Regards"; [/code] You will probably find that you are missing a quote ", a latin brace "}" or a beacket ")".
  4. Call me stupid, but what's a vav function?  ???
  5. I assume that the timezone on you machine is not central time US? If it is then you don't need the putenv. However, the server isn't using central US time you will need to write to code as follows: Use [code] <? putenv("TZ=US"); print date("h:i:s"); ?> [/code] Try the above then chage "TZ=US" to "TZ=GB" (TZ stands for timezone).
  6. Are you saying that you echo doesn't work when you output the content of a file? If so, don't forget that you are viewing it via HTML which will format the output (or at least probably get confused by some of your file format). Get your echo to echo's the file content that doesn't quite work then do view source on the page. You should find that it is all there in the source but isn't all displayed as you expect in the broweser.
  7. I am a little confused by your question. What exactly are you trying to acheive with this symbolic link? Is this a PHP question?
  8. date("h:i:s"); Use putenv("TZ=GB"); to set your timezone (you will need to replace GB with UST or similar).
  9. You will need to use fopen and fwrite - see the PHP manual. The folder that you want the files to be creating in will need to be writeable. This may be a security risk as it will allow anyone to write anything to this folder.
  10. Does the file already exist and is the file/folder on the server writeable? Also, try setting $done to a simple string like "hello" until you get things working.
  11. I have just had an idea. I don't think that your second server is interpreting the file as PHP, it's just displaying the code as HTML. I assume that you aren't missing the <? ?> around your code and you are using a sensible file name extension like ".php"? If so, you need to check your server setup to ensure that it is including PHP correctly and that the PHP file extensions are defined in the config files correctly.
  12. Can you provide the code for the complete file or at least several lines before and after the echo " My name is $var1. My favorite color is  $var2.";?
  13. Try $query = "UPDATE uploads SET shown = 'y', showing = 'y' WHERE file_name = '{$row[0]}'";
  14. You could use a callback function and multiple curl_exec if you don't want to use multi_init. E.g. $hCurl = curl_init(); curl_setopt($hCurl, CURLOPT_WRITEFUNCTION, 'TransactionResultCallback'); $Output = curl_exec($hCurl); $hCurl2 = curl_init(); curl_setopt($hCurl2, CURLOPT_WRITEFUNCTION, 'TransactionResultCallback2'); $Output = curl_exec($hCurl2); You will probably need to use a global variable to store the returned string in your callback functions.
  15. Have you tried using phpmyadmin to see what is going on?
  16. Can you add the following lines to you code: print "var1 = ".$var1.", var2 = ".$var2."<BR>\n"; (make sure that the $var1 and $var2 are not in quotes). What's the output on the 2 machines?
  17. What are you trying to acheive with you multiple cURL sessions?
  18. If you write the e-mail to the page in its standard format then the spam bots will also read it. You could write code to output the e-mail address as an image using the PHP image processing and creation functions.
  19. Try adding the following lines: After the line $query = "SELECT file_name FROM uploads... Add print "1. $query<BR>\n"; After the line $query = "UPDATE uploads... Add print "2. $query<BR>\n"; Let me know what prints out.
  20. This problem has been driving me mad for the past 13 hours. I have php 4 on an existing server and php 5.1.2 on a new server (which I am trying to migrate to). The below test code works fine on php 4, but fails with "Fatal error: Cannot redeclare class..." with php 5. The error only occurs for classes that use extends. Is there a bug in php 5? Has it been fixed in a later version (not that my SUSE server will let me install a later version despite trying for hours). Can someone please help or at least test this out for my on other versions of PHP? You will need 3 simple files to reproduce this problem. I know that the double include in test.php doesn’t make immediate sense but it simulates multiple includes from different file in a php project that contains over 2,000 files (remember, this all works fine on php 4). If you take out the "extends CTest3" from test2.inc and it works fine on PHP5. File 1: test.php <? require "test2.inc"; require "test2.inc"; ?> File 2: test2.inc <? if (defined("CTEST2")) return; define("CTEST2", 1); require "test3.inc"; class CTest2 extends CTest3 { function CTest2() { print "Test2"; } } ?> File 3: “test3.inc” <? if (defined("CTEST3")) return; define("CTEST3", 1); class CTest3 { function CTest3() { print "Test3"; } } ?>
×
×
  • 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.