[PHP] Re: making FORM dissapear when successful login

2005-01-05 Thread Jonathan
I think you should use session control after checking for login.

JHollis [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I had this code working the way i wanted it to (as far as correct
 username and password allowing successful login)...but what i want to
 happen now is when a user successfully logs it it will make the login
 form disappear and just say successfully logged in or welcome user and a
 link below it so they can log off and make the form re-appear.  Below is
 the code that i have where i tried to get it to disappear on successful
 login, but it stays disappeared all the time.  Can someone please point
 out what im doing wrong.  I have tried everything i can think of...and
 nothing works.  Im a PHP newbie...so im sure some of you might get a
 laugh out of this...if it is real easy.

 ---snippet


 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
 html
 head
 link href=style.css rel=stylesheet type=text/css /
 /head
 body
   div id=container
 div id=top
 h1header/h1

 /div
 div id=leftnav
 p

 ?php

 $username=$_POST['username'];
 $password=$_POST['password'];
 $db=user;
 $server=localhost;
 $db_username=root;
 $db_password=***;

 $connect = mysql_connect($server,$db_username,$db_password);
 if (!$connect) {
 die (could not connect to database);
 }
 $select = mysql_select_db($db,$connect);
 if (!$select) {
 die (could not select database $db);
 }
   /*username='$username';*/
 $sql = SELECT * FROM passwords, user_info where id=PID and
 username='$username';
 $result = mysql_query($sql);
 /*$num_rows = mysql_num_rows($result);*/
 while ($user = mysql_fetch_array($result))
 {
 $id = $user['id'];
 $username2 = $user['username'];
 $password2 = $user['password'];
 $firstname = $user['firstname'];
 $email = $user['email_address'];


 IF ($username==$username2  $password==$password2)
 {
 echo(\Welcome, b$firstname/b\);?br?
 echo (\Your email address is b$emailb\);?/tdtr
 a href=?$_SERVER['PHP_SELF']??username=?password=Logoff/a?
 break;
 }
 else
 {
 ?
 FORM action=?$_SERVER['PHP_SELF']? method=post
  INPUT type=hidden name=id
 table
 tdb*/bUsername:/td tdINPUT class=input size=8
 type=text name=username value=?echo $username?/tdtr
 tdb*/bPassword:/td tdINPUT class=input size=8
 type=password name=password/tdtr
 td class=xsmallb* Case Sensitive/b/td
 tdINPUT type=submit value=Login/tdtr
 tdnbsp /td
 /table
 /FORM
 ?

 break;
 }

 }
 //IF ($username != $username2 || $password != $password2) {//



 ?br
 ?
 if  ($username ==   $password == ) {
 echo (Please type in a Username and Password);}

 if  ($username !=   $password == ) {
 echo (Please type in a password);}

 if  ($username ==   $password != ) {
 echo (Please type in a username and password);}

 ?


 /p
 /div
 ?if (($username2==$username  $password2==$password) 
 ($username2!= || $password2!=)){?
 div id=rightnav class=box
 p
 /p
 /div
 ?}?
 div id=content
 h2Subheading/h2
 p
 /p
 p
 /p
 /div
 div id=footer
 p
 Today is
 ?php
 echo( date(F dS Y.));
 ?
 /p
 /div
 /div
 /body
 /html
 snippet

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



[PHP] Re: making FORM dissapear when successful login

2005-01-05 Thread JHollis
Thank you for your suggestion, but do you care to be more descriptive, 
maybe some examples would be nice.  Can you tell my why the code i have 
doesnt work?  I would love to use sessions, but i was just trying to get 
an understanding of how the basics work first.

Jonathan wrote:
I think you should use session control after checking for login.
JHollis [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I had this code working the way i wanted it to (as far as correct
username and password allowing successful login)...but what i want to
happen now is when a user successfully logs it it will make the login
form disappear and just say successfully logged in or welcome user and a
link below it so they can log off and make the form re-appear.  Below is
the code that i have where i tried to get it to disappear on successful
login, but it stays disappeared all the time.  Can someone please point
out what im doing wrong.  I have tried everything i can think of...and
nothing works.  Im a PHP newbie...so im sure some of you might get a
laugh out of this...if it is real easy.
---snippet
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
html
head
link href=style.css rel=stylesheet type=text/css /
/head
body
 div id=container
div id=top
h1header/h1
/div
div id=leftnav
p
?php
$username=$_POST['username'];
$password=$_POST['password'];
$db=user;
$server=localhost;
$db_username=root;
$db_password=***;
$connect = mysql_connect($server,$db_username,$db_password);
if (!$connect) {
die (could not connect to database);
}
$select = mysql_select_db($db,$connect);
if (!$select) {
die (could not select database $db);
}
 /*username='$username';*/
$sql = SELECT * FROM passwords, user_info where id=PID and
username='$username';
$result = mysql_query($sql);
/*$num_rows = mysql_num_rows($result);*/
while ($user = mysql_fetch_array($result))
{
$id = $user['id'];
$username2 = $user['username'];
$password2 = $user['password'];
$firstname = $user['firstname'];
$email = $user['email_address'];
IF ($username==$username2  $password==$password2)
{
echo(\Welcome, b$firstname/b\);?br?
echo (\Your email address is b$emailb\);?/tdtr
a href=?$_SERVER['PHP_SELF']??username=?password=Logoff/a?
break;
}
else
{
?
FORM action=?$_SERVER['PHP_SELF']? method=post
INPUT type=hidden name=id
table
tdb*/bUsername:/td tdINPUT class=input size=8
type=text name=username value=?echo $username?/tdtr
tdb*/bPassword:/td tdINPUT class=input size=8
type=password name=password/tdtr
td class=xsmallb* Case Sensitive/b/td
tdINPUT type=submit value=Login/tdtr
tdnbsp /td
/table
/FORM
?
break;
}
}
//IF ($username != $username2 || $password != $password2) {//

?br
?
if  ($username ==   $password == ) {
echo (Please type in a Username and Password);}
if  ($username !=   $password == ) {
echo (Please type in a password);}
if  ($username ==   $password != ) {
echo (Please type in a username and password);}
?
/p
/div
?if (($username2==$username  $password2==$password) 
($username2!= || $password2!=)){?
div id=rightnav class=box
p
/p
/div
?}?
div id=content
h2Subheading/h2
p
/p
p
/p
/div
div id=footer
p
Today is
?php
echo( date(F dS Y.));
?
/p
/div
/div
/body
/html
snippet
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Please help!

2005-01-05 Thread
To whom it may concern,
When I worte php for ldap_search(), It always shows the warning 
messageWarning: ldap_search(): Search: Operations error ...
My server is windows 2003 with AD.
I have seen one solution on the network, they said that I should add 
ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
in my code if I used windows 2003 with AD. 
I did it. But the warning message is still the same.
What should I do?
Please help me to deal this solution.
Thank you so so so much:)


[PHP] php ignores php_value from httpd.conf?

2005-01-05 Thread Steve Kieu
Hi,
I am trying to debug the problem I have; which is that php seems to 
ignore all php_value I set in httpd.conf. Example I have:

VirtualHost 10.0.44.254:800
DocumentRoot /var/www/webssl
Directory /var/www/webssl
Options Indexes FollowSymLinks MultiViews
AllowOverride All
php_value upload_max_filesize 20M
Order allow,deny
Allow from all
/Directory
/VirtualHost
but when I access http://10.0.44.254:800/some_upload.php
it still sees that the file upload size if 2M (set in global php.ini). 
If I comment out in php.ini; it doesn't have a value at all.
Is it a bug in apache or php or I missed something when compiling them?
apache-1.3.33 PHP 4.3.10.

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


[PHP] SSL

2005-01-05 Thread gustav
Hi there!

Thinking of going from http to https on the server. My question is: Would
there be any differences in my php-code from now?

/G
@varupiraten.se

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



Re: [PHP] migrating to PHP 5 + Apache 2 from PHP 4.3.8 + Apache 1.3.33.

2005-01-05 Thread symbulos partners
Richard Lynch wrote:
 If you re-read the previous emails from Rasmus, you will find that these
 questions are already answered within them.
 
 So I'm going to go on at length here telling you (again) what you don't
 want to hear.

In my opinion, the answer some libraries are thread safe, some are not is
generic. The answer the libraries in chapter VI. Function Reference of
official PHP Manual version 03-01-2005 is specific. Now I think I
understand the answer a bit better.

We did not understand if you were talking about the libraries we develop,
the libraries you develop, the libraries everybody else develops,
commercial libraries, whatever library you can think of. Not
all the libraries are indeed listed in the manual.

I apologise for being stupid and hard of understanding.

 If you can narrow your focus down a bit from *ALL* of Section VI to *just*
 the libraries you *really* need, you might get the answer you want to
 hear: Oh, those are all thread-safe.

Here some more specific questions.

1)Is the core of php thread safe? That is, are the function which do not
need external libraries thread safe?

2)Here is the list of the function sets we need to use, from Section VI

Apache-specific Functions
Array Functions
Calendar Functions
Class/Object Functions
CURL, Client URL Library Functions
Cyrus IMAP administration Functions
Date and Time Functions
Direct IO Functions
Directory Functions
DOM Functions
DOM XML Functions
Error Handling and Logging Functions
File Alteration Monitor Functions
Filesystem Functions
Forms Data Format Functions
FTP Functions
Function Handling Functions
Gettext
GMP Functions
HTTP Functions
Image Functions
IMAP, POP3 and NNTP Functions
PHP / Java Integration
LDAP Functions
Mail Functions
Mathematical Functions
Multibyte String Functions
Mimetype Functions
Miscellaneous Functions
MySQL Functions
Improved MySQL Extension
Network Functions
Unified ODBC Functions
Object Aggregation/Composition Functions
Object property and method call overloading
OpenSSL Functions
Output Control Functions
PDF functions
PHP OptionsInformation
PostgreSQL Functions
Program Execution Functions
Session Handling Functions
Shared Memory Functions
SimpleXML functions
SQLite
Shockwave Flash Functions
Standard PHP Library (SPL) Functions
String Functions
URL Functions
Variable Functions
vpopmail Functions
XML Parser Functions
XML-RPC Functions
XSL functions
XSLT Functions

