Re: [PHP] PHP Accelerator

2004-11-09 Thread Klaus Reimer
Adrian Madrid wrote:
I've been running Turck for some time now on PHP5 and haven't had
segfault problems yet. I must say I'm running the latest CVS and using
file sessions (Turck's would give you segfaults). 
I also tried latest CVS and I don't use Turcks cache. Maybe Turck has 
problems with Objects in PHP5 (because there were the great changes) 
while normal Non-OO-Scripts are running flawlessly.

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


Re: [PHP] Arrays

2004-11-09 Thread Klaus Reimer
Zareef Ahmed wrote:
But you need to do serialize and unserialize in case of array or object.
Do ::
$val_ar=array("one","two","three");
$_SESSION['val_ar_store']=serialize($val_ar);
Serialization is done automatically. You don't need to do it yourself. 
You can even store simple value-objects in the session witout manual 
serialization.

So you can do:
$val_ar = array("one", "two", "three");
$_SESSION['val_ar_store'] = $val_ar;
serialize/unserialize are useful if you want to store complex data in a 
file or in a database.

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


Re: [PHP] PHP Accelerator

2004-11-09 Thread raditha dissanayake
Klaus Reimer wrote:
Adrian Madrid wrote:
I've been running Turck for some time now on PHP5 and haven't had
segfault problems yet. I must say I'm running the latest CVS and using
file sessions (Turck's would give you segfaults). 

I also tried latest CVS and I don't use Turcks cache. Maybe Turck has 
problems with Objects in PHP5 (because there were the great changes) 
while normal Non-OO-Scripts are running flawlessly.
I am also running turck with php5 without too many problems and that's 
why i recommended it to the OP. However none of the scripts that run on 
it make use of any of the new features of php5.


--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Meta refresh best answer ??

2004-11-09 Thread Ing. Ivo F.A.C. Fokkema
Hi Michael,

I always use

header('Refresh: 2; url=' . $_SERVER['PHP_SELF']);

to reload the current page every 2 seconds. You may want to pass $_GET
variables, depending on your needs. Also make sure you call this function
_before_ any other output has gone to the browser.

HTH,

Ivo


On Mon, 08 Nov 2004 22:26:53 -0700, Michael Gale wrote:

> Hello,
> 
>   I really wanted to know if there was a better way to do this using PHP
> ? That is why I e-mailed the list.
> 
> 
> Michael.
> 
> 
> 
> Michael Gale wrote:
>> Hello,
>> 
>> I am working on a site where people will be updating information in
>> a database and should have up to date info. Now since HTTP is stateless
>> the user will not know about any new information until they click on a
>> link or hit a button on the page.
>> 
>> My question is -- if I want to keep a user up to date about changes to
>> any information they might want to know would it be best to create a
>> hidden frame of some sort which does a mete-refresh to a page looking
>> for updates, and if found display a java popup window with a small FYI ?
>> 
>> If so would a meta-refresh of 3-5 seconds be to aggressive ? What about
>> server load ?
>> 
>> Is there a better way ?
>> 
>> Hope I was clear, thanks.
>> 
>> Michael.
>>

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



Re: [PHP] PHP Accelerator

2004-11-09 Thread Klaus Reimer
raditha dissanayake wrote:
I am also running turck with php5 without too many problems and that's 
why i recommended it to the OP. However none of the scripts that run on 
it make use of any of the new features of php5.
One example: I'm using osCommerce, which is not using any new 
PHP5-features (It's PHP4 software) but it is using general OO. And the 
results if MMCache is enabled are very unstable. Most of the time the 
HTML output is corrupted. Sometimes it segfaults. These problemse go 
away if I disable MMCache. On PHP4 everything works fine with MMCache.

--
Bye, K  (FidoNet: 2:240/2188.18)
[A735 47EC D87B 1F15 C1E9  53D3 AA03 6173 A723 E391]
(Finger [EMAIL PROTECTED] to get public key)


signature.asc
Description: OpenPGP digital signature


[PHP] in_array not operating as 'expected'

2004-11-09 Thread Ing. Ivo F.A.C. Fokkema
Hi guys and gals,

I'm not screaming "Bug! Bug!" but this _does_ look 'illogical' to me. I've
searched the archives, but found no earlier conversation. Sorry if
I missed it. Consider the following code:

var_dump(in_array('test', array(0)));

What does this return? I expect bool(false), but it returns bool(true).
After some searching the web, I bumped into this:
http://www.phpdiscuss.com/article.php?id=67763&group=php.bugs

Basically, it is said by derick [at] php.net that this behavior is
expected. The following code :

var_dump('test' == 0);

also returns bool(true). But my logic tells me, that if 'test' == 0, then :

if (0) {
  ...
}

should do the same as 

if ('test') {
  ...
}

but it doesn't! The first if-statement is _not_ executed, the latter is.
In my opinion, this is not correct. Any thoughts on this? Am I not seeing
the logic here?

Thanks for your thoughts.

Ivo Fokkema

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



Re: [PHP] Fping problem

2004-11-09 Thread Jason Wong
On Tuesday 09 November 2004 01:54, [EMAIL PROTECTED] wrote:

> I have written a simple page that uses fping and was working perfectly just
> shelling out to it using the backtick.
>
> The server it was on crapped out and I'm trying to get it going again on
> our new server.I have installed fping, given permissions to everyone to
> run it and copied it to the places where it was before.   /usr/local/bin  
> /bin /sbin
>
> And it will not return the input I give it.

And what, exactly, does that mean?

- what did you do?
- what did you expect to happen?
- what actually happened?
- any logs and error messages?

Not all of us are certified mindreaders, so some basic info would help.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Life is to you a dashing and bold adventure.
*/

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



Re: [PHP] upload via FTP

2004-11-09 Thread Alessandro Rosa
> Your question is not very clear. Do you mean to say you only want your 
> FTP server to be accessible by your php scripts? If so the trick is to 
> listen only on localhost and not on the public ip.
> 

No, only some of the scripts shall be
accessible by other scripts in the FTP server.

Alessandro Rosa

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



Re: [PHP] upload via FTP

2004-11-09 Thread raditha dissanayake
Alessandro Rosa wrote:
Your question is not very clear. Do you mean to say you only want your 
FTP server to be accessible by your php scripts? If so the trick is to 
listen only on localhost and not on the public ip.

   

No, only some of the scripts shall be
accessible by other scripts in the FTP server.
 

That's even more confusing. You run php scripts off a web server and not 
an FTP server.

Alessandro Rosa
 


--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Sub selects vs nested loop

2004-11-09 Thread electroteque
Hi guys and girls, while we are on this topic, has anyone got a good 
senario of a sub select query which can remove the nested loops ? I 
have been wanting to get rid of nested loops for a good while and now 
Mysql 4.1 is out I would like to start using it. So the usual scenario 
for nested loops to to get data out of a 1 to many relationship. Please 
put me on the right path, I had asked the Mysql list but no success.

Daniel
On 09/11/2004, at 5:45 AM, Greg Donald wrote:
On Mon, 08 Nov 2004 21:57:41 +0600, raditha dissanayake
<[EMAIL PROTECTED]> wrote:
Sorry no benchmarks, i am talking from personal experience where I
converted some code from a php nested loop to mysql. I was rather
surprised by the results. I will concede that I may not have optimized
the query properly or that I may not have had the correct indexes, but
since I have been doing this for quite a few years i like to think i 
got
the query right. (feel free to deflate my ego :-) )
Well yeah.. It's hard to believe a well written MySQL sub select query
with proper indexing would be slower than looping through the results
with PHP scripting.
--
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.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] in_array not operating as 'expected'

2004-11-09 Thread Marek Kilimajer
Ing. Ivo F.A.C. Fokkema wrote:
Hi guys and gals,
I'm not screaming "Bug! Bug!" but this _does_ look 'illogical' to me. I've
searched the archives, but found no earlier conversation. Sorry if
I missed it. Consider the following code:
var_dump(in_array('test', array(0)));
What does this return? I expect bool(false), but it returns bool(true).
After some searching the web, I bumped into this:
http://www.phpdiscuss.com/article.php?id=67763&group=php.bugs
Basically, it is said by derick [at] php.net that this behavior is
expected. The following code :
var_dump('test' == 0);
'test' and 0 are not of the same type (string vs int), so string is 
converted to int, 0. In the examples below no type casting is needed.

also returns bool(true). But my logic tells me, that if 'test' == 0, then :
if (0) {
  ...
}
should do the same as 

if ('test') {
  ...
}
but it doesn't! The first if-statement is _not_ executed, the latter is.
In my opinion, this is not correct. Any thoughts on this? Am I not seeing
the logic here?
Thanks for your thoughts.
Ivo Fokkema
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: in_array not operating as 'expected'

2004-11-09 Thread Bogdan Stancescu
Apart from Marek's reply, you should probably check the in_array() 
documentation (look at the third, optional parameter) and search for 
type casting on php.net.

Cheers,
Bogdan
Ing. Ivo F.A.C. Fokkema wrote:
Hi guys and gals,
I'm not screaming "Bug! Bug!" but this _does_ look 'illogical' to me. I've
searched the archives, but found no earlier conversation. Sorry if
I missed it. Consider the following code:
var_dump(in_array('test', array(0)));
What does this return? I expect bool(false), but it returns bool(true).
After some searching the web, I bumped into this:
http://www.phpdiscuss.com/article.php?id=67763&group=php.bugs
Basically, it is said by derick [at] php.net that this behavior is
expected. The following code :
var_dump('test' == 0);
also returns bool(true). But my logic tells me, that if 'test' == 0, then :
if (0) {
  ...
}
should do the same as 

if ('test') {
  ...
}
but it doesn't! The first if-statement is _not_ executed, the latter is.
In my opinion, this is not correct. Any thoughts on this? Am I not seeing
the logic here?
Thanks for your thoughts.
Ivo Fokkema
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] upload via FTP

