php-general Digest 4 Feb 2008 02:20:23 -0000 Issue 5273

Topics (messages 268590 through 268610):

Re: Server to client file transfer with authorization: file always corrupt
        268590 by: szalinski

Re: php competion
        268591 by: pobox.verysmall.org
        268593 by: Paul Scott
        268595 by: Robert Cummings

Re: flash with PHP
        268592 by: pobox.verysmall.org
        268598 by: Casey
        268601 by: Alain Roger
        268605 by: Casey

Re: Timeout while waiting for a server->client transfer to start (large files)
        268594 by: szalinski

Resetting a session variable
        268596 by: Ron Piggott
        268597 by: Per Jessen
        268600 by: Casey
        268602 by: Bastien Koert
        268603 by: Richard Heyes
        268606 by: Feris Thia C.
        268610 by: chetan rane

Re: Jacco van Hooren
        268599 by: Casey

Re: how to make multiple website on one host
        268604 by: Feris Thia C.
        268608 by: jeffry s

Re: how dod you get to do multiple mysql queries        concurrently?
        268607 by: Jochem Maas

about preg_replace, please help !
        268609 by: LKSunny

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message --- On Sat, 02 Feb 2008 23:08:43 -0000, Nathan Rixham <[EMAIL PROTECTED]> wrote:

szalinski wrote:
Hi
 I am having trouble with a file transfer script, as you can see, I am
trying trying to keep the code as simple as possible.
But everytime I download a file with it, it is corrupt. For example, when
I download a small .rar file, just to test, it is always corrupt
('Unexpected end of archive'). I also cleared my browser cache just to be
sure, but same problem.
 I just can't get my head around why it wouldn't be working as it is...
 A couple of questions:
 Have I got too many header requests?
Do I need to worry about output buffering, which is possibly corrupting
the file output (if so, please tell me what to do!)?
Is there an easier way to get returned response header and get a
redirected link, instead of finding and cutting strings?
Is there maybe something wrong with the structure or order of the header
requests, and/or returned headers etc?
 Here is what I have so far:
 <?php
 //ob_start();
//ob_end_flush();
//ob_implicit_flush(TRUE);
 $rslogin = '';
$rspass = '';
$link = addslashes(trim($_POST['link']));
 function cut_str($str, $left, $right)
  {
  $str = substr(stristr($str, $left), strlen($left));
  $leftLen = strlen(stristr($str, $right));
  $leftLen = $leftLen ? -($leftLen) : strlen($str);
  $str = substr($str, 0, $leftLen);
  return $str;
  }
 // Get the full premium link, and store it in $full_link after the
redirect. *Surely* there is an easier way to get redirections?
 if(strlen($link)>0)
{
    $url = @parse_url($link);
    $fp = @fsockopen($url['host'], 80, $errno, $errstr);
    if (!$fp)
        {
$errormsg = "Error: <b>$errstr</b>, please try again later.";
            echo $errormsg;
            exit;
        }
$vars = "dl.start=PREMIUM&uri={$url['path']}&directstart=1";
            $out = "POST {$url['path']} HTTP/1.1\r\n";
            $out .= "Host: {$url['host']}\r\n";
$out .= "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows
NT 5.1)\r\n";
            $out .= "Authorization: Basic
".base64_encode("{$rslogin}:{$rspass}")."\r\n";
$out .= "Content-Type: application/x-www-form-urlencoded\r\n";
            $out .= "Content-Length: ".strlen($vars)."\r\n";
            $out .= "Connection: Close\r\n\r\n";
            fwrite($fp, $out);
            fwrite($fp, $out.$vars);
            while (!feof($fp))
            {
            $string .= fgets($fp, 256);
            }
             //Tell us what data is returned
             //print($string);
            @fclose($fp);
             if (stristr($string, "Location:"))
            {
                $redirect = trim(cut_str($string, "Location:", "\n"));
                $full_link = addslashes(trim($redirect));
            }
 //print($string);
