Re: [PHP] Session Not Being Passed?

2006-05-18 Thread Richard Lynch
On Thu, May 18, 2006 9:23 pm, Mark Sargent wrote:
>  setcookie('username', 'Joe', time()+60);

Because Microsoft engineers are incapable of reading and following a
spec correctly, you will have to supply a "path" along with that
time-out.  The best default path to use is "/"

You can have no time-out and no path, or both, but not just time-out.

> session_start();
> $_SESSION['authuser']=1;
> ?>
> 
> 
> 
> 

For REAL browsers, you should send the content-type with a charset in
the headers as well.

Only something goofy like IE is going to ignore the headers and look
at a META tag instead.

Again, MS doesn't follow specs.  Surprise.

To be super-pedantic, it's also probably better to use:

so the tag closes itself in the new-school XHTML CSS blah blah blah
buzzword way.

> Movie 1
> 
> 
>  $favMovie=urlencode("Life Of Brian");
> echo " href='http://localhost/moviesite.php?favMovie=$favMovie'>";

Errr.

localhost is going to end up being THEIR localhost, which is, like,
their own computer where the browser is, which is very very very
unlikely to have your moviesite.php script on it, if you see what I
mean...

Unless YOU are running this on your own desktop or something.

And even then, you probably should use $_SERVER['PHP_SELF'] or
something instead of localhost, because if you move this script to a
freshly-installed Windows box, they don't actually set up localhost as
127.0.0.1 in some versions of Windows -- You have to dig around in
god-knows-which-directory to find the hosts.sam file (.sam is for
sample) and then copy it and edit it and then re-boot (cuz it's
Windows) to get localhost defined.

Did I mention that MS engineers don't follow specs?

> echo "Click here to see information about my favourite movie!";
> echo "";
> ?>
> 
> 
>
>
> which points to this page,

Well, you WANT it to point to that page, but it probably doesn't, as
noted above...

>  session_start;

You kinda need the function call here with () and everything.

Otherwise, what happens is:
#1. PHP "sees" an undefined constant, and assumes you meant:
'session_start';

#2. PHP issues an E_NOTICE error, but your default error_reporting in
php.ini is probably set to E_ALL ~ E_NOTICE which is *BAD* but there
it is, the old default.

#3. So this statement turns into a rather goofy non-operational
statement that does NOTHING but is, in fact, accepted as a valid PHP
staement, for reasons beyond my ken:
'session_start';
is valid syntax.
God only knows *WHY* it's valid, mind, but it's valid.

> //Check the user has logged in with a valid password
> if ($_SESSION['authuser']!=1) {
>   echo "Sorry, you're not authorized to access this page";
>   exit();
>   }
> ?>
> 
> 
> 
> 
> My Movie Site - 

You really SHOULD clean that variable.

You are wide open for a cross-site scripting attack:
http://phpsec.org/

> 
> 
>  echo "Welcome to our site, ";
> echo $_COOKIE['username'];

Ditto.

> echo "! ";
> echo "My favourite movie is ";
> echo $_REQUEST['favMovie'];

Again.

> echo "";
> $movieRate=5;
> echo "My movie rating for this movie is: ";
> echo  $movieRate;
> ?>
> 
> 
>
> But, I get the error message as if the session is not set,
>
> Sorry, you're not authorized to access this page
>
> but it is set, statically, in the 1st code. I have /my_temp_dir set as
> session.save_path,
>
> session.save_path = "/my_temp_dir"
>
> and have set user/group to htdocs and given permission for htdocs to
> write to /my_temp_dir,
>
> [EMAIL PROTECTED] my_temp_dir]$ ls -al /my_temp_dir
> total 24
> drwxr-xr-x  2 htdocs htdocs 4096 May 19 12:08 .
> drwxr-xr-x 24 root   root   4096 May 19 12:04 ..
> -rw---  1 htdocs htdocs   13 May 19 12:08
> sess_69e7ffdaf855da229f4b067668b0f89d
>
> and it has a session file there as you can see. Is my code wrong,
> perhaps? I'm following Beginning PHP, Apache, MySQL Web Development.
> Cheers.

Also, you should realize that your setcookie isn't really doing much
but send an extra cookie to the browser, which will ANNOY those of us
who monitor cookies before accepting them -- It's just as easy to
store $_SESSION['username'] and use that instead, relying on the PHP
Cookie for the session to work for you, instead of managing your own
Cookie on top of the PHP session cookie.

For homework, you have to change your php.ini file from E_ALL ~
E_NOTICE to just plain E_ALL :-)

You'll be better off in the long run, even if it seems picuyane in the
short run.

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

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



Re: [PHP] Wikimedia - cookies

2006-05-18 Thread Richard Lynch
On Thu, May 18, 2006 10:39 pm, Christopher wrote:
> I've built a front-end to display information from a wikimedia
> database
> that uses Text_Wiki and Text_Wiki_Mediawiki, but I can't seem to
> figure
> out how the wiki keeps track of its cookies and such. I would like to
> expand this to front-end so if it can pick up someone has logged into
> the
> wiki before, and allow them more options.
>
> Does anyone know how the wikimedia cookies are stored and how I can
> access
> them?
>
> Sorry if this is something extremely simple, I'm still a bit of a noob
> :)

While it's remotely possible somebody here uses WikiMedia and knows
the answer it's not really a "General PHP" type of question...

Your best options are:

Ask the WikiMedia folks.

Install LiveHTTPHeaders in Firefox and see what Cookies you get.

Configure your browser to prompt you for all Cookies and see what
Cookies you get.

HTH

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

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



Re: [PHP] Wikimedia - cookies

2006-05-18 Thread Chris

Chris Rukas wrote:
I'm not sure where I should go for wiki community though :-\. I wanted 
to  try and contact the Text_Wiki or the Text_Wiki_Mediawiki or the 
Yawiki  guy(I think the same as the Text_Wiki) for this information but 
PEAR said  talk on this channel. Any recomendations on where I can go to 
ask my  question?


Always CC the mailing list.

Where did you download wikimedia from?

Also, I'm working on a simple program for editing/making/deleting items 
in  an RSS Feed(2.0). Are there programs that already do this for me to  
study/learn off of. I've seen a few that make an entire RSS feed, but 
not  one for maintaining one.


Depends where your content is coming from.

If it's coming from a database, simply don't include the fields you 
don't want to appear in the feed.


--
Postgresql & php tutorials
http://www.designmagick.com/

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



Re: [PHP] Wikimedia - cookies

2006-05-18 Thread Chris Rukas
Hmm, didn't think about it until you said database, but storing an RSS  
feed in mysql woudl probably be easier than parsing an xml file.. :)


Thanks

And downloaded wikimedia from wikimedia.com :p Not much help there from  
what I can get, but I'll try some more. :)


Thanks again.

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



[PHP] Extensions Directory (PEAR/PECL)

2006-05-18 Thread Robert Samuel White
Please let me know if this would be more appropriate to post in a PEAR or
PECL forum.  Today, I've been trying to install some extensions - in
particular, the GD library and the ZIP library.  I've finally managed to get
it all working, but there was one issue that I'd like to clear up for future
reference if possible.

When I ran the command:

pecl install zip-1.3.1

It intalled the zip.so file to:

/usr/local/lib/php/extensions/no-debug-non-zts-20050922/zip.so

The only way I could get zip support working was to put it here:

/usr/local/php/ext

Which is where my extensions directory is located.

I've checked, and the extensions directory is set correctly in the php.ini
file.

Does anyone know where/how it would come up with this other path?

TIA

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



Re: [PHP] Session Not Being Passed?

2006-05-18 Thread Mark Sargent

Jay Blanchard wrote:

[snip]
which points to this page,


[/snip]

You forgot the parentheses after session_start(); (Assuming that you cut
and pasted)

Hi All,

ouch! Can't believe I missed that. Thanx. Cheers.

Mark Sargent.

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



Re: [PHP] Wikimedia - cookies

2006-05-18 Thread Chris

Christopher wrote:
I've built a front-end to display information from a wikimedia database  
that uses Text_Wiki and Text_Wiki_Mediawiki, but I can't seem to figure  
out how the wiki keeps track of its cookies and such. I would like to  
expand this to front-end so if it can pick up someone has logged into 
the  wiki before, and allow them more options.


Does anyone know how the wikimedia cookies are stored and how I can 
access  them?


Sorry if this is something extremely simple, I'm still a bit of a noob :)


The wikimedia community will be able to help you better than we can. 
They know the code and can explain what it is doing and so on.


--
Postgresql & php tutorials
http://www.designmagick.com/

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



[PHP] Wikimedia - cookies

2006-05-18 Thread Christopher
I've built a front-end to display information from a wikimedia database  
that uses Text_Wiki and Text_Wiki_Mediawiki, but I can't seem to figure  
out how the wiki keeps track of its cookies and such. I would like to  
expand this to front-end so if it can pick up someone has logged into the  
wiki before, and allow them more options.


Does anyone know how the wikimedia cookies are stored and how I can access  
them?


Sorry if this is something extremely simple, I'm still a bit of a noob :)

--
Using Opera's revolutionary client: http://www.opera.com/

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



RE: [PHP] Session Not Being Passed?

2006-05-18 Thread Jay Blanchard
[snip]
which points to this page,


[/snip]

You forgot the parentheses after session_start(); (Assuming that you cut
and pasted)

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



[PHP] Session Not Being Passed?

2006-05-18 Thread Mark Sargent

Hi All,

I have this code,






Movie 1


http://localhost/moviesite.php?favMovie=$favMovie'>";
   echo "Click here to see information about my favourite movie!";
   echo "";
?>




which points to this page,






My Movie Site - 


";
   echo "My favourite movie is ";
   echo $_REQUEST['favMovie'];
   echo "";
   $movieRate=5;
   echo "My movie rating for this movie is: ";
   echo  $movieRate;
?>



But, I get the error message as if the session is not set,

Sorry, you're not authorized to access this page

but it is set, statically, in the 1st code. I have /my_temp_dir set as 
session.save_path,


session.save_path = "/my_temp_dir"

and have set user/group to htdocs and given permission for htdocs to 
write to /my_temp_dir,


[EMAIL PROTECTED] my_temp_dir]$ ls -al /my_temp_dir
total 24
drwxr-xr-x  2 htdocs htdocs 4096 May 19 12:08 .
drwxr-xr-x 24 root   root   4096 May 19 12:04 ..
-rw---  1 htdocs htdocs   13 May 19 12:08 
sess_69e7ffdaf855da229f4b067668b0f89d


and it has a session file there as you can see. Is my code wrong, 
perhaps? I'm following Beginning PHP, Apache, MySQL Web Development. Cheers.


Mark Sargent.

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



Re: [PHP] Need help calling PHP page from another server.

2006-05-18 Thread Robert Filipovich

This worked.

Thanks,
Robert


On 5/18/06, Stut <[EMAIL PROTECTED]> wrote:


John Hicks wrote:
> Robert Filipovich wrote:
>> Looks like all of these are happening.
>>
>>
>> The description for Event ID ( 2000 ) in Source ( php ) cannot be
>> found. The local computer may not have the necessary registry
>> information or message DLL files to display messages from a remote
>> computer. The following information is part of the event: php[400],
>> PHP Notice: Undefined index: ocode in C:\siupchat\statusimage.php on
>> line 39.
>>
>> The description for Event ID ( 2000 ) in Source ( php ) cannot be
>> found. The local computer may not have the necessary registry
>> information or message DLL files to display messages from a remote
>> computer. The following information is part of the event: php[1812],
>> PHP Notice: Undefined index: ocode in C:\siupchat\statusimage.php on
>> line 39.
>>
>> The description for Event ID ( 2000 ) in Source ( php ) cannot be
>> found. The local computer may not have the necessary registry
>> information or message DLL files to display messages from a remote
>> computer. The following information is part of the event: php[1444],
>> PHP Notice: Undefined index: HTTP_REFERER in
>> C:\siupchat\statusimage.php on line 52.
>>
>> It is on an IIS server.  Any ideas what PHP.ini setting is causing
>> this error?
>>
>> Thanks,
>> /Robert
>
> I see no reason why the trouble would lie with php.ini.
>
> I'll bet it has something to do with undefined variables.
>
> But these are merely notices, not errors, so they don't explain why you
> never get to the bottom of the program.

Short answer... change the value of error_reporting in php.ini to not
report notices. I'm guessing the script isn't working because it's
outputting the errors, in which case doing this should fix it.

Long answer... ignoring notices leads to sloppy coding and should be
avoided where possible. If I were you and I had the opportunity I'd drop
this OSS package in favour of something where the developers do not cut
corners.

-Stut



Re: [PHP] Need help calling PHP page from another server.

2006-05-18 Thread John Hicks

Stut wrote:

John Hicks wrote:

Robert Filipovich wrote:

Looks like all of these are happening.
 

The description for Event ID ( 2000 ) in Source ( php ) cannot be 
found. The local computer may not have the necessary registry 
information or message DLL files to display messages from a remote 
computer. The following information is part of the event: php[400], 
PHP Notice: Undefined index: ocode in C:\siupchat\statusimage.php on 
line 39.


The description for Event ID ( 2000 ) in Source ( php ) cannot be 
found. The local computer may not have the necessary registry 
information or message DLL files to display messages from a remote 
computer. The following information is part of the event: php[1812], 
PHP Notice: Undefined index: ocode in C:\siupchat\statusimage.php on 
line 39.


The description for Event ID ( 2000 ) in Source ( php ) cannot be 
found. The local computer may not have the necessary registry 
information or message DLL files to display messages from a remote 
computer. The following information is part of the event: php[1444], 
PHP Notice: Undefined index: HTTP_REFERER in 
C:\siupchat\statusimage.php on line 52.


It is on an IIS server.  Any ideas what PHP.ini setting is causing 
this error?
 
Thanks,

/Robert


I see no reason why the trouble would lie with php.ini.

I'll bet it has something to do with undefined variables.

But these are merely notices, not errors, so they don't explain why 
you never get to the bottom of the program.


Short answer... change the value of error_reporting in php.ini to not 
report notices. I'm guessing the script isn't working because it's 
outputting the errors, in which case doing this should fix it.


Long answer... ignoring notices leads to sloppy coding and should be 
avoided where possible. If I were you and I had the opportunity I'd drop 
this OSS package in favour of something where the developers do not cut 
corners.


-Stut



Stut and Richard make a good point that these notices shouldn't be 
taking place, but I don't believe they would cause your program to err 
out (although you *are* using a strange OS, so I could be wrong).


Try to catch your mysql errors (as I've sid before) and throw in a few 
debug displays to narrow it down.


--J

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



Re: [PHP] Narorwed down my problem to one statement:

2006-05-18 Thread Richard Lynch
On Tue, May 16, 2006 11:38 pm, John Meyer wrote:
> $sql = "INSERT INTO
> BOOKS(CopyrightYear,CoverType,DatePurchased,EditionNumber,ISBNNumber,Notes,Pages,Publisher,LOCNumber)
> VALUES(\"" . $_POST["copyrightyear"] . "\",\"" . $_POST["covertype"] .
> "\",\"" . $_POST["datepurchased"] . "\"," . $_POST["editionnumber"] .
> ",\"" . $_POST["isbn"] . "\",\"" . addslashes($_POST["notes"]) . "\","
> .
> (isset($_POST["numberofpages"])?$_POST["numberofpages"]:0) . ",\"" .
> $_POST["publisher"] . "\",\"" . $_POST["locnumber"] . "\")";
>
>
> Okay,  when $_POST["notes"] contains quotes, it seems to break the
> series, ie returns an error at that point of the SQL statement, even
> with addslashes(), am I doing something wrong there?

addslashes should be changed to http://php.net/mysql_real_escape_string

but that won't solve your problem.

Could you PLEASE tell us exactly what is in $_POST["notes"] other than
something with a quote?

Could you PLEASE use mysql_error() to give us the exact error message?

And, just for fun, print out the EXACT query after all that mess of
quotes is done?

For that matter, you're making life really difficult with the
double-quote thing...

$query = "INSERT INTO Books(...) VALUES('$CLEAN[copyrightyear]',
'$CLEAN[covertype]', ...)";

This presumes that you have scrubbed $_POST data into $CLEAN like you
should also be doing.

You could use $_POST in place of $CLEAN if you don't care about SQL
injection attacks...

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

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



Re: [PHP] Converting characters

2006-05-18 Thread Richard Lynch
On Wed, May 17, 2006 6:13 am, Jonas Rosling wrote:
> the PHP newbie is here again asking questions.
> Is there anyway in PHP to convert none international characters so the
> are
> displayed correct?
> In my case I have lots of data in the database with å,ä and ö.

E.

Since those probably ARE the correct characters, maybe you ought to
leave them alone, and use a UTF-8 as your charset in your HTML doctype
and headers and a META tag so that they display correctly in a
browser.

If they are just total garbage charactes from, say, MS Word
copy&paste, read the User Contrib notes here:
http://php.net/str_replace for three different solutions.

You may also want to look at iconv, utf8_decode and similar PHP
functions as a last resort if you really really want to throw away the
correct characters and use ASCII characters that are not really
equivalent, but us Americans like to pretend they are. :-)

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

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