2004-11-09 Thread Alessandro Rosa
> That's even more confusing. You run php scripts off a
> web server and not an FTP server.

Ok ... the server I'm dealing with works for both services.
But let me re-explain the question in new terms.

I have a bunch of php scripts on a web server.
I just wanted to know if it is possible to deny access
permissions for some of such scripts to a public user
but not to other scripts staying on the same server.

Alessandro Rosa

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



RE: [PHP] images doesn't seem to cache

2004-11-09 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 06 November 2004 20:09, anders thoresson wrote:

> >  This code seems to work. Have I got it right?
> 
>   No. I have not. Sometimes the images are viewed from the
> cache, just
> to get downloaded from the server again next time, just a
> minute later,
> when I try again.
> 
>   My local development server is running IIS, my production server is
> running Apache. Where is the best place to look for If-Modified-Since?
> Is $_GET['If-Modified-Since'] a safe bet?

For Apache, I found it in $_SERVER['HTTP_IF_MODIFIED_SINCE']; if IIS passes
it to PHP, I would definitely expect it to be in $_SERVER[].

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



[PHP] using mysql in php problem

2004-11-09 Thread Garth Hapgood - Strickland
I have created a registration page
http://www26a.your-server.co.za/matchm/registration4.php

On this page I have many fields, some of them pulling data out from my
database. I have a javascript validation scipt thats checks on submission of
the form to see if all required fields are filled in correctly.
IF thats the case it should submit the form. Which it isnt doing! It should
start with submission after the validation check is passed.

Then I check to see whether the BusinessName & BusinessOwner already exist,
if not then I am trying to to an insert (which it doesnt do either). Here is
the php code:
$errmsg = "";


$business_query = "SELECT BusinessName, BusinessOwner from business WHERE
BusinessName = '$BusinessName' AND BusinessOwner = '$BusinessOwner'" ;

$result = mysql_query($business_query);