//print("<html><body><h1>".$full_link."</h1>");
   if ($full_link)
     {
     //    Get info about the file we want to download:
         $furl = parse_url($full_link);
        $fvars = "dl.start=PREMIUM&uri={$furl['path']}&directstart=1";
        $head = "Host: {$furl['host']}\r\n";
$head .= "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT
5.1)\r\n";
        $head .= "Authorization: Basic
".base64_encode("{$rslogin}:{$rspass}")."\r\n";
        $head .= "Content-Type: application/x-www-form-urlencoded\r\n";
        $head .= "Content-Length: ".strlen($fvars)."\r\n";
        $head .= "Connection: close\r\n\r\n";
        $fp = @fsockopen($furl['host'], 80, $errno, $errstr);
        if (!$fp)
        {
echo "The script says <b>$errstr</b>, please try again later.";
            exit;
        }
        fwrite($fp, "POST {$furl['path']}  HTTP/1.1\r\n");
        fwrite($fp, $head.$fvars);
        while (!feof($fp))
        {
//Keep reading the info until we get the filename and size from
the returned Header - is there no easy way
//of doing this? I also don't like the way I have to 'find' the
redirected link (above).??
            $tmp .= fgets($fp, 256);
            $d = explode("\r\n\r\n", $tmp);
             // I tried changing this to if ($d), { etc..,  (instead of
$d[1]) and the download of the rar file *wasn't* corrupt, it just had a
filetype of x-rar-compressed instead of
            //application/octet-stream, and the filesize was 'unknown' -
now this is just confusing me...!  So i think (and guess) the problem of
the file corruption is here,
            //because it must add some data to the filestream which
corrupts it. Darn.
            if($d[1])
            {
                preg_match("#filename=(.+?)\n#", $tmp, $fname);
                preg_match("#Content-Length: (.+?)\n#", $tmp, $fsize);
                $h['filename'] = $fname[1] != "" ? $fname[1] :
basename($furl['path']);
                $h['fsize'] = $fsize[1];
                break;
            }
 }
        @fclose($fp);
         $filename = $h['filename'];
        $fsize = $h['fsize'];
 //Now automatically download the file:
         @header("Cache-Control:");
        @header("Cache-Control: public");
        @header("Content-Type: application/octet-stream");
        @header("Content-Disposition: attachment; filename=".$filename);
        @header("Accept-Ranges: bytes");
        if(isset($_SERVER['HTTP_RANGE']))
        {
            list($a, $range)=explode("=",$_SERVER['HTTP_RANGE']);
            $range = str_replace("-", "", $range);
            $new_length = $fsize - $range;
            @header("HTTP/1.1 206 Partial Content");
            @header("Content-Length: $new_length");
        }
        else
        {
            @header("Content-Length: ".$fsize);
        }
        $f2vars = "dl.start=PREMIUM&uri={$furl['path']}&directstart=1";
        $head2 = "Host: {$furl['host']}\r\n";
$head2 .= "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows
NT 5.1)\r\n";
        $head2 .= "Authorization: Basic
".base64_encode("{$rslogin}:{$rspass}")."\r\n";
        $head2 .= "Content-Type: application/x-www-form-urlencoded\r\n";
        if($range != "") $head2 .= "Range: bytes={$range}-\r\n";
        $head2 .= "Content-Length: ".strlen($fvars)."\r\n";
        $head2 .= "Connection: close\r\n\r\n";
        $fp = @fsockopen($furl['host'], 80, $errno, $errstr);
        if (!$fp)
        {
            echo "<span style='color:#688000; background-color:#BBDB54;
font-size : 10pt; text-decoration: none; font-family: Trebuchet MS;'>The
script says <b>$errstr</b>, please try again later.</span>";
            exit;
        }
        @stream_set_timeout($fp, 120);
        fwrite($fp, "POST {$furl['path']}  HTTP/1.1\r\n");
        fwrite($fp, $head2.$f2vars);
        fflush($fp);
        while (!feof($fp))
        {
            $download = fread($fp, 2048);
            echo $download;
            //ob_flush(); //php.net suggestion
        }
 //These two buggers were here originally, but I don't even know if I am
supposed to have them here.
         flush();
         ob_flush();
       @fclose($fp);
        exit;
     }
  }