We would like to know if they are thread safe to a level which is suitable
for production environment.

3)Are there internal mechanisms in php for protecting thread safety (memory
leak, threads overwriting memory in use by another thread, blah, blah)?

We hope these questions are specific enough.
-- 
symbulos partners
-.-
symbulos - ethical services for your organisation
http://www.symbulos.com

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



Re: [PHP] Apache Server with php

2005-01-05 Thread Lester Caine
John Nichel wrote:
Bruce Douglas wrote:
richard...
i'm not sure of the email/list name.. but there is an apache email 
list.. if you get to the apache.org site.. they could help you.. 
they're actually pretty good.. sorry i don't have the name right at my 
fingers right now!!

good luck...
http://httpd.apache.org/lists.html
Who will refer Richard here - because he needs to set up PHP so it can 
actually be run?

Richard take a look at the first half of
http://www.ibphoenix.com/main.nfs?a=ibphoenixpage=ibp_beginners_php
It covers Apache2, PHP5 and Windows - just ignore the Firebird bits ;)
--
Lester Caine
-
L.S.Caine Electronic Services
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: apache 1 vs 2 w/php

2005-01-05 Thread Lester Caine
Sebastian wrote:
I am undecided whether to upgrade to apache 2 (currently running 1.3.33)
I've heard some bad stuff (some good maybe) about using apache 2 with php..
does anyone have an opinions?
General opinion is if Apache1 is working stick with it. I'm using 
Apache2 and never installed Apache1 so can't compare. The main 
development effort is focused only on Apache1 support though.

I know everything has cons/pros but i am just looking for advice on whether
my site will benifit from the upgrade. I'm curious to know if a site that
normally sees 300-500 users online would see any improvements.
That would be nice information to find out, but does not seem to be 
available.

any on going issues? is php faster/slower? downsides? advantages? anything
in general that can help me decide.
If you have a working Apache1 setup leave it alone for the time being. 
And watch out for movement, perhaps next year?

--
Lester Caine
-
L.S.Caine Electronic Services
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Apache Server with php

2005-01-05 Thread Lester Caine
Lester Caine wrote:
It covers Apache2, PHP5 and Windows - just ignore the Firebird bits ;)
*PHP4* - I need to update it for PHP5 ;)
--
Lester Caine
-
L.S.Caine Electronic Services
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] How to argue with ASP people...

2005-01-05 Thread Sagar C Nannapaneni
Ya..

I just had an argument with my collegue (who is ASP programmer).
He said that in ASP he can use a global variable to store the counter and
then
when the IIS is shutting down he can grab that event and dump the counter
variable
to a text file. I just betted him that i can also do that with PHP.

/sagar
- Original Message -
From: Chris Shiflett [EMAIL PROTECTED]
To: Sagar C Nannapaneni [EMAIL PROTECTED];
php-general@lists.php.net
Sent: Tuesday, January 04, 2005 10:12 PM
Subject: Re: [PHP] How to argue with ASP people...


 --- Sagar C Nannapaneni [EMAIL PROTECTED] wrote:
  But just 2 days ago i came along a situation where i have to
  write a hit counter for my website without using a database
  or a text file. Just using a global variable i wanted to do
  this.
 
  I dont know whether php can do this...(or may b i missed it
  out)...but i couldnt get any equivalent thing in php like we
  have GLOBAL.ASA in ASP.

 If GLOBAL.ASA isn't considered a text file, then you can probably use
 SQLite. Just don't call it a database. :-)

 What sort of situation did you encounter where you were required to
 persist data without the two primary means of doing so? You can persist
 data in memory, I guess, depending on how permanent you need this to be -
 your hit counter would be reset when the server reboots. It could be like
 the high scores on an arcade machine. :-)

 Chris

 =
 Chris Shiflett - http://shiflett.org/

 PHP Security - O'Reilly HTTP Developer's Handbook - Sams
 Coming Soon http://httphandbook.org/



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



[PHP] multiple deleting and updating raw mysql via php

2005-01-05 Thread Sejati Opreker
Hi all,
I meet a problem when I want to deleting a multiple
row, I have a table that contain columns UserID, name,
company name, and bill. UserID is uniq.
perhaps, some of UserID, say it five UserID I have to
delete, how to delete all raw that contain that UserID
? and if I want to update bill of a users (multiple
user) that data of users taking from a file ( so the
file contain user UserId and bill), how to make it ?

Thanks,

Aji



__ 
Do you Yahoo!? 
Read only the mail you want - Yahoo! Mail SpamGuard. 
http://promotions.yahoo.com/new_mail 

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



Re: [PHP] php ignores php_value from httpd.conf?

2005-01-05 Thread Sebastian
hmm i never even knew you can put that in there.. i always used .htaccess or
in the php.ini
i've never seen anyone do it in the httpd.conf.

also you shouldn't quote the value.. you might also need to increase
post_max_size

- Original Message - 
From: Steve Kieu [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Tuesday, January 04, 2005 1:48 PM
Subject: [PHP] php ignores php_value from httpd.conf?


 Hi,

 I am trying to debug the problem I have; which is that php seems to
 ignore all php_value I set in httpd.conf. Example I have:

 VirtualHost 10.0.44.254:800
 DocumentRoot /var/www/webssl
 Directory /var/www/webssl
  Options Indexes FollowSymLinks MultiViews
  AllowOverride All
  php_value upload_max_filesize 20M
  Order allow,deny
  Allow from all
 /Directory
 /VirtualHost

 but when I access http://10.0.44.254:800/some_upload.php
 it still sees that the file upload size if 2M (set in global php.ini).
 If I comment out in php.ini; it doesn't have a value at all.
 Is it a bug in apache or php or I missed something when compiling them?
 apache-1.3.33 PHP 4.3.10.

 Kind regards,

 S.KIEU

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



Re: [PHP] migrating to PHP 5 + Apache 2 from PHP 4.3.8 + Apache 1.3.33.

2005-01-05 Thread Matthew Weier O'Phinney
* Symbulos Partners [EMAIL PROTECTED]:
 Richard Lynch wrote:
  If you re-read the previous emails from Rasmus, you will find that these
  questions are already answered within them.
  
  So I'm going to go on at length here telling you (again) what you don't
  want to hear.

 In my opinion, the answer some libraries are thread safe, some are not is
 generic. The answer the libraries in chapter VI. Function Reference of
 official PHP Manual version 03-01-2005 is specific. Now I think I
 understand the answer a bit better.

 We did not understand if you were talking about the libraries we develop,
 the libraries you develop, the libraries everybody else develops,
 commercial libraries, whatever library you can think of. Not
 all the libraries are indeed listed in the manual.

The thing is, the function sets listed in Section VI are not all 'core' PHP
-- in other words, if you were to do a vanilla install of PHP on a
machine, you wouldn't necessarily get all of these functions. Why?
Because most of the sets rely on... drum roll here... external
libraries. And it is the external libraries that PHP cannot guarantee
are threadsafe.

As an example of some function sets requiring external libraries:
snip
 2)Here is the list of the function sets we need to use, from Section VI

 Calendar Functions

Depends on libical

 CURL, Client URL Library Functions

Depends on libcurl

 Cyrus IMAP administration Functions

Depends on cyrus imap libraries

 DOM Functions
 DOM XML Functions

Depends on libxml

 Image Functions

Depends on GD, which has optional dependencies on libjpeg, libpng,
libungif...

 IMAP, POP3 and NNTP Functions

Depends on uw-imap cclient

 LDAP Functions

Depends on openldap libraries

I could keep going on, but hopefully you get the idea.

So, what Rasmus and Richard were saying is, if you can narrow down
*which* function sets you need and are compiling in to your PHP install,
you'll get a much better answer to the question of whether or not the
libraries you're utilizing with PHP are threadsafe. But just saying all
functions referenced in the manual is going to give you the answer,
probably not.

-- 
Matthew Weier O'Phinney   | mailto:[EMAIL PROTECTED]
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org

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



Re: [PHP] Re: Persistent PHP web application?

2005-01-05 Thread electroteque
On 05/01/2005, at 2:39 PM, Rasmus Lerdorf wrote:

You are correct, serialization tends to be the bottleneck when it 
comes to restoring large data structs.  So you either avoid recreating 
the data structure and just use the data directly, or use an 
in-process mechanism like apc_store/apc_fetch which does a straight 
memcpy and doesn't need top serialize.  Of course, this still doesn't 
match writing your own extension to manage your persistent data 
directly without needing to shuffle it around back and forth between 
process and shared memory.

Extensions to me are a black art, I am looking into this realm for a 
nice way of storing persistant objects in memory. Currently I have a 
method  that  includes the class file, serialize the class object into 
a session, unserialize when needed. I can also add dynamic arguments to 
it. Of course this is not useful for db objects.

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


[PHP] Re: Saving Files

2005-01-05 Thread Bogomil Shopov
Hello
Yes you can do that. Please follow the steps:

header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename=downloaded.pdf');
readfile('original.pdf');

 Bogomil
http://purplerain.org


[EMAIL PROTECTED] wrote:
 Hi all.
 
 Note, this may be a bit off topic.
 
 With that said... I am wanting to save a file off my website to a certain 
 location on my computer. Is there a way to click on a button (or something) 
 and that invokes the download, which then saves to (for example) 
 C:\SomePlace\Directory\Pizza\sausage.txt?
 
 The whole process:
 1. User uploads from a specific location (that I already know)
 2. Modifies the file via the web
 3. Saves/downloads the file to that exact location as pulled from and 
 replaces the old file
 
 It seems as though this can be done but I have not found a way to do it, and 
 I have searched a lot. Any thoughts on how to?
 
 Thanks in advance,
 ~Philip

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