if (mysql_num_rows($result) > 0) {$errmsg .= "You are already registered at
Match Makers";}

else {

if (isset($submit) == "Register Now"){mysql_query("INSERT INTO business

(BusinessName, BusinessOwner, StreetAdress, Suburb, CityTown, ProvinceID,
StreetCode, PostalAddress, PostalCode, WebsiteAddress, IndustryID,
IndustryOther, ProductService, BusinessAge, AnnualTurnoverID,
EmpowermentProfileID, BEEScoreCardID, PreferredLocationID,
PreferredProductService, PreferredMatchPartner, PreferredIndustryID,
PreferredIndustryOther, PreferredAgeID, PreferredTurnoverID,
PreferredEmpowermentProfileID, DateRegistered, MarketSourceID)

VALUES

('" . $HTTP_POST_VARS['business_name'] . "', '" .
$HTTP_POST_VARS['street_address'] . "', '" . $HTTP_POST_VARS['suburb'] . "',
$city_town, $province_desc, $street_code, $postal_address, $postal_code,
$website_address, $industry_desc, $industry_other, $product_service,
$business_age, '', '', '', '', '', '', '', '', '', '',)");


$id = mysql_insert_id();


if ($telnumber1 <> '') {mysql_query("INSERT INTO business_communication
(BusinessID,CommunicationType,Destination) VALUES ( '" . $id . "', 1, '".
$HTTP_POST_VARS['telnumber1'] . "')");}

if ($faxnumber1 <> '') {mysql_query("INSERT INTO business_communication
(BusinessID,CommunicationType,Destination) VALUES ( '" . $id . "', 2, '".
$HTTP_POST_VARS['faxnumber1'] . "')");}

if ($cellnumber1 <> '') {mysql_query("INSERT INTO business_communication
(BusinessID,CommunicationType,Destination) VALUES ( '" . $id . "', 3, '".
$HTTP_POST_VARS['cellnumber1'] . "')");}

if ($emailaddress1 <> '') {mysql_query("INSERT INTO business_communication
(BusinessID,CommunicationType,Destination) VALUES ( '" . $id . "', 4, '".
$HTTP_POST_VARS['emailaddress1'] . "')");}


echo "Your registration has been submitted";

}

}

I am not sure where exactly I am going so wrong, and it really is starting
to drive me crazy!
Regards
Garth

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



Re: [PHP] upload via FTP

2004-11-09 Thread Jason Wong
On Tuesday 09 November 2004 11:10, Alessandro Rosa wrote:
> > That's even more confusing. You run php scripts off a
> > web server and not an FTP server.
>
> Ok ... the server I'm dealing with works for both services.
> But let me re-explain the question in new terms.
>
> I have a bunch of php scripts on a web server.
> I just wanted to know if it is possible to deny access
> permissions for some of such scripts to a public user
> but not to other scripts staying on the same server.

It's still not clear what you are describing/asking.

I'll assume that by 'public user' you mean via FTP. If so then most ftp 
servers will allow you to restrict access to specified directories.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
I have a terrible headache,  I was putting on toilet water and the lid fell.
*/

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



Re: [PHP] Meta refresh best answer ??

2004-11-09 Thread Justin French
On 09/11/2004, at 2:33 PM, Michael Gale wrote:
I am working on a site where people will be updating information in a 
database and should have up to date info. Now since HTTP is stateless 
the user will not know about any new information until they click on a 
link or hit a button on the page.

My question is -- if I want to keep a user up to date about changes to 
any information they might want to know would it be best to create a 
hidden frame of some sort which does a mete-refresh to a page looking 
for updates, and if found display a java popup window with a small FYI 
?
Refreshes can be done with header() in PHP, and with .
There's also JpSpan (XmlHttpRequest), which means that a javascript (be 
you're aware that some users may not have it enabled) can query the 
server to retrieve information and act on it.

http://jpspan.sourceforge.net/wiki/doku.php?id=javascript:xmlhttprequest
If so would a meta-refresh of 3-5 seconds be to aggressive ? What 
about server load ?
If you want to ask the server for new data every 3 seconds, it doesn't 
matter which way you do it, the server will have to respond with 
something.  The answer to server load is to buy more hardware, and 
optimise the ___k out of your code, mark-up, and queries :)

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


Re: [PHP] upload via FTP

2004-11-09 Thread raditha dissanayake
Alessandro Rosa wrote:
That's even more confusing. You run php scripts off a
web server and not an FTP server.
   

Ok ... the server I'm dealing with works for both services.
But let me re-explain the question in new terms.
I have a bunch of php scripts on a web server.
I just wanted to know if it is possible to deny access
permissions for some of such scripts to a public user
but not to other scripts staying on the same server.
 

I see. In that case though this is not a php problem. This is a problem 
about setting the right permissions on your file system - for which you 
will need to refer to the documentation for chown and chmod. Your FTP 
server may also have what is known as a 'chroot'  mode where users will 
be prevented from browsing outside their home folder.

Having said all that we had a big discussion about a month ago on 
protecting scripts on a shared server and the generall consensus was 
that there is always a loop hole.

Alessandro Rosa
 


--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] using mysql in php problem

2004-11-09 Thread raditha dissanayake
Garth Hapgood - Strickland wrote:
I have created a registration page
http://www26a.your-server.co.za/matchm/registration4.php
On this page I have many fields, some of them pulling data out from my
database. I have a javascript validation scipt thats checks on submission of
the form to see if all required fields are filled in correctly.
IF thats the case it should submit the form. Which it isnt doing! It should
start with submission after the validation check is passed.
 

This part of the questions should be posted on a js list.
Then I check to see whether the BusinessName & BusinessOwner already exist,
if not then I am trying to to an insert (which it doesnt do either). Here is
the php code:
$errmsg = "";
$business_query = "SELECT BusinessName, BusinessOwner from business WHERE
BusinessName = '$BusinessName' AND BusinessOwner = '$BusinessOwner'" ;
$result = mysql_query($business_query);
if (mysql_num_rows($result) > 0) {$errmsg .= "You are already registered at
Match Makers";}
 

You will do yourself a great service by punctuating indenting your code 
properly. If you read the code of some open source php scripts you will 
find that they are so much easier to read.

else {
if (isset($submit) == "Register Now"){mysql_query("INSERT INTO business
(BusinessName, BusinessOwner, StreetAdress, Suburb, CityTown, ProvinceID,
StreetCode, PostalAddress, PostalCode, WebsiteAddress, IndustryID,
IndustryOther, ProductService, BusinessAge, AnnualTurnoverID,
EmpowermentProfileID, BEEScoreCardID, PreferredLocationID,
PreferredProductService, PreferredMatchPartner, PreferredIndustryID,
PreferredIndustryOther, PreferredAgeID, PreferredTurnoverID,
PreferredEmpowermentProfileID, DateRegistered, MarketSourceID)
VALUES
('" . $HTTP_POST_VARS['business_name'] . "', '" .
$HTTP_POST_VARS['street_address'] . "', '" . $HTTP_POST_VARS['suburb'] . "',
$city_town, $province_desc, $street_code, $postal_address, $postal_code,
$website_address, $industry_desc, $industry_other, $product_service,
$business_age, '', '', '', '', '', '', '', '', '', '',)");
 

See what i mean :-)
$id = mysql_insert_id();
 

..snipped ..
I am not sure where exactly I am going so wrong, and it really is starting
to drive me crazy!
 

The best thing to do is to liberally douse your code with 
error_log(mysql_error()) statement you will then start seeing error 
messages in your log (or your browser depending on your config) about 
what's going wrong.

As has often been pointed out echoing out the queries produced by your 
php script and running them through the mysql client usually helps too.

Regards
Garth
 


--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Why cookie is created?

2004-11-09 Thread Jerry Swanson
So As I understand. Session also store ID on the harddrive. I don't
see the big difference between session and cookies from "privacy"
point of view.







On Mon, 8 Nov 2004 17:55:03 -0500, Paul Reinheimer
<[EMAIL PROTECTED]> wrote:
>  --
>  I don't want to use cookies.
>  I want to use session. When I use this code. It stores data on the harddrive.
>  --
> 
>  When you use Sessions, the data you put in the session is NOT stored
>  on the users hard drive in a cookie. Only the Session ID is stored
>  there. All of the other information you store in the session (say
>  their userid, name, prefernces, security level, etc) is stored on the
>  SERVER. The session ID stored in the cookie only serves as a pointer
>  to the data stored on your server.
> 
>  The alternative to allowing PHP to store the users session id in a
>  cookie is to have php re-write all of the urls on your page to include
>  their session id. Generally this is not the preferred solution for
>  several reasons:
>  1. URLs look a lot messier eg:
>  a) without cookies
>  http://forum.example.com/index.php?sid=a568a4c022a2f8491323c5f3ef5888d8
>  b) with cookies
>  http://forum.edonkey.com/index.php
>  2. Users may accidentally give away their session id, and possibly
>  open the door to session hijacking.
>  3. Users bookmark pages with stale session ids
> 
>  So, in summary. Using sessions only stores the session id on the users
>  hard drive. The rest of the data stored in the session is saved on the
>  server.
> 
>  paul
> 
>  --
>  Paul Reinheimer
> 
> 
> 
> --
> 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] using mysql in php problem

2004-11-09 Thread Murray @ PlanetThoughtful
> I am not sure where exactly I am going so wrong, and it really is starting
> to drive me crazy!
> Regards
> Garth


Hi Garth,

Looks like it's time to do some fairly standard debugging. 

Try putting error_reporting(E_ALL) at the top of the page in question. It
may be that you're currently missing out on helpful error messages because
E_NOTICE messages are suppressed by default.

Also, try assigning your SQL statements to a variable and echoing them and
them copying and pasting them directly either into the MySQL command line
client or via the PHPMyAdmin SQL tab, if you have the package available (or
via any other client that allows you to run SQL against your server which
might report more verbose errors than your installation of PHP has been set
to do).

Ie something like:

$sql = "INSERT INTO business_communication
> (BusinessID,CommunicationType,Destination) VALUES ( '" . $id . "', 1, '".
> $HTTP_POST_VARS['telnumber1'] . "')";

echo $sql;

mysql_query($sql);

...and so on, for each of your SQL statements.

Essentially, you're trying to make certain that the variables you've
populated from your form actually contain the data you expect. It's entirely
possible that one or more of your variables isn't populated correctly, and
this is causing your statement(s) to fail, without an error being reported.

Much warmth,

Murray
http://www.planetthoughtful.org
Building a thoughtful planet,
One quirky comment at a time.

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



RE: [PHP] using mysql in php problem

2004-11-09 Thread Graham Cossey


> -Original Message-
> From: Garth Hapgood - Strickland [mailto:[EMAIL PROTECTED]
> Sent: 09 November 2004 11:27
> To: [EMAIL PROTECTED]
> Subject: [PHP] using mysql in php problem
>
>
> I have created a registration page
> http://www26a.your-server.co.za/matchm/registration4.php
>
> On this page I have many fields, some of them pulling data out from my
> database. I have a javascript validation scipt thats checks on
> submission of
> the form to see if all required fields are filled in correctly.
> IF thats the case it should submit the form. Which it isnt doing!

No need to go any further at this stage then. If your Javascript is not
doing/allowing the form submission then you need to check that code, no
point looking at the PHP code if it's never being called.

[snip]

>
> I am not sure where exactly I am going so wrong, and it really is starting
> to drive me crazy!

Have you tried commenting out the Javascript validation and submitting the
form? If the form then gets processed (by the PHP code) post your problem to
a Javascript list/forum for advice.

Graham

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



[PHP] Re: in_array not operating as 'expected'

2004-11-09 Thread Ing. Ivo F.A.C. Fokkema
Thanx both of you,

I know the type-casting bit and have noticed the third parameter which
'fixes' the in_array issue. I just missed 'test' == 0 implied (int) 'test'
== 0. Typecasting a string to integer indeed returned 0. Typecasting is
of course not necessary within if statements, resulting in my confusion.

Thanks again,

Ivo


On Tue, 09 Nov 2004 12:42:51 +0200, Bogdan Stancescu wrote:

> Apart from Marek's reply, you should probably check the in_array()
> documentation (look at the third, optional parameter) and search for type
> casting on php.net.
> 
> Cheers,
> Bogdan
> 
> Ing. Ivo F.A.C. Fokkema wrote:
> 
>> Hi guys and gals,
>> 
>> I'm not screaming "Bug! Bug!" but this _does_ look 'illogical' to me.
>> I've searched the archives, but found no earlier conversation. Sorry if
>> I missed it. Consider the following code:
>> 
>> var_dump(in_array('test', array(0)));
>> 
>> What does this return? I expect bool(false), but it returns bool(true).
>> After some searching the web, I bumped into this:
>> http://www.phpdiscuss.com/article.php?id=67763&group=php.bugs
>> 
>> Basically, it is said by derick [at] php.net that this behavior is
>> expected. The following code :
>> 
>> var_dump('test' == 0);
>> 
>> also returns bool(true). But my logic tells me, that if 'test' == 0,
>> then :
>> 
>> if (0) {
>>   ...
>> }
>> }
>> should do the same as
>> 
>> if ('test') {
>>   ...
>> }
>> }
>> but it doesn't! The first if-statement is _not_ executed, the latter is.
>> In my opinion, this is not correct. Any thoughts on this? Am I not
>> seeing the logic here?
>> 
>> Thanks for your thoughts.
>> 
>> Ivo Fokkema

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



Re: [PHP] Why cookie is created?

2004-11-09 Thread Ramil Sagum
On Tue, 9 Nov 2004 11:43:19 +, Jerry Swanson <[EMAIL PROTECTED]> wrote:
> So As I understand. Session also store ID on the harddrive. I don't
> see the big difference between session and cookies from "privacy"
> point of view.
> 

Instead of 

"Session also store ID on the harddrive"

a more correct wat to put is is

"Sessions store ONLY an ID on the [user's] harddrive".

All other information you store in the session is placed in the
webserver. The user has no direct access to it. This is how it differs
from using just cookies (where all of the info is stored in the user's
harddisk)



--

ramil

http://ramil.sagum.net

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



[PHP] help with fopen path

2004-11-09 Thread Giles Roadnight
Hi All
 
I'm developing a fusebox PHP app and have a class in a /classes
directory that opens an xml file in a directory below the site root
using this path: "../siteconfig.xml"
 
All of the places I have used this class from so far have been in the
site root. I am now starting some pages in a sub directory. When I use
this class it says it can't open the file. I have tried
"../../siteconfig.xml" instead but it doesn't work either.
 
What's the best way to go about fixing this? I'm quite new to php and
I'm not sure where the relative path is taken from - i.e. is it the
index.php page or the class (obviously not) or my switch file or what?
 
Hope someone can help.
 
Giles Roadnight
http://giles.roadnight.name
 


Re: [PHP] Why cookie is created?

2004-11-09 Thread ankur_os
I just want to give you a simple example that for diff. of session and cookie is
that---

When in our gmail account we will see that one option is there to save the
password for 2 weeks, so that eans when u check that bbox and submit then one
cookie is created for that comp. with your details nand the expiry time would be
for 2 weeks (by converting insec.).

And when u r in checking of your in box just copy the contents of address bar
and then closs all the windo and again paste the address bar link it will sshow
you the login page because your inforation is stored in seession.So when a page
starts it first of al it check the session.it will check the session id from
your co. which is not set when you logged out

FOR SESSION  == " A visitor accessing your web site is assigned an unique id,
the so-called session id. The session support allows you to register arbitrary
numbers of variables to be preserved across requests. When a visitor accesses
your site, PHP will check automatically (if session.auto_start is set to 1) or
on your request (explicitly through session_start() or implicitly through
session_register()) whether a specific session id has been sent with the
request. If this is the case, the prior saved environment is recreated. "

FOR COOKIE == " Cookies are a mechanism for storing data in the remote browser
and thus tracking or identifying return users. "


Ankur Dave
PHP Developer
INDIA

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



Re: [PHP] apache 2, mysql 5.0.1.rpm and php 5.0.2 on RH9

2004-11-09 Thread Haseeb Iqbal
hi,
i manged to install php but with mysqli support only, i want to configure it
mysql and mysqli support. as it turned out the error occured when i tred to
install both mysql and mysqli support, for the time i am living with mysqli
support only untill i figure out what i wsa doing wrong. i have
MySQL-client-5.0.1-0.i386.rpm,MySQL-Max-5.0.1-0.i386.rpm,MySQL-shared-5.0.1-
0.i386.rpm,MySQL-bench-5.0.1-0.i386.rpm,MySQL-devel-5.0.1-0.i386.rpm and
MySQL-server-5.0.1-0.i386.rpm installed.

waiting for comments on how to install both mysql and mysqli support.

Regards,
Haseeb
- Original Message - 
From: "Greg Donald" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 09, 2004 12:52 AM
Subject: Re: [PHP] apache 2, mysql 5.0.1.rpm and php 5.0.2 on RH9


> On Mon, 8 Nov 2004 07:19:30 +0500, Haseeb Iqbal <[EMAIL PROTECTED]>
wrote:
> > /usr/lib/mysql/libmysqlclient.a(net.o)(.text+0x9d0): first defined here
> > collect2: ld returned 1 exit status
> > make: *** [libphp5.la] Error 1
>
> Does /usr/lib/mysql/libmysqlclient.a actually exist?  After you
> installed MySQL from rpms, did you run ldconfig?
>
>
> -- 
> Greg Donald
> Zend Certified Engineer
> http://gdconsultants.com/
> http://destiney.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] Pb'lm of Regular Expression

2004-11-09 Thread ankur_os

thnx for your support every thing is working well 
but 
still one problem, that height and width are not coming so how i modify the
first regular exp. so it shows both height and width.

//s


Thnx...

Ankur Dave 




Quoting Klaus Reimer <[EMAIL PROTECTED]>:

> [EMAIL PROTECTED] wrote:
> > "https://abc.com/first.php?
> > site_id=abc&aid=keyin&lid=keyin&ref=&q=\" width=\"1\" height=\"1\">";
> 
> //s
> 
> The complete tag is in index 0, the src is in index 1 of the match-array.
> 
> 
> > Now what regular expression i write so i can fetch the image tag from my
> site of
> > above syntex.And if possible send me the regular expression of fetching 
> >  
> 
> /(.*?)<\/a>/s
> 
> The complete tag is in index 0, the href attrib in index 1 and the link 
> text in index 2.
> 

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



Re: [PHP] Why cookie is created?

2004-11-09 Thread Jerry Swanson
Why when I specify session.cookie_lifetime = 1 // Cookies are not created.
However, when I specify large lifetime, cookies are created.
session.cookie_lifetime = 1500




On Tue,  9 Nov 2004 08:11:46 -0500, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> I just want to give you a simple example that for diff. of session and cookie 
> is
> that---
> 
> When in our gmail account we will see that one option is there to save the
> password for 2 weeks, so that eans when u check that bbox and submit then one
> cookie is created for that comp. with your details nand the expiry time would 
> be
> for 2 weeks (by converting insec.).
> 
> And when u r in checking of your in box just copy the contents of address bar
> and then closs all the windo and again paste the address bar link it will 
> sshow
> you the login page because your inforation is stored in seession.So when a 
> page
> starts it first of al it check the session.it will check the session id from
> your co. which is not set when you logged out
> 
> FOR SESSION  == " A visitor accessing your web site is assigned an unique id,
> the so-called session id. The session support allows you to register arbitrary
> numbers of variables to be preserved across requests. When a visitor accesses
> your site, PHP will check automatically (if session.auto_start is set to 1) or
> on your request (explicitly through session_start() or implicitly through
> session_register()) whether a specific session id has been sent with the
> request. If this is the case, the prior saved environment is recreated. "
> 
> FOR COOKIE == " Cookies are a mechanism for storing data in the remote browser
> and thus tracking or identifying return users. "
> 
> Ankur Dave
> PHP Developer
> INDIA
> 
>

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



[PHP] page redirect question

2004-11-09 Thread Victor C.
Hi,

Is there anyway to redirect php page other than using
HEADER("LOCATION:URL") ?
Header can only be called if nothing is written to HTML... Is there anyway
around it?

Thanks,

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



Re: [PHP] Pb'lm of Regular Expression

2004-11-09 Thread Klaus Reimer
[EMAIL PROTECTED] wrote:
thnx for your support every thing is working well 
but 
still one problem, that height and width are not coming so how i modify the
first regular exp. so it shows both height and width.

//s

I'm not sure if I understand you. Do you want the complete tag with all 
attributes? The above regex already provides this data in the first 
index of the matches-array. Or do you want to explicitly fetch the width 
and height of an image tag. Then you just need to replace "src" with 
"width" or whatever attribute you want in the above regex. You can also 
read multiple attributes with one regex but then you are limited to a 
specific attribute order. So it will not work for pages which are not 
under you control.

A better solution is to do it in multiple steps:
1. Match the complete tag: //s
2. Match the attribs in the tag: /(\w+)="(.*?)"/s
3. Iterate over the matches of step 2 and search the attribute you need.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] MySQL

2004-11-09 Thread Octavian Rasnita
Hi all,

Please tell me how to send a null string to be inserted in a MySQL database.

If I do something like:

$string = null;

mysql_query("insert ignore into table(field) values($string)");

It gives me an error.

In fact, I have multiple fields to insert, and the error just tell me that
was an error at ... and prints the variables I want to imput and I don't
know what could be the problem.

Do I need to addslashes(), or what else?

Thank you.

Teddy

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



Re: [PHP] page redirect question

2004-11-09 Thread Richard Davey
Hello Victor,

Tuesday, November 9, 2004, 4:07:12 PM, you wrote:

VC> Is there anyway to redirect php page other than using
VC> HEADER("LOCATION:URL") ?
VC> Header can only be called if nothing is written to HTML... Is there anyway
VC> around it?

Not really, no. Maybe with a meta refresh tag or some JavaScript even
within the page, but it's a messy and non-guaranteed way to do it.

Best regards,

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

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



RE: [PHP] MySQL

2004-11-09 Thread Murray @ PlanetThoughtful
> If I do something like:
> 
> $string = null;
> 
> mysql_query("insert ignore into table(field) values($string)");
> 
> It gives me an error.

Pass a string value of 'NULL'.

Ie INSERT INTO table (field) VALUES (NULL);

Or, in your example:

$string = 'NULL';
mysql_query("INSERT INTO table (field) VALUES ($string)");

Much warmth,

Murray
http://www.planetthoughtful.org
Building a thoughtful planet,
One quirky comment at a time.

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



Re: [PHP] page redirect question

2004-11-09 Thread Klaus Reimer
Victor C. wrote:
Is there anyway to redirect php page other than using
HEADER("LOCATION:URL") ?
Header can only be called if nothing is written to HTML... Is there anyway
around it?
You can use output buffering. Then it doesn't matter where you call 
header(). But if you do a redirect you should clear the output buffer 
before doing so to prevent that the output which has been done so far is 
send to the browser.

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


[PHP] Video Uploads

2004-11-09 Thread Jay Fitzgerald
I can upload just about everything with this script; but I don't 
understand why it says that the videos i try to upload are zero length.

--
THE FORM
--





--
THE SCRIPT
--
ini_set ('display_errors', '1');
ini_set ('error_reporting', E_ALL);
if (empty($_POST['submit']))
{
   include ('addform.php');
}
else
{
   $path = 
'/home/mydir/public_html/news/videos/'.$_FILES['form_data']['name'];
   $url = 'http://www.mysite.com/news/videos/';

   $_POST = array_merge($_POST, $_FILES);
  
   if (!empty($_FILES['form_data']['name']))
   {
   if ($_FILES['form_data']['size'] == 0)
   {
   echo 'Problem: '.$_FILES['form_data']['name'].' is zero length';
   }

   if ($_FILES['form_data']['size'] > $_POST['max_size'])
   {
   echo 'Problem: '.$_FILES['form_data']['name'].' is over 
'.$_POST['max_size'].' bytes.';
   }

   if (!is_uploaded_file($_FILES['form_data']['tmp_name']))
   {
   echo $_FILES['form_data']['name'].' is not uploaded.';
   }
   move_uploaded_file($_FILES['form_data']['tmp_name'], $path);
   }
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] page redirect question

2004-11-09 Thread Minuk Choi
Victor, try this.
at the TOP of your HTML, put

then you can have all your regular HTML/PHP/JAVASCRIPT/ETC code, and 
somewhere(in the middle, in the end), you can call


where $URL is a variable that contains a URL and it will work.
?>
- Original Message - 
From: "Victor C." <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 09, 2004 11:07 AM
Subject: [PHP] page redirect question


Hi,
Is there anyway to redirect php page other than using
HEADER("LOCATION:URL") ?
Header can only be called if nothing is written to HTML... Is there anyway
around it?
Thanks,
--
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] Video Uploads

2004-11-09 Thread Minuk Choi
How big are the video files(byte wise)?
Have you tried uploading a non-video file of the same size?
- Original Message - 
From: "Jay Fitzgerald" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 09, 2004 12:10 PM
Subject: [PHP] Video Uploads


I can upload just about everything with this script; but I don't understand 
why it says that the videos i try to upload are zero length.

--
THE FORM
--





--
THE SCRIPT
--
ini_set ('display_errors', '1');
ini_set ('error_reporting', E_ALL);
if (empty($_POST['submit']))
{
   include ('addform.php');
}
else
{
   $path = 
'/home/mydir/public_html/news/videos/'.$_FILES['form_data']['name'];
   $url = 'http://www.mysite.com/news/videos/';

   $_POST = array_merge($_POST, $_FILES);
  if (!empty($_FILES['form_data']['name']))
   {
   if ($_FILES['form_data']['size'] == 0)
   {
   echo 'Problem: '.$_FILES['form_data']['name'].' is zero 
length';
   }

   if ($_FILES['form_data']['size'] > $_POST['max_size'])
   {
   echo 'Problem: '.$_FILES['form_data']['name'].' is over 
'.$_POST['max_size'].' bytes.';
   }

   if (!is_uploaded_file($_FILES['form_data']['tmp_name']))
   {
   echo $_FILES['form_data']['name'].' is not uploaded.';
   }
   move_uploaded_file($_FILES['form_data']['tmp_name'], $path);
   }
}
--
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] Why cookie is created?

2004-11-09 Thread Marek Kilimajer
Jerry Swanson wrote:
Why when I specify session.cookie_lifetime = 1 // Cookies are not created.
However, when I specify large lifetime, cookies are created.
session.cookie_lifetime = 1500
Are your times and timezones set up right? Both client and server
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] help with fopen path

