[PHP] problem with system()

2001-09-14 Thread Arash Dejkam

Hi,

I'm trying to unzip a file and save the unzipped data in a variable in PHP
using :

$result = system ( gzip -d -c myfile.gz ); /* 'gzip -d -c' unzips the
file to 'stdout' */

the above command outputs the result directly to browser instead of putting
it in $result.
I tried exec() too but it didn't help because exec() returns only the last
line of the output data.
let me add that myfile.gz is about 1.5mb.

help me please !

Arash





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] preg_replace_callback()

2001-09-08 Thread Arash Dejkam

Hi,

What is a callback in preg_replace_callback(...) ?
how can I use it ? can anybody give me an example ?

Thanks,
Arash



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: when to delete a temporary file ?

2001-07-07 Thread Arash Dejkam


Lasse [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

 Arash Dejkam [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hi,
 
  I've created a site where users can upload photos and specify which
other
  users are allowed to view them using PHP session management. now I have
  alittle problem in the post-upload page, script creates a temporary copy
 of
  the uploaded image with a name the same as user's session ID, and puts a
  img src=temp file... in the page for the user to view the uploaded
 photo
  and confirm it. now I don't know when to delete that temporary file !
  because I don't know how long does the user's browser take to download
the
  image. currently I delete it in the script coming up just after user
 clicks
  the confirm button, but what if the user close his/her browser before
  clicking the confirm button ? the file remains there for ever !!
  what's your suggestion ?


 Don't your sessions time out BTW? That should make it possible to check
for
 any temp files whose session isn't alive anymore and delete them. Since
the
 corresponding session is dead anyway the image can be safely deleted...

  Or am I missing something?

 --
 Lasse


this was the first approach I thought about, but I don't know how to check
session IDs other that current one I use session_is_registered() to check
for the current session but how can  I check for other sessions ? tell me
please :)

Thanks
Arash Dejkam




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] when to delete a temporary file ?

2001-07-06 Thread Arash Dejkam

Hi,

I've created a site where users can upload photos and specify which other
users are allowed to view them using PHP session management. now I have
alittle problem in the post-upload page, script creates a temporary copy of
the uploaded image with a name the same as user's session ID, and puts a
img src=temp file... in the page for the user to view the uploaded photo
and confirm it. now I don't know when to delete that temporary file !
because I don't know how long does the user's browser take to download the
image. currently I delete it in the script coming up just after user clicks
the confirm button, but what if the user close his/her browser before
clicking the confirm button ? the file remains there for ever !!
what's your suggestion ?

Thanks
Arash Dejkam



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] protected Images without using htaccess

2001-06-23 Thread Arash Dejkam

Hi,

and the shorthand for this :
?php
$img=ImageCreateFromJPEG($filename);
ImageJPEG($img);
?

Thanks
Arash Dejkam

Fredrik Arild Takle [EMAIL PROTECTED] wrote in message
9gvl19$er6$[EMAIL PROTECTED]">news:9gvl19$er6$[EMAIL PROTECTED]...
 1. Authenticate user
 2. Put the pictures in a secret folder or outside http_root
 3. Do this:

 ?php
   header(Content-Type: application/download\n);
   header(Content-Disposition: filename=\$file\);
   $fn = fopen($file , r);
   fpassthru($fn);
 ?

 I hope this helps!

 Fredrik A. Takle
 [EMAIL PROTECTED]
 www.iportal1.com





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] PHP authenticating and session management

2001-06-22 Thread Arash Dejkam

Hi,

I want to use PHP session manager but I have some problems,

I want the session start in a login page so I do this for example:

after authenticating...
session_start();
session_register(username);

then I want the user to be able to see his own pages, what do I have to do
in those pages?

simply check $username and bring up the user's page ? but this makes it
possible for any hacker to send a cookie with username and see that page. I
know that PHP stores a unique random number for each session but how can I
check that it matches with the number in the cookie.

help me please I'm really confused !

Thanks

Arash Dejkam





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: PHP authenticating and session management

2001-06-22 Thread Arash Dejkam

Hi,

Thank you very much, you gave me the lines I was looking for in the 7-8
tutorials I read in last 48 hour to find and I didn't :)

Dejkam
http://www.dejkam.f2s.com

Stephen Yau [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi,

  You can use $HTTP_SESSION_VARS[username] to make sure that this
variable
 is from the user session, not from the cookie.

  When you do a session_register(username);, the $username is store in
the
 server side, not on the client. The client side only have a Session ID
store
 in the cookie. Each time when a client side request a php page, PHP will
see
 if a specific Session ID has been sent with the request. If this is the
 case, the prior saved environment is recreated.

  -Stephen Yau

 Arash Dejkam writes:

  Hi,
 
  I want to use PHP session manager but I have some problems,
 
  I want the session start in a login page so I do this for example:
 
  after authenticating...
  session_start();
  session_register(username);
...



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] protected Images without using htaccess

2001-06-22 Thread Arash Dejkam

Hi,

I'm going to make a page in which users (being authenticated by PHP session
management) upload pictures and specify which other users can see those
pictures, and I want all the process be automated, and I don't want to use
Apache protection on directories, now I have a problem: if I store images in
a directory which is in root directory
of  HTTP server, then any user can access any image by sending a direct
query from his browser like :
www.mysite.com/members/images/img023.jpg even if he is not allowed. and also
I can not save image out of HTTP root directory because then http can not
serve them.
I found a very foolish solution for this :) I can store the images out of
HTTP root dir and then use a PHP script which first checks the session ID
and then sends the images with ImageCreateFromJPEG() and ImageJPEG()
functions.

Can anybody give me a better way to solve this problem ?

Thanks
Arash Dejkam






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]