Re: [PHP] stripping negative number

2004-12-23 Thread Justin England
unsigned does not equal absolute value.
$num = -40;
print Num: $num\n;
$num = abs($num);
print ABS: $num\n;
will display:
Num: -40
ABS: 40
http://us2.php.net/manual/en/function.abs.php
Justin
- Original Message - 
From: Roger Thomas [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Thursday, December 23, 2004 1:18 AM
Subject: [PHP] stripping negative number


I want to convert negative number to its positive equivalent.
$num = -40;
printf(Unsigned value is %u, $num);
output is: Unsigned value is 4294967256
I have checked the manpages and %u seems the right format. Pls advise.
--
roger
---
Sign Up for free Email at http://ureg.home.net.my/
---
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Redirect after download

2004-12-01 Thread Justin England
I am writing a file download system and I need to be able to do a 
redirect after the download is finished. 

Basically, the user will be presented with a simple HTML page that 
contains a link to download the file (href=/download.php?fileid=143).  
I have the code to send the file working just fine, but I can not figure 
out how to do a redirect after the download is complete.  I have spent 
the last hour searching the archives, and the closest I have found is:

http://marc.theaimsgroup.com/?l=php-generalm=106128750620349w=2
But I can't seem to find a way to actually do a Location style 
redirect.  Even static HTML does not display the way one would expect.  
Using a small text file to download, I can view source from NS and see 
the everything that was sent to the browser, and everything is there 
(the ---Boundary(s), the text file, and the simple HTML line).

So my question is: How can I perform a redirect after the file has been 
sent.

Thanks,
Justin
Here is a snippit of download.php (send_file() was found reading the 
comments to the fread function in the PHP documention):

header(Content-Type: multipart/mixed; boundary=\-Boundary-12399\);
if(!send_file($file)) {
   die(File transfer failed!);
   exit;
}else{
  
   print(\n);
   print(---Boundary-12399\r\n);
   print(Content-Type: text/html\r\n);
   print(\r\n);
   print htmlheadtitleSuccess/title/headbodybFile 
transfer s
uccessful!/b/body/html;
   print(\r\n---Boundary-12399\r\n);
   print(\r\n);
   exit;
}

function send_file($file) {
   // read file and send to user
   $status = FALSE;
   if ( (!is_file($file['filelocation'])) or 
(connection_status()!=0) ) return(FALSE);
   print(---Boundary-12399\r\n);
   print(Content-type: application/octet-stream\r\n);
   print(Content-Disposition: inline; filename=\ . 
$file['filename'] . \\r\n);
   print(Content-length:  . $file['filesize'] . \r\n);
   print(Expires:  .  gmdate(D, d M Y H:i:s,  
mktime(date(H)+2,  date(i), date(s),  date(m), date(d),  
date(Y)  )  ) .  GMT\r\n);
   print(Last-Modified:  . gmdate(D, d M Y H:i:s). GMT\r\n);
   //print(Cache-Control: no-cache, must-revalidate\r\n);
   //print(Pragma: no-cache\r\n);
   if ($fh = fopen($file['filelocation'], 'rb')) {
   while(!feof($fh) and (connection_status()==0)) {
   print(fread($fh, 1024*8));
   flush();
   }
   $status = (connection_status()==0);
   fclose($fh);
   }
return($status);
}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Image width??

2001-11-29 Thread Justin England

array getimagesize (string filename [, array imageinfo])

http://www.php.net/manual/en/function.getimagesize.php


Justin England  [EMAIL PROTECTED]
Network Administrator   
E-Net Information Services  http://www.enetis.net
Tel: 605-341-3638   Fax: 605-341-8880

On Thu, 29 Nov 2001, cosmin laslau wrote:

 Hi,
 
 Is there any function or command in PHP that will return the width an image 
 (GIF)?
 
 Thanks.
 
 _
 Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
 
 
 -- 
 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 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] what the best version PHP + APACHE on Solaris8

2001-11-24 Thread Justin England

Just grap the lastest stable version.  As of now:

Apache ver 1.3.22
PHPver 4.0.6

Most all of my Sparc Solaris8 machines are running Apache 1.3.19/PHP 4.0.6

Hope this helps.

Justin England  [EMAIL PROTECTED]
Network Administrator   
E-Net Information Services  http://www.enetis.net
Tel: 605-341-3638   Fax: 605-341-8880

On Thu, 22 Nov 2001, Evgeny Rachlenko wrote:

 Dir Justin England,
 Could you tell me what the version of apache and php do you prefer  for
 Solaris 8 .
 
 thanks
 
 
 
 -- 
 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 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] How to load .php3 pages using PHP4

2001-11-22 Thread Justin England

Comment that line again, and add .php3 to:

AddType application/x-httpd-php .php .php3

This will tell apache to use PHP4 for both .php and .php3 files.


Justin England  [EMAIL PROTECTED]
Network Administrator   
E-Net Information Services  http://www.enetis.net
Tel: 605-341-3638   Fax: 605-341-8880

On Thu, 22 Nov 2001, EDUMEXICO wrote:

 Hi all, I'm using PHP version 4 (module) with no problems in a Debian box, but today 
I download PHPlib;  I installed as the README file told me, but all the files have 
the extension php3, and when I try to open with my browser I it tell me to save the 
file to disc.
 
 I uncomment the next line in srm.conf:
 AddType application/x-httpd-php3 .php3
 
 and restart apache without luck. I don't want to downgrade to PHP3, so is there a 
way of solve this using PHP4? Thanks for your help.
 
 -- 
 Mauricio Téllez Jiménez
 Seguimiento Técnico EDUMEXICO
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 Zamora No. 25, Col. Centro
 C.P. 91000, Xalapa, Ver.
 Tel. 52(28)17-86-87, 17-73-80
 Fax. 52(28)18-64-13
 


--
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] reseting cookie_lifetime

2001-11-21 Thread Justin England

I have:

session.cookie_lifetime = 1200

in my php.ini.  I am using the PHP session functions that are working
fine, except I can't find out how to reset the lifetime timer.  For
example, I log in, my script creates the session, and I do my work.  After
20 minutes of working, the session expires and I have to re-login. How can
I reset the cookie_lifetime timer so that after each request the 20 minute
lifetime starts over?

Each script starts with:
session_name(mysessionname);
session_start();

And then checks session_is_registered('username')

Thanks,

Justin England  [EMAIL PROTECTED]
Network Administrator   
E-Net Information Services  http://www.enetis.net
Tel: 605-341-3638   Fax: 605-341-8880


-- 
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]