2004-11-09 Thread Marek Kilimajer
Giles Roadnight wrote:
Hi All
 
I'm developing a fusebox PHP app and have a class in a /classes
directory that opens an xml file in a directory below the site root
using this path: "../siteconfig.xml"
 
All of the places I have used this class from so far have been in the
site root. I am now starting some pages in a sub directory. When I use
this class it says it can't open the file. I have tried
"../../siteconfig.xml" instead but it doesn't work either.
 
What's the best way to go about fixing this? I'm quite new to php and
I'm not sure where the relative path is taken from - i.e. is it the
index.php page or the class (obviously not) or my switch file or what?
The paths are relative to $PHP_SELF, so you need just 'siteconfig.xml'
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP Accelerator

2004-11-09 Thread Adrian Madrid
I rewrote my framework to use some of the new OOP features in PHP5 and 
haven't had a single segfault yet. Again, my only segfaults came when 
using MMCache's session handler. Another caveat is that I compile my own 
PHP & MMCache everytime instead of using RPMs and stuff.

Anyway, just my 2 cents.
Adrian Madrid
Klaus Reimer wrote:
Adrian Madrid wrote:
I've been running Turck for some time now on PHP5 and haven't had
segfault problems yet. I must say I'm running the latest CVS and using
file sessions (Turck's would give you segfaults). 

I also tried latest CVS and I don't use Turcks cache. Maybe Turck has 
problems with Objects in PHP5 (because there were the great changes) 
while normal Non-OO-Scripts are running flawlessly.


--
Adrian Madrid
HyperX Inc. 
Mobile: 801.815.1870
Office: 801.566.0670 
[EMAIL PROTECTED] 
www.hyperxmedia.com 

9000 S. 45 W.
Sandy, UT 84070
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Video Uploads

2004-11-09 Thread Jay Fitzgerald
The video is 1.5 meg and yes I can upload a PSD file that is 1.8..
Jay
Minuk Choi wrote:
How big are the video files(byte wise)?
Have you tried uploading a non-video file of the same size?
- Original Message - From: "Jay Fitzgerald" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 09, 2004 12:10 PM
Subject: [PHP] Video Uploads

I can upload just about everything with this script; but I don't 
understand why it says that the videos i try to upload are zero length.

--
THE FORM
--





--
THE SCRIPT
--
ini_set ('display_errors', '1');
ini_set ('error_reporting', E_ALL);
if (empty($_POST['submit']))
{
   include ('addform.php');
}
else
{
   $path = 
'/home/mydir/public_html/news/videos/'.$_FILES['form_data']['name'];
   $url = 'http://www.mysite.com/news/videos/';

   $_POST = array_merge($_POST, $_FILES);
  if (!empty($_FILES['form_data']['name']))
   {
   if ($_FILES['form_data']['size'] == 0)
   {
   echo 'Problem: '.$_FILES['form_data']['name'].' is zero 
length';
   }

   if ($_FILES['form_data']['size'] > $_POST['max_size'])
   {
   echo 'Problem: '.$_FILES['form_data']['name'].' is over 
'.$_POST['max_size'].' bytes.';
   }

   if (!is_uploaded_file($_FILES['form_data']['tmp_name']))
   {
   echo $_FILES['form_data']['name'].' is not uploaded.';
   }
   move_uploaded_file($_FILES['form_data']['tmp_name'], $path);
   }
}
--
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] Directory Entries