RE: [PHP] multiple deleting and updating raw mysql via php

2005-01-05 Thread Jay Blanchard
[snip]
I meet a problem when I want to deleting a multiple
row, I have a table that contain columns UserID, name,
company name, and bill. UserID is uniq.
perhaps, some of UserID, say it five UserID I have to
delete, how to delete all raw that contain that UserID
? and if I want to update bill of a users (multiple
user) that data of users taking from a file ( so the
file contain user UserId and bill), how to make it ?
[/snip]

Are you looking for a query to do this? If I understand you correctly

DELETE FROM `table` WHERE `UserID` = 'five';

UPDATE `table` SET `bill` = [data] WHERE `UserID` = 'five';

These are database questions and are best asked on a database list.

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



Re: [PHP] Re: apache 1 vs 2 w/php

2005-01-05 Thread Rasmus Lerdorf
Lester Caine wrote:
Sebastian wrote:
I know everything has cons/pros but i am just looking for advice on 
whether
my site will benifit from the upgrade. I'm curious to know if a site that
normally sees 300-500 users online would see any improvements.
That would be nice information to find out, but does not seem to be 
available.
If you are serving up a lot of static file, you will see an improvement. 
 If it is all dynamic PHP requests, then you won't.  Apache really 
doesn't have much to do on a PHP request so all the performance depends 
on the speed of PHP, not Apache.  There are a few places where Apache2 
has improved things for a PHP request, but these tend to be countered by 
a few places where things have gotten ore expensive.  Every benchmark I 
have done puts PHP under Apache2 right in the same ballpark as PHP under 
Apache1 with Apache1 usually a little bit ahead.  But do your own 
testing on your own platform.  Other peoples' benchmarks are meaningless.

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


[PHP] Re: multiple deleting and updating raw mysql via php

2005-01-05 Thread Jason Barnett
Please do not spam the list.  John sent you to the MySQL list as they 
are better to handle MySQL query questions.  If you have a question 
about how to execute your specific query then you can refer to the PHP 
manual:

http://php.net/manual/en/function.mysql-query.php
--
Teach a person to fish...
Ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html
PHP Manual: http://php.net/manual/
php-general archives: http://marc.theaimsgroup.com/?l=php-generalw=2
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: apache 1 vs 2 w/php

2005-01-05 Thread Matthew Weier O'Phinney
* Sebastian [EMAIL PROTECTED]:
 I am undecided whether to upgrade to apache 2 (currently running 1.3.33)
 I've heard some bad stuff (some good maybe) about using apache 2 with php..
 does anyone have an opinions?

 I know everything has cons/pros but i am just looking for advice on whether
 my site will benifit from the upgrade. I'm curious to know if a site that
 normally sees 300-500 users online would see any improvements.

 any on going issues? is php faster/slower? downsides? advantages? anything
 in general that can help me decide.

This study might help you make up your mind:

http://ilia.ws/archives/32-Apache-1-vs-Apache-2-Performance.html

In summary: apache2 is faster for static content, but slower at serving
PHP; additionally, if using the prefork version of apache2 (which you
need to do to keep PHP stable), much of your performance boost for
static content will be lost. Your best bet: stick with apache1 if using
PHP heavily.

-- 
Matthew Weier O'Phinney   | mailto:[EMAIL PROTECTED]
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org

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



Re[3]: [PHP] How to argue with ASP people...

2005-01-05 Thread Ron Clark




On Tue, 4 Jan 2005, Richard Davey wrote:

 Hello Ron,

 Tuesday, January 4, 2005, 5:59:31 PM, you wrote:

 RC You then do %=filen% to go back into ASP to get the value of the
 RC variable into the HTML code that you wrote. ASP is not including the file,
 RC it is only supplying a file name for SSI includes whether apache SSI or
 RC IIS SSI. The server parsing the HTML recognizes the HTML comment is
 RC sentax for server side include and includes the suppplied file name.

 Perhaps this is a better example for you:

 script1.asp
 %
   StrName = bob
 %

 script2.asp
 !--#include file=script1.asp--
 %
   Response.Write Hello   StrName
 %

 Clearer now? I understand what you're saying perfectly, but in the
 context of ASP scripts I am afraid it's wrong.

 Best regards,

 Richard Davey
 --

With this new example you are still using SSI from the web server to
include an ASP file. ASP itself is not including the file.

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



[PHP] PHP cacher?

2005-01-05 Thread Kimmo Alm
Hello!
I've been looking for some PHP cache software for a while now, and I just  
can't seem to find one suitable for my setup.

I run PHP 5.x on FreeBSD 4.x with Apache 2.x. I don't particularly fancy  
the Linux compability, but rather would prefer a native solution.

It must be free (no charge)...
PS: How come that this isn't included in PHP itself, just as there's  
mod_deflate for Apache 2?

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


Re: [PHP] apache 1 vs 2 w/php

2005-01-05 Thread Josh Whiting
 I am undecided whether to upgrade to apache 2 (currently running 1.3.33)
 I've heard some bad stuff (some good maybe) about using apache 2 with php..
 does anyone have an opinions?

a somewhat interesting discussion on the subject was recently on
slashdot, i suggest reading at least the blog entries linked in the main
story blurb: http://slashdot.org/apache/04/12/21/1837209.shtml

the bad stuff you're referring to is the threading problem, which is
completely solved if you just use the prefork MPM in apache 2, which
AFAIK is the default on linux.  not sure about Win32.

as for a performance improvement... it isn't hard to setup apache 2 on
the same server as apache 1 listening on a different port, then do
benchmarks and see for yourself.

/jw

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



RE: Re[3]: [PHP] How to argue with ASP people...

2005-01-05 Thread Jay Blanchard
[snip]
...stuff...
[/snip]

I think we can all agree that PHP and ASP can do the same things, so the
one glaring difference is COST. An efficient Apache / PHP server can be
set up for much less than an IIS / ASP server, even if you take the same
'box' to do it with. Given the same 'box' you will find the Apache / PHP
server to be much more efficient.

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



RE: Re[3]: [PHP] How to argue with ASP people...

2005-01-05 Thread Ron Clark


On Wed, 5 Jan 2005, Jay Blanchard wrote:

 [snip]
 ...stuff...
 [/snip]

 I think we can all agree that PHP and ASP can do the same things, so the
 one glaring difference is COST. An efficient Apache / PHP server can be
 set up for much less than an IIS / ASP server, even if you take the same
 'box' to do it with. Given the same 'box' you will find the Apache / PHP
 server to be much more efficient.


I totally agree and would add more secure

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



Re[2]: [PHP] Saving Files

2005-01-05 Thread Richard Davey
Hello gustav,

Wednesday, January 5, 2005, 8:41:05 AM, you wrote:

gvs It works very well saving an uploaded file to a specific
gvs destination? It's basically what Richard wants to do? The
gvs replacement of the file is automatically done if no options is
gvs specified in some way to not overwrite in the filesystem...?

He said he wanted to upload the file from his PC, have it modified on
the server via PHP and then saved again on his local PC, over-writing
the original file on the PC with the new modified version.

You cannot do that, you just don't have that level of control over the
browser. The best you could hope for would be to prompt the user to
Please save this over your original and hope they do.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I am not young enough to know everything. - Oscar Wilde

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



Re[2]: [PHP] Saving Files

2005-01-05 Thread Richard Davey
Hello Philip (please email the PHP list directly, not me personally),

Wednesday, January 5, 2005, 4:01:15 PM, you wrote:

PT Ok, I have another question. Would I be able to execute a batch file
PT (or something) upon the user hitting a button, which would then save
PT the file to the specified location?

You could have a button on your web page that when clicked would start
to download a file. However the second your PHP script sends the file
to the browser you are handing over all control regarding how the file
is saved (and where) to the browser. You cannot influence or modify
this behaviour - you send the file to the browser, the browser
takes over from there.

PT It seems as though this can be done because viruses tend to do it all
PT the time - you click on a link or open an email attachment which causes
PT a .exe or .bat file to run. Now I hate relating what I want to do with
PT a virus, but that's how I can most closely relate it.

Sure.. but that is totally outside the confines of a web browser. Even
if you did click a link on a web page (that linked to a virus EXE) all
you are really doing is sending that exe to the browser. What then
happens with it is us to the user/browser configuration and is out of
your control.

If the user is dumb enough to have their browser automatically run any
EXE file they download without prompting - well, that is another
problem altogether and one PHP could never hope to fix
(mod_brain_replacement perhaps?)

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I am not young enough to know everything. - Oscar Wilde

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



[PHP] XML Filters for illegal characters

2005-01-05 Thread Jones, Douglas 1
Hello,

I'm wondering if anyone knows of a filter that can take data to be wrapped in 
XML tags and filter this data encoding any illegal XML characters or, if they 
cannot be encoded, remove them.  The problem I have is a database that contains 
text that must be wrapped in XML.  Some of this text has illegal characters in 
it (probably copied from MS Word).  Some of the characters that keep popping up 
are not very frequently used, so I'm hoping whatever filters get suggested, 
they can simply strip out these characters if they cannot encode them.

thanks for your help.


--
Doug Jones
Co-Op Web Developer
[EMAIL PROTECTED]

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



Re: [PHP] XML Filters for illegal characters

2005-01-05 Thread John Holmes
Jones, Douglas 1 wrote:
I'm wondering if anyone knows of a filter 
 that can take data to be wrapped in XML tags
 and filter this data encoding any illegal XML characters
Have you tried htmlentities()?
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Regular help

