Jump to content

jparker

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jparker's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. My question is that I have written an uploader with PHP 4.3 but it is incredibly slow i.e. 19mb file took about 45 minutes to upload.  Is this down to the release of php or are there common gotchas when uploading large files that I should be aware of. The server which my site is hosted on has an issue updating to the latest release of PHP but if this will sort any known bug then I am happy to pursue this option first before rewriting anything. I have noticed on the php site under Bug #13094 that there was a bug for earlier versions that should have been fixed in version 4.2. Can anyone help? Thanks J
  2. I have simplified the scripts further I have a script called testcookie.php which I have the following code in <?php // Create a session brower cookie (0: denotes deletion on browser closure) setcookie ("username", "jparker", 0); if(isset($_COOKIE["username"])) { echo $_COOKIE["username"] ; } else { echo "Cookie not set"; } ?> The first time I open the page I get "Cookie not set" and then when I refresh I get "jparker" so this is working fine. If I then navigate to testcookie1.php in the same browser which has the following code : - <?php if(isset($_COOKIE["username"])) { echo $_COOKIE["username"] ; } else { echo "Cookie not set"; } ?> I get "Cookie not set" rather than the "jparker" which was set on the previous page. the problem is not so much that it doesn't hold a cookie value but it doesn't take the value to another page. Is this a common problem or am I doing something really stupid? JP
  3. sorry I'll elaborate I am setting a cookie on a login script (index.php) with the following code : - while($row=mysql_fetch_array($result)){ setcookie ("username", $row["username"], time()+604800); setcookie ("userid", $row["urn"], time()+604800); } As this is successful login I am then redirecting using the following code to redirect to the home page print "<script language=\"JavaScript\">"; print "window.location = 'home.php' "; print "</script>"; then once in the home.php page I am simply trying to display the name to welcome the user : - Hello and welcome <?php echo $_COOKIE["username"] ?> As I said this works fine under Apache and Php on windows yet on Apache for linux all that is displayed is "Hello and welcome" as the cookie holds no value. In edition if I run the following code on the home.php page <?php echo $_COOKIE["username"]."<BR>"; echo $HTTP_COOKIE_VARS["username"]."<BR>"; // Another way to debug/test is to view all cookies print_r($_COOKIE); ?> I get the following output : - Array ( [PHPSESSID] => 686b88e663c215f4d150fbaf620df7ee ) whereby the first two statements are blank Your help would be appreciated James
  4. Hello I'm having a problem with cookies now that I have moved my code to the production server. I have set the cookies with setcookie ("username", $row["username"], time()+604800); setcookie ("userid", $row["urn"], time()+604800); and retrieve with <?php echo $_COOKIE["username"] ?> which works fine with Apache and PHP for windows. If I move it to my production server which is Apache it doesn't work. I can't update the version of either Apache (API Version: 20020903) or PHP (Version: 4.3.10) so is it possible to get round this problem or do I have to think of using sessions or even worse javascript cookies. Your help would be much appreciated James
  5. Thanks very much it has worked now. Having seen $HTTP_COOKIE_VARS in examples for retrieving cookies is this now obsolete? James
  6. Hello I have 2 very simple scripts that sets and then gets a cookie to test to see all is working The set script below seems to run without problems : - <?php setcookie ("user", "jparker", time()+604800); ?> the get script below however doesn't work and creates an error in the apache log <?php $user = $HTTP_COOKIE_VARS["user"]; echo "Hello ".$user; ?> The error is : - [client 127.0.0.1] PHP Notice: Undefined variable: HTTP_COOKIE_VARS get.php on line 2 Could you possible point me in the right direction on how to solve this. I'm guessing its a PHP/Apache configuration issue Thanks James
  7. Hello I'm trying to get php to work with mysql. If I log onto mysql with my credentials I can look at the database and so some commands. If I attempt to do the same in php via a script : - <?php $link = mysql_connect('localhost', 'james', 'password'); if (!$link) { print('Could not connect: ' . mysql_error()); exit; } echo 'Connected successfully'; mysql_close($link); ?> I don't get to see the success message but neither do I get the error message. Could someone please spread some light on this as I have a long way to go on my php/mysql journey and this is depressingly early roadblock. James
×
×
  • 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.