Re: [PHP] PHP and mySQL getting smashed...

2006-05-18 Thread Richard Lynch
On Wed, May 17, 2006 6:55 am, Russell Jones wrote:
> I have a site that is getting 30K+ traffic daily and it is smashing
> mySQL -
> any ideas on what to do to make the mysql connections more efficient,
> or
> anything in general. No bandwidth issue here, just the server getting
> killed.

It depends on the application.

For something with many reads and fewer writes like a forum or basic,
if busy, e-commerce you'd consider setting up MySQL replication with
one master for WRITE operations and multiple slaves for SELECT
operations.

For something with a high write/read ratio such as eBay, that would be
a wildly-unsuitable solution.

Your best bet is to ask the MySQL folks, honestly, since it's unlikely
that anything in PHP is going to be "the answer" to this one.

If you have RAM to spare, you could:
Configure /etc/my.cnf to have N + X connections
Use http://php.net/mysql_pconnect

N would be the number of Apache Max children

X would be a "few" spare connections so that, if, say, you NEED to use
shell 'mysql' monitor to DO something, the fact that ALL N connections
are taken by Apache, won't lock you out.

There are significant RAM issues with pconnect, as well as some bugs
in various versions of PHP/MySQL that make this answer a no-go.  Tread
carefully.

But it's at least an on-topic answer, even if an incomplete and maybe
downright bad answer.

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

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



Re: [PHP] Security Concerns with Uploaded Images:

2006-05-18 Thread Richard Lynch
On Wed, May 17, 2006 11:40 am, Richard Collyer wrote:
> Richard Lynch wrote:
>> On Mon, May 15, 2006 1:58 am, Jason Wong wrote:
>>> 2) the uploaded file is a "script" (perl/php/python/etc)
>>
>>> In the case of (2), if the script relies on its shebang line to
>>> execute
>>
>> Not necessarily -- What if I upload an "image" file named
>> "badscript.php" and then I surf to it, after it's in your /images
>> directory?
>
> Couldn't you just use the apache directory option to make sure that
> php
> can't be executed from the /images directory... wonder if that is
> possible.

Yes...

But suppose tomorrow you copy that perfectly wonderful script to let
your family upload their "pictures" and you put them in /pictures with
a couple quick changes in the script, because you don't want their
vacation shots mingled in with your web /images

Now, are you going to 100% for sure remember to change the Directory
/pictures as well?  I *know* I would not remember to do that.

Security only really works when it's repeatable, maintainable, and so
damned easy that it's more work to NOT do it than it is TO do it.

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

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



Re: [PHP] Security Concerns with Uploaded Images:

2006-05-18 Thread Richard Lynch
On Wed, May 17, 2006 11:29 am, Jason Wong wrote:
> On Tuesday 16 May 2006 07:45, Richard Lynch wrote:
>> On Mon, May 15, 2006 1:58 am, Jason Wong wrote:
>> > 2) the uploaded file is a "script" (perl/php/python/etc)
>> >
>> > In the case of (2), if the script relies on its shebang line to
>> > execute
>>
>> Not necessarily -- What if I upload an "image" file named
>> "badscript.php" and then I surf to it, after it's in your /images
>> directory?
>
> I was assuming that any developer who allowed image files to be named
> *.php would be hung, drawn & quartered and shot a few times for good
> measure :)

I'd rather assume that PHP newbies will write any damn code that
works, and not worry about picuyane things like the extension on an
image, because they don't know any better.

I believe I'm being more realistic that way. :-)

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

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



Re: [PHP] Warning: chmod(): Operation not permitted ?

2006-05-18 Thread Richard Lynch
On Thu, May 18, 2006 10:50 am, tedd wrote:
>>File permissions is beyond the scope of this mailing list.  You need
>>to buy a book, research on the web, etc., on *nix system
>>administration, and concentrate on the
>>filesystem/security/permissions sections, and the section on how
>>apps/daemons operate.
>
> My question basically was "why isn't chmod() working for me?" So, I
> thought it might be a question to pose to a php mailing list -- my
> mistake, sorry.
>
> In any event, I'll figure it out.
>
> Thanks.
>
> tedd
>
> PS: 0777 -- so you never go to extremes, or press limits, to try to
> solve a problem?

0777 is what you told us for the DIRECTORY containing the file, not
the file itself.

You did not tell use which user/group owned the file, nor directory,
nor which user PHP is running as.

We CANNOT answer your question directly, because you've asked your
question rather badly.

Posting abusive/argumentative replies to those at least trying to help
you is not likely to make things better, is it?

You're on the horse, and can't get the gate open.

We're leading the horse to water, and can't make him drink.

Maybe you can't get the gate open because you SHOULDN'T ride the horse
down that dangerous path.

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

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



Re: [PHP] Warning: chmod(): Operation not permitted ?

2006-05-18 Thread Richard Lynch
On Wed, May 17, 2006 6:01 pm, tedd wrote:
> chmod($url, 0755);  //where $url is the file I want to change.

If $url is an actual URL to the file, with http:// in the front, you
almost for sure cannot chmod that...

You have to chmod it as a FILE in the file-system.

> That confuses me, because who's the user here? Is it just the system
> administrator or the application?

In Apache with PHP as a Module, it's the User directive in httpd.conf

With CGI, it's that same user, unless it's with suExec, then it could
be anybody, unless...

In IIS, it's probably E_MACHINE_USERNAME user -- but you're on your
own for that one.

The EASIEST way to find out, however, is  which will
TELL you which user it is.

> And if it is just the system administrator, then can't the system
> admin change anything he/she wants anyway? What's the point of having
> uid and gid's if a program can't change the permissions of a sibling
> file?

You do *NOT* want your webserver running as sysadmin!!!

THAT WOULD BE REALLY BAD!!!

And as to what's the point of uid and gid and who can change what,
it's so far off-topic here, in general, that I'll just ignore it,
except to say that PHP runs as a specific user, and that user can ONLY
change the files it is allowed to change, and that is a GOOD THING.

> I have tons of references as to what php filesystem functions are
> available, but I need a good reference as to what permissions are and
> how they actually can be changed in php -- does anyone have one a
> good reference OR care to explain?

You should be able to Google for a "Linux filesystem permissions
how-to" and get what you want here.

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

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



Re: [PHP] Warning: chmod(): Operation not permitted ?

2006-05-18 Thread Richard Lynch
On Wed, May 17, 2006 10:01 am, tedd wrote:
> I have a program that uploads an image file and then tries to set the
> permissions for the image (to be altered later). However, I get a
> "Warning: chmod(): Operation not permitted" error when trying to set
> the permission, what gives? If my program created the file, shouldn't
> it have permission to set the files permissions?
>
> What am I not understanding?

If you are trying to chmod() the file that is in /tmp from the $_FILES
array, you probably can't do that -- but after you
move_uploaded_file() you should be able to chmod that...  Works for
me.

You may need to play with the directory to which the files are moving
and you may want to do:

$old = umask(0);
move_uploaded_file(...);
umask($old);

http://php.net/umask

Also research what current owner/group and permissions are on the file
to see how you got into this problem to start with.

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

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



Re: [PHP] Fast search