2004-11-09 Thread Dave Lampron
Hello I'm having problems with the following code:

if (! ($dp =  opendir($imagesdir))) die ("cannot open $imagesdir.");
while($file = readdir($dp))
{
 if ($file != '.' && $file != '..')
 {

 ///Second test doesn't seem to catch sub-directories under $imagesdir
  if(is_dir($file)) / This is not evaluating properly!!!
  {
   echo "";
   echo $file;
   echo "Directory";
   echo "";
  }
  else
  {
   echo "";
   echo $file;
   echo "";
   echo "Filesize: ";
   echo filesize($file); / This is not evaluating properly either!!!
   echo "";
  }
 }
}
closedir($dp);

echo "";
?>


Can't figure out why this doesn't work. I was thinking perhaps that it might
be directory permissions but that doesn't make sense. It would seem to me
that the ($file = readdir($dp)) is not returning any file attributes perhaps
just text. I could swear that I'v used this same routine to achieve these
results.


Any help appreciated!!


FYI: Running php as an ASAPI filter, on IIS 5.1, using Windows XP/2003, 
using

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



Re: [PHP] Directory Entries

2004-11-09 Thread Jason Wong
On Tuesday 09 November 2004 17:09, Dave Lampron wrote:
> Hello I'm having problems with the following code:
>
> if (! ($dp =  opendir($imagesdir))) die ("cannot open $imagesdir.");
> while($file = readdir($dp))
> {
>  if ($file != '.' && $file != '..')
>  {
>
>  ///Second test doesn't seem to catch sub-directories under $imagesdir
>   if(is_dir($file)) / This is not evaluating properly!!!

Use an absolute path, or if you know your current working directory prepend 
the relative path.

>echo filesize($file); / This is not evaluating properly either!!!

Ditto.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Anger kills as surely as the other vices.
*/

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



[PHP] POST losing SESSION vars?

2004-11-09 Thread Sam Smith

I have a page that will be redirected to a login page if the SESSION var
'authenticatedUser' is not set.

The page has a form in it.

When the page is loaded http://thePage the authentication works fine. When
the submit button is pressed it doesn't. With POST it acts as if the
required session var is not set.

When redirected to the login page the login page DOES recognize the the
session var and redirects back to the first page a logged in user would
usually see.

formPage.php
 ";
header("Location: index.php");
}
...


?>


index.php


In other words the same page should load after the submit button is pressed
but instead the authentication is redirecting.


Thanks for any help.

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



Re: [PHP] POST losing SESSION vars?

2004-11-09 Thread bbonkosk
Pass your session along with your form action...

i.e

$s = SID;
echo "


- Original Message -
From: Sam Smith <[EMAIL PROTECTED]>
Date: Tuesday, November 9, 2004 1:12 pm
Subject: [PHP] POST losing SESSION vars?

> 
> I have a page that will be redirected to a login page if the 
> SESSION var
> 'authenticatedUser' is not set.
> 
> The page has a form in it.
> 
> When the page is loaded http://thePage the authentication works 
> fine. When
> the submit button is pressed it doesn't. With POST it acts as if the
> required session var is not set.
> 
> When redirected to the login page the login page DOES recognize 
> the the
> session var and redirects back to the first page a logged in user 
> wouldusually see.
> 
> formPage.php
>  session_start();
> if(!isset($_SESSION['authenticatedUser'])) {
> $_SESSION['loginMessage'] = "You must first login. ";
> header("Location: index.php");
> }
> ...
> 
>  method="POST"name="purch_form" id="purch_form"
> ...
>  
> ?>
> 
> 
> index.php
>  // FUNCTIONS
> function logged_on($errorMessage) {
>header ("Location: authTest.php"); //tmp Loc while testing
> }
> function login_page ($errorMessage) {
>require_once "login.php"; //page where login pair entered
> }
> // end FUNCTIONS
> 
> // BEGIN authentication
> session_start();
> // First visit
> if (!isset($_SESSION['loginMessage'])) {
>login_page("Registered users please login.");
>exit;
> }
> // PASS
> if(isset($_SESSION['authenticatedUser'])) {
>logged_on("need some control here");
>exit;
> }
> // FAIL
> else {
>login_page($_SESSION['loginMessage']);
>exit;
> }
> ?>
> 
> In other words the same page should load after the submit button 
> is pressed
> but instead the authentication is redirecting.
> 
> 
> Thanks for any help.
> 
> -- 
> 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] help with fopen path