else
{
        $data = "<form method=\"post\">\n";
        $data .= "<input type=\"text\" id=\"link\"
style=\"text-align:center\" name=\"link\" size=\"60\"
onfocus=\"if(this.value=='Enter rapidshare.com URL
here'){this.value=''}\">\n";
$data .= "<br><input type=\"submit\" value=\"Download\"></form>";
        echo $data;
}
?>
 Thanks to anyone who has already helped, I hope some genius can spot an
obvious error, because this is just beyond me!
 :)

I'd be correct in assuming that you have opened up the download in a text browser to see what you've actually recieved yes?

first thing to check... your doing a fsockopen, and posting a raw http request, meaning your getting a raw http response back, which you're echoing straight out, so you should expect to have full http headers and quite possibly http chunked content, rather than a nice file..

use file_get_contents with a stream_context holding all your http request headers instead, as an easy way around it.

or check out the http class, or use zends http class, or create a quick chunk decoder - whichever you do, first step is to actually check the raw content and verify it's not just a raw http response :)

Nathan

Thanks for the reply, Nathan

I actually have since found more about this 'erroneous' output; the script is outputting response headers as part of the file I download!, and also seems to chop a bit off the end of the file (checking with a text file, of course!) So I will try to do what you suggest - thanks for the help. If anyone has any suggestions on a chunk decoder, or maybe a quick example of file_get_contents() with a stream context, feel free... :)
--- End Message ---
--- Begin Message ---
doc wrote:
come on people try you skills at
http://www.rhwebhosting.com/comp/index.php

Are these people joking ;o)

This sounds more like "hey, give us 4-5 great products for free, and we may award you" ;o)

I thought competitions usually give some more or less "abstract" tasks, where people can show how well they master the language, like - "do this with less than 15 lines of code".

But "redesign our web site",... it's funny ;o)

Iv

--- End Message ---
--- Begin Message ---
On Sun, 2008-02-03 at 20:10 +1100, doc wrote:
> come on people try you skills at 
> 
> http://www.rhwebhosting.com/comp/index.php

Reworded as:

Redesign our complete web presence and give us a couple of apps that we can 
flog to our clients,
and we *may* give you a consolation prize.

Yeah right.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

--- End Message ---
--- Begin Message ---
On Sun, 2008-02-03 at 18:15 +0200, Paul Scott wrote:
> On Sun, 2008-02-03 at 20:10 +1100, doc wrote:
> > come on people try you skills at 
> > 
> > http://www.rhwebhosting.com/comp/index.php
> 
> Reworded as:
> 
> Redesign our complete web presence and give us a couple of apps that we can 
> flog to our clients,
> and we *may* give you a consolation prize.

So not worth the time and effort. Any person capable of doing the code
conversion (to AT LEAST C, Python, and Perl nonetheless) is smart enough
to know the potential payoff is worse than flipping burger and
McGeneric's.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
Alain Roger wrote:
Hi,

i would like to have a flash menu in my PHP website.
this is no problem.

My problem is how to exchange data between PHP andFlash (in both direction).
i found a lot of posts on this theme, but nothing with really works under
ActionScript 3 and PHP.

does anyone already solved such topic ?

thx.

I researched this some time ago...

You can pass parameters to flash movie in ONE of the parameters it accepts (don't remember which one, but you can find out). This means, you can't pass each parameter separately, but you have to pack them, somehow (not sure what separators are allowed) and then unpack them inside the movie.

As to passing parameters from the flash movie to the php - basically if people can click inside the movie, you can perhaps send GET or POST requests back to the server, which your php can interpret.

Iv

--- End Message ---
--- Begin Message ---
On Feb 3, 2008, at 12:23 AM, "Alain Roger" <[EMAIL PROTECTED]> wrote:

> Hi,
>
> i would like to have a flash menu in my PHP website.
> this is no problem.
>
> My problem is how to exchange data between PHP andFlash (in both
> direction).
> i found a lot of posts on this theme, but nothing with really works
> under
> ActionScript 3 and PHP.
>
> does anyone already solved such topic ?
>
> thx.
>
> --
> Alain
> ------------------------------------
> Windows XP SP2
> PostgreSQL 8.2.4 / MS SQL server 2005
> Apache 2.2.4
> PHP 5.2.4
> C# 2005-2008

var loadvars = new LoadVars();

http://www.google.com/search?q=loadvars

--- End Message ---
--- Begin Message ---
this is right under actionscript 2.0... i'm working under actionscript 3.0
 :-)