2006-05-18 Thread Richard Lynch
On Wed, May 17, 2006 11:37 am, René Fournier wrote:
> Looking for suggestions on the most compute-efficient way to search
> variable-length strings (~200 characters) for the occurrence of one
> of about 100 possible needles. In other words:
>
> $needles = array ( 1 => "Hello Jim" , 2 => "Yellow Banana" , 3 =>
> "Red Car", ... etc  (100 elements)
>
> $haystack = "Once upon a time there was a programming language that
> everyone loved. Its name was PHP, and the people that worked with it
> also liked Yellow Bananas. One day...";
>
> Now perhaps I'm blind, but I can't see an obvious string or array
> function that simply allows you to use an array as a needle while
> searching a string haystack. What I'm really looking for is something
> like the reverse of in_array.
>
> The obvious thing would be to loop through the needles and run
> substr_count on the haystack... But is there a faster way?

//Kind of a hack, I guess, but might be decently fast:
$pattern = implode('|', $needles);
if (preg_match("/($pattern)/", $haystack, $matches)){
  var_dump($matches);
}

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

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



Re: [PHP] Handling Large Check Box Data

2006-05-18 Thread Richard Lynch
On Wed, May 17, 2006 1:21 pm, Rahul S. Johari wrote:
> I¹m a little confused as to what¹s the best way to handle this.
> I have a form which, apart from lots of other fields, has a set of 25
> ­ 30
> Check Boxes, each of which asks the user for some kind of information
> which
> the user can check or leave unchecked.
> The information each Check Box collects will also appear in the
> ³Listing²
> for users to view once the user has completed & submitted the form.
> Furthermore, there is an Advanced Search also available to users which
> will
> also provide the same 25 - 30 check boxes which define the search
> criteria.
> I¹m not sure what¹s the best, most efficient way to do this.
>
> The tedious way to do this is to make 30 fields in the mySQL database,
> and
> if the check box is checked, the data goes into the corresponding
> field...
> And similarly listing the data from the field if field is
> non-empty And
> similarly including each field in the Search options.
>
> I want suggestions for a better/faster way to do this. I did think
> about
> creating a single field and storing the data from each Œchecked¹ check
> box
> as comma separated values in the single field. I¹m not sure how to do
> that
> and if that¹s the best way But even if I can, I¹m not sure how to
> get
> the data to display separately out of that field in the Listings view
> and
> more importantly how to include that data in the Search options.

You could combine up to 32 bits into a 32-bit integer, and store the
choices as an 'int'

Something like:


For nicer syntax, you could use those >> and << operators for
bit-shifting instead of that goofy "2 *" I used, because I was too
lazy to RTFM to lookup the syntax for << and >>

But since you are right on the edge of needing over 32 bits, this is
probably not such a good idea...

You could also just use a string with the same basic framework:

$data = '';
foreach (...){
  if (isset(...)){
$data .= '1';
  }
  else{
$data .= '0';
  }
}

This is not real flexible when you add more choices, however.

Probably the CORRECT way to do it is to store the values in another
table, with an id field back to the current table.

This will provide the most flexibility in the long run, and probably
be more maintainable and have clearer code.

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

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



Re: [PHP] $_SERVER['REMOTE_ADDR'] arriving in IPv6

2006-05-18 Thread Marcus Bointon

On 18 May 2006, at 21:11, Stut wrote:

The value in that variable is coming from the web server not PHP. I  
suggest you change the web server configuration so it's listening  
on specific v4 IPs only rather than all IPs. See the docs for your  
web server for details on how to do that.


Yup, that was it, thanks. It appears that Apache 2 on OS X listens on  
IPv6 by default. To force it to listen on IPv4 only, change the  
default listen directive in httpd.conf to look like this:


Listen 0.0.0.0:80

Here's the reference: http://httpd.apache.org/docs/2.0/bind.html

Worked a treat for me.

Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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



Re: [PHP] Need help calling PHP page from another server.

2006-05-18 Thread Richard Lynch
You could claim that your error_reporting including E_NOTICE is the
problem...

But it would be FAR more correct to say that your code has errors of
level E_NOTICE, and you've never fixed them before.  Fix them.

On Thu, May 18, 2006 2:09 pm, Robert Filipovich wrote:
> Looks like all of these are happening.
>
>
> The description for Event ID ( 2000 ) in Source ( php ) cannot be
> found. The
> local computer may not have the necessary registry information or
> message
> DLL files to display messages from a remote computer. The following
> information is part of the event: php[400], PHP Notice: Undefined
> index:
> ocode in C:\siupchat\statusimage.php on line 39.
>
> The description for Event ID ( 2000 ) in Source ( php ) cannot be
> found. The
> local computer may not have the necessary registry information or
> message
> DLL files to display messages from a remote computer. The following
> information is part of the event: php[1812], PHP Notice: Undefined
> index:
> ocode in C:\siupchat\statusimage.php on line 39.
>
> The description for Event ID ( 2000 ) in Source ( php ) cannot be
> found. The
> local computer may not have the necessary registry information or
> message
> DLL files to display messages from a remote computer. The following
> information is part of the event: php[1444], PHP Notice: Undefined
> index:
> HTTP_REFERER in C:\siupchat\statusimage.php on line 52.
> It is on an IIS server.  Any ideas what PHP.ini setting is causing
> this
> error?
>
> Thanks,
> /Robert
>
>
> On 5/18/06, John Hicks <[EMAIL PROTECTED]> wrote:
>>
>> Please reply to the list.
>>
>> Robert Filipovich wrote:
>> > I got this in the event viewer when I enabled suslogging.
>> >
>> >
>> > The description for Event ID ( 2000 ) in Source ( php ) cannot be
>> found.
>> > The local computer may not have the necessary registry information
>> or
>> > message DLL files to display messages from a remote computer. The
>> > following information is part of the event: php[144], PHP Notice:
>> > Undefined index: HTTP_REFERER in C:\siupchat\statusimage.php on
>> line 52.
>>
>> I can't grok this easily since it looks like it's coming from a
>> strange
>> OS, but if I were you, I would begin by looking at line 52.
>>
>> --J
>>
>> P.S. Please reply to the list.
>>
>> > On 5/18/06, *Robert Filipovich* <[EMAIL PROTECTED]
>> > > wrote:
>> >
>> > Why do you think it works on the local site?  Is it access to
>> > MySQL?  Seems weird since the provcessing should still be
>> server
>> > side on the MySQL stuff.
>> >
>> > I will see what I can find in the log.
>> >
>> > /Robert
>> >
>> >
>> > On 5/18/06, *John Hicks* <[EMAIL PROTECTED]
>> > > wrote:
>> >
>> > John Hicks wrote:
>> > >  Robert Filipovich wrote:
>> > > > I am using a chat program and trying to call the
>> status page
>> > from another
>> > > > server and the graphic that the page returns does not
>> show
>> up.
>> > > >
>> > > > It works if you are calling from the webserver that
>> the chat
>> > program is
>> > > > working so i feel it is some type of config problem or
>> > security issue.
>> > > >
>> > > > http://www.hidho.com/chattest.htm is the page that
>> uses the
>> code
>> > > >
>> > > > http://chat.siuprem.com/siupchat/client.php',500,500)
>> > ">> src="
>> > > > http://chat.siuprem.com/siupchat/statusimage.php
>> > ">
>> and it
>> > works on
>> > > > http://chat.siuprem.com/siupchat/chattest.htm
>> >  which is
>> the
>> > windows IIS
>> > > > sesrver where PHP is running.
>> > > >
>> > >
>> > >  Do you have access to the source of statusimage.php?
>> > >
>> > >  (I have a hunch it is checking the request's referer.)
>> > >
>> > >  --J
>> >
>> > Since this is open source code ('phpOnline') available at
>> > http://www.dayanahost.com/phponline.cfm
>> > 
>> > I guess it's safe to post an excerpt here:
>> >
>> > ...
>> > [a number of mysql statements without error checking or
>> other
>> exits]
>> > ...
>> > [concluding with:]
>> >
>> > header ("Content-type: image/jpeg");
>> >
>> > if($LastAdmLoginTime==0 || $LastAdmLoginTime<($TTime-120))
>> > {
>> >echo implode('', file('pathtooffline.jpg'));
>> >$OnlineStatus = 0;
>> > }
>> > else
>> > {
>> >echo implode('', file('pathtoonline.jpg '));
>> > }
>> >
>> > Since both of these images are present (i.e. can be
>> accessed
>> > directly)
>> > and 

Re: [PHP] Add Multiple Items, Qty to Cart from html form

2006-05-18 Thread Richard Lynch
On Wed, May 17, 2006 6:59 pm, Andras Kende wrote:
> I trying to add multiple items to a shopping cart with selectable
> quantity
> and price form text field like..
>
> apple   : qty: [__]  price: [__]
> orange : qty: [__]  price: [__]

apple : qty:  price: 
orange : qty:  price: 

> 
>
> I could add multiple items with checkboxes but without selecting
> quantity
> and price..
>

if (isset($_POST['quantity'])){
  var_dump($_POST['quantity']);
  var_dump($_POST['price']);
}

>  if (isset($_POST['itemschecked'])) {
>  foreach($_POST['itemschecked'] as $itemschecked => $checkeditems ){
>  AddItem($checkeditems, 1);
>  }
>
> Any help is appreciated..
>
> Thanks,
>
> Andras
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


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

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



Re: [PHP] Pictures and caches

2006-05-18 Thread Richard Lynch
On Thu, May 18, 2006 3:25 am, Gustav Wiberg wrote:
> The thing I want to do is to copy a picturefile to another
> picturefile.

That's what you THINK you want to do...

> The thing is that I want to copy this file, show it , and then delete
> it
> (when it has been shown) .Is this possible?

You're likely to have problems when the user "reloads" (refreshes)
their page -- as well as all sorts of other problems with
forward/backward buttons.

> I want to do this, because of avoiding problems with cache when
> uploading
> file through an admin-online-system... (the customer uses IE)

In that case, what you REALLY need is the URL to be random, and the
same picture file to always be returned (for the picture you want).

See below.

> When I delete the file in code down below, the picture is not shown (I
> guess
> because the browser hasn't rendered out all info?)

It's way worse than that...

> $fileName = "pictures/products/$dbIDProduct1" . "_small";
>
> $ran = strval(mktime()); //Current time
>
> if (file_exists($fileName . ".gif")) {
>
> copy($fileName . ".gif", "pictures/products/1_$ran.gif");
> showpicture("pictures/products/1_$ran.gif", $dbProductName1, 300,
> 150,
> "top");

This presumably dumps out some HTML, which the user does not even get
for a long time, much less the browser ask for the image, so...

> //deletefile("pictures/products/1_$ran.gif");

Yes, this is WAY too early to delete the file.

> }

Try this:


showpicture("pictures/products/$fileName.gif?$ran", $dbProductName1,
300, 150)

The browser will "see" the ?$ran there and HAVE to get a "new" image
URL, even though it's really the same damn picture.

You may want to look into the many many many archived posts from me
that discus PATH_INFO which describe how to get the ?$ran into the
middle part of the URL, so the URL *looks* like a static directory,
even when it's really a dynamic PHP script.  This will default stupid
browser bugs from ancient browsers, and any similar bugs that crop up
in the future browsers.

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

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



Re: [PHP] PEAR Algorithms/Containers

2006-05-18 Thread Richard Lynch
On Thu, May 18, 2006 8:57 am, tedd wrote:
> However, binary-trees are for searching and I use MySQL for that. I
> don't know specifically how MySQL preforms searches. I had hoped that
> somewhere one could set a bit and change the algorithms, but I
> haven't been able to find any references that allow that.

You really would need to discuss this at length on a MySQL forum/list,
but basically, the first thing you have to look at is the indeces, if
any, on the tables in question.

If you have an index, it could be a B-tree, or a hash, or any other
number of low-level indexed structures which more-or-less imply the
algorithm to be used in a search/sort.

The second thing to examine is MySQL's estimate of the number and
distribution of records to be loaded/examined/returned.

If the result set to be loaded/examine/returned is relatively high
number and widely distributed over hard drive "pages" then MySQL
"knows" it has to do a full table scan anyway, and goes ahead and does
that, I think.

All of the above is a gross over-simplification of something that
MySQL has put a zillion man-hours into solving -- which is why a
database is so GOOD at this sort of thing.

Of course, one doesn't always have a choice...

For example, one might be faced with a dog-slow crappy Google adwords
API feed that can only return keyword traffic estimates for specific
bids, and then one would be forced to hit that dog-slow crappy Google
adwords API feed in a binary search algorithm just to have any hope at
all of completing one's task in some reasonable time-frame...  Not
that I've ever faced this problem, oh no. :-(

To me, the added complexity of a class to handle something as simple
as binary search, hash-search, or even a B-tree or order N, is just
overhead and complexity of integration that I don't need.

When I need that kind of algorithm, I do not find it difficult nor
tedious to just code it from scratch.

But I can see where others would find it a real boon, so I suspect it
would be quite useful for many to find in PEAR or some reasonable PHP
code library.

What might be MORE useful, perhaps, would be an extension in C to add
some of these algorithms to the language somehow -- Since that would
maybe include a performance boost in the algorithm itself, assuming
you could get the data/structures into and out of the C code in some
reasonable way.

YMMV

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

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



Re: [PHP] Sparse 1.0b - framework for MySQL programs

2006-05-18 Thread Daniel Orner

Richard Lynch wrote:

On Thu, May 18, 2006 2:29 pm, Daniel Orner wrote:

 I'd like to announce the first release of Sparse, a new way to
create MySQL programs without actually programming anything! Sparse


LOL!

This is really nice -- though what I find amusing is that, in many
ways, it seems to me to reflect the ideas of what PHP set out to be,
oh so many years ago...

Maybe 15 years from now, you'll be taking Rasmus' job at Yahoo :-)


Heh, there's always time. 8-) Thanks for the feedback!

--Daniel

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



Re: [PHP] Range mktime?

2006-05-18 Thread Richard Lynch
On Thu, May 18, 2006 6:30 am, Gustav Wiberg wrote:
> I wondew which range the mktime has? (in digits)
> In my case it always start with 1.
> something like
> 1147951344
>
> Is this ALWAYS TRUE (that it would start with 1)

No.

0 1/1/1970 midnight
1 1/1/1970 one second after midnight
2 1/1/1970 two seconds after midnight
3 1/1/1970 three seconds after midnight
.
.
60 1/1/1970 one minute after midnight
120 1/1/1970 two minutes after midnight
240 1/1/1970 four minutes after midnight
.
.
.
1147992736 5/18/2006 about 4 PM or so, give or take
.
.
.
20 5/17/2033 8:33:20 pm
.
.
.
0x7fff 1/18/2038 7:14:07 pm, the end of time on 32-bit hardware



should tell you why

Feel free to try different numbers in decimal and hex in place of
0x8000 and you will learn something.

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

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



Re: [PHP] Object Array?

2006-05-18 Thread Jochem Maas

Richard Lynch wrote:

On Thu, May 18, 2006 1:25 pm, Jay Paulson wrote:


I tried with no success yesterday to get an answer to this question so
I'll
try again.

I have an object from using simpleXML and inside that object is an
array
holding even more objects.  However, it's not acting like an array and
therefore I can't go through it. (i.e. I can't use the count function
to see
how big it is and loop through it)

This below should be an array:

$xml->RES->R



Just for fun, try using $xml['RES'] to get $res, and $res['R'] to get
$r and see what $r is.

I don't see *HOW* they could manage to override the -> operator
(unlike C++) but maybe they hacked it somehow...

Guess simpleXML isn't looking quite so simple anymore, eh? :-^


its (simpleXML) a blooming oxymoron!

but do note that implmenting the Iterator interface in a userland class
doesn't have the same [nightmarish] affect in print_r()/var_dump(), in such
cases you just get a 'normal' dump of the object in question. simpleXMLElements
(or whatever they are called) are from my experience rather 'unique' with 
respect
to trying to dump them in order to figure out how they are built up - i.e. you 
can't





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



Re: [PHP] Re: Object Array?

2006-05-18 Thread Richard Lynch
On Thu, May 18, 2006 2:18 pm, Daniel Orner wrote:
>   Try using var_dump rather than print_r... maybe it'll give you more
> accurate data (e.g. to figure out if it's an object, as Rob said, or
> an
> array).

Or not, as it seems to not be very helpful when the object is an
"iterator" whatever that is -- and I hate it already, even though my
experience with "iterator" classes is limited to C++ [shudder]

Are there any forks of PHP with all the OO stuff ripped out?... :-v

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

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



Re: [PHP] Object Array?

2006-05-18 Thread Richard Lynch
On Thu, May 18, 2006 1:25 pm, Jay Paulson wrote:
> I tried with no success yesterday to get an answer to this question so
> I'll
> try again.
>
> I have an object from using simpleXML and inside that object is an
> array
> holding even more objects.  However, it's not acting like an array and
> therefore I can't go through it. (i.e. I can't use the count function
> to see
> how big it is and loop through it)
>
> This below should be an array:
>
> $xml->RES->R

Just for fun, try using $xml['RES'] to get $res, and $res['R'] to get
$r and see what $r is.

I don't see *HOW* they could manage to override the -> operator
(unlike C++) but maybe they hacked it somehow...

Guess simpleXML isn't looking quite so simple anymore, eh? :-^

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

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



Re: [PHP] $_SERVER['REMOTE_ADDR'] arriving in IPv6

2006-05-18 Thread Richard Lynch
On Thu, May 18, 2006 2:22 pm, Marcus Bointon wrote:
> I'm running PHP 5.1.4 on OS X. When I look at $_SERVER
> ['REMOTE_ADDR'], it seems to contain an ipv6 address rather than an
> ipv4 one (at present it's giving me 'fe80::1' instead of the usual
> dotted quad), and that confuses the hell out of things like MySQL's
> INET_ATON() function. I have ipv6 networking disabled in my network
> control panel, and my PHP is configured with --disable-ipv6. How can
> I force it to return only ipv4 addresses? Is there an ini setting
> somewhere?

Assuming for the sake of argument that your visitor is on an IPv6
machine somewhere, would you want $_SERVER['REMOTE_ADDR'] to be not
set at all, or NULL or ???

For now, at least, you should filter the input and discard ipv6 data.

For that matter, you probably ought to be filtering that input anyway,
just in case, for better security and sql-injections, no?

Hard to see how somebody could push something through that variable to
do an sql-injection attack, but there it is.

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

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



Re: [PHP] Sparse 1.0b - framework for MySQL programs

2006-05-18 Thread Richard Lynch
On Thu, May 18, 2006 2:29 pm, Daniel Orner wrote:
>  I'd like to announce the first release of Sparse, a new way to
> create MySQL programs without actually programming anything! Sparse

LOL!

This is really nice -- though what I find amusing is that, in many
ways, it seems to me to reflect the ideas of what PHP set out to be,
oh so many years ago...

Maybe 15 years from now, you'll be taking Rasmus' job at Yahoo :-)

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

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



Re: [PHP] Re: [Repost] Getting rid of "Web page has expired" (POSTDATA Error)

2006-05-18 Thread Chris Shiflett

Nicolas Verhaeghe wrote:

Indeed but you specify that you reshow the form and then
redirect...


Actually, he said:

"If there are errors, then the form is reshown with their values populated."

His code from above that matches this statement is:

if (!$form_passes_validation)

In his example and explanation, the header() function only gets called 
if there are no errors.


Hope that helps.

Chris

--
Chris Shiflett
Principal, OmniTI
http://omniti.com/

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



RE: [PHP] Re: [Repost] Getting rid of "Web page has expired" (POSTDATA Error)

2006-05-18 Thread Nicolas Verhaeghe
Robert Samuel White wrote:
> [SNIP]
> 
> Now one thing bothers me: how do you redirect in step 4 if you have
> shown the form in step 3? 
> 
> How do you avoid a "Cannot modify header information - headers
> already sent by ..." error message? 
> 
> Nicolas Verhaeghe
> E-mail: [EMAIL PROTECTED]
> Phone: 602-490-8000
> 
> [/SNIP]
> 
> 
> 
> Nicholas,
> 
> As long as you haven't outputted anything from your script after the
> form post, you can redirect just fine. 
> 
> Step 3 and Step 4 are two different steps.
> 
> You need something like this:
> 
> 
> if (isset($_POST["btnSubmit"]))
> {
> 
>   // validate form
> 
> }
> 
> if (!$form_passes_validation)
> {
> 
>   // show form
> 
> } else
> {
> 
>Header("location: ");
> 
> }

Indeed but you specify that you reshow the form and then redirect...

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



Re: [PHP] Sparse 1.0b - framework for MySQL programs

2006-05-18 Thread Daniel Orner
	Well... okay, I'll be honest, I never really *wanted* to install it. 
8-) And I'm not exactly a server guru (even updating PHP4 proved to be 
too much for me... for some reason a bunch of dependencies which were 
fine when I got the server no longer work).


er why not? just install a second copy of php into a custom (e.g. your 
homedir)
dir and use that - check the archives for Rasmus' quick guide to setting 
up a second

apache/php installation.

possible reason number 1: XML handling in php5 is rather different than 
in php4,

they offer different xml tools - chances are the exntesion you use

possible reason number 1-N: objects work differently in php5.


	Well, I don't use objects too extensively... I took a look at the 
migrating from PHP4 to PHP5 page on the manual and there didn't seem to 
be anything that would have messed it up. I wasn't aware of the XML 
differences, so yes, that may be a problem. I won't know until someone 
tries. 8-)

Thanks,

--Daniel

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



Re: [PHP] Debug/Learn Recursion of an Object

2006-05-18 Thread Graham Anderson

I got it :)

just put a print_r at each step of the function
like:  print_r($part->$parts);

thanks

g



On May 18, 2006, at 11:59 AM, Robert Cummings wrote:


On Thu, 2006-05-18 at 14:11, Graham Anderson wrote:

I am a bit new to Objects and Recursion
Any push in the right direction is appreciated

Generated from Pear's mimedecode, I have an object whose print_r is:
http://www.siren.cc/dev/object.txt


The function below will correctly traverse the object and find the
'correct' node.
Unfortunately, it is a little beyond my understanding at present. :(

Is there a way to debug the below function to echo how it is
traversing the object ?
For example, how would I echo the key names  and values while it is
traversing ?


http://www.php.net/manual/en/control-structures.foreach.php

Right smack at the top in the grey box. In the future please try  
reading

the manual. This is simplistic question that any newbie should know
having read the manual.

Cheers,
Rob.
--
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'


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



RE: [PHP] Re: [Repost] Getting rid of "Web page has expired" (POSTDATA Error)

2006-05-18 Thread Robert Samuel White
[SNIP] 

Now one thing bothers me: how do you redirect in step 4 if you have shown
the form in step 3?

How do you avoid a "Cannot modify header information - headers already sent
by ..." error message?

Nicolas Verhaeghe
E-mail: [EMAIL PROTECTED]
Phone: 602-490-8000

[/SNIP]



Nicholas,

As long as you haven't outputted anything from your script after the form
post, you can redirect just fine.

Step 3 and Step 4 are two different steps.

You need something like this:


if (isset($_POST["btnSubmit"]))
{

  // validate form

}

if (!$form_passes_validation)
{

  // show form

} else
{

   Header("location: ");

}

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



RE: [PHP] Re: [Repost] Getting rid of "Web page has expired" (POSTDATA Error)

2006-05-18 Thread Nicolas Verhaeghe
Robert Samuel White wrote:
> You might want to modify your coding.  The way I prevent this problem
> from ever happening is this: 
> 
> 
> 
> 1.  The user completes information on the form.
> 
> 2.  The form is validated by PHP.
> 
> 3.  If there are errors, then the form is reshown with their values
> populated. 
> 
> 4.  Once all errors are corrected, I process the form and then use a
> Header("Location: ") to redirect the user to the same page (or
> another page). 
> 
> 
> 
> This has the advantage of allowing a user to click the back button
> and seeing their form with their values still intact. 
> 
> 
> 
> This prevents a method post page from being in the user's browser
> history. 

Now one thing bothers me: how do you redirect in step 4 if you have shown
the form in step 3?

How do you avoid a "Cannot modify header information - headers already sent
by ..." error message?

Nicolas Verhaeghe
E-mail: [EMAIL PROTECTED]
Phone: 602-490-8000

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



Re: [PHP] Need help calling PHP page from another server.

2006-05-18 Thread Stut

John Hicks wrote:

Robert Filipovich wrote:

Looks like all of these are happening.
 

The description for Event ID ( 2000 ) in Source ( php ) cannot be 
found. The local computer may not have the necessary registry 
information or message DLL files to display messages from a remote 
computer. The following information is part of the event: php[400], 
PHP Notice: Undefined index: ocode in C:\siupchat\statusimage.php on 
line 39.


The description for Event ID ( 2000 ) in Source ( php ) cannot be 
found. The local computer may not have the necessary registry 
information or message DLL files to display messages from a remote 
computer. The following information is part of the event: php[1812], 
PHP Notice: Undefined index: ocode in C:\siupchat\statusimage.php on 
line 39.


The description for Event ID ( 2000 ) in Source ( php ) cannot be 
found. The local computer may not have the necessary registry 
information or message DLL files to display messages from a remote 
computer. The following information is part of the event: php[1444], 
PHP Notice: Undefined index: HTTP_REFERER in 
C:\siupchat\statusimage.php on line 52.


It is on an IIS server.  Any ideas what PHP.ini setting is causing 
this error?
 
Thanks,

/Robert


I see no reason why the trouble would lie with php.ini.

I'll bet it has something to do with undefined variables.

But these are merely notices, not errors, so they don't explain why you 
never get to the bottom of the program.


Short answer... change the value of error_reporting in php.ini to not 
report notices. I'm guessing the script isn't working because it's 
outputting the errors, in which case doing this should fix it.


Long answer... ignoring notices leads to sloppy coding and should be 
avoided where possible. If I were you and I had the opportunity I'd drop 
this OSS package in favour of something where the developers do not cut 
corners.


-Stut

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



Re: [PHP] Object Array?

2006-05-18 Thread Jochem Maas

Jay Paulson (CE CEN) wrote:

...


what happens when you do:

foreach ($xml->RES->R as $key => $r) {
echo $r->__toString();
// or
echo $key;
}

?



That actually works.  Strange because I tried this method first yesterday
and spent over an hour trying to get it to work and now it's working?  AH!
:)  Below is the code I use.