2004-11-09 Thread Graham Cossey


> -Original Message-
> From: Giles Roadnight [mailto:[EMAIL PROTECTED]
> Sent: 09 November 2004 13:07
> To: [EMAIL PROTECTED]
> Subject: [PHP] help with fopen path
>
>
> Hi All
>
> I'm developing a fusebox PHP app and have a class in a /classes
> directory that opens an xml file in a directory below the site root
> using this path: "../siteconfig.xml"
>
> All of the places I have used this class from so far have been in the
> site root. I am now starting some pages in a sub directory. When I use
> this class it says it can't open the file. I have tried
> "../../siteconfig.xml" instead but it doesn't work either.
>
> What's the best way to go about fixing this? I'm quite new to php and
> I'm not sure where the relative path is taken from - i.e. is it the
> index.php page or the class (obviously not) or my switch file or what?
>

Just a thought:
If your referencing a file within a PHP script that is included/required
within another script the path should be relative to the 'parent' script.

I am guessing that if you make reference above the site root (using ../../)
the site root will be assumed.

If you have access to the web server config try setting up an alias
such as /config which points to the directory containing your config xml
so that your scripts can reference "/config/siteconfig.xml" from any
directory.

HTH

Graham

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



[PHP] silly question - setting .php as default extension (Apache)

2004-11-09 Thread Brian A. Anderson
Uuuuh... Where do I set the default server extension type to .php in the
apache config? Right now the page will execute on my server, but if there is
an index.php the server won't automatically open it, but instead browses the
directory.

Thanks in advance,

-Brian

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



Re: [PHP] silly question - setting .php as default extension (Apache)

2004-11-09 Thread Marek Kilimajer
Brian A. Anderson wrote:
Uuuuh... Where do I set the default server extension type to .php in the
apache config? Right now the page will execute on my server, but if there is
an index.php the server won't automatically open it, but instead browses the
directory.
DirectoryIndex index.html index.php ...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] silly question - setting .php as default extension (Apache)