On Feb 3, 2008 7:28 PM, Casey <[EMAIL PROTECTED]> wrote:

> On Feb 3, 2008, at 12:23 AM, "Alain Roger" <[EMAIL PROTECTED]> wrote:
>
> > Hi,
> >
> > i would like to have a flash menu in my PHP website.
> > this is no problem.
> >
> > My problem is how to exchange data between PHP andFlash (in both
> > direction).
> > i found a lot of posts on this theme, but nothing with really works
> > under
> > ActionScript 3 and PHP.
> >
> > does anyone already solved such topic ?
> >
> > thx.
> >
> > --
> > Alain
> > ------------------------------------
> > Windows XP SP2
> > PostgreSQL 8.2.4 / MS SQL server 2005
> > Apache 2.2.4
> > PHP 5.2.4
> > C# 2005-2008
>
> var loadvars = new LoadVars();
>
> http://www.google.com/search?q=loadvars
>



-- 
Alain
------------------------------------
Windows XP SP2
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008

--- End Message ---
--- Begin Message ---
On Feb 3, 2008 10:44 AM, Alain Roger <[EMAIL PROTECTED]> wrote:
> this is right under actionscript 2.0... i'm working under actionscript 3.0
>  :-)
>
>
>
> On Feb 3, 2008 7:28 PM, Casey <[EMAIL PROTECTED]> wrote:
>
> > On Feb 3, 2008, at 12:23 AM, "Alain Roger" <[EMAIL PROTECTED]> wrote:
> >
> > > Hi,
> > >
> > > i would like to have a flash menu in my PHP website.
> > > this is no problem.
> > >
> > > My problem is how to exchange data between PHP andFlash (in both
> > > direction).
> > > i found a lot of posts on this theme, but nothing with really works
> > > under
> > > ActionScript 3 and PHP.
> > >
> > > does anyone already solved such topic ?
> > >
> > > thx.
> > >
> > > --
> > > Alain
> > > ------------------------------------
> > > Windows XP SP2
> > > PostgreSQL 8.2.4 / MS SQL server 2005
> > > Apache 2.2.4
> > > PHP 5.2.4
> > > C# 2005-2008
> >
> > var loadvars = new LoadVars();
> >
> > http://www.google.com/search?q=loadvars
> >
>
>
>
> --
>
>
> Alain
> ------------------------------------
> Windows XP SP2
> PostgreSQL 8.2.4 / MS SQL server 2005
> Apache 2.2.4
> PHP 5.2.4
> C# 2005-2008


Does this work?
http://www.peterelst.com/blog/2007/11/28/actionscript-30-wheres-my-loadvars/
-- 
-Casey

--- End Message ---
--- Begin Message ---
Thanks

I have already another post dealing with this issue. (check newsgroup for Server to client file transfer always corrupt).

I had figured out the problem that was corrupting the file, it is the response headers that are being added to the file when it is downloaded, and i don't know how to trim them. I am using a different trim method i 'borrowed' from another script (where it seems to work perfectly!), and I just can't understand why it won't work for me, unless as u say, there are other errors being output, but I have looked at the text file and I don't see anything other than the headers there. When I use the trim script to remove them, it also seems to remove part of the start and end of the text file.

I think the most annoying aspect of whole thing is why it is so difficult to find a solution to this problem, i'm sure other people must have come across this problem?

thanks again :)

On Sun, 03 Feb 2008 16:28:34 -0000, Richard Lynch <[EMAIL PROTECTED]> wrote:

You can use filesize() to get the file size...
http://php.net/filesize

If that's not going to work because you are stripping out part of the
file, or something, Use fgets to get the header info, and then use
fseek to reset the file pointer to the beginning:
http://php.net/fseek
<?php fseek($file, 0);?>

