[PHP] Pipe an email to PHP

2003-08-26 Thread Thomas Tremain
 
I'm sure this question has been visited before, but I've had some troubles
searching through 
the archives.
 
This is at least a two part question.
 
I wish to use a pipe instead of the pop3 class, because I wish the email to
start the script 
instead of waiting for a cronjob.
 
1)  The pipe itself:
On a cPanel server, I wish to setup an email address with a pipe like:
[EMAIL PROTECTED]  :
|/home/account/public_html/mailtools/emailscript.php
 
This always gives me an error saying it cannot foraward.
 
If I pipe it to "|/usr/bin/php
/home/account/public_html/mailtools/emailscript.php"
it tells me: "No input file specified."
 
2) to read the data:
 
I wish to parse the data into $from  $subject and $body
 
The data will then be manipulated, and key pieces of data will be extracted 
and sent to either a database or an instant message to my cell phone. (this 
part I've already solved)
 
 
Thomas Tremain
www.LiveHost.net  
www.GotoNames.com  
www.TrafficExaminer.com  
 
 
 
 


RE: [PHP] OO PHP question

2003-08-26 Thread Ralph Guzman
http://www.php.net/oop

http://php.resourceindex.com/Documentation/Class_Design_and_OOP/

http://www.evolt.org/article/PHP_Intro_to_Objects_and_Classes/17/48911/i
ndex.html


-Original Message-
From: Mike Zornek [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 26, 2003 11:01 AM
To: [EMAIL PROTECTED]
Subject: [PHP] OO PHP question

I'm just beginning a new PHP system and would like to do it in an OO
way.
I'm having trouble getting my head around how I should store the data in
the
MySQL db. I mean do I build model objects in PHP and put logic right in
the
model so anytime I set a property of the object it makes the change to
the
DB right there and then (which may get chatty) or do I build model
objects
and then on pages, initialize them from the DB, do my work and send all
the
data to the db in one shot?

Everything I've done in PHP has been procedural till this point so I'm
up
for any advice, articles, links, etc.

~ Mike
-- 
Mike Zornek
Extreme geek in training
http://MikeZornek.com

-- 
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] verifying sql INSERTs

2003-08-26 Thread Chris W. Parker
Curt Zirzow 
on Tuesday, August 26, 2003 11:26 AM said:

> Like what happens if for some reason the constraint gets dropped?
> having your progam rely on the constraint will cause all data
> integrity to go to hell.

In that case I hope you're also incrementing your own IDs and not
leaving that up to the db either. You might also do yourself a favor and
write down each transaction instead of hoping the computer will do it's
job correctly. ;)

But seriously, how likely is it for a db/table to just drop it's
constraint? And in what situations would/could that happen?


Chris.

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



Re: [PHP] PHP Interview questions

2003-08-26 Thread Gabriel Guzman
On Tue, 2003-08-26 at 10:00, CPT John W. Holmes wrote:

> PHP is server side, so it obviously cannot control light bulbs. Use
> javascript.

maybe the lightbulbs are connected to the server :) 

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



Re: [PHP] PHP Interview questions

2003-08-26 Thread Gabriel Guzman
On Tue, 2003-08-26 at 10:36, Ray Hunter wrote:
> Everyone has given some great information. I have some ideas i would
> like to throw into the mix too.
> 
> Here are some topics:
> 
> 1. Questions regarding HTTP protocols. (SSL)

One that was we like to use is:   Describe an HTTP header.  

Most people who work with php/mysql (or any web development really)
should know what http headers are and (one would hope) be able to
describe them in some sort of detail. 


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



Re: [PHP] HIPAA EDI X12 stuff?

2003-08-26 Thread Cesar Cordovez
Is this related with HIPPA compliance?  I'm VERY interested too...

Richard Lynch wrote:

I don't suppose anybody has any HIPAA stuff implementing something like:
ASC X12N 270/271 (004010X092) or its subsequent standards in PHP?...
Email off-list if you have any idea what I'm talking about, since *I*
don't even want to really do this, so I doubt too many others are
interested...
What I *really* want is to just curl POST to their web-server, or
something similar, but I've been bounced through 4 different
departments/people, and am reduced to reading the 270/271 specs for "fun"
while waiting for them to give me a single straight answer.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PHP if exit Q

2003-08-26 Thread jsWalter
If I am in a second level IF conditional and it failes, I want to jump out
of the parent IF.

How can I do that?



Thanks



Walter

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



Re: [PHP] Need help - past deadline

2003-08-26 Thread David Otton
On Tue, 26 Aug 2003 12:39:53 -0500, you wrote:

> 
> $row[0]; ?>
> 

Missing 

>
>Jay Fitzgerald, Design Director
>- Certified Professional Webmaster (CPW-A)
>- Certified Professional Web Designer (CPWDS-A)
>- Certified Professional Web Developer (CPWDV-A)
>- Certified E-Commerce Manager (CECM-A)
>- Certified Small Business Web Consultant (CWCSB-A)
>
>Bayou Internet - http://www.bayou.com
>Toll Free: 888.30.BAYOU (22968)
>Vox: 318.338.2034 / Fax: 318.338.2506
>E-Mail: [EMAIL PROTECTED]
>ICQ: 38823829 / AIM: bayoujf / MSN: bayoujf / Yahoo: bayoujf
>  

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



Re: [PHP] webserver for mac

2003-08-26 Thread Richard Baskett
on 8/26/03 10:50 AM, Edward Peloke at [EMAIL PROTECTED] wrote:

> Hello all,
> 
> I am doing some php work for a local company who uses a mac.  I was telling
> them that I use apache as my webserver and they want to know what they can
> use as their webserver.  I know nothing about Macs and don't think you an
> run apache but I may be all wrong...what do mac owners use for a webserver?
> 
> Thanks,
> Eddie

My primary machine is a Mac OS X machine and I run Apache, whatever version
you would like, PHP, MySQL and all of the other fun stuff.  Plus I
administer a couple xserves and of course they can run it all also.  Now if
you are using OS 9 then tell them they need to upgrade to OS X.  OS 9 just
has too many problems and shouldn¹t be used as a webserver in my opinion.

Cheers!

Rick

"Do all the good you can, By all the means you can, In all the ways you can,
In all the places you can, At all the times you can, To all the people you
can, As long as ever you can." - John Wesley

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



RE: [PHP] Need help - past deadline

2003-08-26 Thread Chris W. Parker
Jay Fitzgerald 
on Tuesday, August 26, 2003 10:40 AM said:

Whoops! Sent that first one prematurely. heh...


> can someone please look at my code below and tell me why it is only
> working half-way?

What does print_r($row) show you?


Chris.

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



Re: [PHP] PHP Interview questions

2003-08-26 Thread Curt Zirzow
* Thus wrote Richard Baskett ([EMAIL PROTECTED]):
> on 8/26/03 9:57 AM, Robert Cummings at [EMAIL PROTECTED] wrote:
> 
> > This smells like a trick question... Are the switches connected to the
> > same light bulb? You've only mentioned one light bulb? 8)
> > 
> > Cheers,
> > Rob.
> > 
> > 
> > On Tue, 2003-08-26 at 12:35, Jay Blanchard wrote:
> >> Also ask a couple of other questions that require thought, but have
> >> nothing else to do with code. such as...
> >> 
> >> In one room you have 3 light switches, each connected to one light bulb
> >> in another room. How many trips must you make to determine which switch
> >> is connected to which light bulb?
> 
> Only one trip, and Im not sure if I should explain or let you guys figure it
> out :)

toggle_light(1);
sleep(120);
toggle_light(1);

toggle_light(2);
move('self', 'room/');

if ($lightbulb['temp'] > $room['temp']) {
  echo "switch #1";
} elseif ($lightbulb['ison']) {
  echo "switch #2";
} else {
  echo "switch #3";
}

hm.. i had to keep it OT somehow :)


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



RE: [PHP] need help - past deadline