2004-11-09 Thread Graham Cossey

> 
> Uuuuh... Where do I set the default server extension type to .php in the
> apache config? Right now the page will execute on my server, but 
> if there is
> an index.php the server won't automatically open it, but instead 
> browses the
> directory.
> 
> Thanks in advance,
> 
> -Brian

Look for DirectoryIndex in httpd.conf and add index.php

OR

On my Apache2/Linux installation I had to uncomment a line in :
/etc/httpd/conf.d/php.conf

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



Re: [PHP] silly question - setting .php as default extension (Apache)

2004-11-09 Thread Brian A. Anderson
Coolbeans guys!
:)

Thanks,

-Brian

- Original Message - 
From: "Marek Kilimajer" <[EMAIL PROTECTED]>
To: "Brian A. Anderson" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, November 09, 2004 4:07 PM
Subject: Re: [PHP] silly question - setting .php as default extension
(Apache)


> Brian A. Anderson wrote:
> > Uuuuh... Where do I set the default server extension type to .php in the
> > apache config? Right now the page will execute on my server, but if
there is
> > an index.php the server won't automatically open it, but instead browses
the
> > directory.
>
> DirectoryIndex index.html index.php ...
>

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



Re: [PHP] MySQL

2004-11-09 Thread Klaus Reimer
Octavian Rasnita wrote:
Please tell me how to send a null string to be inserted in a MySQL database.
If I do something like:
$string = null;
mysql_query("insert ignore into table(field) values($string)");
This will result in the following SQL query:
insert ignore into table(field) values()
If you output a NULL-String then it's just an empty string. That's why 
you get an error. You have to insert the string NULL into your SQL 
statement. But I'm sure you don't want to hardcode this. You want to 
insert a real string if it is set and you want to insert NULL if the 
string is not set, or not? Then you may try this:

mysql_query(sprintf("insert ignore into table (field) values (%s)",
  is_null($string) ? "NULL" : "'$string'"));

Do I need to addslashes(), or what else?
If the string comes from user input and PHP is not escaping it 
automatically then you want to use this.

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


Re: [PHP] silly question - setting .php as default extension (Apache)

2004-11-09 Thread Ray
On Tuesday 09 November 2004 16:04, Brian A. Anderson wrote:
> Uuuuh... Where do I set the default server extension type to .php
> in the apache config? Right now the page will execute on my server,
> but if there is an index.php the server won't automatically open
> it, but instead browses the directory.
>
> Thanks in advance,
>
> -Brian

Your probably looking for the DirectoryIndex directive.

Apache 1.3.x
http://httpd.apache.org/docs/mod/mod_dir.html#directoryindex

Apache 2.0.x
http://httpd.apache.org/docs-2.0/mod/mod_dir.html#directoryindex

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



Re: [PHP] help with fopen path

2004-11-09 Thread James McGlinn
Hi Giles,
I'm developing a fusebox PHP app and have a class in a /classes
directory that opens an xml file in a directory below the site root
using this path: "../siteconfig.xml"
All of the places I have used this class from so far have been in the
site root. I am now starting some pages in a sub directory. When I use
this class it says it can't open the file. I have tried
"../../siteconfig.xml" instead but it doesn't work either.
What's the best way to go about fixing this? I'm quite new to php and
I'm not sure where the relative path is taken from - i.e. is it the
index.php page or the class (obviously not) or my switch file or what?
You might want to set your global parameters (such as the full path to 
class files) in a config file which is auto_prepend'ed to each PHP 
script.

That way you can always require_once( $GLOBALS['classPath'] . 
'/class.YourClass.php' ) regardless of your working directory.

James McGlinn
Project Manager
BCom, BSc, Zend Certified Engineer (PHP)
Servers.co.nz Ltd
68 Shortland St, Auckland	PO Box 3688 Shortland St, Auckland, New 
Zealand
Phone: 0800 4 SERVERS	Fax: +64 9 358 5187

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


RE: [PHP] page redirect question

2004-11-09 Thread Zareef Ahmed

Hi,

   Alas there is no any other way to redirect the page without sending
headers in PHP. 
You may use javascript for this purpose.

Well it is matter of programming practice.
We must do processing before presenting the content to users.
It will be helpful in many situations.

So instead of doing 

1.Draw header
2. Draw middle bar upon user input and according to business logic.
3. Draw footer

We Must Use
1. Make Business logic and process user input  and  do required task
such as redirection
2. Store result of step 1 in any entities like variables.
3. Draw Header
4. Make Middle bar using set entities.
5. Draw footer.


This is just a overview of approach. You may need to process more things
along with middle bar, but it is good idea to do logical  processing
before presentation.

Zareef Ahmed 









-Original Message-
From: Victor C. [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 09, 2004 9:37 PM
To: [EMAIL PROTECTED]
Subject: [PHP] page redirect question


Hi,

Is there anyway to redirect php page other than using
HEADER("LOCATION:URL") ?
Header can only be called if nothing is written to HTML... Is there
anyway around it?

Thanks,

-- 


--
Zareef Ahmed :: A PHP develoepr in Delhi ( India )
Homepage :: http://www.zasaifi.com

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



[PHP] basic script

2004-11-09 Thread a.garcia
I just want the URL that is on the navigator bar be 
printed... this is my script but it just does not do it... 
why,.. please help, cheers

First Variables Example





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


RE: [PHP] basic script

2004-11-09 Thread Zareef Ahmed

Hi,
Use 
 print $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];

Zareef Ahmed 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 10, 2004 9:56 AM
To: [EMAIL PROTECTED]
Subject: [PHP] basic script


I just want the URL that is on the navigator bar be 
printed... this is my script but it just does not do it... 
why,.. please help, cheers

First Variables Example




>> Well where you set the $x






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





--
Zareef Ahmed :: A PHP develoepr in Delhi ( India )
Homepage :: http://www.zasaifi.com

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



[PHP] Do You Need addslashes() When Using Bind Variables

2004-11-09 Thread Francis Chang
Hi,

I'm using the Oracle database though I think this question is generic to all 
databases.

If you're using bind variables and preparing the SQL statements ahead of 
time, do you still need to call addslashes() before binding the strings to 
the bind variables?

Thanks in advance.

Francis

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



[PHP] Re: Auto Form Fill on option select

2004-11-09 Thread dellylix
It's Sorted Now,

It got Java'd.


"Kevin Dell" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Hi all,
I have a question that I can't get my head around and was hoping someone
could answer for me.

I have a form with a number of fields.

Field one is a 
The option fields are built from an sql statement and a where clause builds
the options fields
...


etc...

When I select one of the options, the form automatically goes off and does
another sql select a with the WHERE value of the selected $teamname,  and
then populates the next field, but I can't think how.

Any pointers?

TIA
K

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