You can then read as much or as little as you like with fread.

As far as the corrupt files go, compare what you got with the download
and the original in a text editor or a hex editor to see what
happened.

You might have some PHP warnings or notices at the front of the file,
or at the end, messing the file contents up.

On Thu, January 31, 2008 12:11 pm, szalinski wrote:
On Thu, 31 Jan 2008 00:02:55 -0000, Richard Lynch <[EMAIL PROTECTED]>
wrote:

<snip>


Hello Richard

Well, thank you for pointing that out to me! I was actually trying to
read
it into RAM, but that was a silly mistake.

But now I have the problem that, even though you are correct, the
problem
seems to still remain, in the sense that I actually *need* to read the
start of the file just to get the header info (so i can retrieve the
Content-Length, and the filename).
Since I tried your method above, I thought I had got the script to
finally
work - which it seemed to - but every file I download with it is
corrupt.
I tried downloading a WinRAR file, and I get 'unexpected end of
archive'.
:( I know for a fact that the archive itself is NOT corrupt, because I
tried it with various different files and all of them ended up
corrupt!

I found some info on the net about fread() and fgets(), and it seems
that
fgets() only reads one line of data up to 1024 bytes, or in my case,
64
bytes. This is what I want to happen, because I need the 'reading' to
abort/break when I have read the required info from the header...I
wish
(and hope!) there was an easier way to get this info other than
searching
for it. :|

Now I am truly vexed because the files are all corrupt when
downloaded,
because I can't see anything wrong with the code. I have added a few
comments, so you can see what I think is the problematic area.

By the way, many thanks for your enthusiastic help so far! - I hope
you
don't take this email to mean I will be mailing you frequently,
believe me
I know you must be busy, and I only mailed you as a last resort!

Thanks again!

<?php

//ob_start();
//ob_end_flush();
//ob_implicit_flush(TRUE);

$rslogin = '';
$rspass = '';
$link = addslashes(trim($_POST['url']));

function cut_str($str, $left, $right)
   {
   $str = substr(stristr($str, $left), strlen($left));
   $leftLen = strlen(stristr($str, $right));
   $leftLen = $leftLen ? -($leftLen) : strlen($str);
   $str = substr($str, 0, $leftLen);
   return $str;
   }

// Get the full premium link, and store it in $full_link after the
redirect. *Surely* there is an easier way to get redirections?

if(strlen($link)>0)
{
        $url = @parse_url($link);
        $fp = @fsockopen($url['host'], 80, $errno, $errstr);
        if (!$fp)
         {
             $errormsg = "Error: <b>$errstr</b>, please try again
later.";
             echo $errormsg;
             exit;
         }

                        $vars = 
"dl.start=PREMIUM&uri={$url['path']}&directstart=1";
                        $out = "POST {$url['path']} HTTP/1.1\r\n";
                        $out .= "Host: {$url['host']}\r\n";
                        $out .= "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; 
Windows NT
5.1)\r\n";
                        $out .= "Authorization: Basic
".base64_encode("{$rslogin}:{$rspass}")."\r\n";
                        $out .= "Content-Type: 
application/x-www-form-urlencoded\r\n";
                        $out .= "Content-Length: ".strlen($vars)."\r\n";
                        $out .= "Connection: Close\r\n\r\n";
                        fwrite($fp, $out);
                        fwrite($fp, $out.$vars);
                        unset($string);
                        while (!feof($fp))
                        {
                        $string.= fgets($fp, 64);
                        }
                         //Tell us what data is returned
                         //print($string);
                        @fclose($fp);

                        if (stristr($string, "Location:"))
                        {
                                $redirect = trim(cut_str($string, "Location:", 
"\n"));
                                $full_link = $redirect;
                        }

//print($string);
//print("<html><body><h1>".$full_link."</h1>");



if ($full_link)

        {

        //      Get info about the file we want to download:

                $furl = parse_url($full_link);
         $fvars =
"dl.start=PREMIUM&uri={$furl['path']}&directstart=1";
         $head = "Host: {$furl['host']}\r\n";
         $head .= "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0;
Windows
NT 5.1)\r\n";
         $head .= "Authorization: Basic
".base64_encode("{$rslogin}:{$rspass}")."\r\n";
         $head .= "Content-Type:
application/x-www-form-urlencoded\r\n";
         $head .= "Content-Length: ".strlen($fvars)."\r\n";
         $head .= "Connection: close\r\n\r\n";
         $fp = @fsockopen($furl['host'], 80, $errno, $errstr);
         if (!$fp)
         {
             echo "The script says <b>$errstr</b>, please try again
later.";
             exit;
         }
         fwrite($fp, "POST {$furl['path']}  HTTP/1.1\r\n");
         fwrite($fp, $head.$fvars);
         while (!feof($fp))
         {
                        //Keep reading the info until we get the filename and 
size from the
returned Header - is there no easy way
                        //of doing this? I also don't like the way I have to 
'find' the
redirected link (above).??
             $tmp .= fgets($fp, 64);
                        $d = explode("\r\n\r\n", $tmp);

                        // I tried changing this to if ($d), { etc..,  (instead 
of $d[1])
and
the download of the rar file *wasn't* corrupt, it just had a filetype
of
x-rar-compressed instead of
                        //apppication/octet-stream, and the filesize was 
'unknown' - now
this
is just confusing me...! :( So i think (and guess) the problem of the
file
corruption is here,
                        //because it must add some data to the filestream which 
corrupts
it.
Darn.
                        if($d[1])
             {
                 preg_match("#filename=(.+?)\n#", $tmp, $fname);
                 preg_match("#Content-Length: (.+?)\n#", $tmp,
$fsize);
                 $h['filename'] = $fname[1] != "" ? $fname[1] :
basename($furl['path']);
                 $h['fsize'] = $fsize[1];
                                break;
             }
                }

         @fclose($fp);

                //print($tmp);

                $filename = $h['filename'];
         $fsize = $h['fsize'];

                //Now automatically download the file:

         @header("Cache-Control:");
         @header("Cache-Control: public");
         @header("Content-Type: application/octet-stream");
         @header("Content-Disposition: attachment;
filename=".$filename);
         @header("Accept-Ranges: bytes");
         if(isset($_SERVER['HTTP_RANGE']))
         {
             list($a, $range)=explode("=",$_SERVER['HTTP_RANGE']);
             $range = str_replace("-", "", $range);
             $new_length = $fsize - $range;
             @header("HTTP/1.1 206 Partial Content");
             @header("Content-Length: $new_length");
         }
         else
         {
             @header("Content-Length: ".$fsize);
         }
         $fvars =
"dl.start=PREMIUM&uri={$furl['path']}&directstart=1";
         $head = "Host: {$furl['host']}\r\n";
         $head .= "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0;
Windows
NT 5.1)\r\n";
         $head .= "Authorization: Basic
".base64_encode("{$rslogin}:{$rspass}")."\r\n";
         $head .= "Content-Type:
application/x-www-form-urlencoded\r\n";
         if($range != "") $head .= "Range: bytes={$range}-\r\n";
         $head .= "Content-Length: ".strlen($fvars)."\r\n";
         $head .= "Connection: close\r\n\r\n";
         $fp = @fsockopen($furl['host'], 80, $errno, $errstr);
         if (!$fp)
         {
             echo "<span style='color:#688000;
background-color:#BBDB54;
font-size : 10pt; text-decoration: none; font-family: Trebuchet
MS;'>The
script says <b>$errstr</b>, please try again later.</span>";
             exit;
         }
         @stream_set_timeout($fp, 300);
         fwrite($fp, "POST {$furl['path']}  HTTP/1.1\r\n");
         fwrite($fp, $head.$fvars);
         fflush($fp);
         while (!feof($fp))
         {
             echo fread($fp, 2048);
             //ob_flush(); //php.net suggestion
         }

                //These were here originally, but I don't even know if I am 
supposed
to
have them here.
         // flush();
         // ob_flush;
        @fclose($fp);
         exit;

        }




}
else
{
         $data = "<form method=\"post\">\n";
         $data .= "<input type=\"text\" id=\"url\"
style=\"text-align:center\" name=\"url\" size=\"60\"
onfocus=\"if(this.value=='Enter rapidshare.com URL
here'){this.value=''}\">\n";
         $data .= "<br><input type=\"submit\"
value=\"Download\"></form>";
         echo $data;
}
?>