2003-08-26 Thread Jay Blanchard
[snip]
$sql = "SELECT seat, alias FROM attendees";
$sql_result = mysql_query($sql,$connection) or die("Couldn't execute
query.");

$row = mysql_fetch_array($sql_result);
$myseat = 
array('70','71','72','73','74','75','76','77','78','79','80','81','82','
83','84');
$i = 70;

foreach ($myseat as $seat)
{
 if (($seat) == ($row[0]))
[/snip]

Jay you are not looping through each row as far as I can see. You fetch
the row array once, getting you one seat and one alias. You loop through
the $myseat array against the one row, and I think you should loop
through the $myseat array for each row...right?

Jay

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



RE: [PHP] Website templating schemes

2003-08-26 Thread Chris W. Parker
Russell P Jones 
on Tuesday, August 26, 2003 10:44 AM said:

> Agreed with John W. Homes regarding his method of website templating.
> It is used in that fashion for all sites run by demcampaigns.com and
> www.collegedems.com

In that case it CAN'T be a good idea! HAR HAR!



Chris.

p.s. not looking to start a holy/flame war, just thought it'd be funny!

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



Re: [PHP] webserver for mac

2003-08-26 Thread andu
On Tue, 26 Aug 2003 13:50:27 -0400
[EMAIL PROTECTED] (Edward Peloke) wrote:

> Hello all,
> 
> I am doing some php work for a local company who uses a mac.  I was
> telling them that I use apache as my webserver and they want to know
> what they can use as their webserver.  I know nothing about Macs and
> don't think you an run apache but I may be all wrong...what do mac
> owners use for a webserver?

MacOS X runs Apache PHP MYSQL and probably anything else that you can
run on Linux/BSD. Actually it comes with Apache as default server.

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


-- 
Andu

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



Re: [PHP] verifying sql INSERTs

2003-08-26 Thread Curt Zirzow
* Thus wrote Chris W. Parker ([EMAIL PROTECTED]):
> Marek Kilimajer 
> on Tuesday, August 26, 2003 3:59 AM said:
> 
> > mysql_query() will return true for queries that don't return rows and
> > were executed without error, so you can use
> > return mysql_query();
> 
> > You should also make a UNIQUE index on email column, then you can
> > check the number returned by mysql_errno(), one number I don't
> > remember signals duplicate entry error.
> 
> OOhhh... You know, I already HAVE done this, and I just came to the
> realization that if I've already got a constraint on the email column
> then why the heck am I checking to see if the value is already there?
> That's just a waste of resources.
> 
> I should instead just try to perform the INSERT and then if it fails I
> know I've already got a record. If it doesn't I know everything is cool.

I've debated with myself several times if this is really a good
method to not have duplicates in the database. 

Like what happens if for some reason the constraint gets dropped?
having your progam rely on the constraint will cause all data
integrity to go to hell.

Since the field is a unique index, there wont be much overhead in
the query itself.

Still undecided...

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



Re: [PHP] webserver for mac

2003-08-26 Thread Mark Bomgardner
[PHP] webserver for macIf your company is using MAC OS X, apache is the built in 
webserver.  If they are using less than that, apache is not going to work.  I would 
suggest that you have your client use OS X.  You can use the single user version if 
you are going to host just one site, if it's going to multiple site, user OS X Server.
  - Original Message - 
  From: [EMAIL PROTECTED] 
  To: [EMAIL PROTECTED] Php. Net 
  Sent: Tuesday, August 26, 2003 12:50 PM
  Subject: [PHP] webserver for mac


  Hello all, 

  I am doing some php work for a local company who uses a mac.  I was telling 
  them that I use apache as my webserver and they want to know what they can 
  use as their webserver.  I know nothing about Macs and don't think you an 
  run apache but I may be all wrong...what do mac owners use for a webserver? 

  Thanks, 
  Eddie 

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


RE: [PHP] Need help - past deadline

2003-08-26 Thread Chris W. Parker
Jay Fitzgerald 
on Tuesday, August 26, 2003 10:40 AM said:

> can someone please look at my code below and tell me why it is only
> working half-way? It is only displaying radio buttons and seats for
> numbers 71, 73, 75, 77, 79, 81, 83, and 85.and it is printing
> seat # 76 since that is the one in the database between seats 81 and
> 83why is this happenening and HOW can i correct it???
> 
> 
> $sql = "SELECT seat, alias FROM attendees";
> $sql_result = mysql_query($sql,$connection) or die("Couldn't execute
> query."); 
> 
> $row = mysql_fetch_array($sql_result);
> $myseat =
>
array('70','71','72','73','74','75','76','77','78','79','80','81','82','
83','84');
> $i = 70;
> 
> foreach ($myseat as $seat)
> {
>  if (($seat) == ($row[0]))
>  {
>  if ($i <= 84)
>  {
>> 
>   class="red">
>}
>  }
> 
>  else
>  {
>  if ($i <= 84)
>  {
>> 
>   class="green">
>}
>  }
> }
>> 
> 
> 
> 
> Jay Fitzgerald, Design Director
> - Certified Professional Webmaster (CPW-A)
> - Certified Professional Web Designer (CPWDS-A)
> - Certified Professional Web Developer (CPWDV-A)
> - Certified E-Commerce Manager (CECM-A)
> - Certified Small Business Web Consultant (CWCSB-A)
> 
> Bayou Internet - http://www.bayou.com
> Toll Free: 888.30.BAYOU (22968)
> Vox: 318.338.2034 / Fax: 318.338.2506
> E-Mail: [EMAIL PROTECTED]
> ICQ: 38823829 / AIM: bayoujf / MSN: bayoujf / Yahoo: bayoujf
> 

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



Re: [PHP] webserver for mac

2003-08-26 Thread Larry E . Ullman
what do mac owners use for a webserver?
OS X users (Server and Client) use Apache 1.x, which is built-in. 
People with earlier versions of the operating system (OS 9 and earlier) 
used WebStar (I don't know if it supports PHP) or WebTen by Tenon 
(which is just a version of Apache and does support PHP). There may be 
others but those are the big two, I believe.

Larry

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


[PHP] OO PHP question

2003-08-26 Thread Mike Zornek
I'm just beginning a new PHP system and would like to do it in an OO way.
I'm having trouble getting my head around how I should store the data in the
MySQL db. I mean do I build model objects in PHP and put logic right in the
model so anytime I set a property of the object it makes the change to the
DB right there and then (which may get chatty) or do I build model objects
and then on pages, initialize them from the DB, do my work and send all the
data to the db in one shot?

Everything I've done in PHP has been procedural till this point so I'm up
for any advice, articles, links, etc.

~ Mike
-- 
Mike Zornek
Extreme geek in training
http://MikeZornek.com

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



[PHP] Suggest a portal management system ?

2003-08-26 Thread fatih olcer
can you please suggest a portal management system that is:

- bug free 
- open source
- modular 
and  with a good interface


thx.

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



[PHP] mac web server

2003-08-26 Thread Edward Peloke
ok, please excuse my last question, I see you can use apache on a mac per
the phpmac site.

Thanks,
Eddie

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



Re: [PHP] PHP Interview questions

2003-08-26 Thread Michael A Smith
CPT John W. Holmes wrote:

From: "Jay Blanchard" <[EMAIL PROTECTED]>

 

Also ask a couple of other questions that require thought, but have
nothing else to do with code. such as...
In one room you have 3 light switches, each connected to one light bulb
in another room. How many trips must you make to determine which switch
is connected to which light bulb?
   

PHP is server side, so it obviously cannot control light bulbs. Use
javascript.
---John Holmes...

 

That was good. :)

-Michael

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


Re: [PHP] Website templating schemes

2003-08-26 Thread Russell P Jones
Agreed with John W. Homes regarding his method of website templating. It
is used in that fashion for all sites run by demcampaigns.com and
www.collegedems.com

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



[PHP] Need help - past deadline

2003-08-26 Thread Jay Fitzgerald
can someone please look at my code below and tell me why it is only working 
half-way? It is only displaying radio buttons and seats for numbers 71, 73, 
75, 77, 79, 81, 83, and 85.and it is printing seat # 76 since that is 
the one in the database between seats 81 and 83why is this happenening 
and HOW can i correct it???

$sql = "SELECT seat, alias FROM attendees";
$sql_result = mysql_query($sql,$connection) or die("Couldn't execute query.");
$row = mysql_fetch_array($sql_result);
$myseat = 
array('70','71','72','73','74','75','76','77','78','79','80','81','82','83','84');
$i = 70;

foreach ($myseat as $seat)
{
if (($seat) == ($row[0]))
{
if ($i <= 84)
{
?>


}
}

else
{
if ($i <= 84)
{
?>


}
}
}
?>


Jay Fitzgerald, Design Director
- Certified Professional Webmaster (CPW-A)
- Certified Professional Web Designer (CPWDS-A)
- Certified Professional Web Developer (CPWDV-A)
- Certified E-Commerce Manager (CECM-A)
- Certified Small Business Web Consultant (CWCSB-A)
Bayou Internet - http://www.bayou.com
Toll Free: 888.30.BAYOU (22968)
Vox: 318.338.2034 / Fax: 318.338.2506
E-Mail: [EMAIL PROTECTED]
ICQ: 38823829 / AIM: bayoujf / MSN: bayoujf / Yahoo: bayoujf
  

Re: [PHP] PHP Interview questions

2003-08-26 Thread Ray Hunter
Everyone has given some great information. I have some ideas i would
like to throw into the mix too.

Here are some topics:

1. Questions regarding HTTP protocols. (SSL)

2. Questions regarding the server that you will be deploying on.
   If you are deploying to apache or iis they should be familiar.

3. MySQL questions. (setup, maintenance, sql, optimization)
   There are many ways to do this and they should give you some answer.

4. Also questions regarding development platform.
   Do they know how to work on the platform. I dont know how man
   people i have seen that develop on windows and deploy to linux and
   have no idea how to debug on linux.

5. Questions regarding development practices. 
   - Coding standards
   - Design procedures and policies they have used.
   - Source code control: Cvs, Visual Source safe, etc.
   - Development life cycle.

6. What other techniologies do they know. Can these be utilized.


Hope that gives you some more to think about.


--
Ray

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



[PHP] webserver for mac

2003-08-26 Thread Edward Peloke
Hello all,

I am doing some php work for a local company who uses a mac.  I was telling
them that I use apache as my webserver and they want to know what they can
use as their webserver.  I know nothing about Macs and don't think you an
run apache but I may be all wrong...what do mac owners use for a webserver?

Thanks,
Eddie

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



[PHP] need help - past deadline

2003-08-26 Thread Jay Fitzgerald
can someone please look at my code below and tell me why it is only working 
half-way? It is only displaying radio buttons and seats for numbers 71, 73, 
75, 77, 79, 81, 83, and 85.and it is printing seat # 76 since that is 
the one in the database between seats 81 and 83why is this happenening 
and HOW can i correct it???

$sql = "SELECT seat, alias FROM attendees";
$sql_result = mysql_query($sql,$connection) or die("Couldn't execute query.");
$row = mysql_fetch_array($sql_result);
$myseat = 
array('70','71','72','73','74','75','76','77','78','79','80','81','82','83','84');
$i = 70;

foreach ($myseat as $seat)
{
if (($seat) == ($row[0]))
{
if ($i <= 84)
{
?>


}
}

else
{
if ($i <= 84)
{
?>


}
}
}
?>


Jay Fitzgerald, Design Director
- Certified Professional Webmaster (CPW-A)
- Certified Professional Web Designer (CPWDS-A)
- Certified Professional Web Developer (CPWDV-A)
- Certified E-Commerce Manager (CECM-A)
- Certified Small Business Web Consultant (CWCSB-A)
Bayou Internet - http://www.bayou.com
Toll Free: 888.30.BAYOU (22968)
Vox: 318.338.2034 / Fax: 318.338.2506
E-Mail: [EMAIL PROTECTED]
ICQ: 38823829 / AIM: bayoujf / MSN: bayoujf / Yahoo: bayoujf
  

[PHP] Back button issue

2003-08-26 Thread Tom Tsongas
Hello folks.

I seem to be encountering a strange problem with one of my PHP pages. I 
have a form page that has textfields, textareas, pulldowns and menulists 
on it that the user uses to set up a query to scan for data on our 
database. After they run the query, they often hit the Back button to 
make slight changes to that query.

What I am noticing is that the values in the menulists seem to be 
resetting themselves and not retaining what the user had placed in them 
and they user the Back button. All the other forms elements work just 
fine. Seems like these menu lists don't behave the same way. This is 
consistent across both Netscape and IE.

I currently have my session hanlding on the page set to the following:
session_cache_limiter('none');
session_start();
Has anyone seen this behaviour before? Anyone know how to fix it?

- Tom

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


[PHP] Re: Details

2003-08-26 Thread L-Soft list server at PEACH.EASE.LSOFT.COM (1.8e)
> See the attached file for details
Unknown command - "SEE". Try HELP.

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



[PHP] please help past deadline

2003-08-26 Thread Jay Fitzgerald


can someone please look at my code below and tell me why it is only working 
half-way? It is only displaying radio buttons and seats for numbers 71, 73, 
75, 77, 79, 81, 83, and 85.and it is printing seat # 76 since that is 
the one in the database between seats 81 and 83why is this happenening 
and HOW can i correct it???

$sql = "SELECT seat, alias FROM attendees";
$sql_result = mysql_query($sql,$connection) or die("Couldn't execute query.");
$row = mysql_fetch_array($sql_result);
$myseat = 
array('70','71','72','73','74','75','76','77','78','79','80','81','82','83','84');
$i = 70;

foreach ($myseat as $seat)
{
if (($seat) == ($row[0]))
{
if ($i <= 84)
{
?>


}
}

else
{
if ($i <= 84)
{
?>


}
}
}
?> 

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


Re: [PHP] PHP Interview questions

2003-08-26 Thread Richard Baskett
on 8/26/03 9:57 AM, Robert Cummings at [EMAIL PROTECTED] wrote:

> This smells like a trick question... Are the switches connected to the
> same light bulb? You've only mentioned one light bulb? 8)
> 
> Cheers,
> Rob.
> 
> 
> On Tue, 2003-08-26 at 12:35, Jay Blanchard wrote:
>> Also ask a couple of other questions that require thought, but have
>> nothing else to do with code. such as...
>> 
>> In one room you have 3 light switches, each connected to one light bulb
>> in another room. How many trips must you make to determine which switch
>> is connected to which light bulb?

Only one trip, and Im not sure if I should explain or let you guys figure it
out :)

Cheers!

Rick

"I haven't failed, I've found 10,000 ways that don't work." - Ben Franklin

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



RE: [PHP] PHP Interview questions

2003-08-26 Thread Brian S. Drexler
Each connected to a different light bulb, 3 switches, 3 bulbs.  Not exactly
rocket science here people. :-)

-Original Message-
From: Robert Cummings [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 26, 2003 12:57 PM
To: Jay Blanchard
Cc: CPT John W. Holmes; Micheal Harris; [EMAIL PROTECTED]
Subject: RE: [PHP] PHP Interview questions


This smells like a trick question... Are the switches connected to the
same light bulb? You've only mentioned one light bulb? 8)

Cheers,
Rob.


On Tue, 2003-08-26 at 12:35, Jay Blanchard wrote:
> Also ask a couple of other questions that require thought, but have
> nothing else to do with code. such as...
>
> In one room you have 3 light switches, each connected to one light bulb
> in another room. How many trips must you make to determine which switch
> is connected to which light bulb?


--
.-.
| Worlds of Carnage - http://www.wocmud.org   |
:-:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the  |
| stuff of nightmares grasp for your soul.|
`-'

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

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



[PHP] dynamical balancing text in two colums

2003-08-26 Thread Dynamical.biz
Hi, I've been dealing withs this question:

I've never seen dynamical balanced text in two colums in a web so this the
challenge.

html formated text is stored in a database, conetion and placed into a
variable i.e.:
$text = "http://www.lamundial.net/img/labordeta.jpg"; align=left
border=0>efe.Zaragoza. El parlamentario.Some more text
tranquilo simplenente trabajando."; ... some more paragrphs just like
newspaper articles.

the first idea is this:
1. count the total characters in $text string so we can guess juts the half
2. getting into $tx1 variable the fisrt half
3. count the total characters in $tx1 till the fisrt "" STARTING from
the END to the BEGUINING of $tx1
4. getting into $col1 the fist part
5. getting into $col2 the rest
6. render the text in a table

//CODE
1. $half = floor(strlen($texto)/2);
2. $tx1 = substr($text,0,$half);
3. $first_P = strrpos($tx1,"");

4. $col1 = substr($text,0,$first_P);
5. $col2 = substr($text,$first_P);
6.

  


  


PROBLEMS
easy to know the middle point of a string but we have html code so easy to
break it badly, something like:
 so this is
why the  idea.

If there is a large paragrph in the middle of the whole text the columns the
two columns are not so nice balanced, this is why I ask the people writing
articles for my web trying to avoid long ones. They use HTMLAREA
http://www.interactivetools.com/products/htmlarea/ from Interactive tools so
the html is not done by hand.

anyway just in case there is no way to correctly balance the text I let the
writer the "1 colum / 2 colums" as an option so the traditional 1 colum (no
colums) is always available. they can display the final render os the
article as they save it when writing so the decide.

this is working at most of the articles in
http://www.lamundial.net

i.e.:
http://www.lamundial.net/home.php?pg=article&idart=124
http://www.lamundial.net/home.php?pg=article&idart=121
http://www.lamundial.net/home.php?pg=article&idart=118

the text balancing is working quite nice


any other idea?
thanks



aniceto lópez
DYNAMICAL.BIZ
web development
host services

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



RE: [PHP] PHP Interview questions

2003-08-26 Thread Jay Blanchard
[snip]
> In one room you have 3 light switches, each connected to one light
bulb
> in another room. How many trips must you make to determine which
switch
> is connected to which light bulb?

PHP is server side, so it obviously cannot control light bulbs. Use
javascript.
[/snip]

That really did make me LOL! John you are a PHP comedic genious! I also
got an off-list about it being dependent on the state of
register_globals

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



RE: [PHP] PHP Interview questions

2003-08-26 Thread Jay Blanchard
[snip]
This smells like a trick question... Are the switches connected to the
same light bulb? You've only mentioned one light bulb? 8)
[/snip]

I should have been clearer. There are 3 light bulbs, each connected to
one of 3 switches. Replies are coming in off-list as well. :) I have
more like these...cognitive thinking questions is category these fall
into. Not necessarily any wrong answers, but the answers tell a little
about how the person thinkstheoretically.

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



Re: [PHP] Website templating schemes

2003-08-26 Thread CPT John W. Holmes
From: "Joel Konkle-Parker" <[EMAIL PROTECTED]>


> I'm trying to make a PHP-backed website, and I'm trying to decide between
two
> templating schemes:
>
> 1. define 2 php template files: header.php, footer.php. in index.php,
require
> header.php, output content, require footer.php
>
> 2. define a php template file and a local page file. index.php defines
body()
> and crequires template.php. template.php prints the header, calls body()
to
> print the content, and and prints the footer.
>
> I'm currently using the second method, but I've only seen the first used
> elsewhere. Is there a reason that #1 is better than #2 (or is anything
else even
> better than that?)?

With method 2 it seems like your template file would become redundant
because every one of them would have to contain the header and footer code.

I would use 3 template files, header.php, footer.php, and body_index.php

index.php would:

1. PERFORM LOGIC
2. include header
3. include body
4. include footer

Then, all you have to do is make new body_XXX.php files for each page on
your site and the header/footer content is contained in one place.

---John Holmes...

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



Re: [PHP] verifying sql INSERTs

2003-08-26 Thread CPT John W. Holmes
From: "Chris W. Parker" <[EMAIL PROTECTED]>

> I should instead just try to perform the INSERT and then if it fails I
> know I've already got a record. If it doesn't I know everything is cool.

If it is a certain kind of failure, then you have a duplicate, otherwise it
could be another type of failure/error. Use mysql_errno() to make sure you
catch the right error as a duplicate.

---John Holmes...

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



Re: [PHP] PHP Interview questions

2003-08-26 Thread CPT John W. Holmes
From: "Jay Blanchard" <[EMAIL PROTECTED]>

> Also ask a couple of other questions that require thought, but have
> nothing else to do with code. such as...
>
> In one room you have 3 light switches, each connected to one light bulb
> in another room. How many trips must you make to determine which switch
> is connected to which light bulb?

PHP is server side, so it obviously cannot control light bulbs. Use
javascript.

---John Holmes...

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



RE: [PHP] Website templating schemes

2003-08-26 Thread Chris W. Parker
Joel Konkle-Parker 
on Tuesday, August 26, 2003 9:26 AM said:

> I'm currently using the second method, but I've only seen the first
> used elsewhere. Is there a reason that #1 is better than #2 (or is
> anything else even better than that?)?

Thought about using Smarty? http://smarty.php.net

And I completely don't understand Option #2. What does body() do and why
do you call it? Can you show some pseudo code to help us (or maybe it's
just me) understand how Option #2 works?


Chris.

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



Re: [PHP] how to keep decimals from rounding

2003-08-26 Thread Rob Yelvington
Curt, thanks for the reply and the suggestion.  Truncating is exactly 
what I will do.

Thanks!

~Rob

Curt Zirzow wrote:
* Thus wrote Rob Yelvington ([EMAIL PROTECTED]):

Is there a way to surpress round() or number_format() from rounding 
decimal places?

I have a value of ".253338" being returned via a calc function.

I take that value and multiply by 100 because I want "25.333" to be 
displayed.

I've used round(), sprintf(), and number_format() and each of them 
rounds the value up.


One  would expect sprintf not too round, but, behold, it does.
According to bugs.php.net, it is not a bug.

I had a problem with precision earlier which I solved...my 'precision' 
setting in php.ini was set too low.  Is there something in php.ini that 
controls rounding?

Any heads up are appreciated!


Perhaps by truncating the string to your precision that you desire.

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


RE: [PHP] PHP Interview questions

2003-08-26 Thread Robert Cummings
This smells like a trick question... Are the switches connected to the
same light bulb? You've only mentioned one light bulb? 8)

Cheers,
Rob.


On Tue, 2003-08-26 at 12:35, Jay Blanchard wrote:
> Also ask a couple of other questions that require thought, but have
> nothing else to do with code. such as...
> 
> In one room you have 3 light switches, each connected to one light bulb
> in another room. How many trips must you make to determine which switch
> is connected to which light bulb?


-- 
.-.
| Worlds of Carnage - http://www.wocmud.org   |
:-:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the  |
| stuff of nightmares grasp for your soul.|
`-'

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



Re: [PHP] Serve a file using PHP

2003-08-26 Thread CPT John W. Holmes
From: "Grant Rutherford" <[EMAIL PROTECTED]>
> Is there a way that PHP can allow a user to browse the files on the
> server's network, and ultimately send the file to the user?
>
> I'm making a database interface with PHP to be used internally on our
> network.  Through a PHP interface, the user wants to browse their
> network and find a file, and insert the file's path into the database.
> The user then wants the database to display a link, which when clicked
> will open the file.  They want this to work in Mozilla or IE, on both
> windows and linux machines.  I tried making the path a link with
> file://"path", but Mozilla wouldn't follow the link (probably a security
> thing; it makes sense that links shouldn't open local files).
>
> Is there a way that I can give PHP the network path (through $_POST for
> example), and it would return the file instead of an HTML document?

Can't you just link to \\computer_name\path\to\file.doc (or whatever the
filename is) ?

file:/// would try to load it off of their machine, not a network machine.

---John Holmes...

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



RE: [PHP] SMTP - Authorization?

2003-08-26 Thread Mathiau
Another life saver! This news group is great! Thnx.

-Original Message-
From: Manuel Lemos [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 26, 2003 12:09 AM
To: Mathiau
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] SMTP - Authorization?

Hello,

On 08/25/2003 09:34 PM, Mathiau wrote:
> basically i am sending out a mailing list to customers, - using a PHP
> script, however the SMTP i am using needs to have Authorization to log
into
> the outgoing SMTP  - i HAVE to use this authentication no if's and ot
> butt's., otherwise i will be blocked by Yahooo / AOL and some other
provider
> for running a relay SMTP as they see it and contirbuting to spammers
by
> allow anon acces to my smtp.
> 
> I know i can put my SMTP server on an internal ip so the outside world
can
> not see if but that is a bandaid fix for me - i want to know if PHP
can use
> an SMTP server that requires authotization to use it?
> 
> 
> HELP! me searches for this have turned up no results or people simply
not
> knowing what i need to get done.

The mail() function does not support authentication. You may want to try

this SMTP class that lets you send messages via a server that requires 
authentication.

http://www.phpclasses.org/smtpclass

Use it in conjunction with this other class that lets you compose and 
send properly formatted messages:

http://www.phpclasses.org/mimemessage

-- 

Regards,
Manuel Lemos

Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



RE: [PHP] PHP Interview questions

2003-08-26 Thread Javier Tacon

Yes, I gree with all.

To test their mySql level, you can show them two tables, and the results from a join 
between the two tables, so you ask them for what is the SELECT statement to get that 
results.

Example ..

Table1:
++-+-+--+
| id | name| surname | departmentId |
++-+-+--+
|  1 | John| Doe |1 |
|  2 | Scott   | Johnson |2 |
|  3 | Mikael  | Martin  |2 |
|  4 | Nicolas | Survey  |3 |
++-+-+--+

Table2:
+++
| id | departmentName |
+++
|  1 | Production |
|  2 | Sales  |
|  3 | Marketing  |
+++

Question: What's the select statement to show this results:
+-+-++
| name| surname | departmentName |
+-+-++
| John| Doe | Production |
| Mikael  | Martin  | Sales  |
| Nicolas | Survey  | Marketing  |
| Scott   | Johnson | Sales  |
+-+-++

Answer: select name,surname, departmentName from table1 left join table2 on 
table1.departmentId=table2.id order by name asc;

This example is very very easy, don't put it into your exam :)
Look for other examples searching in google or any searcher ..


-Mensaje original-
De: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
Enviado el: martes, 26 de agosto de 2003 18:03
Para: Micheal Harris; [EMAIL PROTECTED]
Asunto: Re: [PHP] PHP Interview questions


From: "Micheal Harris" <[EMAIL PROTECTED]>

> I am in the process of hiring someone that needs to have extensive PHP and
> MySQL experience. Does anyone have any suggestions for interview
questions?
> I have no PHP or MySQL experience, and come from a non-technical
background.
> I want the questions to be technical, but I am unsusre as to how specific
I
> should get with the questionning!

How are you going to grade it, though, if you don't know PHP or MySQL?

I say you should send them to the list and let us grill them!! We'll sort
out the riff-raff.. :)

Seriously, look at their portfolio, call their references, and MAKE them
write code.

TASK: Create a PHP application that will insert names and dates of birth
into a MySQL database.

CONDITIONS: Given the PHP Manual, MySQL Manual, Notepad (or similar text
editor), and database host, user, and password information.

STANDARD: The application will run without errors when complete. The
application will accept a first name, last name, and date of birth (in
DDMMMYY format) through an HTML form and store the information in a MySQL
database. The application will list all current entries in the database in
an HTML table after a new row is inserted.

Things to look for:

1. Do they program for register_globals ON or OFF?
2. Do they check the setting of magic_quote_gpc?
3. Do they include error checking of form data and queries?
4. Is their program open to cross site scripting or SQL injection attacks?
5. Do they use a DATE type column or VARCHAR column for dates?
6. Do they write valid HTML?
7. How many files do they use to accomplish the task?
8. Do they try to add extra "fluff" instead of just accomplishing the task?

Hopefully others will pipe up with their comments, also. :)

---John Holmes...

-- 
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] PHP Interview questions