foreach ($xml->RES->R as $key => $r) {
echo $r->U.'';
echo $r->UD.'';
echo $r->UE.'';
echo $r->T.'';
echo $r->RK.'';
echo $r->S.'';
echo $r->LANG.'';
echo '';

}



hey would you look at that - another happy punter guided by pure guess work :-)
(I still not any nearer to grokking simpleXML)

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



Re: [PHP] $_SERVER['REMOTE_ADDR'] arriving in IPv6

2006-05-18 Thread Stut

Marcus Bointon wrote:
I'm running PHP 5.1.4 on OS X. When I look at $_SERVER['REMOTE_ADDR'], 
it seems to contain an ipv6 address rather than an ipv4 one (at present 
it's giving me 'fe80::1' instead of the usual dotted quad), and that 
confuses the hell out of things like MySQL's INET_ATON() function. I 
have ipv6 networking disabled in my network control panel, and my PHP is 
configured with --disable-ipv6. How can I force it to return only ipv4 
addresses? Is there an ini setting somewhere?


The value in that variable is coming from the web server not PHP. I 
suggest you change the web server configuration so it's listening on 
specific v4 IPs only rather than all IPs. See the docs for your web 
server for details on how to do that.


-Stut

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



Re: [PHP] Object Array?

2006-05-18 Thread Jay Paulson \(CE CEN\)
 I tried with no success yesterday to get an answer to this question so I'll
 try again.
 
 I have an object from using simpleXML and inside that object is an array
 holding even more objects.  However, it's not acting like an array and
 therefore I can't go through it. (i.e. I can't use the count function to
 see
 how big it is and loop through it)
>>> 
>>> use foreach on it (I think 'it' is a weirdo object that implements an
>>> iterator
>>> interface - which pretty much sums up simpleXML ;-):
>>> 
>>> foreach ($xml->RES->R as $r) {
>>> echo $r->U, $r->UD; // etc
>>> }
>>> 
>>> does that get you anywhere?
> 
> what happens when you do:
> 
> foreach ($xml->RES->R as $key => $r) {
> echo $r->__toString();
> // or
> echo $key;
> }
> 
> ?

That actually works.  Strange because I tried this method first yesterday
and spent over an hour trying to get it to work and now it's working?  AH!
:)  Below is the code I use.

foreach ($xml->RES->R as $key => $r) {
echo $r->U.'';
echo $r->UD.'';
echo $r->UE.'';
echo $r->T.'';
echo $r->RK.'';
echo $r->S.'';
echo $r->LANG.'';
echo '';

}

>> 
>> 
>> I've tried that and $xml->RES->R only goes through one record
>> $xml->RES->R[0] and then it stops.  What I did find that worked was this.
> 
> in what way does it stop?
> 
>> 
>> $i = 0;
>> while (isset($xml->RES->R[$i]) || !empty($xml->RES->R[$i]) {
>> // do stuff
>> $i++;
>> }
> 
> odd. I don't suppose $xml->RES->R has any methods does it? like hasChildren()
> or
> hasAttributes()?



Re: [PHP] Sparse 1.0b - framework for MySQL programs

2006-05-18 Thread Jochem Maas

Daniel Orner wrote:
I haven't been able to install PHP5 on my own server, so I don't 


er why not? just install a second copy of php into a custom (e.g. your homedir)
dir and use that - check the archives for Rasmus' quick guide to setting up a 
second
apache/php installation.

know for sure, but I can't think of any reason why it wouldn't. 8-) Part 


possible reason number 1: XML handling in php5 is rather different than in php4,
they offer different xml tools - chances are the exntesion you use

possible reason number 1-N: objects work differently in php5.


of why I need beta testers.

--Daniel


does it run on php5?





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



Re: [PHP] Sparse 1.0b - framework for MySQL programs

2006-05-18 Thread Robert Cummings
On Thu, 2006-05-18 at 15:52, Daniel Orner wrote:
>   I haven't been able to install PHP5 on my own server, so I don't know 
> for sure, but I can't think of any reason why it wouldn't. 8-) Part of 
> why I need beta testers.

That's ok PHP5 is a fringe community *lol*. Although I may switch now
that you can use the var keyword again for class vars.

Then again maybe I should just wait for PHP6 for a full embrace *grin*.
All I know is I don't really need any of the sugar candy in PHP5.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



RE: [PHP] Re: [Repost] Getting rid of "Web page has expired" (POSTDATA Error)

2006-05-18 Thread Nicolas Verhaeghe
Robert Samuel White wrote:
> You might want to modify your coding.  The way I prevent this problem
> from ever happening is this: 
> 
> 
> 
> 1.  The user completes information on the form.
> 
> 2.  The form is validated by PHP.
> 
> 3.  If there are errors, then the form is reshown with their values
> populated. 
> 
> 4.  Once all errors are corrected, I process the form and then use a
> Header("Location: ") to redirect the user to the same page (or
> another page). 
> 
> 
> 
> This has the advantage of allowing a user to click the back button
> and seeing their form with their values still intact. 
> 
> 
> 
> This prevents a method post page from being in the user's browser
> history. 

Robert,

I do the three first items but not the last one (#3 is done both client-side
and server-side by the way). I can add a hard redirect but I am a bit
surprised that it should fix the issue.

Yet I see it in Chris Shiflett's article at
http://shiflett.org/articles/guru-speak-nov2004

He also advises to add ini_set('session.cache_limiter', 'private');

Can somebody explain the login behind the redirect?

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



Re: [PHP] Object Array?

2006-05-18 Thread Jochem Maas

Jay Paulson wrote:

don't bother trying to print_r() or var_dump() SimpleXML objects you'll fry
your
brain - seriously you'll never get anything that makes sense - this is due to
the
way simpleXML using iterators or something like that - it's a bit like voodoo
to
me too so I find it hard to explain.

I'm sure there is a saying about 'when things are so simple, you just don't
get'
that's applicable here :-P



KISS - Keep It Simple Stupid. Haha..
 


Jay Paulson wrote:


I tried with no success yesterday to get an answer to this question so I'll
try again.

I have an object from using simpleXML and inside that object is an array
holding even more objects.  However, it's not acting like an array and
therefore I can't go through it. (i.e. I can't use the count function to see
how big it is and loop through it)


use foreach on it (I think 'it' is a weirdo object that implements an iterator
interface - which pretty much sums up simpleXML ;-):

foreach ($xml->RES->R as $r) {
echo $r->U, $r->UD; // etc
}

does that get you anywhere?


what happens when you do:

foreach ($xml->RES->R as $key => $r) {
echo $r->__toString();
// or
echo $key;
}

?





I've tried that and $xml->RES->R only goes through one record
$xml->RES->R[0] and then it stops.  What I did find that worked was this.


in what way does it stop?



$i = 0;
while (isset($xml->RES->R[$i]) || !empty($xml->RES->R[$i]) {
// do stuff
$i++;
}


odd. I don't suppose $xml->RES->R has any methods does it? like hasChildren() or
hasAttributes()?

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



Re: [PHP] Sparse 1.0b - framework for MySQL programs

2006-05-18 Thread Daniel Orner
	I haven't been able to install PHP5 on my own server, so I don't know 
for sure, but I can't think of any reason why it wouldn't. 8-) Part of 
why I need beta testers.


--Daniel


does it run on php5?


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



Re: [PHP] Sparse 1.0b - framework for MySQL programs

2006-05-18 Thread Jochem Maas

Daniel Orner wrote:

I apologize if this was already posted, but I didn't see it go through.

I'd like to announce the first release of Sparse, a new way to 
create MySQL programs without actually programming anything! Sparse 
takes care of handling the SQL data, navigation, displaying errors, 
input validation, and caching. Using a few extra HTML tags allows 
surprising power, yet remains easy to use and very customizable. It can 
save a lot of time and effort during development! It's especially 
well-suited for creating admin back-ends of sites that use MySQL.
This means that you can actually create entire MySQL-backed programs 
without using a single line of PHP code. However, more complex forms and 
queries can be easily integrated with PHP code as well.


The Sparse homepage is here: http://sparse-php.sourceforge.net/

Besides looking for beta testers, I'd also like to know the best way 
to spread the word about it, so if anyone has any comments or help they 
can offer, please do so!


does it run on php5?


Thanks!

--Daniel Orner



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



Re: [PHP] Object Array?

2006-05-18 Thread Jay Paulson
> don't bother trying to print_r() or var_dump() SimpleXML objects you'll fry
> your
> brain - seriously you'll never get anything that makes sense - this is due to
> the
> way simpleXML using iterators or something like that - it's a bit like voodoo
> to
> me too so I find it hard to explain.
> 
> I'm sure there is a saying about 'when things are so simple, you just don't
> get'
> that's applicable here :-P

KISS - Keep It Simple Stupid. Haha..
 
> 
> Jay Paulson wrote:
>> I tried with no success yesterday to get an answer to this question so I'll
>> try again.
>> 
>> I have an object from using simpleXML and inside that object is an array
>> holding even more objects.  However, it's not acting like an array and
>> therefore I can't go through it. (i.e. I can't use the count function to see
>> how big it is and loop through it)
> 
> use foreach on it (I think 'it' is a weirdo object that implements an iterator
> interface - which pretty much sums up simpleXML ;-):
> 
> foreach ($xml->RES->R as $r) {
> echo $r->U, $r->UD; // etc
> }
> 
> does that get you anywhere?

I've tried that and $xml->RES->R only goes through one record
$xml->RES->R[0] and then it stops.  What I did find that worked was this.

$i = 0;
while (isset($xml->RES->R[$i]) || !empty($xml->RES->R[$i]) {
// do stuff
$i++;
}

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



Re: [PHP] Object Array?

2006-05-18 Thread Jochem Maas

don't bother trying to print_r() or var_dump() SimpleXML objects you'll fry your
brain - seriously you'll never get anything that makes sense - this is due to 
the
way simpleXML using iterators or something like that - it's a bit like voodoo to
me too so I find it hard to explain.

I'm sure there is a saying about 'when things are so simple, you just don't get'
that's applicable here :-P


Jay Paulson wrote:

I tried with no success yesterday to get an answer to this question so I'll
try again.

I have an object from using simpleXML and inside that object is an array
holding even more objects.  However, it's not acting like an array and
therefore I can't go through it. (i.e. I can't use the count function to see
how big it is and loop through it)


use foreach on it (I think 'it' is a weirdo object that implements an iterator
interface - which pretty much sums up simpleXML ;-):

foreach ($xml->RES->R as $r) {
echo $r->U, $r->UD; // etc
}

does that get you anywhere?

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



Re: [PHP] Object Array?