2005-01-05 Thread M. Sokolewicz
preg_match_all('/(.+)/U', $string, $result);
Uro Gruber wrote:
Hello!
I'm pulling my hair so please help.
I need correct regular expression to get string between 
but if I use 2 pair of  must also work
this is some kind of a test
matches would be
this is
some kind
of a test
I hope somebody have and idea, because I can only get one or everything 
from first  to the last one.

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


Re: [PHP] Regular help

2005-01-05 Thread John Holmes
Uro Gruber wrote:
I need correct regular expression to get string between 
but if I use 2 pair of  must also work
this is some kind of a test
matches would be
this is
some kind
of a test
preg_match_all('/[^]*/',$text,$matches);
[^]* matches anything that is not a double quote
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] XML Filters for illegal characters

2005-01-05 Thread Jones, Douglas 1
Yes, I have tried htmlentities.  Unfortunately it doesn't seem to be catching 
the characters that are plaguing my program.


--
Doug Jones
Co-Op Web Developer
[EMAIL PROTECTED]


-Original Message-
From: John Holmes [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 05, 2005 11:32 AM
To: Jones, Douglas 1
Cc: php-general@lists.php.net
Subject: Re: [PHP] XML Filters for illegal characters


Jones, Douglas 1 wrote:
 I'm wondering if anyone knows of a filter 
  that can take data to be wrapped in XML tags
  and filter this data encoding any illegal XML characters

Have you tried htmlentities()?

-- 

---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

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



Re: [PHP] SSL

2005-01-05 Thread Jamie Alessio
 Thinking of going from http to https on the server.
 Would there be any differences in my php-code from now?

Switching from http to https shouldn't require any big changes to your 
PHP code. The PHP code itself doesn't care that it is being accessed via 
a https url - your webserver takes care of all that before/after 
invoking PHP.

A few things you might need to watch out for:
- If you have hard links to http://yoursite.com/page.php instead of 
relative links to just page.php then users will be directed away from 
https and to http when they follow links on the site. You probably don't 
want this and it will cause browser security warnings in many cases. 
Even if you have a lot of these you might be able to get around it by 
using apache's mod_rewrite to redirect all http requests over to https.

- Similarly, be careful about references to external files in your final 
html output. This includes images, style sheets and javascript includes. 
Make all references relative so that browsers won't display an error to 
the effect of some of the content on this page is secure and some of it 
isn't.

- I have used a wysiwyg html editor as a text area replacement and had 
trouble with SSL warnings in IE because of iframe tags. Just something 
to keep in mind if you're using complex third-party php/javascript 
applications 
(http://wysiwygpro.com/xForum/topic.asp?TOPIC_ID=69SearchTerms=iframe).

I worked on a large code base that ran via http on my local dev server 
and via https on the live server and it wasn't a problem. The PHP code 
works the same regardless of whether the traffic between the web server 
and the browser is encrypted or not.

- Jamie
Thinking of going from http to https on the server. My question is: Would
there be any differences in my php-code from now?
/G
@varupiraten.se
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Regular help

2005-01-05 Thread Uro Gruber
Hello!
I'm pulling my hair so please help.
I need correct regular expression to get string between 
but if I use 2 pair of  must also work
this is some kind of a test
matches would be
this is
some kind
of a test
I hope somebody have and idea, because I can only get one or 
everything from first  to the last one.

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


[PHP] Re: XML Filters for illegal characters

2005-01-05 Thread Jason Barnett
Douglas 1 Jones wrote:
Hello,
I'm wondering if anyone knows of a filter that can take data to be wrapped in 
XML tags and filter this data encoding any illegal XML characters or, if they 
cannot be encoded, remove them.  The problem I have is a database that contains 
text that must be wrapped in XML.  Some of this text has illegal characters in 
it (probably copied from MS Word).  Some of the characters that keep popping up 
are not very frequently used, so I'm hoping whatever filters get suggested, 
they can simply strip out these characters if they cannot encode them.
thanks for your help.

Perhaps I am misunderstanding your problem, so let me ask it another 
way.  Is the problem that you are getting characters entered into the 
database that are encoded in one way (e.g. UTF-8) when you expected the 
characters to be encoded in another way (e.g. ISO-8859-1)?

--
Teach a person to fish...
Ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html
PHP Manual: http://php.net/manual/
php-general archives: http://marc.theaimsgroup.com/?l=php-generalw=2
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Regular help

2005-01-05 Thread John Holmes
M. Sokolewicz wrote:
 Uro Gruber wrote:
 I need correct regular expression to get string between 

 but if I use 2 pair of  must also work

 this is some kind of a test

 matches would be

 this is
 some kind
 of a test

preg_match_all('/(.+)/U', $string, $result);
If the text between quotes can include newlines, you'll want to use
preg_match_all('/(.+)/Us', $string, $result);
or what I replied with in my other post. :)
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] How to argue with ASP people...

2005-01-05 Thread Chris Shiflett
--- Sagar C Nannapaneni [EMAIL PROTECTED] wrote:
 I just had an argument with my collegue (who is ASP
 programmer). He said that in ASP he can use a global
 variable to store the counter and then when the IIS is
 shutting down he can grab that event and dump the
 counter variable to a text file. I just betted him that
 i can also do that with PHP.

This just demonstrates that your colleague may not really know what a
global variable is - what is really happening. Not understanding the
underlying mechanism certainly isn't a unique characteristic of ASP
developers (many PHP developers are guilty of the same), but it seems to
be more prevalent among them. I credit this mostly to the unnecessary
abstraction of details in the language.

Of course, this comes down to a difference in perspective. ASP development
places more responsibility on the language and less on the developer -
much like Java. It is safer. PHP places more responsibility on the
developer and less on the language - much like C. It is more flexible. As
a manager, you like ASP and Java, because they limit the likelihood of
your developers making a mistake. As a developer, you like PHP and C,
because you want the power and flexibility, and you have confidence in
yourself.

This isn't true for everyone. Some managers are technically astute and
choose flexibility over safety, having confidence in their ability to
manage the project as well as hire skilled developers. Some developers
choose safety over flexibility, because they see programming as a job, not
a craft, and they're not looking to impress anyone - they just want a
paycheck.

Ask your colleague if there is a tradeoff concerning the convenience of a
persistent process when it comes to performance and scaling issues. There
are advantages and disadvantages to each, and PHP certainly doesn't win on
all fronts.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly HTTP Developer's Handbook - Sams
Coming Soon http://httphandbook.org/

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



[PHP] Re: PHP cacher?

2005-01-05 Thread Matthew Weier O'Phinney
* Kimmo Alm [EMAIL PROTECTED]:
 Hello!

 I've been looking for some PHP cache software for a while now, and I just  
 can't seem to find one suitable for my setup.

 I run PHP 5.x on FreeBSD 4.x with Apache 2.x. I don't particularly fancy  
 the Linux compability, but rather would prefer a native solution.

 It must be free (no charge)...

http://eaccelerator.sourceforge.net/Home

 PS: How come that this isn't included in PHP itself, just as there's  
 mod_deflate for Apache 2?

Probably because it's overkill for most sites.

-- 
Matthew Weier O'Phinney   | mailto:[EMAIL PROTECTED]
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org

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



[PHP] Re: PHP cacher?

2005-01-05 Thread Kimmo Alm
On 5 Jan 2005 17:28:42 -, Matthew Weier O'Phinney [EMAIL PROTECTED]  
wrote:

* Kimmo Alm [EMAIL PROTECTED]:
Hello!
I've been looking for some PHP cache software for a while now, and I  
just
can't seem to find one suitable for my setup.

I run PHP 5.x on FreeBSD 4.x with Apache 2.x. I don't particularly fancy
the Linux compability, but rather would prefer a native solution.
It must be free (no charge)...
http://eaccelerator.sourceforge.net/Home
I was happy when you showed me that link, as I had managed to not find  
that particular accelerator software.

However, that ALSO doesn't seem to support PHP 5 and says nothing about  
FreeBSD.

PS: How come that this isn't included in PHP itself, just as there's
mod_deflate for Apache 2?
Probably because it's overkill for most sites.
Well... it should still be available as an option.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: [PHP-INSTALL] Compile Errors on Solaris 9

2005-01-05 Thread Andrew Kreps
On Wed, 5 Jan 2005 10:17:29 -0800, H. Scott Brown [EMAIL PROTECTED] wrote:
 Hi, List,
 
 I need some help with compilation.
 
 ./configure runs fine, in the following manner (4.3.10):
 