2003-08-26 Thread Jay Blanchard
[snip]
I say you should send them to the list and let us grill them!! We'll
sort
out the riff-raff.. :)
[/snip]

Hear! Hear! :)

Also ask a couple of other questions that require thought, but have
nothing else to do with code. such as...

In one room you have 3 light switches, each connected to one light bulb
in another room. How many trips must you make to determine which switch
is connected to which light bulb?


We could come up with a test for PHP candidates. :)

Jay

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



RE: [PHP] verifying sql INSERTs

2003-08-26 Thread Chris W. Parker
Marek Kilimajer 
on Tuesday, August 26, 2003 3:59 AM said:

> mysql_query() will return true for queries that don't return rows and
> were executed without error, so you can use
> return mysql_query();

> You should also make a UNIQUE index on email column, then you can
> check the number returned by mysql_errno(), one number I don't
> remember signals duplicate entry error.

OOhhh... You know, I already HAVE done this, and I just came to the
realization that if I've already got a constraint on the email column
then why the heck am I checking to see if the value is already there?
That's just a waste of resources.

I should instead just try to perform the INSERT and then if it fails I
know I've already got a record. If it doesn't I know everything is cool.

Good idea!


Chris.

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



Re: [PHP] Serve a file using PHP

2003-08-26 Thread [EMAIL PROTECTED]
Hello,