2006-05-18 Thread Jay Paulson \(CE CEN\)
>> I have an object from using simpleXML and inside that object is an array
>> holding even more objects.  However, it's not acting like an array and
>> therefore I can't go through it. (i.e. I can't use the count function to see
>> how big it is and loop through it)
>> 
>> This below should be an array:
>> 
>> $xml->RES->R
>> 
>> When I use print_r($xml->RES) I get the below.  As you can see [R] => Array
>> but yet in the above example it is an object.  I'm so confused and lost.
>> Can anyone help?  PHP version 5.0.4
>> 
>> SimpleXMLElement Object
>> (
>> [M] => 2010
> 
>> [R] => Array
>> (
>> [0] => SimpleXMLElement Object
>> (
>> [U] => http://.../benefits/
> >
>> )
>> 
>> [1] => SimpleXMLElement Object
>> (
>> [U] => http://.../benefits/benefits_websites.html
> > )
>> 
>> [2] => SimpleXMLElement Object
>> (
>> [U] => http://www..com/jobs//benefits.html
> 
> You are right: $xml->RES->R is an array.
> 
> If it doesn't act like an array, you might try assigning it to a new
> variable. Maybe something like this:
> 
> $MyArray = $xml->RES->R;
> print_r($MyArray);
> 
> Others might have better ideas. Keep trying.
> 
> --J

I've tried that even going so far as doing:

$MyArray = array();
$MyArray = $xml->RES-R
print_r($MyArray);

I still run into the same problem. Hm.

jay



Re: [PHP] Re: Object Array?

2006-05-18 Thread Jay Paulson
This keeps getting stranger and stranger.  I did the var_dump and I got this
for R:

  ["R"]=>
  array(10) {

So it's an array but when I pass it through is_array it says it's not an
array.  However, when I pass it through is_object it says it's an object?!


On 5/18/06 2:18 PM, "Daniel Orner" <[EMAIL PROTECTED]> wrote:

> Try using var_dump rather than print_r... maybe it'll give you more
> accurate data (e.g. to figure out if it's an object, as Rob said, or an
> array).
> 
> --Daniel
> 
> Jay Paulson wrote:
>> I tried with no success yesterday to get an answer to this question so I'll
>> try again.
>> 
>> I have an object from using simpleXML and inside that object is an array
>> holding even more objects.  However, it's not acting like an array and
>> therefore I can't go through it. (i.e. I can't use the count function to see
>> how big it is and loop through it)
>> 
>> This below should be an array:
>> 
>> $xml->RES->R
>> 
>> When I use print_r($xml->RES->R) I get $xml->RES->R[0] printed, which is
>> below:
>> 
>> SimpleXMLElement Object
>> (
>> [U] => http://.../benefits/
>> [UD] => http://.../benefits/
>> [UE] => http://.../benefits/
>> [T] => Benefits
>> 
>> [RK] => 10
>> [CRAWLDATE] =>  17 May 2006
>> [FS] => SimpleXMLElement Object
>> (
>> )
>> 
>> [S] => Home, Benefits Forms Jobs Training Locations, Who We Are
>> E-Info Publications EVA Team Websites. ... 2006 Benefits
>> Vote. Benefits Links. Benefits Websites. ...
>> [LANG] => en
>> [HAS] => SimpleXMLElement Object
>> (
>> [L] => SimpleXMLElement Object
>> (
>> )
>> 
>> [C] => SimpleXMLElement Object
>> (
>> )
>> 
>> )
>> 
>> )
>> 
>> 
>> When I use print_r($xml->RES) I get the below.  As you can see [R] => Array
>> but yet in the above example it is an object.  I'm so confused and lost.
>> Can anyone help?  PHP version 5.0.4
>> 
>> SimpleXMLElement Object
>> (
>> [M] => 2010
>> [FI] => SimpleXMLElement Object
>> (
>> )
>> 
>> [NB] => SimpleXMLElement Object
>> (
>> [NU] =>
>> /search?q=benefits&site=default_collection&hl=en&lr=&ie=UTF-8&output=xml_no_
>> dtd&client=default_frontend&access=p&sort=date:D:L:d1&start=10&sa=N
>> )
>> 
>> [R] => Array
>> (
>> [0] => SimpleXMLElement Object
>> (
>> [U] => http://.../benefits/
>> [UD] => http://.../benefits/
>> [UE] => http://.../benefits/
>> [T] => Benefits
>> 
>> [RK] => 10
>> [CRAWLDATE] =>  17 May 2006
>> [FS] => SimpleXMLElement Object
>> (
>> )
>> 
>> [S] => Home, Benefits Forms Jobs Training
>> Locations, Who We Are E-Info Publications EVA Team Websites. ...
>> 2006 Benefits Vote. Benefits Links. Benefits Websites.
>> ...  
>> [LANG] => en
>> [HAS] => SimpleXMLElement Object
>> (
>> [L] => SimpleXMLElement Object
>> (
>> )
>> 
>> [C] => SimpleXMLElement Object
>> (
>> )
>> 
>> )
>> 
>> )
>> 
>> [1] => SimpleXMLElement Object
>> (
>> [U] => http://.../benefits/benefits_websites.html
>> [UD] => http://.../benefits/benefits_websites.html
>> [UE] => http://.../benefits/benefits_websites.html
>> [T] => Benefits
>> 
>> [RK] => 9
>> [CRAWLDATE] =>  17 May 2006
>> [FS] => SimpleXMLElement Object
>> (
>> )
>> 
>> [S] => Home, Benefits Forms Jobs Training
>> Locations, Who We Are E-Info Publications EVA Team Websites.
>> Benefits Websites.  ...
>> [LANG] => en
>> [HAS] => SimpleXMLElement Object
>> (
>> [L] => SimpleXMLElement Object
>> (
>> )
>> 
>> [C] => SimpleXMLElement Object
>> (
>> )
>> 
>> )
>> 
>> [HN] => /benefits
>> )
>> 
>> [2] => SimpleXMLElement Object
>> (
>> [U] => http://www..com/jobs//benefits.html
>> [UD] => http://www..com/jobs//benefits.html
>> [UE] => http://www..com/jobs//benefits.html
>> [T] =>  : Jobs 

[PHP] Sparse 1.0b - framework for MySQL programs

2006-05-18 Thread Daniel Orner

I apologize if this was already posted, but I didn't see it go through.

I'd like to announce the first release of Sparse, a new way to 
create MySQL programs without actually programming anything! Sparse 
takes care of handling the SQL data, navigation, displaying errors, 
input validation, and caching. Using a few extra HTML tags allows 
surprising power, yet remains easy to use and very customizable. It can 
save a lot of time and effort during development! It's especially 
well-suited for creating admin back-ends of sites that use MySQL.
This means that you can actually create entire MySQL-backed 
programs without using a single line of PHP code. However, more complex 
forms and queries can be easily integrated with PHP code as well.


The Sparse homepage is here: http://sparse-php.sourceforge.net/

Besides looking for beta testers, I'd also like to know the best 
way to spread the word about it, so if anyone has any comments or help 
they can offer, please do so!

Thanks!

--Daniel Orner

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



Re: [PHP] Need help calling PHP page from another server.

2006-05-18 Thread John Hicks

Robert Filipovich wrote:

Looks like all of these are happening.
 

The description for Event ID ( 2000 ) in Source ( php ) cannot be found. 
The local computer may not have the necessary registry information or 
message DLL files to display messages from a remote computer. The 
following information is part of the event: php[400], PHP Notice: 
Undefined index: ocode in C:\siupchat\statusimage.php on line 39.


The description for Event ID ( 2000 ) in Source ( php ) cannot be found. 
The local computer may not have the necessary registry information or 
message DLL files to display messages from a remote computer. The 
following information is part of the event: php[1812], PHP Notice: 
Undefined index: ocode in C:\siupchat\statusimage.php on line 39.


The description for Event ID ( 2000 ) in Source ( php ) cannot be found. 
The local computer may not have the necessary registry information or 
message DLL files to display messages from a remote computer. The 
following information is part of the event: php[1444], PHP Notice: 
Undefined index: HTTP_REFERER in C:\siupchat\statusimage.php on line 52.


It is on an IIS server.  Any ideas what PHP.ini setting is causing this 
error?
 
Thanks,

/Robert


I see no reason why the trouble would lie with php.ini.

I'll bet it has something to do with undefined variables.

But these are merely notices, not errors, so they don't explain why you 
never get to the bottom of the program.


Have you patched statusimage.php yet to report mysql errors? (Display 
your sql statements while you are at it.)


I posted the (GNU open) source here:
http://johnhicks.org/statusimage.phps
in case someone else on the list would care to look.

--J



 
On 5/18/06, *John Hicks* <[EMAIL PROTECTED] 
> wrote:


Please reply to the list.

Robert Filipovich wrote:
 > I got this in the event viewer when I enabled suslogging.
 >
 >
 > The description for Event ID ( 2000 ) in Source ( php ) cannot be
found.
 > The local computer may not have the necessary registry information or
 > message DLL files to display messages from a remote computer. The
 > following information is part of the event: php[144], PHP Notice:
 > Undefined index: HTTP_REFERER in C:\siupchat\statusimage.php on
line 52.

I can't grok this easily since it looks like it's coming from a strange
OS, but if I were you, I would begin by looking at line 52.

--J

P.S. Please reply to the list.

 > On 5/18/06, *Robert Filipovich* <[EMAIL PROTECTED]

 > >> wrote:
 >
 > Why do you think it works on the local site?  Is it access to
 > MySQL?  Seems weird since the provcessing should still be server
 > side on the MySQL stuff.
 >
 > I will see what I can find in the log.
 >
 > /Robert
 >
 >
 > On 5/18/06, *John Hicks* < [EMAIL PROTECTED]

 > >> wrote:
 >
 > John Hicks wrote:
 > >  Robert Filipovich wrote:
 > > > I am using a chat program and trying to call the
status page
 > from another
 > > > server and the graphic that the page returns does not
show up.
 > > >
 > > > It works if you are calling from the webserver that
the chat
 > program is
 > > > working so i feel it is some type of config problem or
 > security issue.
 > > >
 > > > http://www.hidho.com/chattest.htm is the page that
uses the code
 > > >
 > > > http://chat.siuprem.com/siupchat/client.php',500,500)
 > <
http://chat.siuprem.com/siupchat/client.php',500,500)>">http://chat.siuprem.com/siupchat/statusimage.php

 > ">
and it
 > works on
 > > > http://chat.siuprem.com/siupchat/chattest.htm
 >  which is the
 > windows IIS
 > > > sesrver where PHP is running.
 > > >
 > >
 > >  Do you have access to the source of statusimage.php?
 > >
 > >  (I have a hunch it is checking the request's referer.)
 > >
 > >  --J
 >
 > Since this is open source code ('phpOnline') available at
 > http://www.dayanahost.com/phponline.cfm

 > 
 > I guess it's safe to post an excerpt here:
 >
 > ...
 > [a number of mysql statements without error checking or
other exits]
 > ...
 

[PHP] $_SERVER['REMOTE_ADDR'] arriving in IPv6

2006-05-18 Thread Marcus Bointon
I'm running PHP 5.1.4 on OS X. When I look at $_SERVER 
['REMOTE_ADDR'], it seems to contain an ipv6 address rather than an  
ipv4 one (at present it's giving me 'fe80::1' instead of the usual  
dotted quad), and that confuses the hell out of things like MySQL's  
INET_ATON() function. I have ipv6 networking disabled in my network  
control panel, and my PHP is configured with --disable-ipv6. How can  
I force it to return only ipv4 addresses? Is there an ini setting  
somewhere?


Thanks,

Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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



[PHP] Re: Object Array?

2006-05-18 Thread Daniel Orner
	Try using var_dump rather than print_r... maybe it'll give you more 
accurate data (e.g. to figure out if it's an object, as Rob said, or an 
array).


--Daniel

Jay Paulson wrote:

I tried with no success yesterday to get an answer to this question so I'll
try again.

I have an object from using simpleXML and inside that object is an array
holding even more objects.  However, it's not acting like an array and
therefore I can't go through it. (i.e. I can't use the count function to see
how big it is and loop through it)

This below should be an array:

$xml->RES->R

When I use print_r($xml->RES->R) I get $xml->RES->R[0] printed, which is
below:

SimpleXMLElement Object
(
[U] => http://.../benefits/
[UD] => http://.../benefits/
[UE] => http://.../benefits/
[T] => Benefits

[RK] => 10
[CRAWLDATE] =>  17 May 2006
[FS] => SimpleXMLElement Object
(
)

[S] => Home, Benefits Forms Jobs Training Locations, Who We Are
E-Info Publications EVA Team Websites. ... 2006 Benefits
Vote. Benefits Links. Benefits Websites. ...
[LANG] => en
[HAS] => SimpleXMLElement Object
(
[L] => SimpleXMLElement Object
(
)

[C] => SimpleXMLElement Object
(
)

)

)


When I use print_r($xml->RES) I get the below.  As you can see [R] => Array
but yet in the above example it is an object.  I'm so confused and lost.
Can anyone help?  PHP version 5.0.4

SimpleXMLElement Object
(
[M] => 2010
[FI] => SimpleXMLElement Object
(
)

[NB] => SimpleXMLElement Object
(
[NU] =>
/search?q=benefits&site=default_collection&hl=en&lr=&ie=UTF-8&output=xml_no_
dtd&client=default_frontend&access=p&sort=date:D:L:d1&start=10&sa=N
)

[R] => Array
(
[0] => SimpleXMLElement Object
(
[U] => http://.../benefits/
[UD] => http://.../benefits/
[UE] => http://.../benefits/
[T] => Benefits

[RK] => 10
[CRAWLDATE] =>  17 May 2006
[FS] => SimpleXMLElement Object
(
)

[S] => Home, Benefits Forms Jobs Training
Locations, Who We Are E-Info Publications EVA Team Websites. ...
2006 Benefits Vote. Benefits Links. Benefits Websites.
...  
[LANG] => en

[HAS] => SimpleXMLElement Object
(
[L] => SimpleXMLElement Object
(
)

[C] => SimpleXMLElement Object
(
)

)

)

[1] => SimpleXMLElement Object
(
[U] => http://.../benefits/benefits_websites.html
[UD] => http://.../benefits/benefits_websites.html
[UE] => http://.../benefits/benefits_websites.html
[T] => Benefits

[RK] => 9
[CRAWLDATE] =>  17 May 2006
[FS] => SimpleXMLElement Object
(
)

[S] => Home, Benefits Forms Jobs Training
Locations, Who We Are E-Info Publications EVA Team Websites.
Benefits Websites.  ...
[LANG] => en
[HAS] => SimpleXMLElement Object
(
[L] => SimpleXMLElement Object
(
)

[C] => SimpleXMLElement Object
(
)

)

[HN] => /benefits
)

[2] => SimpleXMLElement Object
(
[U] => http://www..com/jobs//benefits.html
[UD] => http://www..com/jobs//benefits.html
[UE] => http://www..com/jobs//benefits.html
[T] =>  : Jobs :
[RK] => 10
[FS] => SimpleXMLElement Object
(
)

[S] => ... Benefits Summary. ...
The Benefits of a Unique Culture. At  ... success. Medical
Care Benefits. Available after ...
[LANG] => en
[HAS] => SimpleXMLElement Object
(
[L] => SimpleXMLElement Object
(
)

[C] => SimpleXMLElement Object
(
)

)

)

Etc..


--
PHP General Mailing List (ht

Re: [PHP] Object Array?

2006-05-18 Thread John Hicks

Jay Paulson wrote:

I have an object from using simpleXML and inside that object is an array
holding even more objects.  However, it's not acting like an array and
therefore I can't go through it. (i.e. I can't use the count function to see
how big it is and loop through it)

This below should be an array:

$xml->RES->R

When I use print_r($xml->RES) I get the below.  As you can see [R] => Array
but yet in the above example it is an object.  I'm so confused and lost.
Can anyone help?  PHP version 5.0.4

SimpleXMLElement Object
(
[M] => 2010



[R] => Array
(
[0] => SimpleXMLElement Object
(
[U] => http://.../benefits/

>

)

[1] => SimpleXMLElement Object
(
[U] => http://.../benefits/benefits_websites.html

> )


[2] => SimpleXMLElement Object
(
[U] => http://www..com/jobs//benefits.html


You are right: $xml->RES->R is an array.

If it doesn't act like an array, you might try assigning it to a new 
variable. Maybe something like this:


$MyArray = $xml->RES->R;
print_r($MyArray);

Others might have better ideas. Keep trying.

--J

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



Re: [PHP] Need help calling PHP page from another server.

2006-05-18 Thread Robert Filipovich

Looks like all of these are happening.


The description for Event ID ( 2000 ) in Source ( php ) cannot be found. The
local computer may not have the necessary registry information or message
DLL files to display messages from a remote computer. The following
information is part of the event: php[400], PHP Notice: Undefined index:
ocode in C:\siupchat\statusimage.php on line 39.

The description for Event ID ( 2000 ) in Source ( php ) cannot be found. The
local computer may not have the necessary registry information or message
DLL files to display messages from a remote computer. The following
information is part of the event: php[1812], PHP Notice: Undefined index:
ocode in C:\siupchat\statusimage.php on line 39.

The description for Event ID ( 2000 ) in Source ( php ) cannot be found. The
local computer may not have the necessary registry information or message
DLL files to display messages from a remote computer. The following
information is part of the event: php[1444], PHP Notice: Undefined index:
HTTP_REFERER in C:\siupchat\statusimage.php on line 52.
It is on an IIS server.  Any ideas what PHP.ini setting is causing this
error?

Thanks,
/Robert


On 5/18/06, John Hicks <[EMAIL PROTECTED]> wrote:


Please reply to the list.

Robert Filipovich wrote:
> I got this in the event viewer when I enabled suslogging.
>
>
> The description for Event ID ( 2000 ) in Source ( php ) cannot be found.
> The local computer may not have the necessary registry information or
> message DLL files to display messages from a remote computer. The
> following information is part of the event: php[144], PHP Notice:
> Undefined index: HTTP_REFERER in C:\siupchat\statusimage.php on line 52.

I can't grok this easily since it looks like it's coming from a strange
OS, but if I were you, I would begin by looking at line 52.

--J

P.S. Please reply to the list.

> On 5/18/06, *Robert Filipovich* <[EMAIL PROTECTED]
> > wrote:
>
> Why do you think it works on the local site?  Is it access to
> MySQL?  Seems weird since the provcessing should still be server
> side on the MySQL stuff.
>
> I will see what I can find in the log.
>
> /Robert
>
>
> On 5/18/06, *John Hicks* <[EMAIL PROTECTED]
> > wrote:
>
> John Hicks wrote:
> >  Robert Filipovich wrote:
> > > I am using a chat program and trying to call the status page
> from another
> > > server and the graphic that the page returns does not show
up.
> > >
> > > It works if you are calling from the webserver that the chat
> program is
> > > working so i feel it is some type of config problem or
> security issue.
> > >
> > > http://www.hidho.com/chattest.htm is the page that uses the
code
> > >
> > > http://chat.siuprem.com/siupchat/client.php',500,500)
> ">http://chat.siuprem.com/siupchat/statusimage.php
> "> and it
> works on
> > > http://chat.siuprem.com/siupchat/chattest.htm
>  which is the
> windows IIS
> > > sesrver where PHP is running.
> > >
> >
> >  Do you have access to the source of statusimage.php?
> >
> >  (I have a hunch it is checking the request's referer.)
> >
> >  --J
>
> Since this is open source code ('phpOnline') available at
> http://www.dayanahost.com/phponline.cfm
> 
> I guess it's safe to post an excerpt here:
>
> ...
> [a number of mysql statements without error checking or other
exits]
> ...
> [concluding with:]
>
> header ("Content-type: image/jpeg");
>
> if($LastAdmLoginTime==0 || $LastAdmLoginTime<($TTime-120))
> {
>echo implode('', file('pathtooffline.jpg'));
>$OnlineStatus = 0;
> }
> else
> {
>echo implode('', file('pathtoonline.jpg '));
> }
>
> Since both of these images are present (i.e. can be accessed
> directly)
> and since there isn't any exit prior to the execution of the
above
> statement, I conclude that the program must be erring out before
> it gets
> here.
>
> Check your php error log first. If you don't find anything there
> then
> edit the program to add error checking for all the sql commands.
>
> You might also find help at the phpOnline forums:
> http://www.dayanahost.com/forum2/index.php?act=SF&f=11&;
> 
>
> If you can't find the problem, since the program is short, you
could
> post it to the list.
>
> --J
>
>

Re: [PHP] Debug/Learn Recursion of an Object

2006-05-18 Thread Robert Cummings
On Thu, 2006-05-18 at 14:11, Graham Anderson wrote:
> I am a bit new to Objects and Recursion
> Any push in the right direction is appreciated
> 
> Generated from Pear's mimedecode, I have an object whose print_r is:
> http://www.siren.cc/dev/object.txt
> 
> 
> The function below will correctly traverse the object and find the  
> 'correct' node.
> Unfortunately, it is a little beyond my understanding at present. :(
> 
> Is there a way to debug the below function to echo how it is  
> traversing the object ?
> For example, how would I echo the key names  and values while it is  
> traversing ?

http://www.php.net/manual/en/control-structures.foreach.php

Right smack at the top in the grey box. In the future please try reading
the manual. This is simplistic question that any newbie should know
having read the manual.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Object Array?

2006-05-18 Thread Robert Cummings
On Thu, 2006-05-18 at 14:25, Jay Paulson wrote:
> I tried with no success yesterday to get an answer to this question so I'll
> try again.
> 
> I have an object from using simpleXML and inside that object is an array
> holding even more objects.  However, it's not acting like an array and
> therefore I can't go through it. (i.e. I can't use the count function to see
> how big it is and loop through it)
> 
> This below should be an array:
> 
> $xml->RES->R

Looks ot me like it isn't what it "should" be. It's an object.

Cheers,
Rob.

> 
> When I use print_r($xml->RES->R) I get $xml->RES->R[0] printed, which is
> below:
> 
> SimpleXMLElement Object
> (
> [U] => http://.../benefits/
> [UD] => http://.../benefits/
> [UE] => http://.../benefits/
> [T] => Benefits
> 
> [RK] => 10
> [CRAWLDATE] =>  17 May 2006
> [FS] => SimpleXMLElement Object
> (
> )
> 
> [S] => Home, Benefits Forms Jobs Training Locations, Who We Are
> E-Info Publications EVA Team Websites. ... 2006 Benefits
> Vote. Benefits Links. Benefits Websites. ...
> [LANG] => en
> [HAS] => SimpleXMLElement Object
> (
> [L] => SimpleXMLElement Object
> (
> )
> 
> [C] => SimpleXMLElement Object
> (
> )
> 
> )
> 
> )
> 
> 
> When I use print_r($xml->RES) I get the below.  As you can see [R] => Array
> but yet in the above example it is an object.  I'm so confused and lost.
> Can anyone help?  PHP version 5.0.4
> 
> SimpleXMLElement Object
> (
> [M] => 2010
> [FI] => SimpleXMLElement Object
> (
> )
> 
> [NB] => SimpleXMLElement Object
> (
> [NU] =>
> /search?q=benefits&site=default_collection&hl=en&lr=&ie=UTF-8&output=xml_no_
> dtd&client=default_frontend&access=p&sort=date:D:L:d1&start=10&sa=N
> )
> 
> [R] => Array
> (
> [0] => SimpleXMLElement Object
> (
> [U] => http://.../benefits/
> [UD] => http://.../benefits/
> [UE] => http://.../benefits/
> [T] => Benefits
> 
> [RK] => 10
> [CRAWLDATE] =>  17 May 2006
> [FS] => SimpleXMLElement Object
> (
> )
> 
> [S] => Home, Benefits Forms Jobs Training
> Locations, Who We Are E-Info Publications EVA Team Websites. ...
> 2006 Benefits Vote. Benefits Links. Benefits Websites.
> ...  
> [LANG] => en
> [HAS] => SimpleXMLElement Object
> (
> [L] => SimpleXMLElement Object
> (
> )
> 
> [C] => SimpleXMLElement Object
> (
> )
> 
> )
> 
> )
> 
> [1] => SimpleXMLElement Object
> (
> [U] => http://.../benefits/benefits_websites.html
> [UD] => http://.../benefits/benefits_websites.html
> [UE] => http://.../benefits/benefits_websites.html
> [T] => Benefits
> 
> [RK] => 9
> [CRAWLDATE] =>  17 May 2006
> [FS] => SimpleXMLElement Object
> (
> )
> 
> [S] => Home, Benefits Forms Jobs Training
> Locations, Who We Are E-Info Publications EVA Team Websites.
> Benefits Websites.  ...
> [LANG] => en
> [HAS] => SimpleXMLElement Object
> (
> [L] => SimpleXMLElement Object
> (
> )
> 
> [C] => SimpleXMLElement Object
> (
> )
> 
> )
> 
> [HN] => /benefits
> )
> 
> [2] => SimpleXMLElement Object
> (
> [U] => http://www..com/jobs//benefits.html
> [UD] => http://www..com/jobs//benefits.html
> [UE] => http://www..com/jobs//benefits.html
> [T] =>  : Jobs :
> [RK] => 10
> [FS] => SimpleXMLElement Object
> (
> )
> 
> [S] => ... Benefits Summary. ...
> The Benefits of a Unique Culture. At  ... success. Medical
> Care Benefits. Available after ...
> [LANG] => en
> [HAS] => SimpleXMLElement Object
> (
> [L] => SimpleXMLElement Object
> (
>

[PHP] Object Array?

2006-05-18 Thread Jay Paulson
I tried with no success yesterday to get an answer to this question so I'll
try again.

I have an object from using simpleXML and inside that object is an array
holding even more objects.  However, it's not acting like an array and
therefore I can't go through it. (i.e. I can't use the count function to see
how big it is and loop through it)

This below should be an array:

$xml->RES->R

When I use print_r($xml->RES->R) I get $xml->RES->R[0] printed, which is
below:

SimpleXMLElement Object
(
[U] => http://.../benefits/
[UD] => http://.../benefits/
[UE] => http://.../benefits/
[T] => Benefits

[RK] => 10
[CRAWLDATE] =>  17 May 2006
[FS] => SimpleXMLElement Object
(
)

[S] => Home, Benefits Forms Jobs Training Locations, Who We Are
E-Info Publications EVA Team Websites. ... 2006 Benefits
Vote. Benefits Links. Benefits Websites. ...
[LANG] => en
[HAS] => SimpleXMLElement Object
(
[L] => SimpleXMLElement Object
(
)

[C] => SimpleXMLElement Object
(
)

)

)


When I use print_r($xml->RES) I get the below.  As you can see [R] => Array
but yet in the above example it is an object.  I'm so confused and lost.
Can anyone help?  PHP version 5.0.4

SimpleXMLElement Object
(
[M] => 2010
[FI] => SimpleXMLElement Object
(
)

[NB] => SimpleXMLElement Object
(
[NU] =>
/search?q=benefits&site=default_collection&hl=en&lr=&ie=UTF-8&output=xml_no_
dtd&client=default_frontend&access=p&sort=date:D:L:d1&start=10&sa=N
)

[R] => Array
(
[0] => SimpleXMLElement Object
(
[U] => http://.../benefits/
[UD] => http://.../benefits/
[UE] => http://.../benefits/
[T] => Benefits

[RK] => 10
[CRAWLDATE] =>  17 May 2006
[FS] => SimpleXMLElement Object
(
)

[S] => Home, Benefits Forms Jobs Training
Locations, Who We Are E-Info Publications EVA Team Websites. ...
2006 Benefits Vote. Benefits Links. Benefits Websites.
...  
[LANG] => en
[HAS] => SimpleXMLElement Object
(
[L] => SimpleXMLElement Object
(
)

[C] => SimpleXMLElement Object
(
)

)

)

[1] => SimpleXMLElement Object
(
[U] => http://.../benefits/benefits_websites.html
[UD] => http://.../benefits/benefits_websites.html
[UE] => http://.../benefits/benefits_websites.html
[T] => Benefits

[RK] => 9
[CRAWLDATE] =>  17 May 2006
[FS] => SimpleXMLElement Object
(
)

[S] => Home, Benefits Forms Jobs Training
Locations, Who We Are E-Info Publications EVA Team Websites.
Benefits Websites.  ...
[LANG] => en
[HAS] => SimpleXMLElement Object
(
[L] => SimpleXMLElement Object
(
)

[C] => SimpleXMLElement Object
(
)

)

[HN] => /benefits
)

[2] => SimpleXMLElement Object
(
[U] => http://www..com/jobs//benefits.html
[UD] => http://www..com/jobs//benefits.html
[UE] => http://www..com/jobs//benefits.html
[T] =>  : Jobs :
[RK] => 10
[FS] => SimpleXMLElement Object
(
)

[S] => ... Benefits Summary. ...
The Benefits of a Unique Culture. At  ... success. Medical
Care Benefits. Available after ...
[LANG] => en
[HAS] => SimpleXMLElement Object
(
[L] => SimpleXMLElement Object
(
)

[C] => SimpleXMLElement Object
(
)

)

)

Etc..

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



[PHP] Debug/Learn Recursion of an Object

2006-05-18 Thread Graham Anderson

I am a bit new to Objects and Recursion
Any push in the right direction is appreciated

Generated from Pear's mimedecode, I have an object whose print_r is:
http://www.siren.cc/dev/object.txt


The function below will correctly traverse the object and find the  
'correct' node.

Unfortunately, it is a little beyond my understanding at present. :(

Is there a way to debug the below function to echo how it is  
traversing the object ?
For example, how would I echo the key names  and values while it is  
traversing ?


The hope is that something will click and I'll finally wrap my brain  
around this


many thanks





function getBody(&$part, $primary = 'text', $secondary = 'plain')
{
$body = false;


if (is_array($part)) {

foreach($part as $subpart) {
if (! $body = getBody($subpart, $primary, $secondary)) {
continue;
} else {
return $body;

}
}

} else {

if (isset($part->parts)) {

return getBody($part->parts, $primary, $secondary);

} else {

if ($part->ctype_primary == $primary && $part->ctype_secondary ==  
$secondary) {

return($part->body);
}

}
}
return $body;
}

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



[PHP] Re: PHP and mySQL getting smashed...

2006-05-18 Thread Robert Samuel White
Upgrade your MySQL distribution to the latest version (5+).

 

Upgrade any shared MySQL libraries to the latest distribute.

 

Recompile MySQL with mysqli support.

 

http://php.net/mysqli

 

And use that instead of the regular MySQL functions.

 

That's what I did and it has made a huge difference.

 

Not to mention, the mysqli library has so many more functions available to
you.

 

~Samuel

 

 



[PHP] Re: [Repost] Getting rid of "Web page has expired" (POSTDATA Error)

2006-05-18 Thread Robert Samuel White
You might want to modify your coding.  The way I prevent this problem from
ever happening is this:

 

1.  The user completes information on the form.

2.  The form is validated by PHP.

3.  If there are errors, then the form is reshown with their values
populated.

4.  Once all errors are corrected, I process the form and then use a
Header("Location: ") to redirect the user to the same page (or another
page).

 

This has the advantage of allowing a user to click the back button and
seeing their form with their values still intact.

 

This prevents a method post page from being in the user's browser history.



Re: [PHP] Need help calling PHP page from another server.

2006-05-18 Thread John Hicks

Please reply to the list.

Robert Filipovich wrote:

I got this in the event viewer when I enabled suslogging.
 

The description for Event ID ( 2000 ) in Source ( php ) cannot be found. 
The local computer may not have the necessary registry information or 
message DLL files to display messages from a remote computer. The 
following information is part of the event: php[144], PHP Notice: 
Undefined index: HTTP_REFERER in C:\siupchat\statusimage.php on line 52.


I can't grok this easily since it looks like it's coming from a strange 
OS, but if I were you, I would begin by looking at line 52.


--J

P.S. Please reply to the list.

On 5/18/06, *Robert Filipovich* <[EMAIL PROTECTED] 
> wrote:


Why do you think it works on the local site?  Is it access to
MySQL?  Seems weird since the provcessing should still be server
side on the MySQL stuff.
 
I will see what I can find in the log.
 
/Robert


 
On 5/18/06, *John Hicks* <[EMAIL PROTECTED]

> wrote:

John Hicks wrote:
>  Robert Filipovich wrote:
> > I am using a chat program and trying to call the status page
from another
> > server and the graphic that the page returns does not show up.
> >
> > It works if you are calling from the webserver that the chat
program is
> > working so i feel it is some type of config problem or
security issue.
> >
> > http://www.hidho.com/chattest.htm is the page that uses the code
> >
> > http://chat.siuprem.com/siupchat/client.php',500,500)
">http://chat.siuprem.com/siupchat/statusimage.php
"> and it
works on
> > http://chat.siuprem.com/siupchat/chattest.htm
 which is the
windows IIS
> > sesrver where PHP is running.
> >
>
>  Do you have access to the source of statusimage.php?
>
>  (I have a hunch it is checking the request's referer.)
>
>  --J

Since this is open source code ('phpOnline') available at
http://www.dayanahost.com/phponline.cfm

I guess it's safe to post an excerpt here:

...
[a number of mysql statements without error checking or other exits]
...
[concluding with:]

header ("Content-type: image/jpeg");

if($LastAdmLoginTime==0 || $LastAdmLoginTime<($TTime-120))
{
   echo implode('', file('pathtooffline.jpg'));
   $OnlineStatus = 0;
}
else
{
   echo implode('', file('pathtoonline.jpg '));
}

Since both of these images are present (i.e. can be accessed
directly)
and since there isn't any exit prior to the execution of the above
statement, I conclude that the program must be erring out before
it gets
here.

Check your php error log first. If you don't find anything there
then
edit the program to add error checking for all the sql commands.

You might also find help at the phpOnline forums:
http://www.dayanahost.com/forum2/index.php?act=SF&f=11&;


If you can't find the problem, since the program is short, you could
post it to the list.

--J


 





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



RE: [PHP] LDAP Query

2006-05-18 Thread php
For anyone interested: after some furhter troubleshooting, I found the error.  
The password I was passing was incorrect.  What I found interesting is that 
even though the password was incorrect, the bind function still worked.  I'm 
thinking that it logged me in as anonymous at that stage.

>Our organization is migrating away from Novell E-directory to MS Active 
>Directory.  I have a php class that allows me to run various queries on our 
>e-directory ldap server which I am working to convert to AD.  However, I'm 
>running into an error that i cannot figure out.  I have updated the base_dn to 
>point tothe correct location (verified by a third party ldap browser).  Also 
>added a username and password since our AD environment doesn't allow anonymous 
>queries.  The error I get is 
>
>Warning: ldap_search() [function.ldap-search]: Search: Operations error in 
>/var/www/html/intranet/_php/class.ldap_test.php on line 149
>
>On that line I have this line of code
>$result = ldap_search($this->conn,$this->base_dn,$filter);
>
>Where $this->conn evaluates to Resource id #3, $this->base_dn is the correct 
>dn (ou=something,dc=domain,dc=domain_part_2) and $filter is cn=myusername
>
>Can anyone shed some light on this?  Below is the entire method from the 
>class.
>
>   function connectldap($filter,$override=false) {
>   //connect to the server
>   $this->conn = ldap_connect($this->server);
>   
>   //if the connection failed, set the error message
>   //and return false
>   if(!$this->conn) {
>   $this->errMsg[] = "Unable to connect to server\n";
>   return false;
>   }
>   //ldap_set_option($this->conn, LDAP_OPT_PROTOCOL_VERSION, 3);
>   //bind the connection.  This function will perform an
>   //anonymous query to get the full 
>   $bind = @ldap_bind($this->conn,$this->ldap_user,$ldap_passwd);
>   if(!$bind) {
>   $this->errMsg[] =  "Unable to bind to server\n";
>   return false;
>   }
>   echo "$filter - " . $this->conn . " - " . $bind . " - " . 
> $this->base_dn 
>. "\n";
>   //run the ldap query
>   $result = ldap_search($this->conn,$this->base_dn,$filter);
>   //if the search failed, then return false and set the error 
> message
>   if(!$result) {
>   $this->errMsg[] =  "Search failed - " . 
> ldap_error($this->conn) . "\n";
>   return false;
>   }
>   //get the entries and store them in a variable
>   $info=ldap_get_entries($this->conn,$result);
>   
>   //if the number of entries reutnred is zero, then the user
>   //could not be found in the ldap server
>   if($info["count"] == 0) {
>   $this->errMsg[] =  "User Unknown\n";
>   return false;
>   }
>   //otherwise, if the number of entries found is greater than 1, 
> then
>   //more than one object was found.
>   elseif($info["count"]>1 && !$override) {
>   $this->errMsg[] =  "There was more than one user 
> found\n";
>   return false;
>   }
>   else {
>   return $info;
>   }
>   }
>
>Thank you,
>Robbert van Andel
>
>-- 
>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] Pictures and caches

2006-05-18 Thread Stut

Eric Butera wrote:

On 5/18/06, Gustav Wiberg <[EMAIL PROTECTED]> wrote:
I had to do something similar to keep a javascript file from being
cached by an aol proxy.  Heres a simple example that you could change
to suit your needs by changing the js to something like image.php and
making it send image headers and outputting the contents of your file.

1) Rewrite rule in httpd.conf or virtual.conf
===
RewriteRule ^/lib/(.*)/test.js.php /lib/test.js.php [QSA,L]


2) Create test.js.php in /lib/test.js.php
===



3) Access url: http://example.local/lib/4908574987/test.js.php.  You
can create your url like /lib/time()/test.js.php.

This way you don't have to worry about creating and deleting files.


There's no need to use mod_rewrite for this. You'll get the same result 
if you us a url like


$url = '/lib/test.js.php?'.time();

It's a nail, use a hammer not the screwdriver.

-Stut

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



Re: [PHP] What's this in my dir list?

2006-05-18 Thread Jochem Maas

tedd wrote:

At 10:58 AM -0400 5/18/06, John Nichel wrote:


tedd wrote:


Hi Gang:

When I list one of my directories, via:

echo("");
system("ls -l");
echo("");

I get:

-rw-r--r--  1 ancientstones psacln  6980 Apr 28 18:46 ancientstones.gif
-rw-r--r--  1 ancientstones psacln  2090 May 14 10:10 as.css
-rw-r--r--  1 ancientstones psacln   658 May  2 14:59 big_m.php


--^ -> Type of file
---^^^ -> User bits (user has read write)
--^^^ -> Group bits (group can read)
-^^^ -> Other bits (world can read)
--^ -> Hard links
^ -> User (owner)
--^^ -> Group
-- -> Filesize
--- -> last mod
 -> filename

Really, I'm not trying to be a dick, but buy a book/research this 
online.  It's pretty important for the security of your system.


--
John C. Nichel IV



No problem being a dick -- my question was "is psacln the group"?


which is a question about the *nix filesystem - bit off the scope for
this list.

btw 'psacln' is a group created by Plesk Hosting Software installations.
googling for 'psacln' on its own actually would have given you this info
and confirmed that it is indeed a user group.



The answer was "Yes". I was looking for conformation.


confirmation as in confirm not conform.

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



Re: [PHP] Pictures and caches

2006-05-18 Thread Eric Butera

On 5/18/06, Gustav Wiberg <[EMAIL PROTECTED]> wrote:

Hi!

The thing I want to do is to copy a picturefile to another picturefile.
The thing is that I want to copy this file, show it , and then delete it
(when it has been shown) .Is this possible?

I want to do this, because of avoiding problems with cache when uploading
file through an admin-online-system... (the customer uses IE)

When I delete the file in code down below, the picture is not shown (I guess
because the browser hasn't rendered out all info?)

If you want more code, tell me :-)

Best regards
/Gustav Wiberg



$fileName = "pictures/products/$dbIDProduct1" . "_small";

$ran = strval(mktime()); //Current time

if (file_exists($fileName . ".gif")) {

copy($fileName . ".gif", "pictures/products/1_$ran.gif");
showpicture("pictures/products/1_$ran.gif", $dbProductName1, 300, 150,
"top");
//deletefile("pictures/products/1_$ran.gif");

}

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




I had to do something similar to keep a javascript file from being
cached by an aol proxy.  Heres a simple example that you could change
to suit your needs by changing the js to something like image.php and
making it send image headers and outputting the contents of your file.

1) Rewrite rule in httpd.conf or virtual.conf
===
RewriteRule ^/lib/(.*)/test.js.php /lib/test.js.php [QSA,L]


2) Create test.js.php in /lib/test.js.php
===



3) Access url: http://example.local/lib/4908574987/test.js.php.  You
can create your url like /lib/time()/test.js.php.

This way you don't have to worry about creating and deleting files.

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



RE: [PHP] Warning: chmod(): Operation not permitted ?

2006-05-18 Thread tedd

At 5:11 PM -0600 5/17/06, Brady Mitchell wrote:

 > "chmod() can only change the permissions of files that are owned by

 the user running the command. In most cases, this is the user that
 the web server runs on."

 That confuses me, because who's the user here? Is it just the system
 administrator or the application?


This is the user that Apache (or whatever webserver) is running as.  If
you're using Apache, look at your httpd.conf file to find out who that
user is.  If you're creating files successfully, you can just look at
the owner of that file to find out who it is.

Is safe_mode enabled?

 >From the manual (http://us3.php.net/chmod):



In my code, I use:

ini_set( 'safe_mode', '0' );

Which I think disables "safe_mode" and from what I've read, the 
default is off and in my phpinfo, it says it's 'off" -- so I think 
it's off. :-)



Note:  When safe mode is enabled, PHP checks whether the files or
directories you are about to operate on have the same UID (owner) as the
script that is being executed. In addition, you cannot set the SUID,
SGID and sticky bits.


I understand that, except for the sticky bits -- I don't know what 
they are, but will look them up later.


But safe_mode is off, so any application should be able to chmod(), right?

However, when my application tries to change permissions via chmod(), 
it fails and generates a warning.


BUT -- considering that this is a permission issue and not a php one, 
as I've been told, I'll end this thread and look elsewhere for an 
answer.


Thanks.

tedd
--

http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Warning: chmod(): Operation not permitted ?

2006-05-18 Thread John Nichel

tedd wrote:
File permissions is beyond the scope of this mailing list.  You need 
to buy a book, research on the web, etc., on *nix system 
administration, and concentrate on the filesystem/security/permissions 
sections, and the section on how apps/daemons operate.


--
John C. Nichel IV



John:

My question basically was "why isn't chmod() working for me?" So, I 
thought it might be a question to pose to a php mailing list -- my 
mistake, sorry.


chmod() is working the way it's supposed to.  You're not getting the 
results you desire, and to understand why, you need to understand how 
file ownership and permissions work on a *nix system.


PS: 0777 -- so you never go to extremes, or press limits, to try to 
solve a problem?




Not when it will compromise the security of my system.  There is always 
another way to solve the problem.


--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] Need help calling PHP page from another server.

2006-05-18 Thread John Hicks

John Hicks wrote:

Robert Filipovich wrote:

I am using a chat program and trying to call the status page from another
server and the graphic that the page returns does not show up.

It works if you are calling from the webserver that the chat program is
working so i feel it is some type of config problem or security issue.

http://www.hidho.com/chattest.htm is the page that uses the code

http://chat.siuprem.com/siupchat/client.php',500,500)">http://chat.siuprem.com/siupchat/statusimage.php";> and it works on
http://chat.siuprem.com/siupchat/chattest.htm which is the windows IIS
sesrver where PHP is running.



Do you have access to the source of statusimage.php?

(I have a hunch it is checking the request's referer.)

--J


Since this is open source code ('phpOnline') available at
http://www.dayanahost.com/phponline.cfm
I guess it's safe to post an excerpt here:

...
[a number of mysql statements without error checking or other exits]
...
[concluding with:]

header ("Content-type: image/jpeg");

if($LastAdmLoginTime==0 || $LastAdmLoginTime<($TTime-120))
{
echo implode('', file('pathtooffline.jpg'));
$OnlineStatus = 0;
}
else
{
echo implode('', file('pathtoonline.jpg'));
}

Since both of these images are present (i.e. can be accessed directly) 
and since there isn't any exit prior to the execution of the above 
statement, I conclude that the program must be erring out before it gets 
here.


Check your php error log first. If you don't find anything there then 
edit the program to add error checking for all the sql commands.


You might also find help at the phpOnline forums: 
http://www.dayanahost.com/forum2/index.php?act=SF&f=11&;


If you can't find the problem, since the program is short, you could 
post it to the list.


--J

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



Re: [PHP] Warning: chmod(): Operation not permitted ?

2006-05-18 Thread tedd
File permissions is beyond the scope of this mailing list.  You need 
to buy a book, research on the web, etc., on *nix system 
administration, and concentrate on the 
filesystem/security/permissions sections, and the section on how 
apps/daemons operate.


--
John C. Nichel IV



John:

My question basically was "why isn't chmod() working for me?" So, I 
thought it might be a question to pose to a php mailing list -- my 
mistake, sorry.


In any event, I'll figure it out.

Thanks.

tedd

PS: 0777 -- so you never go to extremes, or press limits, to try to 
solve a problem?


--

http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] What's this in my dir list?

2006-05-18 Thread tedd

At 10:58 AM -0400 5/18/06, John Nichel wrote:

tedd wrote:

Hi Gang:

When I list one of my directories, via:

echo("");
system("ls -l");
echo("");

I get:

-rw-r--r--  1 ancientstones psacln  6980 Apr 28 18:46 ancientstones.gif
-rw-r--r--  1 ancientstones psacln  2090 May 14 10:10 as.css
-rw-r--r--  1 ancientstones psacln   658 May  2 14:59 big_m.php

--^ -> Type of file
---^^^ -> User bits (user has read write)
--^^^ -> Group bits (group can read)
-^^^ -> Other bits (world can read)
--^ -> Hard links
^ -> User (owner)
--^^ -> Group
-- -> Filesize
--- -> last mod
 -> filename

Really, I'm not trying to be a dick, but buy a book/research this 
online.  It's pretty important for the security of your system.


--
John C. Nichel IV


No problem being a dick -- my question was "is psacln the group"?

The answer was "Yes". I was looking for conformation.

Thanks.

tedd
--

http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] LDAP Query

2006-05-18 Thread php
Our organization is migrating away from Novell E-directory to MS Active 
Directory.  I have a php class that allows me to run various queries on our 
e-directory ldap server which I am working to convert to AD.  However, I'm 
running into an error that i cannot figure out.  I have updated the base_dn to 
point tothe correct location (verified by a third party ldap browser).  Also 
added a username and password since our AD environment doesn't allow anonymous 
queries.  The error I get is 

Warning: ldap_search() [function.ldap-search]: Search: Operations error in 
/var/www/html/intranet/_php/class.ldap_test.php on line 149

On that line I have this line of code
$result = ldap_search($this->conn,$this->base_dn,$filter);

Where $this->conn evaluates to Resource id #3, $this->base_dn is the correct dn 
(ou=something,dc=domain,dc=domain_part_2) and $filter is cn=myusername

Can anyone shed some light on this?  Below is the entire method from the class.

function connectldap($filter,$override=false) {
//connect to the server
$this->conn = ldap_connect($this->server);

//if the connection failed, set the error message
//and return false
if(!$this->conn) {
$this->errMsg[] = "Unable to connect to server\n";
return false;
}
//ldap_set_option($this->conn, LDAP_OPT_PROTOCOL_VERSION, 3);
//bind the connection.  This function will perform an
//anonymous query to get the full 
$bind = @ldap_bind($this->conn,$this->ldap_user,$ldap_passwd);
if(!$bind) {
$this->errMsg[] =  "Unable to bind to server\n";
return false;
}
echo "$filter - " . $this->conn . " - " . $bind . " - " . 
$this->base_dn . "\n";
//run the ldap query
$result = ldap_search($this->conn,$this->base_dn,$filter);
//if the search failed, then return false and set the error 
message
if(!$result) {
$this->errMsg[] =  "Search failed - " . 
ldap_error($this->conn) . "\n";
return false;
}
//get the entries and store them in a variable
$info=ldap_get_entries($this->conn,$result);

//if the number of entries reutnred is zero, then the user
//could not be found in the ldap server
if($info["count"] == 0) {
$this->errMsg[] =  "User Unknown\n";
return false;
}
//otherwise, if the number of entries found is greater than 1, 
then
//more than one object was found.
elseif($info["count"]>1 && !$override) {
$this->errMsg[] =  "There was more than one user 
found\n";
return false;
}
else {
return $info;
}
}

Thank you,
Robbert van Andel

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



Re: [PHP] Getting rid of "Web page has expired" (POSTDATA error)

2006-05-18 Thread Chris Shiflett

I wrote an article on this subject that might help:

http://shiflett.org/articles/guru-speak-nov2004

Chris

--
Chris Shiflett
Principal, OmniTI
http://omniti.com/

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



Re: [PHP] [Repost] Getting rid of "Web page has expired" (POSTDATAerror)

2006-05-18 Thread chris smith

On 5/19/06, Nicolas Verhaeghe <[EMAIL PROTECTED]> wrote:

I have searched and not found...


http://marc.theaimsgroup.com/?t=10980586931&r=1&w=2
http://marc.theaimsgroup.com/?t=10751522972&r=1&w=2
http://marc.theaimsgroup.com/?t=10620110712&r=1&w=2


--
Postgresql & php tutorials
http://www.designmagick.com/

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



RE: [PHP] [Repost] Getting rid of "Web page has expired" (POSTDATAerror)

2006-05-18 Thread Nicolas Verhaeghe
I have searched and not found...


-Original Message-
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 18, 2006 1:21 AM
To: Nicolas Verhaeghe
Cc: php-general@lists.php.net
Subject: Re: [PHP] [Repost] Getting rid of "Web page has expired"
(POSTDATAerror)


Nicolas Verhaeghe wrote:
> I am having an issue with certain pages preventing the user from going 
> back to the previous page.
>  
> The message given by Firefox is: "The page you are trying to view 
> contains PSTDATA that has expired from cache".

This has been discussed a lot in the past. Check the archives:

http://marc.theaimsgroup.com/?l=php-general

-- 
Postgresql & php tutorials
http://www.designmagick.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] What's this in my dir list?

2006-05-18 Thread John Nichel

tedd wrote:

Hi Gang:

When I list one of my directories, via:

echo("");
system("ls -l");
echo("");

I get:

-rw-r--r--  1 ancientstones psacln  6980 Apr 28 18:46 ancientstones.gif
-rw-r--r--  1 ancientstones psacln  2090 May 14 10:10 as.css
-rw-r--r--  1 ancientstones psacln   658 May  2 14:59 big_m.php

--^ -> Type of file
---^^^ -> User bits (user has read write)
--^^^ -> Group bits (group can read)
-^^^ -> Other bits (world can read)
--^ -> Hard links
^ -> User (owner)
--^^ -> Group
-- -> Filesize
--- -> last mod
 -> filename

Really, I'm not trying to be a dick, but buy a book/research this 
online.  It's pretty important for the security of your system.


--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] Warning: chmod(): Operation not permitted ?

2006-05-18 Thread John Nichel

tedd wrote:

At 11:18 AM -0400 5/17/06, John Nichel wrote:

tedd wrote:

Hi (please insert your preference):

This should be simple, but I'm having problems.

I have a program that uploads an image file and then tries to set the 
permissions for the image (to be altered later). However, I get a 
"Warning: chmod(): Operation not permitted" error when trying to set 
the permission, what gives? If my program created the file, shouldn't 
it have permission to set the files permissions?


What am I not understanding?


Without seeing code, permissions of the directories, what sticky bits 
might or might not be set, etc., you could not be understanding many 
thingsor just onewho knows.


I read all of your Google links, but no help. Just another example of 
how Google is not the answer.


Then you're asking the wrong question.


In any event, my code is pretty simple, just:

chmod($url, 0755);  //where $url is the file I want to change.

The error I receive is noted above in the subject line.

The permissions of the directories vary, but the folder that has the 
file I want to change permissions is currently set at 0777.


Nice security there.  Regardless, even if the user your webserver is 
running as has write permission to the directory (don't know who 
owns/what group that directory belongs to, as you didn't tell us that), 
you won't be able to change permissions of a file in that directory if 
the file isn't owned by the same user apache is running as.


In doing a lstat() of both the parent program that created the file and 
the child file shows that they both have the identical uid and gid 
(i.e., the same user and group id's).


And what user does Apache run as?


Now, everything I've read, says:

chmod() changes the permission of the specified file with the following 
caveat.


"chmod() can only change the permissions of files that are owned by the 
user running the command. In most cases, this is the user that the web 
server runs on."


That confuses me, because who's the user here? Is it just the system 
administrator or the application?


And if it is just the system administrator, then can't the system admin 
change anything he/she wants anyway? What's the point of having uid and 
gid's if a program can't change the permissions of a sibling file?


This question should answer the previous question for you.

I have tons of references as to what php filesystem functions are 
available, but I need a good reference as to what permissions are and 
how they actually can be changed in php -- does anyone have one a good 
reference OR care to explain?


As it is now, I know how ride the horse, but I can't get the gate open.


File permissions is beyond the scope of this mailing list.  You need to 
buy a book, research on the web, etc., on *nix system administration, 
and concentrate on the filesystem/security/permissions sections, and the 
section on how apps/daemons operate.


--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] What's this in my dir list?

2006-05-18 Thread cajbecu
yup, psacln is the group of the user ancientstones who`s owner of the files.

tedd wrote:
> Hi Gang:
> 
> When I list one of my directories, via:
> 
> echo("");
> system("ls -l");
> echo("");
> 
> I get:
> 
> -rw-r--r--  1 ancientstones psacln  6980 Apr 28 18:46 ancientstones.gif
> -rw-r--r--  1 ancientstones psacln  2090 May 14 10:10 as.css
> -rw-r--r--  1 ancientstones psacln   658 May  2 14:59 big_m.php
> ...
> 
> My question is, what is "psacln"?
> 
> In all the reference material I've looked at, that column is absent. Is
> that the "name" for the group?
> 
> Thanks.
> 
> tedd

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



[PHP] Re: What's this in my dir list?

2006-05-18 Thread Barry

tedd schrieb:

Hi Gang:

When I list one of my directories, via:

echo("");
system("ls -l");
echo("");

I get:

-rw-r--r--  1 ancientstones psacln  6980 Apr 28 18:46 ancientstones.gif
-rw-r--r--  1 ancientstones psacln  2090 May 14 10:10 as.css
-rw-r--r--  1 ancientstones psacln   658 May  2 14:59 big_m.php
...

My question is, what is "psacln"?

In all the reference material I've looked at, that column is absent. Is 
that the "name" for the group?


Thanks.

tedd

groupowner of that file.
yes.

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



[PHP] What's this in my dir list?

2006-05-18 Thread tedd

Hi Gang:

When I list one of my directories, via:

echo("");
system("ls -l");
echo("");

I get:

-rw-r--r--  1 ancientstones psacln  6980 Apr 28 18:46 ancientstones.gif
-rw-r--r--  1 ancientstones psacln  2090 May 14 10:10 as.css
-rw-r--r--  1 ancientstones psacln   658 May  2 14:59 big_m.php
...

My question is, what is "psacln"?

In all the reference material I've looked at, that column is absent. 
Is that the "name" for the group?


Thanks.

tedd
--

http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] PEAR Algorithms/Containers

2006-05-18 Thread Robert Cummings
On Thu, 2006-05-18 at 06:41, Andrew Brampton wrote:
> Hi,
> 
> In the past few weeks I've found the need for a hash table and a container 
> that gives me O(log) search efficiency. Now I'm aware I can use associative 
> arrays for my hash table, but I wanted to ensure efficiency. For my O(log) 
> container I ended up using a sorted array, and a binary search (which I had 
> to write).
> 
> Now I thought common data structures, and algorithms, like these, and many 
> others such as Binary Trees, Red/Black Trees and sorting algorithms and so 
> on would be a useful addition to PHP, or more specifically PEAR, however I 
> was unable to find any previous classes that provided these structures.
> 
> So I figured I would make a set of containers and algorithms that could be 
> used in a generic way , and hopefully put this code into PEAR. But before I 
> start making nice PEAR code, I wanted to ask why nothing like this already 
> exists? Is it because everyone has been to lazy until now, or is there a 
> real reason that I'm missing that has made such structures pointless.

They more than likely don't exist because PHP's associative array is
O(lg n) and so everything else is pretty much just as good, except not
quite as good because it will be implemented in PHP whereas the internal
associative array is in C. Additionally PHP already provides all you
could probably need for sorting. If this is purely for academic fun then
I'd say go ahead, but if you are thinking real life applications, then
I'd suggest spending your time on algorithms that don't have a
just-as-good alternative already implemented internally.

BTW, I don't think you can make an O(1) hash table in PHP since even if
you succeeded in making a perfect hash then PHP will perform O(lg n)
lookup into whatever structure you've made.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] PEAR Algorithms/Containers

2006-05-18 Thread tedd

At 11:41 AM +0100 5/18/06, Andrew Brampton wrote:

Hi,

In the past few weeks I've found the need for a hash table and a 
container that gives me O(log) search efficiency. Now I'm aware I 
can use associative arrays for my hash table, but I wanted to ensure 
efficiency. For my O(log) container I ended up using a sorted array, 
and a binary search (which I had to write).


Now I thought common data structures, and algorithms, like these, 
and many others such as Binary Trees, Red/Black Trees and sorting 
algorithms and so on would be a useful addition to PHP, or more 
specifically PEAR, however I was unable to find any previous classes 
that provided these structures.


So I figured I would make a set of containers and algorithms that 
could be used in a generic way , and hopefully put this code into 
PEAR. But before I start making nice PEAR code, I wanted to ask why 
nothing like this already exists? Is it because everyone has been to 
lazy until now, or is there a real reason that I'm missing that has 
made such structures pointless.


thanks for any comments/replies
Andrew



Andrew:

I know what you are talking about, I wrote a splay binary-tree demo, see:

http://www.sperling.com/freeware.php

I've often wondered if there are algorithms like that in php buried somewhere.

However, binary-trees are for searching and I use MySQL for that. I 
don't know specifically how MySQL preforms searches. I had hoped that 
somewhere one could set a bit and change the algorithms, but I 
haven't been able to find any references that allow that.


In any event, the size of the things I work with (<50k items) are so 
small that it really doesn't matter for me -- and I don't know at 
what size where it starts to be a problem for others.


So, if I was to take my previous code and port it over to php, I 
would most certainly test it against MySQL for performance before 
spending too much time providing something that doesn't significantly 
improve the status-quo.


tedd
--

http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Add Multiple Items, Qty to Cart from html form

2006-05-18 Thread Wolf

> a useful addition can be to use the item id in the 'key' of the input names
> (and always quoting your element attributes is highly recommended):
Yes, when I generate my cart I use the itemID as a key field (since the
ID stayed the same but the # in the database could change).

And ALWAYS quote your inputs in HTML.  It makes for a lot less
headaches.  But then I wasn't sending COMPLETE code, just enough to get
him on the right track. :)

We should all be using the guidelines within http://phpsec.org/ to keep
good coding practices.



> another thing that popped into my head was the fact that it's
> probably not intended behaviour to allow the customer to determine the
> unit price of an item -
> but if it is then can I have 10 Plasma Screens at 1 dollar a pop? ;-)
I too need the screens at 1 dollar (52" Wide-screen format please) as
well as the 6-person hot-tub and deck combo.

Wolf

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



Re: [PHP] PEAR Algorithms/Containers

2006-05-18 Thread Jochem Maas

Andrew Brampton wrote:

Hi,

In the past few weeks I've found the need for a hash table and a 
container that gives me O(log) search efficiency. Now I'm aware I can 
use associative arrays for my hash table, but I wanted to ensure 
efficiency. For my O(log) container I ended up using a sorted array, and 
a binary search (which I had to write).


Now I thought common data structures, and algorithms, like these, and 
many others such as Binary Trees, Red/Black Trees and sorting algorithms 
and so on would be a useful addition to PHP, or more specifically PEAR, 
however I was unable to find any previous classes that provided these 
structures.


So I figured I would make a set of containers and algorithms that could 
be used in a generic way , and hopefully put this code into PEAR. But 
before I start making nice PEAR code, I wanted to ask why nothing like 
this already exists? Is it because everyone has been to lazy until now, 
or is there a real reason that I'm missing that has made such structures 
pointless.


sounds like a good idea. probably the reason it doesn't exist is because
the entry level for making something worthwhile is high - and most people
with such needs end up building something specific because it's easier.

if you do go the PEAR route my suggestion would be to avoid all/any of the
PEAR base classes - to save bloat and make the components more usable for
people who don't want/need PEAR (or are not allowed to use it).



thanks for any comments/replies
Andrew


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



Re: [PHP] Add Multiple Items, Qty to Cart from html form

2006-05-18 Thread Jochem Maas

Wolf wrote:

Andras,

Apples  


a useful addition can be to use the item id in the 'key' of the input names
(and always quoting your element attributes is highly recommended):

Apples  

that way you can easily fish out the quantities when looping the
selected items (example mostly ignores input cleaning/validation for brevity 
etc -
but you shouldn't :-) e.g. get anal about make sure things are actually 
integers when
that is what you require, etc):

foreach ($_POST['item'] as $itemId => $itemName) {
if (isset($_POST['item'][$itemId]) && ($qty = 
intval($_POST['item'][$itemId])) {
addItem($itemId, $qty);
}
}

another thing that popped into my head was the fact that it's
probably not intended behaviour to allow the customer to determine the
unit price of an item -
but if it is then can I have 10 Plasma Screens at 1 dollar a pop? ;-)



Will get you where you need to go on the HTML side of things, then on
the back end you need to process each array.  By setting a default value
of 0 for the qty, you force users to change the values, but you also
keep your arrays intact and easier (IMHO) to deal with.

Wolf

Andras Kende wrote:


Hello,

I trying to add multiple items to a shopping cart with selectable
quantity and price form text field like..

apple   : qty: [__]  price: [__]
orange : qty: [__]  price: [__]



I could add multiple items with checkboxes but without selecting
quantity and price..

if (isset($_POST['itemschecked'])) {
foreach($_POST['itemschecked'] as $itemschecked => $checkeditems ){
AddItem($checkeditems, 1);
}

Any help is appreciated..

Thanks,

Andras





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



RE: [PHP] Add Multiple Items, Qty to Cart from html form

2006-05-18 Thread Andras Kende

-Original Message-
From: Wolf [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 17, 2006 9:47 PM
To: Andras Kende
Cc: php-general@lists.php.net
Subject: Re: [PHP] Add Multiple Items, Qty to Cart from html form

Andras,

Apples  

Will get you where you need to go on the HTML side of things, then on
the back end you need to process each array.  By setting a default value
of 0 for the qty, you force users to change the values, but you also
keep your arrays intact and easier (IMHO) to deal with.

Wolf

Andras Kende wrote:
> Hello,
> 
> I trying to add multiple items to a shopping cart with selectable
> quantity and price form text field like..
> 
> apple   : qty: [__]  price: [__]
> orange : qty: [__]  price: [__]
> 
> 
> 
> I could add multiple items with checkboxes but without selecting
> quantity and price..
> 
> if (isset($_POST['itemschecked'])) {
> foreach($_POST['itemschecked'] as $itemschecked => $checkeditems ){
> AddItem($checkeditems, 1);
> }
> 
> Any help is appreciated..
> 
> Thanks,
> 
> Andras


Wolf,

The tip worked great !! All working as expected now...

$listvals=$_POST['item'];
$n=count($listvals);
$i=0;
while ( $i < $n )  {
if ($qty[$i] > 0) {
AddItem($item[$i], $qty[$i]);
UpdatePrice($item[$i], $price[$i]);
}
$i++;
}

Thanks,

Andras Kende
http://www.kende.com

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



Re: [PHP] Re: Range mktime?

2006-05-18 Thread Gustav Wiberg


- Original Message - 
From: "Barry" <[EMAIL PROTECTED]>

To: ; "Gustav Wiberg" <[EMAIL PROTECTED]>
Cc: "PHP General" 
Sent: Thursday, May 18, 2006 1:45 PM
Subject: [PHP] Re: Range mktime?



Gustav Wiberg schrieb:

Hi

I wondew which range the mktime has? (in digits)
In my case it always start with 1.
something like
1147951344

Is this ALWAYS TRUE (that it would start with 1)

Best regards
/Gustav Wiberg

mktime is giving you the time in seconds since 1st april 1970

So no. It's not true.

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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


Ok, thanx!

Best regards
/Gustav Wiberg

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



[PHP] Re: Range mktime?

2006-05-18 Thread Barry

Gustav Wiberg schrieb:

Hi

I wondew which range the mktime has? (in digits)
In my case it always start with 1.
something like
1147951344

Is this ALWAYS TRUE (that it would start with 1)

Best regards
/Gustav Wiberg

mktime is giving you the time in seconds since 1st april 1970

So no. It's not true.

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



[PHP] Range mktime?

2006-05-18 Thread Gustav Wiberg

Hi

I wondew which range the mktime has? (in digits)
In my case it always start with 1.
something like
1147951344

Is this ALWAYS TRUE (that it would start with 1)

Best regards
/Gustav Wiberg

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



[PHP] PEAR Algorithms/Containers

2006-05-18 Thread Andrew Brampton

Hi,

In the past few weeks I've found the need for a hash table and a container 
that gives me O(log) search efficiency. Now I'm aware I can use associative 
arrays for my hash table, but I wanted to ensure efficiency. For my O(log) 
container I ended up using a sorted array, and a binary search (which I had 
to write).


Now I thought common data structures, and algorithms, like these, and many 
others such as Binary Trees, Red/Black Trees and sorting algorithms and so 
on would be a useful addition to PHP, or more specifically PEAR, however I 
was unable to find any previous classes that provided these structures.


So I figured I would make a set of containers and algorithms that could be 
used in a generic way , and hopefully put this code into PEAR. But before I 
start making nice PEAR code, I wanted to ask why nothing like this already 
exists? Is it because everyone has been to lazy until now, or is there a 
real reason that I'm missing that has made such structures pointless.


thanks for any comments/replies
Andrew 


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



[PHP] Pictures and caches

2006-05-18 Thread Gustav Wiberg

Hi!

The thing I want to do is to copy a picturefile to another picturefile.
The thing is that I want to copy this file, show it , and then delete it 
(when it has been shown) .Is this possible?


I want to do this, because of avoiding problems with cache when uploading 
file through an admin-online-system... (the customer uses IE)


When I delete the file in code down below, the picture is not shown (I guess 
because the browser hasn't rendered out all info?)


If you want more code, tell me :-)

Best regards
/Gustav Wiberg



$fileName = "pictures/products/$dbIDProduct1" . "_small";

$ran = strval(mktime()); //Current time

if (file_exists($fileName . ".gif")) {

   copy($fileName . ".gif", "pictures/products/1_$ran.gif");
   showpicture("pictures/products/1_$ran.gif", $dbProductName1, 300, 150, 
"top");

   //deletefile("pictures/products/1_$ran.gif");

}

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



Re: [PHP] [Repost] Getting rid of "Web page has expired" (POSTDATA error)

2006-05-18 Thread Chris

Nicolas Verhaeghe wrote:

I am having an issue with certain pages preventing the user from going back
to the previous page.
 
The message given by Firefox is: "The page you are trying to view contains

PSTDATA that has expired from cache".


This has been discussed a lot in the past. Check the archives:

http://marc.theaimsgroup.com/?l=php-general

--
Postgresql & php tutorials
http://www.designmagick.com/

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