[snip]
 *** Error code 1
 make: Fatal error: Command failed for target `ext/zlib/zlib.lo'
 
 Any ideas? I really need to get this going ASAP. I'll post it here first,
 but it looks like a bug?

I once had a similar problem, although not on Solaris.  Have you tried
using --with-zlib or --with-zlib=shared?

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



[PHP] Re: XML Filters for illegal characters

2005-01-05 Thread Jones, Douglas 1
Perhaps I am misunderstanding your problem, so let me ask it another 
way.  Is the problem that you are getting characters entered into the 
database that are encoded in one way (e.g. UTF-8) when you expected the 
characters to be encoded in another way (e.g. ISO-8859-1)?

No, the problem involves characters in the text that are Illegal XML characters 
much like  is an Illegal XML character.  Only, the one the character that my 
software is reporting as illegal is apparently not one that is caught by the 
normal filters (like htmlentities or even some functions specifically coded for 
XML that I found on the PHP.net website).  I think the problem with the filters 
that I have tried is that they only attempt to change entities that are can be 
encoded to something XML safe.  Ideally, what I want is something that just 
removes the offending character if it cannot make it safe for XML.  So, say  
is made into amp; but an unexpected symbol is simply removed. For example 
(suppose ^ is a symbol that cannot be encode for this example):

input: string
output: stramp;ing

input: str^ing
output: string


I hope this makes things clear.  I think that a function just like htmlentities 
but one that just removes characters that are illegal but can not be fixed 
would be the ideal solution.

If anyone needs further clarification, I would be happy to try to provide it.




--
Doug Jones
Co-Op Web Developer
[EMAIL PROTECTED]

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



Re: [PHP] php ignores php_value from httpd.conf?

2005-01-05 Thread Steve Kieu

 --- Sebastian [EMAIL PROTECTED] wrote: 
 hmm i never even knew you can put that in there..

Yes according to php official manual you can
quote Chapter 4 Runtime configuration How to change
configuration setting
When using PHP as an Apache module, you can also
change the configuration settings using directives in
Apache configuration files (e.g. httpd.conf) and
.htaccess files. You will need AllowOverride Options
or AllowOverride All privileges to do so.
/quote

 always used .htaccess or
 in the php.ini
 i've never seen anyone do it in the httpd.conf.
I will try to do it in .htaccess to see but doubt that
it works when in httpd.conf not work.
 
 also you shouldn't quote the value.. you might also

Unquoting it does not solve the problem.

 need to increase
 post_max_size

Will try it. But not only upload_max_filesize; I used
to specify open_dir as well.
 
Thank you for reply.

Kind regards,

=
S.KIEU

Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com

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



[PHP] Php 400 error with suexec/cgi

2005-01-05 Thread Aurélien Cabezon
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi,
I have set up an Apache 1.3.33 with PHP 4.3.10 patched for suexec. Php
run as CGI. Some of my visitors got this [1] error (code 400). When they
turn http/1.1 option ON with IE, the error disapear. Google's crawlers
~ also get the 400 error. What can i do ? I have played with php/cgi
redirect option (in php.ini), but nothing is better. Any suggestion ?
Thanks very much,
- -Acz
Error [1]
- ---
Security Alert! The PHP CGI cannot be accessed directly.
This PHP CGI binary was compiled with force-cgi-redirect enabled. This
means that a page will only be served up if the REDIRECT_STATUS CGI
variable is set, e.g. via an Apache Action directive.
For more information as to why this behaviour exists, see the manual
page for CGI security.
For more information about changing this behaviour or re-enabling this
webserver, consult the installation file that came with this
distribution, or visit the manual page.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFB3Ftm2e0VO2fZtNYRAtQMAJ9GlpfSai6WfNMvK4DnuJbM3bWOCwCfTCAr
e7CttCMMRB1tKvoZPBYMh1U=
=9a2E
-END PGP SIGNATURE-
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: XML Filters for illegal characters

2005-01-05 Thread John Holmes
Jones, Douglas 1 wrote:
 I think that a function just like htmlentities but one
 that just removes characters that are illegal but can not
 be fixed would be the ideal solution.
How do you define what can and cannot be fixed, though? You'd have to 
know the bad characters and in that case, a simple str_replace() is 
all you need.

$bad_characters = array('^','*','#');
$text = str_replace($bad_characters,'',$text);
$text = htmlentities($text);
Or, since you don't really know what's bad then you'd want to define 
what's good. You could use get_html_translation_table() to find 
everything that htmlentities() will convert and then combine those 
characters, alphanumeric characters and whitespace into a preg_replace 
to match anything that's *not* one of those characters and erase it.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] compilation of 4.3.10 fails at zend_strtod.c

2005-01-05 Thread Nat Irons
I have a production server running Mac OS X Server 10.2.8 and PHP 4.3.9. 
Building 4.3.10 fails, along the same lines as this report from last 
week to php-install:

  http://marc.theaimsgroup.com/?l=php-installm=110351226709409w=2

Several closed bugs seem to refer to this problem, for instance:

  http://bugs.php.net/bug.php?id=30927

which suggests it should have been fixed in CVS by of Dec 1, 2004. Mr. 
Byrne discovered otherwise with 200412200130, but I confirmed that it 
apparently has been fixed by stable-200412292330.

So, I seem to be faced with the choice of either putting a snapshot into 
production, or waiting for the next regularly scheduled PHP release to 
resolve ostensibly high-priority security problems. Is there a third 
option?

Thanks,

  -nat

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



Re: [PHP] Re: Persistent PHP web application?

2005-01-05 Thread Richard Lynch
Rasmus Lerdorf wrote:
 Robert Cummings wrote:
 FWIW, I can't see how a WYW server is going to make his application run
 faster. The transfer of the data he wants will still have to be
 serialized and unserialized (in an optimal WYW server only unserialized)
 and this is is exactly his bottleneck using an include. Actually I'd
 imagine because he's using an accelerator it's fast as it can get
 without using some kind of shared memory system. Correct me if I'm
 confused and you know how to transfer raw zend vars over a socket
 without the need to unserialize on the receiver end.

 You are correct, serialization tends to be the bottleneck when it comes
 to restoring large data structs.  So you either avoid recreating the
 data structure and just use the data directly, or use an in-process
 mechanism like apc_store/apc_fetch which does a straight memcpy and
 doesn't need top serialize.  Of course, this still doesn't match writing
 your own extension to manage your persistent data directly without
 needing to shuffle it around back and forth between process and shared
 memory.

Perhaps I'm just being naive and/or stupid, but I was imagining his array
elements going in separate apc_store()s...

And he'd not serialize them, cuz they're just INT or CHAR...

So he'd only retrieve what he needed on a one-by-one basis, very quickly...

But maybe that can't be done.

Or maybe it would be incredibly inefficient.

Or both. :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] making FORM dissapear when successful login

2005-01-05 Thread Richard Lynch
JHollis wrote:
 I had this code working the way i wanted it to (as far as correct
 username and password allowing successful login)...but what i want to
 happen now is when a user successfully logs it it will make the login
 form disappear and just say successfully logged in or welcome user and a
 link below it so they can log off and make the form re-appear.  Below is
 the code that i have where i tried to get it to disappear on successful
 login, but it stays disappeared all the time.  Can someone please point
 out what im doing wrong.  I have tried everything i can think of...and
 nothing works.  Im a PHP newbie...so im sure some of you might get a
 laugh out of this...if it is real easy.

I would *NOT* use break; to get out of the successful login...

Just move everything else inside the else{ } block if you don't want it to
appear.

After they *DO* login, perhaps use http://php.net/session_start so they
can *stay* logged in.  You'll need to move the password check (and
database connection and so on) to be *ABOVE* all the HTML stuff -- to the
very tip-top of the file.

Then, to log them out, you can use the code from
http://php.net/session_destroy

For sure, don't send stuff through as ?_SERVER[username]=xxx

$_SERVER is for the web server to fill in, not you.

You'll just confuse yourself (next week/month/year) and any other
programmer if you start polluting $_SERVER with your own stuff.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: Re[3]: [PHP] How to argue with ASP people...

2005-01-05 Thread Richard Lynch
It should be noted that the MS KnowledgeBase article about trying to do a
dynamic include (as of when I last used ASP, years ago) made absolutely NO
mention of using:

!--#include %=FileName% --!

and tells you to just 'read' and 'print' the file -- which doesn't execute
the ASP at all, and there is no 'eval' function (as far as I could find).

So, assuming this #include stuff actually works, I guess it's just the
documentation that sucked, not the actual technology.

For *THIS* problem.

I fought with ASP for only a few months, but it felt like years, and I
hated every minute of it.

I actually wrote comments in ASP like:

% /*
Microsoft sucks, Microsoft sucks
Can't moveFirst in an empty record set
*/ %

My co-workers knew when such comments were written, since I would sing
them as I typed.  (Yes, really)

I had a lonng song before that two months was up...

Boolean expressions don't short-circuit is another verse I recall, off
the top of my head.

Sadly, I lost all my copies of that song/project.

Oh well.

If somebody out there actually *LIKES* ASP VBScript programming, more
power to them -- So long as I don't have to ever use it again, I don't
care what you use.

Oh yeah, here's a good one:

*EVERY* error message coming back from SQL Server had the same error
number -- Even when the error *message* was different!  That's got to be
in the running for dumbest software design choice on the planet.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Re: Persistent PHP web application?

2005-01-05 Thread Rasmus Lerdorf
Richard Lynch wrote:
Rasmus Lerdorf wrote:
Robert Cummings wrote:
FWIW, I can't see how a WYW server is going to make his application run
faster. The transfer of the data he wants will still have to be
serialized and unserialized (in an optimal WYW server only unserialized)
and this is is exactly his bottleneck using an include. Actually I'd
imagine because he's using an accelerator it's fast as it can get
without using some kind of shared memory system. Correct me if I'm
confused and you know how to transfer raw zend vars over a socket
without the need to unserialize on the receiver end.
You are correct, serialization tends to be the bottleneck when it comes
to restoring large data structs.  So you either avoid recreating the
data structure and just use the data directly, or use an in-process
mechanism like apc_store/apc_fetch which does a straight memcpy and
doesn't need top serialize.  Of course, this still doesn't match writing
your own extension to manage your persistent data directly without
needing to shuffle it around back and forth between process and shared
memory.

Perhaps I'm just being naive and/or stupid, but I was imagining his array
elements going in separate apc_store()s...
And he'd not serialize them, cuz they're just INT or CHAR...
So he'd only retrieve what he needed on a one-by-one basis, very quickly...
But maybe that can't be done.
You can apc_store an entire PHP array in a single call and bring it back 
out with a single apc_fetch call without any serialization needed.  It 
does however do a deep-copy, so there is still overhead, but it is an 
order of magnitude faster than serialize/unserialize.

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


Re: [PHP] Saving Files

2005-01-05 Thread Richard Lynch
[EMAIL PROTECTED] wrote:

 3. Saves/downloads the file to that exact location as pulled from and
 replaces the old file

Ain't no way you're going to be allowed to decide where to save files on
*MY* computer!

That would be a MAJOR security hole...

Now let's look at ways you *COULD* do this.

First, you're looking at a DESKTOP application that can arbitrarily
read/open/write files on the user's desktop.

To keep it relevent, we'll then suggest you use PHP-GTK: http://gtk.php.net

So your user has to install your PHP-GTK application on their own computer.

Then, your GTK PHP application can read/write files on their computer
(assuming they have permission to do so in the first place) and you can
use the functions like http://php.net/file to talk to your web-server.

So it *could* be done, with the rather *HUGE* caveat that you have to get
users to install your PHP GTK application on their machine.

NOTE: There might be easier/faster ways to accomplish building a desktop
application, depending on your skills and background.  But PHP-GTK is one
very good possible solution, which will also for sure have the web access
part of it pretty easy.  Plus it will be portable to many OSes.  And you
can compile it to make it look like a real application, as I understand
it -- though that might cost money for the compiler.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Persistent PHP web application?

2005-01-05 Thread Richard Lynch
 So if what your application mostly does is load in all this data and
 respond to requests, you could write a *SINGLE* PHP application which
 listened on port 12345 (or whatever port you like) and responded with
 the
 data requested.  Like writing your own web-server, only it's a
 _-server where you get to fill in the blank with whatever your
 application does.

 Please see my repsonse to Manuel Lemos and his suggestion to run a SOAP
 server. Basically my concern is the lack of having a
 multi-process/forking server to handle concurrent incoming requests
 (which may or may not be a problem - not sure).  We're talking about a
 persistent PHP server (SOAP or otherwise), and I'm having trouble
 groking how that would work in an environment with many concurrent
 requests.  (Other than, of course, running a PHP SOAP server inside
 Apache which brings me back to square one :)

[shrug]
In my Dream World, you could run as many % php -q wyw_server.php
processes as you like, and the low-level socket code would take care of
only having one of them respond to any given request.

Assuming that's not Reality Based, I guess you could try to figure out how
Apache does its pre-fork and child management...

Ya know, Rasmus' answer of just making your own PHP Module is looking REAL
GOOD right now...

You'll have to stumble your way through a LITTLE bit of C -- most of which
is going to be copypaste from his example code (http://talks.php.net)

And then you're going to copypaste your monster array into your new C code.

Then you'll have to change every line with $foo to just have foo, and
declare foo correctly, and segregate all your data/arrays so all the
arrays have only one kind of data in them, and...

It's going to be confusing as hell at first, but do it with a very SMALL
version of your monster array, and after you get the hang of that, it will
be a lot of global SearchReplace to make your big array work.

Or you could pay a guy who knows C and PHP to do it in, what, a couple
hours?  Depends on how confusing your arrays are, and how heterogeneous
they are, I guess.

Once you do that, all your data is in PHP/Apache when it launches, and
it's always available to your PHP script all the time.  Sweet.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] whats happen fsockopen function?

2005-01-05 Thread Richard Lynch


You're STILL seeing the same WARNING message?

Or now it's just not working?



QT wrote:
 hi,

 I clean all  signs, but still no result. This code was working perfect
 last
 two years. I don't know what happen?




 Richard Lynch [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 QT wrote:
  Dear Sirs,
 
  my fsockopen function is not working, for last 1 day. And I get
 following
  error on log.
 
  Any idea why?
 
  PHP Warning:  Call-time pass-by-reference has been deprecated -
 argument
  passed

 Get rid of the  signs in your code inside the fsockopen(  )

 --
 Like Music?
 http://l-i-e.com/artists.htm

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




-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Persistent PHP web application?

2005-01-05 Thread Rasmus Lerdorf
Richard Lynch wrote:
Or you could pay a guy who knows C and PHP to do it in, what, a couple
hours?  Depends on how confusing your arrays are, and how heterogeneous
they are, I guess.
Once you do that, all your data is in PHP/Apache when it launches, and
it's always available to your PHP script all the time.  Sweet.
Anything you do in the MINIT hook is basically free, so it would be 
trivial to load the data for the array from somewhere.  Like a database, 
an xml file, etc.  So you wouldn't need to hardcode a complex array 
structure in your MINIT hook, just have this generic little extension 
that creates an array (or object) from some external source.  To change 
the data you would change that external source and restart your server, 
or you could write a PHP function in your extension that forced a reload 
with the caveat that each running httpd process would need to have that 
function be called since your array/object lives in each process separately.

If you ask really nicely one of the folks on the pecl-dev list might 
just write this thing for you.  Especially if you spec it out nicely and 
think through how it should work.

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


[PHP] Apache won't start after upgrading to 4.3.10

2005-01-05 Thread Matt Blasinski
Hi,
I recently upgraded from PHP 4.3.4 to 4.3.10 with Apache 1.3.29 on
Solaris.  Before the upgrade, everything was working fine.  After,
Apache won't start up correctly.
'apachectl start' works correctly, but doesn't load any of the SSL
components.
'apachectl startssl' does not work.  It generates the following on the
command line, and nothing in the apache error logs (set to debug, as
high as we can set them).
Segmentation Fault - core dumped
./apachectl startssl: httpd could not be started
I'm not very familiar with examining core files, so I haven't gotten
very far with that.  I also tried trussing the command but didn't figure
it out from there.  If you have suggestions with either of these things
that would be helpful.
Also, if it helps:
$php -i
phpinfo()
PHP Version = 4.3.10
System = SunOS mumble 5.8 Generic_117350-08 sun4u
Build Date = Jan  5 2005 13:03:09
Configure Command =  './configure' '--with-curl'
'--with-openssl=/usr/local/openssl'
'--with-apxs=/usr/local/wiscmail/admin/bin/apxs'
Server API = Command Line Interface
Virtual Directory Support = disabled
Configuration File (php.ini) Path = /usr/local/lib/php.ini
PHP API = 20020918
PHP Extension = 20020429
Zend Extension = 20021010
Debug Build = no
Thread Safety = disabled
Registered PHP Streams = php, http, ftp, https, ftps
If anyone has had a similar problem or has suggestions it would be
greatly appreciated.
Thanks,
Matt
--
Matt Blasinski (mbv)
Software Engineer
Internet Infrastructure Applications Technology
Division of Information Technology
3121 Computer Science and Statistics
1210 West Dayton Street
Madison WI 53706
Work (608) 262-2286
Personal Cell (608) 347-6940
?php
echo You can have it fast, cheap, or working.  Choose two.;
?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] endless while loop

2005-01-05 Thread Gunter Sammet
Hi all:
I am having some trouble getting the following code to work:

if (is_array($bundle_attributes)) {

reset($bundle_attributes);

while (list($option, $value) = each($bundle_attributes)) {

reset($value);

while (list($option2, $value2) = each($value)) {

$this-contents[$products_id]['attributes'][$option] = $value;

if (tep_session_is_registered('customer_id')) tep_db_query(insert into  . 
TABLE_CUSTOMERS_BASKET_BUNDLE_ATTRIBUTES .  (customers_id, products_id, 
sub_product_id, products_options_id, products_options_value_id) values (' . 
(int)$customer_id . ', ' . tep_db_input($products_id) . ', ' . $option . 
', ' . (int)$option2 . ', ' . (int)$value2 . '));

}

}

}

}

It gives me an endless loop in the second while loop. It seems like it 
doesn't move the pointer to the next value in the $option array. When I do a 
print in that loop, I am getting the key value pair for the first element in 
the $option array. Changing it to a for loop works. Any ideas why this 
happens?

TIA

Gunter

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



[PHP] Re: making FORM dissapear when successful login

2005-01-05 Thread Jerry Kita
I do exactly the same thing on my website. I use PHP's Session handling 
to determine if a user is actually logged on.

You can see that I check a variable called $validlogon which I set to 
either YES or NO at the beginning of the script

?php
if ($validlogon == NO) {
print p class=\hnavbar\Salkehatchie Members Login Here:br\n;
print form action=\Salkehatchie_LoginScript.php\ method=\POST\\n;
print p class=\login\smallUSER ID:/smallbr\n;
print input type=\text\ name=\userid\brbr\n;
print smallPASSWORD:/smallbr\n;
print input type=\password\ name=\password\brbr\n;
print input type=\submit\ value=\Enter\/p\n;
print /form\n;
  }
?
Near the beginning of my script I check for the existence of a valid session
?php
if (isset($_SESSION[userid])) {
   $validlogon = YES;
   } else {
   $validlogon = NO;
   }
?
Setting the $validlogon variable allows me to do a number of useful 
things. For example, there are certain parts of the webpage that I 
reveal to logged in users. Checking $validlogon allows me to decide 
dynamically what to render to the browser. In the following I display
a message showing the user as being logged in and give them a link that
logs them out.

if ($validlogon == YES) {
   print table style=\width: 100%\;\n;
   print tbody\n;
   print tr\n;
   print td width=\50%\p class=\login\smallbYOU ARE LOGGED 
IN AS: $_SESSION[userid]/b/small/p/td\n;
   print td width=\50%\p class=\login\smallbCLICK a 
href=\LogoutScript.php\ here/a TO LOGOUT/b/small/p/td\n;
print /tr\n;
print /table\n;
}

Hope this is helpful
Jerry Kita
JHollis wrote:
I had this code working the way i wanted it to (as far as correct 
username and password allowing successful login)...but what i want to 
happen now is when a user successfully logs it it will make the login 
form disappear and just say successfully logged in or welcome user and a 
link below it so they can log off and make the form re-appear.  Below is 
the code that i have where i tried to get it to disappear on successful 
login, but it stays disappeared all the time.  Can someone please point 
out what im doing wrong.  I have tried everything i can think of...and 
nothing works.  Im a PHP newbie...so im sure some of you might get a 
laugh out of this...if it is real easy.

---snippet
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
html
head
link href=style.css rel=stylesheet type=text/css /
/head
body
 div id=container
div id=top
h1header/h1

/div
div id=leftnav
p
?php
$username=$_POST['username'];
$password=$_POST['password'];
$db=user;
$server=localhost;
$db_username=root;
$db_password=***;

$connect = mysql_connect($server,$db_username,$db_password);
if (!$connect) {
die (could not connect to database);
}
$select = mysql_select_db($db,$connect);
if (!$select) {
die (could not select database $db);
}
 /*username='$username';*/
$sql = SELECT * FROM passwords, user_info where id=PID and 
username='$username';
$result = mysql_query($sql);
/*$num_rows = mysql_num_rows($result);*/
while ($user = mysql_fetch_array($result))
{
$id = $user['id'];
$username2 = $user['username'];
$password2 = $user['password'];
$firstname = $user['firstname'];
$email = $user['email_address'];
   
   
IF ($username==$username2  $password==$password2)
{
echo(\Welcome, b$firstname/b\);?br?
echo (\Your email address is b$emailb\);?/tdtr
a 
href=?$_SERVER['PHP_SELF']??username=?password=Logoff/a?
break;
}
else
{
?
FORM action=?$_SERVER['PHP_SELF']? method=post
INPUT type=hidden name=id
table
tdb*/bUsername:/td tdINPUT class=input 
size=8 type=text name=username value=?echo $username?/tdtr
tdb*/bPassword:/td tdINPUT class=input 
size=8 type=password name=password/tdtr
td class=xsmallb* Case Sensitive/b/td
tdINPUT type=submit value=Login/tdtr
tdnbsp /td
/table
/FORM
?
   
break;
}
   
}   
//IF ($username != $username2 || $password != $password2) {//

   

?br
?
if  ($username ==   $password == ) {
echo (Please type in a Username and Password);}
if  ($username !=   $password == ) {
echo (Please type in a password);}
if  ($username ==   $password != ) {
echo (Please type in a username and password);}

 ?
   

/p
/div
?if (($username2==$username  $password2==$password)  
($username2!= || $password2!=)){?
div id=rightnav class=box
p
/p
/div
?}?
div id=content
h2Subheading/h2
p
/p
p
/p
/div
div id=footer
p
Today is
?php
echo( date(F dS Y.));

[PHP] Re: PHP cacher?

2005-01-05 Thread Matthew Weier O'Phinney
* Kimmo Alm [EMAIL PROTECTED]:
 On 5 Jan 2005 17:28:42 -, Matthew Weier O'Phinney [EMAIL PROTECTED]  
 wrote:
  * Kimmo Alm [EMAIL PROTECTED]:
   I've been looking for some PHP cache software for a while now, and
   I  just can't seem to find one suitable for my setup.
  
   I run PHP 5.x on FreeBSD 4.x with Apache 2.x. I don't particularly fancy
   the Linux compability, but rather would prefer a native solution.
  
   It must be free (no charge)...
 
  http://eaccelerator.sourceforge.net/Home

 I was happy when you showed me that link, as I had managed to not find  
 that particular accelerator software.

 However, that ALSO doesn't seem to support PHP 5 and says nothing about  
 FreeBSD.

I don't mean to be rude, but how deep did you dig into that site?

It *does* support PHP5, as of 0.9.1. It was for that reason that it came
into being -- it forked off of Turckk mmcache because no progress was
being made on PHP5 compatability.

Also -- of the two items in the FAQ, one *specifically* addresses
compiling for FreeBSD.

-- 
Matthew Weier O'Phinney   | mailto:[EMAIL PROTECTED]
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org

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



[PHP] Re: making FORM dissapear when successful login

2005-01-05 Thread JHollis
Where do i need to start my session?  Ive copied and pasted exactly what 
you have typed..and the form doesnt display unless i hard code the 
variable to NO.

Jerry Kita wrote:
I do exactly the same thing on my website. I use PHP's Session handling 
to determine if a user is actually logged on.

You can see that I check a variable called $validlogon which I set to 
either YES or NO at the beginning of the script

?php
if ($validlogon == NO) {
print p class=\hnavbar\Salkehatchie Members Login Here:br\n;
print form action=\Salkehatchie_LoginScript.php\ method=\POST\\n;
print p class=\login\smallUSER ID:/smallbr\n;
print input type=\text\ name=\userid\brbr\n;
print smallPASSWORD:/smallbr\n;
print input type=\password\ name=\password\brbr\n;
print input type=\submit\ value=\Enter\/p\n;
print /form\n;
  }
?
Near the beginning of my script I check for the existence of a valid 
session

?php
if (isset($_SESSION[userid])) {
   $validlogon = YES;
   } else {
   $validlogon = NO;
   }
?
Setting the $validlogon variable allows me to do a number of useful 
things. For example, there are certain parts of the webpage that I 
reveal to logged in users. Checking $validlogon allows me to decide 
dynamically what to render to the browser. In the following I display
a message showing the user as being logged in and give them a link that
logs them out.

if ($validlogon == YES) {
   print table style=\width: 100%\;\n;
   print tbody\n;
   print tr\n;
   print td width=\50%\p class=\login\smallbYOU ARE LOGGED 
IN AS: $_SESSION[userid]/b/small/p/td\n;
   print td width=\50%\p class=\login\smallbCLICK a 
href=\LogoutScript.php\ here/a TO LOGOUT/b/small/p/td\n;
print /tr\n;
print /table\n;
}

Hope this is helpful
Jerry Kita
JHollis wrote:
I had this code working the way i wanted it to (as far as correct 
username and password allowing successful login)...but what i want to 
happen now is when a user successfully logs it it will make the login 
form disappear and just say successfully logged in or welcome user and 
a link below it so they can log off and make the form re-appear.  
Below is the code that i have where i tried to get it to disappear on 
successful login, but it stays disappeared all the time.  Can someone 
please point out what im doing wrong.  I have tried everything i can 
think of...and nothing works.  Im a PHP newbie...so im sure some of 
you might get a laugh out of this...if it is real easy.

---snippet
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
html
head
link href=style.css rel=stylesheet type=text/css /
/head
body
 div id=container
div id=top
h1header/h1

/div
div id=leftnav
p
?php
$username=$_POST['username'];
$password=$_POST['password'];
$db=user;
$server=localhost;
$db_username=root;
$db_password=***;
$connect = mysql_connect($server,$db_username,$db_password);
if (!$connect) {
die (could not connect to database);
}
$select = mysql_select_db($db,$connect);
if (!$select) {
die (could not select database $db);
}
 /*username='$username';*/
$sql = SELECT * FROM passwords, user_info where id=PID and 
username='$username';
$result = mysql_query($sql);
/*$num_rows = mysql_num_rows($result);*/
while ($user = mysql_fetch_array($result))
{
$id = $user['id'];
$username2 = $user['username'];
$password2 = $user['password'];
$firstname = $user['firstname'];
$email = $user['email_address'];
  IF ($username==$username2  $password==$password2)
{
echo(\Welcome, b$firstname/b\);?br?
echo (\Your email address is b$emailb\);?/tdtr
a 
href=?$_SERVER['PHP_SELF']??username=?password=Logoff/a?
break;
}
else
{
?
FORM action=?$_SERVER['PHP_SELF']? method=post
INPUT type=hidden name=id
table
tdb*/bUsername:/td tdINPUT class=input 
size=8 type=text name=username value=?echo $username?/tdtr
tdb*/bPassword:/td tdINPUT class=input 
size=8 type=password name=password/tdtr
td class=xsmallb* Case Sensitive/b/td
tdINPUT type=submit value=Login/tdtr
tdnbsp /td
/table
/FORM
?
   break;
}
   }   //IF ($username != $username2 || $password != 
$password2) {//

  
?br
?
if  ($username ==   $password == ) {
echo (Please type in a Username and Password);}

if  ($username !=   $password == ) {
echo (Please type in a password);}
if  ($username ==   $password != ) {
echo (Please type in a username and password);}
 ?
   /p
/div
?if (($username2==$username  $password2==$password)  

[PHP] Re: PHP cacher?

2005-01-05 Thread Kimmo Alm
On 6 Jan 2005 03:02:10 -, Matthew Weier O'Phinney [EMAIL PROTECTED]  
wrote:

* Kimmo Alm [EMAIL PROTECTED]:
On 5 Jan 2005 17:28:42 -, Matthew Weier O'Phinney  
[EMAIL PROTECTED]
wrote:
 * Kimmo Alm [EMAIL PROTECTED]:
  I've been looking for some PHP cache software for a while now, and
  I  just can't seem to find one suitable for my setup.
 
  I run PHP 5.x on FreeBSD 4.x with Apache 2.x. I don't particularly  
fancy
  the Linux compability, but rather would prefer a native solution.
 
  It must be free (no charge)...

 http://eaccelerator.sourceforge.net/Home

I was happy when you showed me that link, as I had managed to not find
that particular accelerator software.
However, that ALSO doesn't seem to support PHP 5 and says nothing about
FreeBSD.
I don't mean to be rude, but how deep did you dig into that site?
It *does* support PHP5, as of 0.9.1. It was for that reason that it came
into being -- it forked off of Turckk mmcache because no progress was
being made on PHP5 compatability.
Also -- of the two items in the FAQ, one *specifically* addresses
compiling for FreeBSD.
Hmm... I'm very sorry if this is the case, which it probably is.
I looked through the entire site (all I could find), and even downloaded  
the latest package and read the README.

Quote: Requirements

apache 1.3, mod_php 4.1, autoconf, automake, libtool, m4
This is where I stopped reading. Perhaps it was a stupid thing to do.
Thanks again for the tip. Since you're most likely right, I'll dig in  
further into the docs.

But on my side, the requirements aren't exactly clear in any way...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: PHP cacher?

2005-01-05 Thread Kimmo Alm
On 6 Jan 2005 03:02:10 -, Matthew Weier O'Phinney [EMAIL PROTECTED]  
wrote:

* Kimmo Alm [EMAIL PROTECTED]:
On 5 Jan 2005 17:28:42 -, Matthew Weier O'Phinney  
[EMAIL PROTECTED]
wrote:
 * Kimmo Alm [EMAIL PROTECTED]:
  I've been looking for some PHP cache software for a while now, and
  I  just can't seem to find one suitable for my setup.
 
  I run PHP 5.x on FreeBSD 4.x with Apache 2.x. I don't particularly  
fancy
  the Linux compability, but rather would prefer a native solution.
 
  It must be free (no charge)...

 http://eaccelerator.sourceforge.net/Home

I was happy when you showed me that link, as I had managed to not find
that particular accelerator software.
However, that ALSO doesn't seem to support PHP 5 and says nothing about
FreeBSD.
I don't mean to be rude, but how deep did you dig into that site?
It *does* support PHP5, as of 0.9.1. It was for that reason that it came
into being -- it forked off of Turckk mmcache because no progress was
being made on PHP5 compatability.
Also -- of the two items in the FAQ, one *specifically* addresses
compiling for FreeBSD.
I looked at the Web site again, and now it was all clear. Perhaps I was  
mentally drunk or something at the time I first checked it. Sorry.

However, it's funny how they lie in the actual README ;-)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: making FORM dissapear when successful login

2005-01-05 Thread JHollis
nevermind...i figured it out. I will read up on sessions and test some 
things with what you posted and if i have anymore questions, i will post 
them. Thanks Jerry.

If anyone else has any other suggestions, please feel free to share them 
with me.

JHollis wrote:
Where do i need to start my session?  Ive copied and pasted exactly what 
you have typed..and the form doesnt display unless i hard code the 
variable to NO.

Jerry Kita wrote:
I do exactly the same thing on my website. I use PHP's Session 
handling to determine if a user is actually logged on.

You can see that I check a variable called $validlogon which I set to 
either YES or NO at the beginning of the script

?php
if ($validlogon == NO) {
print p class=\hnavbar\Salkehatchie Members Login Here:br\n;
print form action=\Salkehatchie_LoginScript.php\ method=\POST\\n;
print p class=\login\smallUSER ID:/smallbr\n;
print input type=\text\ name=\userid\brbr\n;
print smallPASSWORD:/smallbr\n;
print input type=\password\ name=\password\brbr\n;
print input type=\submit\ value=\Enter\/p\n;
print /form\n;
  }
?
Near the beginning of my script I check for the existence of a valid 
session

?php
if (isset($_SESSION[userid])) {
   $validlogon = YES;
   } else {
   $validlogon = NO;
   }
?
Setting the $validlogon variable allows me to do a number of useful 
things. For example, there are certain parts of the webpage that I 
reveal to logged in users. Checking $validlogon allows me to decide 
dynamically what to render to the browser. In the following I display
a message showing the user as being logged in and give them a link that
logs them out.

if ($validlogon == YES) {
   print table style=\width: 100%\;\n;
   print tbody\n;
   print tr\n;
   print td width=\50%\p class=\login\smallbYOU ARE 
LOGGED IN AS: $_SESSION[userid]/b/small/p/td\n;
   print td width=\50%\p class=\login\smallbCLICK a 
href=\LogoutScript.php\ here/a TO LOGOUT/b/small/p/td\n;
print /tr\n;
print /table\n;
}

Hope this is helpful
Jerry Kita
JHollis wrote:
I had this code working the way i wanted it to (as far as correct 
username and password allowing successful login)...but what i want to 
happen now is when a user successfully logs it it will make the login 
form disappear and just say successfully logged in or welcome user 
and a link below it so they can log off and make the form re-appear.  
Below is the code that i have where i tried to get it to disappear on 
successful login, but it stays disappeared all the time.  Can someone 
please point out what im doing wrong.  I have tried everything i can 
think of...and nothing works.  Im a PHP newbie...so im sure some of 
you might get a laugh out of this...if it is real easy.

---snippet
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
html
head
link href=style.css rel=stylesheet type=text/css /
/head
body
 div id=container
div id=top
h1header/h1

/div
div id=leftnav
p
?php
$username=$_POST['username'];
$password=$_POST['password'];
$db=user;
$server=localhost;
$db_username=root;
$db_password=***;
$connect = mysql_connect($server,$db_username,$db_password);
if (!$connect) {
die (could not connect to database);
}
$select = mysql_select_db($db,$connect);
if (!$select) {
die (could not select database $db);
}
 /*username='$username';*/
$sql = SELECT * FROM passwords, user_info where id=PID and 
username='$username';
$result = mysql_query($sql);
/*$num_rows = mysql_num_rows($result);*/
while ($user = mysql_fetch_array($result))
{
$id = $user['id'];
$username2 = $user['username'];
$password2 = $user['password'];
$firstname = $user['firstname'];
$email = $user['email_address'];
  IF ($username==$username2  
$password==$password2)
{
echo(\Welcome, b$firstname/b\);?br?
echo (\Your email address is b$emailb\);?/tdtr
a 
href=?$_SERVER['PHP_SELF']??username=?password=Logoff/a?
break;
}
else
{
?
FORM action=?$_SERVER['PHP_SELF']? method=post
INPUT type=hidden name=id
table
tdb*/bUsername:/td tdINPUT class=input 
size=8 type=text name=username value=?echo 
$username?/tdtr
tdb*/bPassword:/td tdINPUT class=input 
size=8 type=password name=password/tdtr
td class=xsmallb* Case Sensitive/b/td
tdINPUT type=submit value=Login/tdtr
tdnbsp /td
/table
/FORM
?
   break;
}
   }   //IF ($username != $username2 || $password != 
$password2) {//

  ?br
?
if  ($username ==   $password == ) {
echo (Please type in a Username and Password);}
if  ($username 

[PHP] call a function within the same class

2005-01-05 Thread kalinga
Dear all,
I recently started PHP OOP and I'm bit confused about best and the most
efficient methods when 'declaring a class' and 'calling function',
could somebody
explain me with following sample code, it would be great..

thanks..

class classLdap{

$rslt = $_POST['rslt'];

function ldapConnect($rslt){
  
  ..
  return $rslt;
}// end function ldapConnect

function ldapAdd($rslt){
  // i want to call ldapConnect($rslt) here what is the best method.

$rslt = classLdap::ldapConnect($rslt);
 
//or
//(curently i'm doing this way, it's to lengthy)

 $new_classLdap = new classLdap;
 $rslt = $new_classLdap-ldapConnect($rslt);

//or

 $rslt = $this-ldapConnect($rslt); 
}// end function ldapAdd

}// end class  

-- 
vk.

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



[PHP] Setting Up PHP

2005-01-05 Thread George McGuey
I am using SAMS Teach Yourself on PHP,MYSQL and Apache.

 

Everything has gone well except for the final step to test the PHP by
creating in Apache htdocs file called phpinfo.php.
 
When I do this and then go to the http://localhost/phpinfo.php to view the
information page all I get is the original lines of that are in the text
file which is ?php phpinfo() ; ?
 
Need help and I am an absolute novice in terms of knowledge.
 
Thanks 
 
 

 

G. McGuey

 



[PHP] Weird search and replace

2005-01-05 Thread Liam Gibbs
I'm trying to do a search-and-replace for a certain string (#1) from a bigger 
string (#2), take that string (#1), do an SQL search, then do a little fiddling 
to make another string (#3), and put that string (#3) back into the big string 
(#2) to replace the certain string (#1).

Here's what I need. I have a string such as this:

Yadda yadda yadda yadda '32'(l) yadda yadda yadda '2'(l) yadda '419'(l). (#2)

I need to find the strings like '32'(l), '2'(l), and '419'(l), including the 
single quotes. Basically a '[0-9]*'(l). This is #1.

Take that string, look up a record in an SQL table based on the number in the 
single quotes. Take a field in the record (#3) and replace #1 with it. So 
basically, we have:

Yadda yadda yadda yadda supplanted-string yadda yadda yadda supplanted-string 
yadda supplanted-string. (#2)

I really hope I'm explaining this properly, and after a few attempts, I have no 
clue where to restart. Does anyone have any ideas how to do this?

[PHP] Image copying

2005-01-05 Thread Liam Gibbs
Hello,

I'm having a real frustrating time with my problem here, which is to copy one 
JPEG to another resource. I'm not even sure where I'm going wrong, or how to 
find it out, because it seems that I'm getting all my resource IDs fine (when I 
echo them, I get 'resource ID #x'), and no error message pops up. Just a broken 
image is produced. I've been racking myself for so long now that my problem may 
be right under my nose, but my brain is so baked it's just not working. And 
I've tried to leave and come back to it, but... you know how it is. Here's what 
I'm doing.

What I'm trying to do is copy one JPEG to another JPEG (as mentioned) on the 
fly. I don't want to have a new file produced, just a modified JPEG (a few 
circles here and there) held in a resource. Here's how I call my function and 
how I display the image via HTML:

print(IMG ALT... HEIGHT... WIDTH... SRC = \ . copy_pic($sourcepic) . \);

So I'm calling the function straight from the SRC attribute of the IMG tag. 
Here's what's in my function:

function copy_pic($sourcepic) {
   if(file_exists($sourcepic)) {
  $destinationpic = imagecreatetruecolor(imagesx($sourcepic), 
imagesy($sourcepic));
  imagecopy($destinationpic, $sourcepic, 0, 0, 0, 0, imagesx($sourcepic), 
imagesy($sourcepic));
   }

   return $destinationpic;
}

After this, I'm going to be tampering with the pic, but I just wanted to make 
sure I'm getting something, which I'm not. All I get is a broken image. No 
error message, no nothing. Please tell me I'm not overlooking some really 
idiotic thing, but I'm just having one heckuva time with this.

Thanks, everyone.