Bit suprised that mozilla didn't let you access the file using the 
'file://' notation. Did you actually use three slashes? ie it should be
'file:///home/grant' and not 'file://home/grant/' 

There isn't any other way in which you can use PHP to access files on a 
hard disk. PHP is a server side scripting language. You could always try 
signed java applets.

all the best

Grant Rutherford wrote:

Hello,

Is there a way that PHP can allow a user to browse the files on the 
server's network, and ultimately send the file to the user?

I'm making a database interface with PHP to be used internally on our 
network.  Through a PHP interface, the user wants to browse their 
network and find a file, and insert the file's path into the 
database.  The user then wants the database to display a link, which 
when clicked will open the file.  They want this to work in Mozilla or 
IE, on both windows and linux machines.  I tried making the path a 
link with file://"path", but Mozilla wouldn't follow the link 
(probably a security thing; it makes sense that links shouldn't open 
local files).

Is there a way that I can give PHP the network path (through $_POST 
for example), and it would return the file instead of an HTML document?

Thanks for any help,
Grant


--
http://www.raditha.com/php/progress.php
A progress bar for PHP file uploads.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] preg_match bug

2003-08-26 Thread Christian Calloway
Hmm.. who knows, Ive wasted to much time on this silly problem. I appreciate
your help Curt, thanks.


"Christian Calloway" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Fixed the problem using "s" pattern modifier: '/regexp/s', without it, it
> still hangs using '(.|\n)' in the pattern.
>
> "Christian Calloway" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Errors are not being logged on my XP Pro box (error logging is on)
> >
> > "Curt Zirzow" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > * Thus wrote Christian Calloway ([EMAIL PROTECTED]):
> > > > Hey I wanted to see if anyone was getting the same problem. Using
> > preg_match
> > > > in the following pattern:
> > > >
> > > > "/(.|\n)+?<\/tr>/"
> > > >
> > > > PHP seems to be crashing. I get a "Page cannot be displayed" message
> > from
> > > > the browser. I've come across this before, and I just upgraded to
> 4.3.3,
> > and
> > > > no difference.
> > >
> > > An error from the browser doesn't exactly prove that php is
> > > 'Crashing'. Please look in the system logs for the crash.
> > >
> > > Also, in order to be able to reproduce this a small snipplet of
> > > code that can reproduce the 'crash' would be exrememly helpful.
> > >
> > >
> > > Curt
> > > -- 
> > > "I used to think I was indecisive, but now I'm not so sure."

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



RE: [PHP] verifying sql INSERTs

2003-08-26 Thread Chris W. Parker
John W. Holmes 
on Monday, August 25, 2003 5:37 PM said:

> You should use mysql_error() to ensure your query did not fail for any
> reason. Assuming the query was successful, you can use
> mysql_affected_rows() to see if it actually had any impact on the
> database, i.e. the row was inserted.

Hey good idea. I'll do some experiment'n.


Chris.

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



[PHP] Website templating schemes

2003-08-26 Thread Joel Konkle-Parker
I'm trying to make a PHP-backed website, and I'm trying to decide between two
templating schemes:

1. define 2 php template files: header.php, footer.php. in index.php, require
header.php, output content, require footer.php

2. define a php template file and a local page file. index.php defines body()
and crequires template.php. template.php prints the header, calls body() to
print the content, and and prints the footer.

I'm currently using the second method, but I've only seen the first used
elsewhere. Is there a reason that #1 is better than #2 (or is anything else even
better than that?)?


--
Joel Konkle-Parker
Webmaster [Ballsome.com]

Phone [662-518-1636]
E-mail[EMAIL PROTECTED]

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



[PHP] Serve a file using PHP

2003-08-26 Thread Grant Rutherford
Hello,

Is there a way that PHP can allow a user to browse the files on the 
server's network, and ultimately send the file to the user?

I'm making a database interface with PHP to be used internally on our 
network.  Through a PHP interface, the user wants to browse their 
network and find a file, and insert the file's path into the database.  
The user then wants the database to display a link, which when clicked 
will open the file.  They want this to work in Mozilla or IE, on both 
windows and linux machines.  I tried making the path a link with 
file://"path", but Mozilla wouldn't follow the link (probably a security 
thing; it makes sense that links shouldn't open local files).

Is there a way that I can give PHP the network path (through $_POST for 
example), and it would return the file instead of an HTML document?

Thanks for any help,
Grant
--
Grant Rutherford
Iders Incorporated
600A Clifton Street
Winnipeg, MB
R3G 2X6
http://www.iders.ca
tel: 204-779-5400 ext 36
fax: 204-779-5444

Iders Incorporated: Confidential

Note: This message is intended solely for the use of the designated
recipient(s) and their appointed delegates, and may contain
confidential information.  Any unauthorized disclosure, copying or
distribution of its contents is strictly prohibited.  If you have
received this message in error, please destroy it and advise the sender
immediately by phone, Email or facsimile.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] preg_match bug

2003-08-26 Thread Curt Zirzow
* Thus wrote Christian Calloway ([EMAIL PROTECTED]):
> Certainly.
> 
> It crashes out when attempting to parse large files. My resource limits are
> set to 20m in the php.ini file, so thats not the issue.

I tried this with a 10MB html file that found 1160 matches. It
might be specific to your html file.


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



Re: [PHP] PHP Interview questions

2003-08-26 Thread CPT John W. Holmes
From: "Micheal Harris" <[EMAIL PROTECTED]>

> I am in the process of hiring someone that needs to have extensive PHP and
> MySQL experience. Does anyone have any suggestions for interview
questions?
> I have no PHP or MySQL experience, and come from a non-technical
background.
> I want the questions to be technical, but I am unsusre as to how specific
I
> should get with the questionning!

How are you going to grade it, though, if you don't know PHP or MySQL?

I say you should send them to the list and let us grill them!! We'll sort
out the riff-raff.. :)

Seriously, look at their portfolio, call their references, and MAKE them
write code.

TASK: Create a PHP application that will insert names and dates of birth
into a MySQL database.

CONDITIONS: Given the PHP Manual, MySQL Manual, Notepad (or similar text
editor), and database host, user, and password information.

STANDARD: The application will run without errors when complete. The
application will accept a first name, last name, and date of birth (in
DDMMMYY format) through an HTML form and store the information in a MySQL
database. The application will list all current entries in the database in
an HTML table after a new row is inserted.

Things to look for:

1. Do they program for register_globals ON or OFF?
2. Do they check the setting of magic_quote_gpc?
3. Do they include error checking of form data and queries?
4. Is their program open to cross site scripting or SQL injection attacks?
5. Do they use a DATE type column or VARCHAR column for dates?
6. Do they write valid HTML?
7. How many files do they use to accomplish the task?
8. Do they try to add extra "fluff" instead of just accomplishing the task?

Hopefully others will pipe up with their comments, also. :)

---John Holmes...

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



Re: [PHP] preg_match bug

2003-08-26 Thread Christian Calloway
Fixed the problem using "s" pattern modifier: '/regexp/s', without it, it
still hangs using '(.|\n)' in the pattern.

"Christian Calloway" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Errors are not being logged on my XP Pro box (error logging is on)
>
> "Curt Zirzow" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > * Thus wrote Christian Calloway ([EMAIL PROTECTED]):
> > > Hey I wanted to see if anyone was getting the same problem. Using
> preg_match
> > > in the following pattern:
> > >
> > > "/(.|\n)+?<\/tr>/"
> > >
> > > PHP seems to be crashing. I get a "Page cannot be displayed" message
> from
> > > the browser. I've come across this before, and I just upgraded to
4.3.3,
> and
> > > no difference.
> >
> > An error from the browser doesn't exactly prove that php is
> > 'Crashing'. Please look in the system logs for the crash.
> >
> > Also, in order to be able to reproduce this a small snipplet of
> > code that can reproduce the 'crash' would be exrememly helpful.
> >
> >
> > Curt
> > -- 
> > "I used to think I was indecisive, but now I'm not so sure."

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



Re: [PHP] Controlling Access

2003-08-26 Thread David Otton
On Tue, 26 Aug 2003 08:44:59 -0700, you wrote:

>I have an application that consists of some 30 php modules.  Each one links 
>to another, as you can imagine. How can I create a security mechanism that 
>only allows the modules in my system to be called from one-another? I do 
>nto want any of the modules to be called by typing them on the address bar. 
>Of course, sessions takes care of folks who have not logged into the 
>system, btu I don;t want registered users hacking around either.
>
>I though of using HTTP_REFERER as a handshake restrictor, but it seems to 
>be unstable and unreliable. Any suggestions?

What do you mean by "called"? They include() each other? What level of
access does a "registered user" have?

If you don't want something to be accessible via a URL, then don't put it in
the webroot. Move the modules into an external directory, and include them
in.

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



Re: [PHP] case insensitive sort

2003-08-26 Thread Marek Kilimajer
It right there under your nose:
strcasecmp()
Steve Buehler wrote:

I am using the following function for a sort on an array.  I hope 
someone can help me out here and let me know how to change it to make it 
a "case insensitivie" sort.  Right now, it is "case sensitive" so the 
sort of the array will put the Capital letters first.  Here are the 
results of the search:
Buehler, Steve
Buehler, Steve
Teste, Teste
a, a
asdf, adsf
asdf, asdf
dsdlkj, sd

Here is the code to sort:
$GLOBALS[sortterm]="cont_name";
usort($logins, "cmp");
function cmp ($a, $b) {
GLOBAL $sortterm;
return strcmp($a[$sortterm], $b[$sortterm]);
}
Thanks
Steve
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] preg_match bug

2003-08-26 Thread Christian Calloway
Errors are not being logged on my XP Pro box (error logging is on)

"Curt Zirzow" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> * Thus wrote Christian Calloway ([EMAIL PROTECTED]):
> > Hey I wanted to see if anyone was getting the same problem. Using
preg_match
> > in the following pattern:
> >
> > "/(.|\n)+?<\/tr>/"
> >
> > PHP seems to be crashing. I get a "Page cannot be displayed" message
from
> > the browser. I've come across this before, and I just upgraded to 4.3.3,
and
> > no difference.
>
> An error from the browser doesn't exactly prove that php is
> 'Crashing'. Please look in the system logs for the crash.
>
> Also, in order to be able to reproduce this a small snipplet of
> code that can reproduce the 'crash' would be exrememly helpful.
>
>
> Curt
> -- 
> "I used to think I was indecisive, but now I'm not so sure."

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



RE: [PHP] Controlling Access

2003-08-26 Thread Javier Tacon

You can play with a $_SESSION var, ..

Imagine that you have the file a.php with ..



And you want b.php that can only be executed after a.php:



And so ...

-Mensaje original-
De: Doug Wolfgram [mailto:[EMAIL PROTECTED]
Enviado el: martes, 26 de agosto de 2003 17:45
Para: [EMAIL PROTECTED]
Asunto: [PHP] Controlling Access


I have an application that consists of some 30 php modules.  Each one links 
to another, as you can imagine. How can I create a security mechanism that 
only allows the modules in my system to be called from one-another? I do 
nto want any of the modules to be called by typing them on the address bar. 
Of course, sessions takes care of folks who have not logged into the 
system, btu I don;t want registered users hacking around either.

I though of using HTTP_REFERER as a handshake restrictor, but it seems to 
be unstable and unreliable. Any suggestions?


D




'Marketing that Listens"

Doug Wolfgram
CEO - GRAFX Group, Inc.
www.gfx.com
www.aimprojects.com
949.433.3641

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

2003-08-26 Thread Christian Calloway
Certainly.

It crashes out when attempting to parse large files. My resource limits are
set to 20m in the php.ini file, so thats not the issue.

(.|\n)+?%";
$matches = array();

// output number of matches
echo preg_match_all($reg, $fileBuffer, $matches);

?>

"Curt Zirzow" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> * Thus wrote Christian Calloway ([EMAIL PROTECTED]):
> > Hey I wanted to see if anyone was getting the same problem. Using
preg_match
> > in the following pattern:
> >
> > "/(.|\n)+?<\/tr>/"
> >
> > PHP seems to be crashing. I get a "Page cannot be displayed" message
from
> > the browser. I've come across this before, and I just upgraded to 4.3.3,
and
> > no difference.
>
> An error from the browser doesn't exactly prove that php is
> 'Crashing'. Please look in the system logs for the crash.
>
> Also, in order to be able to reproduce this a small snipplet of
> code that can reproduce the 'crash' would be exrememly helpful.
>
>
> Curt
> -- 
> "I used to think I was indecisive, but now I'm not so sure."

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



Re: [PHP] MD5 System Password check with PHP

2003-08-26 Thread Burhan
Quoting Justin French <[EMAIL PROTECTED]>:

> Burhan,
> 
> Please try to quote the right person when replying to a thread -- your 
> messages was, I assume, intended for Chinmoy Barua, not me.
> 
> It saves confusion, and keeps the thread more useful and easier to 
> follow.

My apologies Justin, I realized that when you pointed it out :(

-- 
Burhan
phplist[at]meidomus[dot]com
http://www.meidomus.com

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



Re: [PHP] case insensitive sort

2003-08-26 Thread Steve Buehler
Ok.  Now I REALLY feel like an idiot.  Thanks so much for your help.

Steve

At 05:46 PM 8/26/2003 +0200, you wrote:
It right there under your nose:
strcasecmp()
Steve Buehler wrote:

I am using the following function for a sort on an array.  I hope someone 
can help me out here and let me know how to change it to make it a "case 
insensitivie" sort.  Right now, it is "case sensitive" so the sort of the 
array will put the Capital letters first.  Here are the results of the search:
Buehler, Steve
Buehler, Steve
Teste, Teste
a, a
asdf, adsf
asdf, asdf
dsdlkj, sd
Here is the code to sort:
$GLOBALS[sortterm]="cont_name";
usort($logins, "cmp");
function cmp ($a, $b) {
GLOBAL $sortterm;
return strcmp($a[$sortterm], $b[$sortterm]);
}
Thanks
Steve


--
This message has been scanned for viruses and
dangerous content by the MailScanner at ow4, and is
believed to be clean.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] if seat is sold

2003-08-26 Thread Jim Lucas
here is that code I talked about


 

";
  } else {
echo "";
echo "";
echo $alphabet[($i / $rowCount)];
echo "";
echo "";
  }

  if(in_array($val, $taken)) {
echo "{$val}";
  } else {
echo " {$val}";
  }

  if($i % $rowCount + 1)
echo "";
  else
echo "";

}
echo "";
?>

Give it a run and let me know what you think.


Jim Lucas

- Original Message - 
From: "Jay Fitzgerald" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 25, 2003 6:23 PM
Subject: [PHP] if seat is sold


> 1. here is my code:  http://codedump.phpfreaks.com/viewcode.php?id=1162
> 2. here is a screenie of my seating chart:
http://www.bayou.com/jay/chart.gif
>
> 3. what i am wanting to do is using CSS i want to "strike-through" the
> seats that are in the db - else, I want them to display normally
>
> note: the seat numbers are not in the db unless someone chooses that
> seatthey are a while loop of numbers 1 through 240
>
> Anyone got any ideas?
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



[PHP] Controlling Access

2003-08-26 Thread Doug Wolfgram
I have an application that consists of some 30 php modules.  Each one links 
to another, as you can imagine. How can I create a security mechanism that 
only allows the modules in my system to be called from one-another? I do 
nto want any of the modules to be called by typing them on the address bar. 
Of course, sessions takes care of folks who have not logged into the 
system, btu I don;t want registered users hacking around either.

I though of using HTTP_REFERER as a handshake restrictor, but it seems to 
be unstable and unreliable. Any suggestions?

D




'Marketing that Listens"

Doug Wolfgram
CEO - GRAFX Group, Inc.
www.gfx.com
www.aimprojects.com
949.433.3641
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP Interview questions

2003-08-26 Thread Peter James
Even better than questions, make a one or two hour case study.  Have them
demonstrate their ability.

1. How would you solve X problem?
2. What do you think about Y?
3. Write some code to solve Z?

A good place for ideas for case studies might be codewalkers, weberdev, or
php-editors.

There's a big difference between talking and walking.

My 2 cents.

--
Peter James
Editor-in-Chief, php|architect Magazine
[EMAIL PROTECTED]

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


- Original Message - 
From: "Micheal Harris" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, August 26, 2003 9:22 AM
Subject: [PHP] PHP Interview questions


> Hello All,
>
> I am in the process of hiring someone that needs to have extensive PHP and
> MySQL experience. Does anyone have any suggestions for interview
questions?
> I have no PHP or MySQL experience, and come from a non-technical
background.
> I want the questions to be technical, but I am unsusre as to how specific
I
> should get with the questionning!
>
> Thanks for any help,
>
> Mike
>
> P.S - Replies can be sent directly to this address if seen as more
> apporpriate, as oppposed to sending it to the whole list.
>
> _
> MSN 8 with e-mail virus protection service: 2 months FREE*
> http://join.msn.com/?page=features/virus
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

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



[PHP] case insensitive sort

2003-08-26 Thread Steve Buehler
I am using the following function for a sort on an array.  I hope someone 
can help me out here and let me know how to change it to make it a "case 
insensitivie" sort.  Right now, it is "case sensitive" so the sort of the 
array will put the Capital letters first.  Here are the results of the search:
Buehler, Steve
Buehler, Steve
Teste, Teste
a, a
asdf, adsf
asdf, asdf
dsdlkj, sd

Here is the code to sort:
$GLOBALS[sortterm]="cont_name";
usort($logins, "cmp");
function cmp ($a, $b) {
GLOBAL $sortterm;
return strcmp($a[$sortterm], $b[$sortterm]);
}
Thanks
Steve
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PHP Interview questions

2003-08-26 Thread Micheal Harris
Hello All,

I am in the process of hiring someone that needs to have extensive PHP and 
MySQL experience. Does anyone have any suggestions for interview questions? 
I have no PHP or MySQL experience, and come from a non-technical background. 
I want the questions to be technical, but I am unsusre as to how specific I 
should get with the questionning!

Thanks for any help,

Mike

P.S - Replies can be sent directly to this address if seen as more 
apporpriate, as oppposed to sending it to the whole list.

_
MSN 8 with e-mail virus protection service: 2 months FREE*  
http://join.msn.com/?page=features/virus

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


Re: [PHP] math functions?

2003-08-26 Thread Amanda McComb
Perfect!  Thanks!  


On Tue, 26 Aug 2003, CPT John W. Holmes wrote:

> From: "Amanda McComb" <[EMAIL PROTECTED]>
> 
> 
> > I am having trouble finding math functions on php.net.  I am also getting
> > "page not found" errors when trying to search.
> > 
> > Basically, I'm looking for a mod or division function - something I can
> > use to tell me when a number is evening divisable by a certain number.
> 
> % is mod, / is division...
> 
> $a = 10;
> $b = 5;
> 
> if($a % $b == 0)
> { echo "evenly devisable"; }
> 
> Arithmetic Operators:
> http://us2.php.net/manual/en/language.operators.arithmetic.php
> 
> Math Functions:
> http://us2.php.net/manual/en/ref.math.php
> 
> BCMath Functions
> http://us2.php.net/manual/en/ref.bc.php
> 
> ---John Holmes...
> 
> -- 
> 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] math functions?

2003-08-26 Thread Amanda McComb
The reason was because we are having intermittent network problems and I
was unable to search for it.  That's why I was asking for a place to find
math functions.  

I also asked for a "mod" function, which in most languages is short for
modulus.

On 26 Aug 2003, Robert Cummings wrote:

> Is there some reason you can't use the modulus operator?
> 
> http://www.php.net/manual/en/language.operators.arithmetic.php
> 
> Cheers,
> Rob.
> 
> 
> On Tue, 2003-08-26 at 11:07, Amanda McComb wrote:
> > I am having trouble finding math functions on php.net.  I am also getting
> > "page not found" errors when trying to search.
> > 
> > Basically, I'm looking for a mod or division function - something I can
> > use to tell me when a number is evening divisable by a certain number.
> > 
> > Thanks!
> > Amanda
> > 
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> > 
> -- 
> .-.
> | Worlds of Carnage - http://www.wocmud.org   |
> :-:
> | Come visit a world of myth and legend where |
> | fantastical creatures come to life and the  |
> | stuff of nightmares grasp for your soul.|
> `-'
> 
> 
> 

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



Re: [PHP] problem passing variable between forms.

2003-08-26 Thread Chris Shiflett
--- Angelo Zanetti <[EMAIL PROTECTED]> wrote:
> I pass this variable to the next page using POST I receive the
> variable and use it, no problem, but then when I try to pass it
> to the next form in the URL (using an A HREF:
> 
>   )
...
> My register_globals is off.

Read back through your question, and at least one problem should be very clear:

1. The client sends you data in a POST request.
2. You have register_globals disabled.
3. You reference $chk.

You need to reference this as $_POST['chk']. Read this:

http://www.php.net/register_globals

Also, as others have mentioned, you need to understand how to work with arrays
a bit more. The manual can be very helpful. Read this:

http://us2.php.net/array

Hope that helps.

Chris

=
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/

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



Re: [PHP] Re: math functions?

2003-08-26 Thread Robert Cummings
Just to be precise, modulus does NOT return true and false. Given A%B it
returns the remainder after dividing B into A. This happens to be
equivalent to false when there is no remainder, and equivalent to true
when there is a remainder.

Cheers,
Rob.


On Tue, 2003-08-26 at 11:11, Kae Verens wrote:
> Amanda McComb wrote:
> > I am having trouble finding math functions on php.net.  I am also getting
> > "page not found" errors when trying to search.
> > 
> > Basically, I'm looking for a mod or division function - something I can
> > use to tell me when a number is evening divisable by a certain number.
> 
> % is the mod operator in quite a few languages, and works in PHP as well.
> 
> if(7%4), for example, will return true (3), while (12%6) will return false
> 
> integers only, IIRC
> 
> Kae
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
-- 
.-.
| Worlds of Carnage - http://www.wocmud.org   |
:-:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the  |
| stuff of nightmares grasp for your soul.|
`-'

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



Re: [PHP] if seat is sold

2003-08-26 Thread Jim Lucas
on a side note, you realize that you could loose all all of the while loops
and replace them with two or three nested foreach() loops?

Build yourself one big array and loop through it.

If you need any advice, drop me a note.

Jim Lucas

- Original Message - 
From: "Jay Fitzgerald" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 25, 2003 6:23 PM
Subject: [PHP] if seat is sold


> 1. here is my code:  http://codedump.phpfreaks.com/viewcode.php?id=1162
> 2. here is a screenie of my seating chart:
http://www.bayou.com/jay/chart.gif
>
> 3. what i am wanting to do is using CSS i want to "strike-through" the
> seats that are in the db - else, I want them to display normally
>
> note: the seat numbers are not in the db unless someone chooses that
> seatthey are a while loop of numbers 1 through 240
>
> Anyone got any ideas?
>
> -- 
> 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] math functions?

2003-08-26 Thread CPT John W. Holmes
From: "Amanda McComb" <[EMAIL PROTECTED]>


> I am having trouble finding math functions on php.net.  I am also getting
> "page not found" errors when trying to search.
> 
> Basically, I'm looking for a mod or division function - something I can
> use to tell me when a number is evening divisable by a certain number.

% is mod, / is division...

$a = 10;
$b = 5;

if($a % $b == 0)
{ echo "evenly devisable"; }

Arithmetic Operators:
http://us2.php.net/manual/en/language.operators.arithmetic.php

Math Functions:
http://us2.php.net/manual/en/ref.math.php

BCMath Functions
http://us2.php.net/manual/en/ref.bc.php

---John Holmes...

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



[PHP] Re: Image Magick

2003-08-26 Thread Kae Verens
Mike At Spy wrote:
Anyone here familiar with the installation of Image Magick and what files it
installs on your machine?
I had an admin put it on, and then took it off - but took it off by removing
what she thought were all of the files related to it.  I just found some
files I think that are.  They are located in the usr/local/bin directory and
are called:
animate
composite
convert
display
identify
mogrify
montage
The date/time of the files being put there seems to correspond with when the
admin put the program on, and names of the files seem to imply it to me.
And I just wanted to make sure I'm not going to screw up something else by
removing them. :)
Thanks!
the easiest way to remove them is to use RPM, if that was what was used 
to install them
rpm -e ImageMagick

if there are no dependency problems, then it will go ahead.

make sure that you don't have any libraries that use it! I use 
ImageMagick in a PHP image-upload function that resizes to a maximum 
size. The RPM program would not tell you of that dependency.

Kae

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


Re: [PHP] math functions?

2003-08-26 Thread Robert Cummings
Is there some reason you can't use the modulus operator?

http://www.php.net/manual/en/language.operators.arithmetic.php

Cheers,
Rob.