--- End Message ---
--- Begin Message ---
What is the command to reset a session variable --- essentially deleting
all of the values it contains?  Ron

--- End Message ---
--- Begin Message ---
Ron Piggott wrote:

> What is the command to reset a session variable --- essentially
> deleting all of the values it contains?  Ron
> 

I haven't checked, but how about unset() ?


/Per Jessen, Zürich

--- End Message ---
--- Begin Message ---
On Feb 3, 2008 10:25 AM, Per Jessen <[EMAIL PROTECTED]> wrote:
> Ron Piggott wrote:
>
> > What is the command to reset a session variable --- essentially
> > deleting all of the values it contains?  Ron
> >
>
> I haven't checked, but how about unset() ?
>
>
> /Per Jessen, Zürich
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

unset($_SESSION);
or
$_SESSION = array();

-- 
-Casey

--- End Message ---
--- Begin Message ---
unset($_SESSION['var_name']);



bastien


----------------------------------------
> From: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> Date: Sun, 3 Feb 2008 13:14:47 -0500
> Subject: [PHP] Resetting a session variable
> 
> What is the command to reset a session variable --- essentially deleting
> all of the values it contains?  Ron
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

_________________________________________________________________

--- End Message ---
--- Begin Message ---
unset($_SESSION);
or
$_SESSION = array();