On Tue, 2003-08-26 at 11:07, Amanda McComb wrote:
> I am having trouble finding math functions on php.net.  I am also getting
> "page not found" errors when trying to search.
> 
> Basically, I'm looking for a mod or division function - something I can
> use to tell me when a number is evening divisable by a certain number.
> 
> Thanks!
> Amanda
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
-- 
.-.
| Worlds of Carnage - http://www.wocmud.org   |
:-:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the  |
| stuff of nightmares grasp for your soul.|
`-'

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



[PHP] Re: math functions?

2003-08-26 Thread Kae Verens
Amanda McComb wrote:
I am having trouble finding math functions on php.net.  I am also getting
"page not found" errors when trying to search.
Basically, I'm looking for a mod or division function - something I can
use to tell me when a number is evening divisable by a certain number.
% is the mod operator in quite a few languages, and works in PHP as well.

if(7%4), for example, will return true (3), while (12%6) will return false

integers only, IIRC

Kae

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


[PHP] Re: php and var statics

2003-08-26 Thread Alvaro Martinez
Ok,
I correct the two mistakes but it doesnt works yet.
What is character & for?

Alvaro
- Original Message - 
From: "Greg Beaver" <[EMAIL PROTECTED]>
To: "Alvaro Martinez" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, August 26, 2003 3:58 PM
Subject: Re: php and var statics




Alvaro Martinez wrote:
> I have written this code:
>
> class db{
>var $_miInstancia;
>
>function db (){
>   // funcion que se conecta con la BBDD
>  static $miInstancia;
>  $this->_miInstancia=&$miInstancia;
>
>  $result = @mysql_pconnect("inforalv", "discoteca",
"password");
>  if (!$result)
>return false;
>  if ([EMAIL PROTECTED]("discoteca"))
>return false;
>}
>
> function getInstancia(){
>if (!isset($this))
>   $_miInstancia=new db();
>return $_miInstancia;
> }
> }
>
> This is a Singleton Pattern, but it doesnt work.
> I want to obtain only one instance of db class but when I do this...:
>
>$conexiondb=db::getInstancia();
>$conexiondb=db::getInstancia();
>
> In the two calls I get a new db object.
> Could you please tell me if there is anything wrong?

two mistakes - you need to use &, and the static var must be in
getInstancia()

function &getInstancia(){
 static $miInstancia;
 if (!get_class($miInstancia) == 'db') {
 $miInstancia = &new db();
 }
 return $miInstancia;
}

$conexiondb = &db::getInstancia();

Regards,
Greg
--
http://www.phpdoc.org
phpDocumentor

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



[PHP] math functions?

2003-08-26 Thread Amanda McComb
I am having trouble finding math functions on php.net.  I am also getting
"page not found" errors when trying to search.

Basically, I'm looking for a mod or division function - something I can
use to tell me when a number is evening divisable by a certain number.

Thanks!
Amanda

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



[PHP] Re: pear problem

2003-08-26 Thread Catalin Trifu
Hi,

Did you added the /usr/php/pear/share/pear in the php.ini
include_path option ?
Besides the mime is part of Mail_Mime extension and
SOAP needs some extensions too (don't remember exactly which)
so check if all requirements are met.
btw! what's the error message when it crashes ?

Cheers,
Catalin

"Moritz Steiner" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
I've a problem with pear, only the DB.php and the Mail.php are working,
all the others I installed don't work.

Installed packages:
===
Package  Version  State
DB   1.5.0RC1 stable
HTTP_Request 1.1.1stable
Mail 1.1.1stable
Mail_Mime1.2.1stable
Net_DIME 0.3  beta
Net_URL  1.0.10   stable
SOAP 0.8RC1   beta

When I have a look into the directory, it's like that:

[lxcmsb3] /usr/php/pear/share/pear > l
total 72
drwxr-xr-x6 root root 4096 Aug 26 16:24 SOAP
drwxr-xr-x6 root root 4096 Aug 26 16:24 docs
drwxr-xr-x2 root root 4096 Aug 26 16:24 HTTP
drwxr-xr-x2 root root 4096 Aug 26 16:24 Net
drwxr-xr-x4 root root 4096 Aug 26 16:24 tests
drwxr-xr-x2 root root 4096 Aug 26 16:24 Mail
drwxr-xr-x3 root root 4096 Aug 26 16:24 data
-rw-r--r--1 root root 7331 Aug 26 16:23 Mail.php
drwxr-xr-x2 root root 4096 Aug 26 16:23 DB
-rw-r--r--1 root root29165 Aug 26 16:23 DB.php



In this code snipplet the first three lines work very well, but when I
try to access a subdirectory it crashes...
1 require 'DB.php';
2 $db = DB::connect('mysql://mysql:[EMAIL PROTECTED]/mysql);
3 require 'Mail.php';
4 require 'Mail/mime.php';

It's exactly the same with require 'SOAP/Client.php' instead of line 4


Please help me.
Moritz

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



RE: [PHP] imap problem

2003-08-26 Thread Jay Blanchard
[snip]
yes
[/snip]

Have you checked that PHP has IMAP enabled by loading up a phpinfo()
page?

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



[PHP] pear problem

2003-08-26 Thread Moritz Steiner
I've a problem with pear, only the DB.php and the Mail.php are working,
all the others I installed don't work. 

Installed packages:
===
Package  Version  State
DB   1.5.0RC1 stable
HTTP_Request 1.1.1stable
Mail 1.1.1stable
Mail_Mime1.2.1stable
Net_DIME 0.3  beta
Net_URL  1.0.10   stable
SOAP 0.8RC1   beta

When I have a look into the directory, it's like that:

[lxcmsb3] /usr/php/pear/share/pear > l
total 72
drwxr-xr-x6 root root 4096 Aug 26 16:24 SOAP
drwxr-xr-x6 root root 4096 Aug 26 16:24 docs
drwxr-xr-x2 root root 4096 Aug 26 16:24 HTTP
drwxr-xr-x2 root root 4096 Aug 26 16:24 Net
drwxr-xr-x4 root root 4096 Aug 26 16:24 tests
drwxr-xr-x2 root root 4096 Aug 26 16:24 Mail
drwxr-xr-x3 root root 4096 Aug 26 16:24 data
-rw-r--r--1 root root 7331 Aug 26 16:23 Mail.php
drwxr-xr-x2 root root 4096 Aug 26 16:23 DB
-rw-r--r--1 root root29165 Aug 26 16:23 DB.php



In this code snipplet the first three lines work very well, but when I
try to access a subdirectory it crashes... 
1 require 'DB.php';
2 $db = DB::connect('mysql://mysql:[EMAIL PROTECTED]/mysql);
3 require 'Mail.php';
4 require 'Mail/mime.php';

It's exactly the same with require 'SOAP/Client.php' instead of line 4


Please help me.
Moritz

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



FW: [PHP] XmlRPC - Server did not understand request

2003-08-26 Thread Donald Tyler


-Original Message-
From: Donald Tyler [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 26, 2003 9:29 AM
To: 'Marek Kilimajer'
Subject: RE: [PHP] XmlRPC - Server did not understand request

Well that fixed it.

*Slaps head*. I guess I should have noticed that. Sorry for such a retarded
question.

Thanks for the help. =0)

-Original Message-
From: Marek Kilimajer [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 26, 2003 9:18 AM
To: Donald Tyler
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] XmlRPC - Server did not understand request

Donald Tyler wrote:

> sending http request:
> 
> POST Test_Server/XML/PHP_Servers/XMLTEST.php HTTP/1.0
should be
POST /Test_Server/...
(asuming Test_Server is a directory)

> User-Agent: xmlrpc-epi-php/0.2 (PHP)
> Host: localhost:80
should be
Host: localhost

> Content-Type: text/xml
> Content-Length: 111
> 
> 
> 
> test
> 
> 
> 
> receiving response...
> 
> got response:
> 
> . 
> 
> 
> 
> 400 Bad Request
> 
> Bad Request
> Your browser sent a request that this server could not understand.
> 
> 
> Apache/2.0.47 (Win32) PHP/4.3.2 Server at localhost Port
> 80
> 
> 
> 
> 
> 
> 
> //---[ Here is the client code: ---\\
> 
>  
> require_once('XMLRPC_Utils.php');
> 
> $XMLRequest = array();
> 
> $options = array('output type' => 'xml', 'version' => 'xmlrpc');
> $result = xu_rpc_http_concise(
>   array(method=> 'test',
> args  => $XMLRequest,
> host  => 'localhost',
> uri   =>
> 'Test_Server/XML/PHP_Servers/XMLTEST.php',
> port  => 80,
> options   => $options,
> debug => 1));
> 
> ?>
> 
> //---[ Here is the server code: ---\\
> 
>  
> include("xmlrpc_utils.php");
> 
> // ensure extension is loaded.
> xu_load_extension();
> 
> function test($method_name, $params, $app_data)
>   {
>   return 'Hello Scott';
>   }
> 
>   /* create a new server object */
>   $server = xmlrpc_server_create();
>   
>   xmlrpc_server_register_method($server, "test", "test");
>   
>   /* Now, let's get the client's request from the post data */
>   $request_xml = $HTTP_RAW_POST_DATA;
>   if(!$request_xml) {
> $request_xml = $HTTP_GET_VARS[xml];
>   }
>   if(!$request_xml) {
> echo "No XML input found!";
>   }
>   else {
> /* setup some (optional) output options */
> $display = array();
> if($HTTP_POST_VARS[verbosity]) {
>$display[verbosity] = $HTTP_POST_VARS[verbosity];
> }
> if($HTTP_POST_VARS[escaping]) {
>$display[escaping] = $HTTP_POST_VARS[escaping];
> }
> else {
>$display[escaping] = array("non-ascii", "markup");
> }
> if($HTTP_POST_VARS[version]) {
>$display[version] = $HTTP_POST_VARS[version];
> }
> if($HTTP_POST_VARS[encoding]) {
>$display[encoding] = $HTTP_POST_VARS[encoding];
> }
> if($HTTP_POST_VARS[output_type]) {
>$display[output_type] = $HTTP_POST_VARS[output_type];
> }
>   
> /* handle the request */
> $response = xmlrpc_server_call_method($server, $request_xml,
> $response, $display);
>   
> if($HTTP_POST_VARS[disp] === "html") {
>if($HTTP_POST_VARS[output_type] === "php") {
>   echo "\n";
>   var_dump($response);
>   echo "\n\n";
>}
>else {
>   echo "\n$response\n\n";
>}
> }
> else {
>echo "$response";
> }
>   }
>   
> ?>
> 

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



AW: [PHP] imap problem

2003-08-26 Thread Moritz Steiner
yes

-Ursprüngliche Nachricht-
Von: Jay Blanchard [mailto:[EMAIL PROTECTED] 
Gesendet: Dienstag, 26. August 2003 16:23
An: Moritz Steiner; PHP
Betreff: RE: [PHP] imap problem

[snip]
I downloaded imap as indicated on php.net/imap, compiled it, and
recompiled php with --with=imap. Ok  everything worked fine, no error
messages, but when I call the function imap_open() I get the following:

Fatal error: Call to undefined function: imap_open() in
/usr/apache/htdocs/mail.php on line 43

Does anyone know where the error could be?
[/snip]

Did you restart Apache?

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



[PHP] Image Magick

2003-08-26 Thread Mike At Spy

Anyone here familiar with the installation of Image Magick and what files it
installs on your machine?

I had an admin put it on, and then took it off - but took it off by removing
what she thought were all of the files related to it.  I just found some
files I think that are.  They are located in the usr/local/bin directory and
are called:

animate
composite
convert
display
identify
mogrify
montage

The date/time of the files being put there seems to correspond with when the
admin put the program on, and names of the files seem to imply it to me.

And I just wanted to make sure I'm not going to screw up something else by
removing them. :)

Thanks!

-Mike

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



RE: [PHP] imap problem

2003-08-26 Thread Jay Blanchard
[snip]
I downloaded imap as indicated on php.net/imap, compiled it, and
recompiled php with --with=imap. Ok  everything worked fine, no error
messages, but when I call the function imap_open() I get the following:

Fatal error: Call to undefined function: imap_open() in
/usr/apache/htdocs/mail.php on line 43

Does anyone know where the error could be?
[/snip]

Did you restart Apache?

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



Re: [PHP] XmlRPC - Server did not understand request

2003-08-26 Thread Marek Kilimajer
Donald Tyler wrote:

sending http request:

POST Test_Server/XML/PHP_Servers/XMLTEST.php HTTP/1.0
should be
POST /Test_Server/...
(asuming Test_Server is a directory)
User-Agent: xmlrpc-epi-php/0.2 (PHP)
Host: localhost:80
should be
Host: localhost
Content-Type: text/xml
Content-Length: 111


test


receiving response...

got response:

. 



400 Bad Request

Bad Request
Your browser sent a request that this server could not understand.


Apache/2.0.47 (Win32) PHP/4.3.2 Server at localhost Port
80





//---[ Here is the client code: ---\\



require_once('XMLRPC_Utils.php');

$XMLRequest = array();

$options = array('output type' => 'xml', 'version' => 'xmlrpc');
$result = xu_rpc_http_concise(
array(method=> 'test',
  args  => $XMLRequest,
  host  => 'localhost',
  uri   =>
'Test_Server/XML/PHP_Servers/XMLTEST.php',
  port  => 80,
  options   => $options,
  debug => 1));
?>

//---[ Here is the server code: ---\\



include("xmlrpc_utils.php");

// ensure extension is loaded.
xu_load_extension();
function test($method_name, $params, $app_data)
{
return 'Hello Scott';
}
/* create a new server object */
$server = xmlrpc_server_create();

xmlrpc_server_register_method($server, "test", "test");

/* Now, let's get the client's request from the post data */
$request_xml = $HTTP_RAW_POST_DATA;
if(!$request_xml) {
  $request_xml = $HTTP_GET_VARS[xml];
}
if(!$request_xml) {
  echo "No XML input found!";
}
else {
  /* setup some (optional) output options */
  $display = array();
  if($HTTP_POST_VARS[verbosity]) {
 $display[verbosity] = $HTTP_POST_VARS[verbosity];
  }
  if($HTTP_POST_VARS[escaping]) {
 $display[escaping] = $HTTP_POST_VARS[escaping];
  }
  else {
 $display[escaping] = array("non-ascii", "markup");
  }
  if($HTTP_POST_VARS[version]) {
 $display[version] = $HTTP_POST_VARS[version];
  }
  if($HTTP_POST_VARS[encoding]) {
 $display[encoding] = $HTTP_POST_VARS[encoding];
  }
  if($HTTP_POST_VARS[output_type]) {
 $display[output_type] = $HTTP_POST_VARS[output_type];
  }

  /* handle the request */
  $response = xmlrpc_server_call_method($server, $request_xml,
$response, $display);

  if($HTTP_POST_VARS[disp] === "html") {
 if($HTTP_POST_VARS[output_type] === "php") {
echo "\n";
var_dump($response);
echo "\n\n";
 }
 else {
echo "\n$response\n\n";
 }
  }
  else {
 echo "$response";
  }
}

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


[PHP] imap problem

2003-08-26 Thread Moritz Steiner

I downloaded imap as indicated on php.net/imap, compiled it, and
recompiled php with --with=imap. Ok  everything worked fine, no error
messages, but when I call the function imap_open() I get the following:

Fatal error: Call to undefined function: imap_open() in
/usr/apache/htdocs/mail.php on line 43

Does anyone know where the error could be?
Moritz

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



[PHP] Re: Checking for Javascript funcionality

2003-08-26 Thread Kae Verens
Hecchan wrote:



I do something similar to this at http://contactjuggling.org/

if the server thinkks JavaScript is set, then it uses the above to make 
sure. Otherwise, it puts this in the header:
document.location="/?s=1"

Kae

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


Re: [PHP] problem passing variable between forms.

2003-08-26 Thread Lowell Allen
> I have a form in which I have a table with dynamic checkboxes, they are in a
> checkbox array ( name = chk[]...), I pass this variable to the next page
> using POST I receive the variable and use it, no problem, but then when I
> try to pass it to the next form in the URL (using an A HREF:
> 
>   )
> 
> then it doesnt get passed. I have also tried sending it with POST and a
> submit button

Isn't $chk an array? To pass an array in a form, you should serialize it and
encode it, then after receiving it you decode it and unserialize it:

$portable_array = base64_encode(serialize($array));

You can then pass $portable_array as a form hidden input value. To turn it
back into an array:

$array = unserialize(base64_decode($portable_array));

--
Lowell Allen

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



[PHP] XmlRPC - Server did not understand request

2003-08-26 Thread Donald Tyler
Thanks to the excellent help from someone at Full Data Systems (Thank you!),
I finally managed to get the XmlRPC extension working on my windows PHP
installation.

I am not trying to send any params at the moment, all I want to do is get a
valid response.

However, now when I try and run the script in debug mode, I get an error
message (Details below).

The same script works fine on a Mac OSX Server machine that we have. Anyone
have any idea's?

opening socket to host: localhost, port: 80, uri:
Test_Server/XML/PHP_Servers/XMLTEST.php

sending http request:

POST Test_Server/XML/PHP_Servers/XMLTEST.php HTTP/1.0
User-Agent: xmlrpc-epi-php/0.2 (PHP)
Host: localhost:80
Content-Type: text/xml
Content-Length: 111



test



receiving response...

got response:

. 



400 Bad Request

Bad Request
Your browser sent a request that this server could not understand.


Apache/2.0.47 (Win32) PHP/4.3.2 Server at localhost Port
80






//---[ Here is the client code: ---\\

 'xml', 'version' => 'xmlrpc');
$result = xu_rpc_http_concise(
array(method=> 'test',
  args  => $XMLRequest,
  host  => 'localhost',
  uri   =>
'Test_Server/XML/PHP_Servers/XMLTEST.php',
  port  => 80,
  options   => $options,
  debug => 1));

?>

//---[ Here is the server code: ---\\

No XML input found!";
}
else {
  /* setup some (optional) output options */
  $display = array();
  if($HTTP_POST_VARS[verbosity]) {
 $display[verbosity] = $HTTP_POST_VARS[verbosity];
  }
  if($HTTP_POST_VARS[escaping]) {
 $display[escaping] = $HTTP_POST_VARS[escaping];
  }
  else {
 $display[escaping] = array("non-ascii", "markup");
  }
  if($HTTP_POST_VARS[version]) {
 $display[version] = $HTTP_POST_VARS[version];
  }
  if($HTTP_POST_VARS[encoding]) {
 $display[encoding] = $HTTP_POST_VARS[encoding];
  }
  if($HTTP_POST_VARS[output_type]) {
 $display[output_type] = $HTTP_POST_VARS[output_type];
  }

  /* handle the request */
  $response = xmlrpc_server_call_method($server, $request_xml,
$response, $display);

  if($HTTP_POST_VARS[disp] === "html") {
 if($HTTP_POST_VARS[output_type] === "php") {
echo "\n";
var_dump($response);
echo "\n\n";
 }
 else {
echo "\n$response\n\n";
 }
  }
  else {
 echo "$response";
  }
}

?>

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



Re: [PHP] problem passing variable between forms.

2003-08-26 Thread CPT John W. Holmes

- Original Message - 
From: "Angelo Zanetti" <[EMAIL PROTECTED]>
> I have a form in which I have a table with dynamic checkboxes, they are in
a
> checkbox array ( name = chk[]...), I pass this variable to the next page
> using POST I receive the variable and use it, no problem, but then when I
> try to pass it to the next form in the URL (using an A HREF:
>
>   )

You need to serialize() the array in order to pass all of it's values.

$ser = urlencode(serialize($chk));

$url = "confirmrequest.php?requested=$ser";

Then on the receiving side...

$chk = unserialize($_GET['requested']);

You could also just add it to the session and make it easy...

$_SESSION['chk'] = $chk;

and on the receiving page:

$chk = $_SESSION['chk'];

---John Holmes...

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



[PHP] Re: php and var statics

2003-08-26 Thread Greg Beaver


Alvaro Martinez wrote:
I have written this code:

class db{
   var $_miInstancia;
   function db (){
  // funcion que se conecta con la BBDD
 static $miInstancia;
 $this->_miInstancia=&$miInstancia;
 $result = @mysql_pconnect("inforalv", "discoteca", "password");
 if (!$result)
   return false;
 if ([EMAIL PROTECTED]("discoteca"))
   return false;
   }
function getInstancia(){
   if (!isset($this))
  $_miInstancia=new db();
   return $_miInstancia;
}
}
This is a Singleton Pattern, but it doesnt work.
I want to obtain only one instance of db class but when I do this...:
   $conexiondb=db::getInstancia();
   $conexiondb=db::getInstancia();
In the two calls I get a new db object.
Could you please tell me if there is anything wrong?
two mistakes - you need to use &, and the static var must be in 
getInstancia()

function &getInstancia(){
static $miInstancia;
if (!get_class($miInstancia) == 'db') {
$miInstancia = &new db();
}
return $miInstancia;
}
$conexiondb = &db::getInstancia();

Regards,
Greg
--
http://www.phpdoc.org
phpDocumentor
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] problem passing variable between forms.

2003-08-26 Thread Angelo Zanetti

HI all

I have a form in which I have a table with dynamic checkboxes, they are in a
checkbox array ( name = chk[]...), I pass this variable to the next page
using POST I receive the variable and use it, no problem, but then when I
try to pass it to the next form in the URL (using an A HREF:

  )

 then it doesnt get passed. I have also tried sending it with POST and a
submit button


On the page that receives the variable (or meant to ) I have tried this with
POST:

$chk_array =  $_POST['chk'];


===
and this with sending the variable as part of the URL:

echo("count chk: " . count($requested). "");
===

My register_globals is off. I am not sure what Im doing wrong,

Help would be appreciated

Thanx In advance

Angelo

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



Re: [PHP] Cannot pass values from one page to another

2003-08-26 Thread [EMAIL PROTECTED]
what's your register globals settings?
did you try to retrieve from HTTP_COOKIE_VARS ?
murugesan wrote:

Thanks for the message.
I looked into the manual.
But it is not working.
Ofcourse I used session_start in every pages.
-murugesan

- Original Message - 
From: "Jay Blanchard" <[EMAIL PROTECTED]>
To: "murugesan" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, August 26, 2003 5:23 PM
Subject: RE: [PHP] Cannot pass values from one page to another

[snip]
I got this value in next page(main.php)
But from there I am not able to pass it to next page
I used 
session_register('uid');
in main.php
but in next page $uid is returning null
[/snip]

First, look at the manual for sessions. You have posted many questions
where the manual would have provided you a solution. 

Are you placing session_start() at the top of each page where you expect
session variables to be available? You should be...
Have a pleasant day.

 



--
http://www.raditha.com/php/progress.php
A progress bar for PHP file uploads.


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


Re: [PHP] user verification with apache/php question

2003-08-26 Thread David Otton
On Tue, 26 Aug 2003 11:48:22 -0700, you wrote:

>I want to password protect a directory with a .htaccess file. But i don't
>want to use the (ugly) browser popup login window.
>
>Is there a way that php sends the password/login data to apache so that the
>browser popup won't show up?

Chapter 16 in the manual is called "HTTP Authentication with PHP".

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



[PHP] Checking for Javascript funcionality

2003-08-26 Thread hecchan
Hi people,

I think is the PHP scripter needs to know in advance if he can count on 
Client-side scripting capability.
I just start with PHP but wrote this chunk of code to check it.


if (isset($_REQUEST['UA_js'])) {
	session_start();
	$_SESSION['UA_js'] = $_REQUEST['UA_js'];
	if ($_SESSION['UA_js'] == 'true') {
		$_SESSION['UA_coky'] = $_REQUEST['UA_coky'];
		... add more vars
	}
	header( "Location: http://mydomain.com/secondPage.php"; );
	exit;
}
?>



	




	
	
	... add more hidden fields


UA_form = document.forms[0];
UA_form['UA_coky'].value = navigator.cookieEnabled;
... set more values
UA_form.submit();
Then you can send the client the page tailored for him and to know in advance what can you expect from him. It would be nice if the browser sent in the request a flag about this funcionality. Sure this code can be improved (I'd love ideas about it) but think the knowledge of what's exactly is in the other side will pay the extra process. Sorry about my english -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] php and var statics

2003-08-26 Thread Alvaro Martinez
I have written this code:

class db{
   var $_miInstancia;

   function db (){
  // funcion que se conecta con la BBDD
 static $miInstancia;
 $this->_miInstancia=&$miInstancia;

 $result = @mysql_pconnect("inforalv", "discoteca", "password");
 if (!$result)
   return false;
 if ([EMAIL PROTECTED]("discoteca"))
   return false;
   }

function getInstancia(){
   if (!isset($this))
  $_miInstancia=new db();
   return $_miInstancia;
}
}

This is a Singleton Pattern, but it doesnt work.
I want to obtain only one instance of db class but when I do this...:

   $conexiondb=db::getInstancia();
   $conexiondb=db::getInstancia();

In the two calls I get a new db object.
Could you please tell me if there is anything wrong?

Thanks.

alvaro

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



Re: [PHP] Cannot pass values from one page to another

2003-08-26 Thread murugesan
Thanks for the message.
I looked into the manual.
But it is not working.
Ofcourse I used session_start in every pages.

-murugesan

- Original Message - 
From: "Jay Blanchard" <[EMAIL PROTECTED]>
To: "murugesan" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, August 26, 2003 5:23 PM
Subject: RE: [PHP] Cannot pass values from one page to another


[snip]
I got this value in next page(main.php)
But from there I am not able to pass it to next page
I used 
session_register('uid');
in main.php
but in next page $uid is returning null
[/snip]

First, look at the manual for sessions. You have posted many questions
where the manual would have provided you a solution. 

Are you placing session_start() at the top of each page where you expect
session variables to be available? You should be...

Have a pleasant day.

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



RE: [PHP] Cron time to activate mail and error handling

2003-08-26 Thread Jay Blanchard
[snip]
1. We want to activate cron to wake up at certain time.  We do not know
how
to configure the time for waking up?
[/snip]

cron should be "active" all of the time. Type;

ps aux | grep cron

and you shold see cron running as a daemon

[snip]
2. We are sending mails using PHP program.  PHP program is activated
Cron.
We want to know wheather the mail was sent successfully or not.  How do
we
know about the success and failure
[/snip]

Put your e-mail address at the end of the list to make sure that you
receive a copy of the e-mail to be sent. Or put in a process to send you
an e-mail at the end of the PHP script notifying you that the job is
complete. As to "successful" are you meaning whether or not the
receipient got the e-mail? Check for bounced e-amils?

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



Re: [PHP] PHP permissions problem

2003-08-26 Thread Lowell Allen
> * Thus wrote Lowell Allen ([EMAIL PROTECTED]):
>> My commercial host is set up with the public root directory, "public_html",
>> owned by user: userid, group: nobody. Directories I create within
>> public_html are owned by user: userid, group: userid. As a result, PHP does
>> not have permission to create files or write to files in public_html, but it
>> does within its subdirectories.
>> 
>> Is this a common setup? Are there security problems with changing the
>> ownership of public_html to user: userid, group: userid so PHP can create
>> files within the root directory? Advice, opinions, and links to relevant
>> information are requested.
> 
> I usually keep my writable directories outside the public_html
> directory. 
> 
> homedir/public_html/*   All read only by webserver.
> homedir/private_data/*  Make these files read/write
> 
> 
> Curt

I should have explained that the setup is a problem because the site uses a
content management system that updates a few static HTML pages -- the pages
that get hit most often. The commercial host seems to have changed their
standard setup so that my CMS can no longer update these pages since PHP no
longer has permission to write to public_html. (I'll eventually get an
explanation from the host. I find I have to email one simple question at a
time.)

I could change the permissions of public_html to 777, but that doesn't seem
like a good idea. I could write the static files to a subdirectory, but that
would require rewriting several output functions. Or I could ask the
commercial host to change ownership of public_html to userid.userid. But is
there a security problem with that?

--
Lowell Allen

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



RE: [PHP] Cannot pass values from one page to another

2003-08-26 Thread Jay Blanchard
[snip]
I got this value in next page(main.php)
But from there I am not able to pass it to next page
I used 
session_register('uid');
in main.php
but in next page $uid is returning null
[/snip]

First, look at the manual for sessions. You have posted many questions
where the manual would have provided you a solution. 

Are you placing session_start() at the top of each page where you expect
session variables to be available? You should be...

Have a pleasant day.

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



  1   2   >