This reset all of the session variables. To reset only one, try this:

<?php
    unset($_SESSION['key']);
?>


--
Richard Heyes
http://www.websupportsolutions.co.uk

Knowledge Base and Helpdesk software for £299 hosted for you -
no installation, no maintenance, new features automatic and free

--- End Message ---
--- Begin Message ---
Resetting all session variables or one of those session vars ?

If you need to reset all then use *session_destroy() *function.

Hope it helps..

Regards,

Feris
http://top-10.bigspacehosting.com

On Feb 4, 2008 1:14 AM, Ron Piggott <[EMAIL PROTECTED]> wrote:

> What is the command to reset a session variable --- essentially deleting
> all of the values it contains?  Ron
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
Hi

there are 2 functions
session_unset('Key');
session_destroy();

please find them in the manual.  i think they are the 2 used for setting and
usetting the session.


On Feb 4, 2008 1:14 AM, Feris Thia C. <[EMAIL PROTECTED]> wrote:

> Resetting all session variables or one of those session vars ?
>
> If you need to reset all then use *session_destroy() *function.
>
> Hope it helps..
>
> Regards,
>
> Feris
> http://top-10.bigspacehosting.com
>
> On Feb 4, 2008 1:14 AM, Ron Piggott <[EMAIL PROTECTED]> wrote:
>
> > What is the command to reset a session variable --- essentially deleting
> > all of the values it contains?  Ron
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>



-- 
Have A pleasant Day
Chetan. D. Rane
Location: India
Contact: +91-9986057255
other ID: [EMAIL PROTECTED]
            [EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
On Feb 3, 2008 1:51 AM, Jim Lucas <[EMAIL PROTECTED]> wrote:
> Nathan Rixham wrote:
> > wish he'd turn that auto responder off.. *sigh* - he's now top of my
> > contacts in gtalk..
> >
>
> That is his way of getting to the top of next weeks PostTrack Report
> from Dan    :)
>
> Jim
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

You could set up Gmail's filters.

-- 
-Casey

--- End Message ---
--- Begin Message ---
Yes you can.

Just mirror the additional domains and in your PHP app check the
$_SERVER["HTTP_HOST"] variable.

Hope this helps !

Regards,

Feris
http://top-10.bigspacehosting.com


On Feb 3, 2008 2:20 PM, jeffry s <[EMAIL PROTECTED]> wrote:

> i am wondering whether this can be done. i know it can.
> is it possible to make one website with the ability to host multiple
> website.
> it is something like website generator. eg: www.shopify.org
>
> let say for example i have a website www.example.org.
> i can point a domain name (www.example1.org) to the server where
> www.example.org hosted,
> and when user visit www.example1.org, it execute the same scripts as
> www.example.org with
> with different themes and website configuration.
>
> anyone have the idea?
>
> thanks
>

--- End Message ---
--- Begin Message ---
On Feb 4, 2008 3:33 AM, Feris Thia C. <[EMAIL PROTECTED]> wrote:

> Yes you can.
>
> Just mirror the additional domains and in your PHP app check the
> $_SERVER["HTTP_HOST"] variable.
>
> Hope this helps !
>
> Regards,
>
> Feris
> http://top-10.bigspacehosting.com
>
>
> On Feb 3, 2008 2:20 PM, jeffry s <[EMAIL PROTECTED]> wrote:
>
> > i am wondering whether this can be done. i know it can.
> > is it possible to make one website with the ability to host multiple
> > website.
> > it is something like website generator. eg: www.shopify.org
> >
> > let say for example i have a website www.example.org.
> > i can point a domain name (www.example1.org) to the server where
> > www.example.org hosted,
> > and when user visit www.example1.org, it execute the same scripts as
> > www.example.org with
> > with different themes and website configuration.
> >
> > anyone have the idea?
> >
> > thanks
> >
>

great help, thanks you all.. =)

--- End Message ---
--- Begin Message ---
Paul Scott schreef:
Did anyone actually get this mail?

it came through :-)


More concrete example? What would you like to see?

the column spec. what kind of geomtery column is it? and
are you using it as a primary key? or some else ... if so what kind
of stuff are you storing in there? also in what way are you
using it that gives you such a speed boost with queries?

I read the mysql docs, I understand the principles but I'm having
a hard time figuring out how to apply in practice in terms of
making use of the performance gains you mentione ... specifically
in a web environment where heavy queries are often along the lines
of paginated data combined with user defined filters (e.g. a product
list sorted by price, etc and filter on type/category/keyword/etc)

sorry if I'm sounding like a idiot :-)


I suspect that some of my mail is getting dropped :(

--Paul

On Fri, 2008-02-01 at 06:33 +0200, Paul Scott wrote:
On Fri, 2008-02-01 at 03:40 +0100, Jochem Maas wrote:

I for one would really like to see a concrete example of this kind of
use of geometry columns and spacial indexes as an alternative to the stand
integer based primary keys.

On one of my local postGIS tables:

CREATE INDEX k1
  ON kanagawa
  USING gist
  (the_geom);


A gist index is a GEOS based spatial index. You will need GEOS to create
one.

When loading spatial data, your geometry column looks like so:

01050000000100000001020000000C00000011ECE564CF7561404A8999CCDABC4140E5C0981ACE75614012901CD641BD4140603C8386BE756140E525611B40BD41405BF216D3BD756140151DC9E53FBD414054DC1A4DBD756140760B997A3FBD414012219BD1BC756140D20823E33EBD41407AB2884EBC7561400F2110243EBD41404571B4D0BB756140CC0C6A213DBD4140F707192ABB7561405DF2A1803CBD4140F0F11CA4BA756140C3D1B7413CBD4140E89CB2ADB97561406F046D233CBD414017D4B7CCA97561406D47AD7F39BD4140

Which is WKB (Well Known Binary) data or WKT (Well Known Text) data. The
gist index simply indexes this as opposed to the regular gid (which you
still use btree indexes on anyways)

--Paul

All Email originating from UWC is covered by disclaimer http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

------------------------------------------------------------------------

All Email originating from UWC is covered by disclaimer http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm

--- End Message ---
--- Begin Message ---
<?
$txt = <<<eof
aaaaaaaaa
aaaaaaaaa
aaaaaaaaa

bbbbbbbb
bbbbbbbb

bbbbbbbb
eof;

//i just want replace "start to first \r\n\r\n"
//how can i do ?
//i want out put
/*
bbbbbbbb
bbbbbbbb

bbbbbbbb
*/
print preg_replace("What's is this ?", "", $txt);

//Thank You !!
?> 

--- End Message ---

Reply via email to