Re: [PHP] PHP5 Book Recommendation?

2004-09-19 Thread Miles Keaton
On Sun, 19 Sep 2004 07:26:25 +1000, Justin French
[EMAIL PROTECTED] wrote:
 Can someone recommend a decent PHP5 book?  In particular, I'm
 interested in Classes and OOP.  I consider myself an above average PHP4
 developer, so I'm definitely not looking for a beginner book, BUT I
 have ZERO experience with OOP (in any language), so I'd like a book
 that can teach me everything I need to know about OOP one step at a
 time, geared towards good OOP design, and PHP5-specific OOP problems.


I was in the exact same position as you for many years.

I even started writing all of my functions in classes/objects because
I thought that's what I was supposed to be doing, but never really
understood why.

Then I got a cheap paperback book called  THE OBJECT-ORIENTED THOUGHT
PROCESS by Matt Weisfeld, and it *finally* all made sense!  This book
is *so* well-written, that you really understand the whole OOP mindset
after just the first 3 chapters.

Justin, I highly recommend you get this book.  Then AFTER reading it,
spend even an hour with PHP5 getting to see how PHP5 does inheritance,
abstract classes, private/public methods, etc.   But really you need
to understand the mindset first, and THEN the language-specifics.

(And then for the fun of it, spend a weekend learning Ruby :
http://www.ruby-lang.com/en/ - where *everything* is an object.)

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



[PHP] var references question

2004-09-19 Thread Brandon Goodin
Greetings,

 

This is a little difficult to explain. So, below is an example I will work
from. Forgive my ignorance here. I am a java developer using php4 and trying
to figure out a particular scenario.

 

In the following example when I run the myscript.php I pass the $myarr into
the addVal function of the MyClass class. The var_dump in the addVal
function appropriately displays all of the elements of the array a,b,c and
d. However, the var_dump that is done in the script immediately following
the addVal method call displays only elements a,b and c with NO d. From what
I can see, php does not retain the same reference to the array object when
it passes it into the function. It appears that it clones the array and
retains only the changes within the scope of the function. In java I am used
to creating an array and passing it into a method which accomplishes
operations against the array. The passed in array is also modified because
it is a reference to the same array object.

 

Is there a way to accomplish this behavior in php 4?

 

For example:

 

 myscript.php 

 

.

 

$myarr = array();

 

$myarr[valuea]=a;

$myarr[valueb]=b;

$myarr[valuec]=c;

 

$myclass = new MyClass();

$myclass-addVal($myarr);

 

var_dump($myarr);

 

.

 

===end 

 

 

 

 myclass.php 

 

class MyClass {

 

function addVal($myarr){

  $myarr[valued] = d;

  var_dump($myarr);

}

 

}

===end 

 

 

Thanks,

Brandon

 



[PHP] how to post data to java servlet

2004-09-19 Thread QT
Dear Sirs,

I need to post 3 string data to destination adres. But I see first time, the
name of the variables are same such as DATA. I ask the destination ovner is
there any error. Should be the form fields name such as DATA1, DATA2 and
DATA3.

According him, his form is working fine and fields are concenated fields.

Then I try to post with following string; but I haven't succed to transfer
my string data to other side. What should I do?


$str = DATA=abcDATA=123DATA=xxx

  $len = strlen($str);

$p = POST /httpsmspp/servlet/sms HTTP/1.0\r\n;
  $p.= Host: 123.31.228.206\r\n;
  $p.= Content-type: application/x-www-form-urlencoded\r\n;
  $p.= Content-length: $len\n\n;
  $p.= $str\n;
  $p.= \r\n;
$server = 123.31.228.206;
$connection_timeout = 10;
$fp = fsockopen ($server, 80, $errno, $errstr, $connection_timeout);

  fputs ($fp,$p);
$recdata = ;
while (!feof($fp))
 {
  $recdata .= fgets ($fp,128);
 }
  fclose ($fp);


One of the friend, said I should send data on body of message. But I do not
understand what his mean with body of the message.

Best Regards

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



[PHP] Re: var references question

2004-09-19 Thread M. Sokolewicz
That's because you're moving the variable from the main scope to the 
function scope. When you're there, you import the VALUES (that is, make 
a COPY) of the variables supplised via the function call. If you change 
a variable inside the function, it will only be changed in the function 
scope, and not the main scope. To do that, you'll need to declare that 
variable to be global.

eg:

function addVal() {
  global $myarr;
  $myarr[valued] = d;
  var_dump($myarr);
}

that would do what you're trying to do.
Brandon Goodin wrote:
Greetings,
 

This is a little difficult to explain. So, below is an example I will work
from. Forgive my ignorance here. I am a java developer using php4 and trying
to figure out a particular scenario.
 

In the following example when I run the myscript.php I pass the $myarr into
the addVal function of the MyClass class. The var_dump in the addVal
function appropriately displays all of the elements of the array a,b,c and
d. However, the var_dump that is done in the script immediately following
the addVal method call displays only elements a,b and c with NO d. From what
I can see, php does not retain the same reference to the array object when
it passes it into the function. It appears that it clones the array and
retains only the changes within the scope of the function. In java I am used
to creating an array and passing it into a method which accomplishes
operations against the array. The passed in array is also modified because
it is a reference to the same array object.
 

Is there a way to accomplish this behavior in php 4?
 

For example:
 

 myscript.php 
 

.
 

$myarr = array();
 

$myarr[valuea]=a;
$myarr[valueb]=b;
$myarr[valuec]=c;
 

$myclass = new MyClass();
$myclass-addVal($myarr);
 

var_dump($myarr);
 

.
 

===end 
 

 

 

 myclass.php 
 

class MyClass {
 

function addVal($myarr){
  $myarr[valued] = d;
  var_dump($myarr);
}
 

}
===end 
 

 

Thanks,
Brandon
 


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


[PHP] looking for a mysql news server

2004-09-19 Thread Mike
hi, I've currently been looking for a mysql news server where I could post
some questions on mysql database design (cause they shurely wouldn't fit
here) and I have yet to find one. Can anyone help? 

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



Re: [PHP] PHP and extern link

2004-09-19 Thread Martin Justra
Hi,
 Did you want to

 a) redirect the user to https://www.domain.com/...

 or

 b) display the contents of https://www.domain.com/...?

I want to redirect the user. But as soon as I try with fopen (https://) 
I get the following error:

 Warning: 
fopen(https://tto.deutschepost.de/nexttonline/jsp/direct_access.do?v_benutzer=xxxv_passwort=xxxv_ic=xxxv_spr=deu):
 
failed to open stream: No such file or directory in 
/var/www/catalog/blubb.php on line 2

It seems that fopen is not able to open it, because it is not redirected to 
a file...

Any solutions ?

Martin 

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



Re: [PHP] PHP and extern link

2004-09-19 Thread Robby Russell
On Sun, 2004-09-19 at 02:29, Martin Justra wrote:
 Hi,
  Did you want to
 
  a) redirect the user to https://www.domain.com/...
 
  or
 
  b) display the contents of https://www.domain.com/...?
 
 I want to redirect the user. But as soon as I try with fopen (https://) 
 I get the following error:
 
  Warning: 
 fopen(https://tto.deutschepost.de/nexttonline/jsp/direct_access.do?v_benutzer=xxxv_passwort=xxxv_ic=xxxv_spr=deu):
  
 failed to open stream: No such file or directory in 
 /var/www/catalog/blubb.php on line 2
 
 It seems that fopen is not able to open it, because it is not redirected to 
 a file...
 
 Any solutions ?
 
 Martin 

try
?php
header(Location: http://domain.com/;);
?

-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting  Development
/



signature.asc
Description: This is a digitally signed message part


Re: [PHP] PHP and extern link

2004-09-19 Thread Martin Justra
Hello Robert,

yes that works. But the problem is that I don't want that the one who opens 
the site can see the whole link in the navigation line of the browser (where 
you type your adress in).

In your solution I get the whole link

Martin 

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



[PHP] Re: how to post data to java servlet

2004-09-19 Thread Catalin Trifu
Hi,
$str = DATA=abcDATA=123DATA=xxx
I believe you should encode the string with http://www.php.net/rawurlencode
but make sure u don't encode the  and = signs.
  $len = strlen($str);
$p = POST /httpsmspp/servlet/sms HTTP/1.0\r\n;
  $p.= Host: 123.31.228.206\r\n;
  $p.= Content-type: application/x-www-form-urlencoded\r\n;
I think you the Content-Type here is wrong, since you don't encode your
string to match the content type. Perhaps text/plain might do it.
  $p.= Content-length: $len\n\n;
here there should be another line
$p .= \r\n;
here the \n\n should be \r\n
  $p.= $str\n;
here \n should be \r\n
  $p.= \r\n;
the above line should not exist
$server = 123.31.228.206;
$connection_timeout = 10;
$fp = fsockopen ($server, 80, $errno, $errstr, $connection_timeout);
  fputs ($fp,$p);
$recdata = ;
while (!feof($fp))
 {
  $recdata .= fgets ($fp,128);
 }
  fclose ($fp);
What is the response from the server ?
Hope this helps,
Catalin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Infinate looping

2004-09-19 Thread Andrew Kreps
On Sat, 18 Sep 2004 19:48:37 -0500, Stephen Craton
[EMAIL PROTECTED] wrote:
 Here's what I'm doing in a nutshell: Loop infinitely, checking for changes
 to a database, flushing the data, sleep, and repeat the loop. It all goes
 well and I'm getting it to work correctly. However, I'm not sure on the
 impact on my webserver.

Personally, I think you're taking the wrong approach to solve your
problem.  PHP scripts were meant to execute in short fashion, to get
over and done with.  If you need something that checks for changes,
don't make the PHP script run from now until doomsday, set it up as a
scheduled task that runs every minute (or whatever interval you
require).  It's a much cleaner setup, and you're removing the
webserver from the equation since you'll be running PHP from the
command line.

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



Re: [PHP] PHP and extern link

2004-09-19 Thread Andrew Kreps
On Sun, 19 Sep 2004 01:07:25 +0200, Martin Justra [EMAIL PROTECTED] wrote:
 Hello,
 
 I want to write a script which does the following:
 
 You enter http://www.test.com/test.php?number=123456
 
 and the script shows the site
 https://www.domain.com/direct_access.do?usert=testpassword=testnumber=123456
 

I have a site with a similar need.  I accomplished it using the Curl
extension, it's documented in the PHP manual.  If you'd like to give
it a shot, search the manual for curl_init.

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



Re: [PHP] PHP and extern link

2004-09-19 Thread Jason Wong
On Sunday 19 September 2004 18:02, Martin Justra wrote:

 yes that works. But the problem is that I don't want that the one who opens
 the site can see the whole link in the navigation line of the browser
 (where you type your adress in).

 In your solution I get the whole link

If you want to redirect the user there is no way to prevent the user from 
seeing the URL s/he is being redirected to.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
I'll defend to the death your right to say that, but I never said I'd
listen to it!
-- Tom Galloway with apologies to Voltaire
*/

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



Re: [PHP] List Etiquette

2004-09-19 Thread Mag
Top posting
Whats that?

hehehe


--- -{ Rene Brehmer }- [EMAIL PROTECTED]
wrote:

 Most mail programs have their default settings set
 for top posting ... 
 while most news clients are set for bottom posting
  which way is the 
 most preferable depends on what's most useful for
 your reply ... but those 
 that enjoy mixing top and bottom posting are the
 daft ones ... once a 
 thread goes into top posting, it's easier to simply
 continue that way ... 
 otherwise it gets utterly confusing 
 
 But some kinds of replies, especially to long windy
 posts, are better made 
 at the bottom or inline ... or a mix  especially
 lists like this one 
 where it's alot of programming code, are usually
 easier to read when 
 bottom/inline posted  while regular commentary
 lists benefit more from 
 the top posting ...
 
 There's advantages and disadvantages to both
 principles, and some people 
 prefer one over the other ... but it's really
 depending on the actual 
 content and nature of the discussion whether the one
 is preferable to each 
 other...
 
 In either method, learn to trim, and everyone will
 be much happier nomatter 
 how you reply ... any properly configured signature
 will be removed 
 automatically by a properly written client program
 ... but the rest of the 
 crud you really need to peel out with manual labour
 ...
 
 
 Rene
 
 At 00:33 19-09-2004, Robert Cummings wrote:
 *RUH ROH* Better watch out, top posting is an
 extremely unpopular
 discussion. Some members of the list will attempt
 to lambaste you and
 tell you that because the rules are written, then
 they must be the final
 word. Feel free to post however you please, while
 the dogs might bark
 loudly, they are at a safe distance. You'll notice
 that many, many
 people top post. Some people top post, some bottom
 post, and almost
 everyone at some point interlace posts. Don't
 forget that at one time
 people thought the world was flat because people
 said it was so, of
 course we know better now, but change usually comes
 at the price of old
 customs, and some old dogs hate new tricks.
 
 Happy top posting,
 Rob.
 
 -- 
 Rene Brehmer
 aka Metalbunny
 
 If your life was a dream, would you wake up from a
 nightmare, dripping of 
 sweat, hoping it was over? Or would you wake up
 happy and pleased, ready to 
 take on the day with a smile?
 
 http://metalbunny.net/
 References, tools, and other useful stuff...
 Check out the new Metalbunny forums at
 http://forums.metalbunny.net/
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



[PHP] date function

2004-09-19 Thread Magdy
Hi,
i'm pleasure to write to u and hope to finde an answer..
my problem is with date( ) function which is display a GMT time which is different 
from my zone with 3 hours,,,how can i correct this.
Thanks in advance.

Magdy


Re: [PHP] List Etiquette

2004-09-19 Thread Octavian Rasnita
Hi,

I have a very strong reason for top posting and a very strong one for not
agreeing too much bottom posting at all, and this is the fact that I am
blind and if I need to read a bottom post, I need to read again and again
the whole original message, even though most of the time I remember what was
it about, and I don't like to lose so much time to read it again so many
times.

I have read somewhere a Netiquette rule that advice top posting (I don't
remember where, but could be on W3C site...) and the reasons for that rule
were that:

1. Most of the times, the members of the list remember the subject of the
original message, and those who don't remember it, can make that effort for
scrolling down, because the most important part is not the original message,
but the answer.
2. People with dissabiliteies, that access the computer reading line by
line, will have to skip many rows sometimes in order to reach to the
important part of the message, and very often that important part have just
a single line, or two lines, and they might skip them if they read the text
faster.
3. Top posting is much easier to be done for most of the members of a list,
because they don't have to trim the original message very selective, but
they can just  hit reply, start writing, then they can press page down
once or a few times, or point with the mouse,  and delete from that point to
the end of the original message and that's all.
If bottom posting, the original message need to be trimmed for not including
signatures, advertising, and other unneeded things.

Well, I guess these are the reasons Microsoft made their mail clients in
such a way that the text cursor appears at the top of the reply window by
default, and not by mistake, and let's don't forget that most computer users
use MS Windows...

Even though I prefer top posting for the reasons I have told you about, I
also use sometimes bottom posting, and I also use answering point by point
in the original message where is the case.
I use bottom posting only in short threads, in which the members might not
remember about the subject of the original message, or in messages that are
hard to understand without reading the original message.

If I answer something like:

Your problem can be solved by using the following code: ...

Most of the users won't understand what problem was that answer for, because
on the lists we use to talk about problems all the time.

But if I answer something like:

If you want to create a program for downloading and parsing a file, use the
following code:...

Then I think that everyone will understand what is my answer for, and they
don't need to read again the original message, because they even might
remember that message.

So I think the top posting is preferred by users for a very good reason, but
I also think that we should try to admit that other members of the list have
other preferences, and try not fighting for that.

Cheers.

Teddy

- Original Message - 
From: Jason Wong [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, September 19, 2004 5:02 AM
Subject: Re: [PHP] List Etiquette


On Sunday 19 September 2004 07:52, Robert Cummings wrote:

 But definitely there's not global consensus.

I really shouldn't be indulging you as it's pretty obvious you're only here
for a vigorous debate (that's my euphemism for an argument - the not so nice
meaning of argument).

The OP asked for the pros and cons of top posting vs bottom posting. I
responded with some reasons why top posting is bad.

What did you come up with?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz

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



Re: [PHP] Browser caching problem.

2004-09-19 Thread Octavian Rasnita
BTW, does anyone know if there is a program or script that can listen to
the stream and save it into a file?
I know this can be done using a program for recording the sound, but that is
not a very professional solution and it depends on the quality of the sound
card, the speed of internet connection, etc.

I am wondering if there is a program that can work with the mms:// protocol
for getting the data, or other protocols for streaming if there are more...
or if there are any specifications for making such a program.

Thanks.

Teddy

- Original Message - 
From: Jason Wong [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, September 19, 2004 2:25 AM
Subject: Re: [PHP] Browser caching problem.


On Sunday 19 September 2004 07:12, Daniel Guerrier wrote:
 I'm using this code to dynamically retrieve windows
 media files and send it to the browser.  I thought the
 cache header would prevent the file from being cached.

 The only problems is the .wmv file still ends up in my
 IE temp files folder.  How can I prevent this from
 happening?

Don't give them the file in the first place?

If you're trying to prevent someone from saving the file and playing it back
at a later date then I think you'll need to stream the file. Have a look on
the MS site. Note that no matter what you do, if someone is determined
enough
they'll still be able to capture the contents.

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



Re: [PHP] List Etiquette

2004-09-19 Thread Jason Wong
On Sunday 19 September 2004 19:36, Octavian Rasnita wrote:

 I have a very strong reason for top posting and a very strong one for not
 agreeing too much bottom posting at all, and this is the fact that I am
 blind and if I need to read a bottom post, I need to read again and again
 the whole original message, even though most of the time I remember what
 was it about, and I don't like to lose so much time to read it again so
 many times.

That's about the only good reason I've heard for top posting thus far. 

However it is something that is (potentially) easily solved by software. If 
everybody sticks to the universally recognised '' character to denote text 
quoted from previous posts then your mail client or newsreader can easily 
skip the quoted text.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Hawkeye's Conclusion:
It's not easy to play the clown when you've got to run the whole
circus.
*/

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



[PHP] curl grabbing a website

2004-09-19 Thread Martin Justra
Hello,

I finally managed to grab the website via curl. Now the problen is that I 
want to have a small piece of that site. I tried to cut that site by 
explode. Now the browser hangs. He says waiting for www.domain.de and 
does nothing.

Here is my listing:
?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 
https://www.example?benutzer=aaapasswort=bbbic=tracking;);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$test = curl_exec($ch);
$teil = explode(!-- rows --, $test);
echo $teil[0];
curl_close($ch);

What did I do wrong ?

Martin


? 

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



Re: [PHP] curl grabbing a website

2004-09-19 Thread Jason Wong
On Sunday 19 September 2004 20:49, Martin Justra wrote:

 I finally managed to grab the website via curl. Now the problen is that I
 want to have a small piece of that site. I tried to cut that site by
 explode. Now the browser hangs. He says waiting for www.domain.de and
 does nothing.

 Here is my listing:
 ?php
 $ch = curl_init();
 curl_setopt($ch, CURLOPT_URL,
 https://www.example?benutzer=aaapasswort=bbbic=tracking;);
 curl_setopt($ch, CURLOPT_HEADER, 0);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 $test = curl_exec($ch);
 $teil = explode(!-- rows --, $test);
 echo $teil[0];
 curl_close($ch);

What does your php error log say? (manual  Error Handling and Logging 
Functions)

What does your webserver error log say?

If the page that you're grabbing is large, one possibility is that you've run 
out of memory (your php log would tel you this), I suggest you curl_close() 
before explode().

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
There is nothing stranger in a strange land than the stranger who comes
to visit.
*/

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



Re: [PHP] How does work shorten url services?

2004-09-19 Thread Peter Brodersen
On Sat, 18 Sep 2004 22:33:09 +0800, in php.general
[EMAIL PROTECTED] (Jason Wong) wrote:

 Ok, it is like I thought, but if it is made in PHP is
 there a way to catch all the ID sent to the main page
 of tinyurl.com and then query the database?

If your webserver is apache you could use its rewrite engine to ensure that 
all requests to http://example.com/ gets processed by php (see apache docs). 

Further: Apache-solution

One of the simplest methods (if the user is able to change the
configuration of the server config or virtual host) is to point
DocumentRoot to a file and not a directory. E.g.

DocumentRoot /path/to/handler.php

At least the apache following with debian stable will issue a warning
(which could be ignored) that the directory-path does not exist. I
suppose it only checks for the existance of a directory with that
name.

Another dirty method include using a 404-document for handling
requests to files that do not exist:
ErrorDocument 404 /404handler.php
(one could still set a 200 OK-returncode)


.. but all this is out of PHP-scope.

-- 
- Peter Brodersen

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



[PHP] password-protecting with PHP, help plz

2004-09-19 Thread AceZero2790
Hello,
I'm trying to password protect a page with PHP, using forms and $_POST data 
and all that stuff. However, I'm running into problems setting it so that if 
the POST is equal to a certain thing, it'll do this or that (using if...else 
commands) and also problems with just getting blank pages whenever I use the 
if...else commands. I tried this two different ways, illustrated below.

Here is what my original log in page 1 looks like. 

?php
echo _HTML_

form method=post action=testing2.php
Username: input type=text name=user
br
input type=submit value=submit
/form

_HTML_;

?

This page shows up ok, with the form generating just fine. The problem is 
when I get to the action page, testing2.php. Here is that:

?php

if ($_POST['user']) == me {

echo it's me!;

} else {

echo not me;

?

This page just shows up as blank (after I submit on the log in page). What am 
I doing wrong?

Also, I tried putting it all one page using if...else and $_SERVER[PHP_SELF] 
like this:

?php
// print if form was submitted

if ($_POST['user'] {
echo hey it works; 

} else {

// if they are just viewing the page for first time


echo _HTML_

form method=post action=$_SERVER[PHP_SELF]
Username: input type=text name=user
br
input type=submit value=submit
/form

_HTML_;

?

However, all I get is a blank page on this one as well. What am I doing 
wrong?

Help sincerely appreciated,
Andrew


Re: [PHP] date function

2004-09-19 Thread Jordi Canals
On Sun, 19 Sep 2004 14:29:54 +0300, Magdy [EMAIL PROTECTED] wrote:

 my problem is with date( ) function which is display a GMT time which is different 
 from my zone with 3 hours,,,how can i correct this.

The date() function, gets the system current date/time if you don't
pass the second parameter. So, change the system time or give the
second parameter with a correct date.

You can use also the mktime() function to calculate a new date/time
for your zone.

Not tested, but something like that could work:

date('Y-m-d H:i', mktime(date(H), date(i), date(m), date(d), date(Y));

Regards,
Jordi.

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



Re: [PHP] List Etiquette

2004-09-19 Thread John Nichel
Octavian Rasnita wrote:
Hi,
I have a very strong reason for top posting and a very strong one for not
agreeing too much bottom posting at all, and this is the fact that I am
blind and if I need to read a bottom post, I need to read again and again
the whole original message, even though most of the time I remember what was
it about, and I don't like to lose so much time to read it again so many
times.
Do the words get smaller at the bottom?  Having to scroll thru line 
after line of message doesn't deal with top vs. bottom posting...that 
stems from people not trimming non-releative parts out of the message.

I have read somewhere a Netiquette rule that advice top posting (I don't
remember where, but could be on W3C site...) and the reasons for that rule
were that:
I have *never* seen any site dealing with mailing lists/newsgroups that 
suggested top posting over bottom posting.

1. Most of the times, the members of the list remember the subject of the
original message, and those who don't remember it, can make that effort for
scrolling down, because the most important part is not the original message,
but the answer.
Did you take a survey of list members to come to the conclusion of who 
remembers what?  I usually remember what's going on in a thread only if 
I've been posting to that thread from the begininning.  I, along with 
many other members of this list post to numerous mailing lists, but 
according to you, we remember the subject matter of one little thread? 
And if we don't, it's up to us to scroll thru the mess of top and bottom 
posted replies so that we can figure out what's going on, just to help 
someone?

2. People with dissabiliteies, that access the computer reading line by
line, will have to skip many rows sometimes in order to reach to the
important part of the message, and very often that important part have just
a single line, or two lines, and they might skip them if they read the text
faster.
Everyone on this list who falls into this category, raise your hand. 
I'm sorry if you have a disability and all, but you're suggesting that 
the good of the one outweighs the good of the many.

3. Top posting is much easier to be done for most of the members of a list,
because they don't have to trim the original message very selective, but
they can just  hit reply, start writing, then they can press page down
once or a few times, or point with the mouse,  and delete from that point to
the end of the original message and that's all.
If bottom posting, the original message need to be trimmed for not including
signatures, advertising, and other unneeded things.
Ahhh, the laziness defense.
Well, I guess these are the reasons Microsoft made their mail clients in
such a way that the text cursor appears at the top of the reply window by
default, and not by mistake, and let's don't forget that most computer users
use MS Windows...
Yeah, MS is so good with standards.
snip
See, trimming posts...not that hard.
--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Associative Array Benchmarking

2004-09-19 Thread Curt Zirzow
* Thus wrote bskolb:
  
 Benchmark results:
  
 Function assocArrayWithQuotes() ran 50 times in 4.4331 seconds.
 Function assocArrayWithoutQuotes() ran 50 times in 6.4170 seconds.
  
 The only difference in the two functions is the use of quotes, one with and
 the other without.

That is because the  one without the quotes, php first checks to
see if a constant is defined with that name, if not then the
literal value will be used.


Curt
-- 
The above comments may offend you. flame at will.

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



Re: [PHP] var references question

2004-09-19 Thread Curt Zirzow
* Thus wrote Brandon Goodin:
 Greetings,
  
 
 In the following example when I run the myscript.php I pass the $myarr into
 the addVal function of the MyClass class. The var_dump in the addVal
 function appropriately displays all of the elements of the array a,b,c and
 d. However, the var_dump that is done in the script immediately following
 the addVal method call displays only elements a,b and c with NO d. From what
 I can see, php does not retain the same reference to the array object when
 it passes it into the function. It appears that it clones the array and
 retains only the changes within the scope of the function. In java I am used
 to creating an array and passing it into a method which accomplishes
 operations against the array. The passed in array is also modified because
 it is a reference to the same array object.


PHP pass by value by default, you want to pass by reference, see:

  http://php.net/functions.arguments.php



Curt
-- 
The above comments may offend you. flame at will.

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



[PHP] cant stop phpfile from beeing run by cron

2004-09-19 Thread Merlin
Hi there,
A few months ago I have written a php file which is activated daily by a cronjob 
run by user: www
Now I cant find that cron job to disable it.

/var/log/messages shows following entry:
Sep 19 06:00:00 server /USR/SBIN/CRON[28397]: (www) CMD (/usr/local/bin/php 
/home/www/follow_up_new_members.php )

Has anybody an idea where to find it? I did check crontab -l with the user www, 
but there is no such entry.

Thanx for any help on that,
Merlin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] cant stop phpfile from beeing run by cron

2004-09-19 Thread Jason Wong
On Sunday 19 September 2004 22:47, Merlin wrote:

 A few months ago I have written a php file which is activated daily by a
 cronjob run by user: www
 Now I cant find that cron job to disable it.

 /var/log/messages shows following entry:
 Sep 19 06:00:00 server /USR/SBIN/CRON[28397]: (www) CMD (/usr/local/bin/php
 /home/www/follow_up_new_members.php )

 Has anybody an idea where to find it? I did check crontab -l with the user
 www, but there is no such entry.

Find out from your OS manual/helpline/mailing list where the details of your 
cronjobs are stored.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Keep a diary and one day it'll keep you.
-- Mae West
*/

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



Re: [PHP] cant stop phpfile from beeing run by cron

2004-09-19 Thread John Nichel
Merlin wrote:
Hi there,
A few months ago I have written a php file which is activated daily by a 
cronjob run by user: www
Now I cant find that cron job to disable it.

/var/log/messages shows following entry:
Sep 19 06:00:00 server /USR/SBIN/CRON[28397]: (www) CMD 
(/usr/local/bin/php /home/www/follow_up_new_members.php )

Has anybody an idea where to find it? I did check crontab -l with the 
user www, but there is no such entry.
I'm sure a mailing list for your OS, or for cron can help you more in 
this endeavor

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] List Etiquette

2004-09-19 Thread Octavian Rasnita
Hi,

From: John Nichel [EMAIL PROTECTED]

Do the words get smaller at the bottom?  Having to scroll thru line
after line of message doesn't deal with top vs. bottom posting...that
stems from people not trimming non-releative parts out of the message.
---

The rules should be made to make the reading process easier for the readers
and the top posting versus bottom posting has nothing to do with the
trimming of the messages.
It is much easier to trim a message when top posting, just as I explained
you.

I have *never* seen any site dealing with mailing lists/newsgroups that
suggested top posting over bottom posting.
--
Keep searching. :-)

Did you take a survey of list members to come to the conclusion of who
remembers what?  I usually remember what's going on in a thread only if
I've been posting to that thread from the begininning.  I, along with
many other members of this list post to numerous mailing lists, but
according to you, we remember the subject matter of one little thread?
And if we don't, it's up to us to scroll thru the mess of top and bottom
posted replies so that we can figure out what's going on, just to help
someone?
---

Yes, if you are not lazy. :-)
I have also told that in case of a little thread, I also use to bottom post,
because its subject might not be remembered by others.

Everyone on this list who falls into this category, raise your hand.
I'm sorry if you have a disability and all, but you're suggesting that
the good of the one outweighs the good of the many.
--

Do you think that I am the only one on this list that prefer top posting?
I think the way people like to post on a mailing list  depends on how they
were used to post and that way tend to be consider the best by them.
And that way depends on more things, like the email client used, and that
email client depend on the operating system used, and so on.
And I have seen that many people that use Unix use to like bottom posting
and I don't know why... who knows, maybe the Unix email clients automaticly
put the cursor at the bottom of the original message...

Teddy

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



Re: [PHP] password-protecting with PHP, help plz

2004-09-19 Thread Curt Zirzow
* Thus wrote [EMAIL PROTECTED]:
 
 This page shows up ok, with the form generating just fine. The problem is 
 when I get to the action page, testing2.php. Here is that:
 
 ?php
 
 if ($_POST['user']) == me {
 
 echo it's me!;
 
 } else {
 
 echo not me;
 
 ?

You have a parse error, no ending }

You should turn display_errors on in your php.ini and restart the
webserver.


Curt
-- 
The above comments may offend you. flame at will.

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



Re: [PHP] password-protecting with PHP, help plz

2004-09-19 Thread Jason Wong
On Sunday 19 September 2004 21:47, [EMAIL PROTECTED] wrote:

 I'm trying to password protect a page with PHP, using forms and $_POST data
 and all that stuff.

I strongly suggest you search out a few tutorials on this subject.

  google  php authentication tutorial

would be a good start.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
The chain which can be yanked is not the eternal chain.
-- G. Fitch
*/

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



[PHP] Re: DROP TABLE IF EXISTS

2004-09-19 Thread Pat
Maybe something like this:
http://dev.mysql.com/doc/mysql/en/TRUNCATE.html


John Taylor-Johnston [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 MySQL question:

 DROP TABLE IF EXISTS

 Instead of dropping the table, I want to truncate the table if it contains
something. ANyone know of a way? I couldn't find anything under truncate in
the manual.

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



[PHP] Nubie scripting question

2004-09-19 Thread revDAVE
 I would like to set up a situation where I have one  main page with a bunch
of thumbnail pictures on it.  Each will have a link to a larger photo.
However, rather than just simply  loading a raw JPEG to a blank page, I
would like to use PHP, so that each link will point to 1 main php display
page - that I can program to look nice and display  all the images from this
one page - one at a time - of course.

So - the thumbnail links would look something like this:


a href=http://www.mydomain.com/display.php?pic=pic1.gif; img
src=pic1thumb.gif alt=deals/a


This URL addition: ?pic=pic1.gif  (will carry the name of the picture to be
loaded)

Q: here is what I am unclear of: since I do not know PhP -  how do I get the
main display page to read this part of the URL?

img src=??? Url.pic ??? alt=deals - how do I write this?

 thanks  in advance for your help



--
Thanks - RevDave
[EMAIL PROTECTED]
[db-lists]

Check out some great Domain Names at:
http://www.domains4days.com

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



Re: [PHP] password-protecting with PHP, help plz

2004-09-19 Thread AceZero2790
I appreciate the help, but unfortunately it still doesn't work. I changed 
testing2.php, the action page to do this:

?php

if ($_POST['user']) == me {
echo Andrew;

} else {
echo not me;
}

?

I still get a blank page. What's more I turned on Display Errors and 
restarted the server, but still got no error message.

I don't know what the problem is, maybe there is something wrong with my 
comparison?


-Andrew


Re: [PHP] PHP and extern link

2004-09-19 Thread Marek Kilimajer
Martin Justra wrote:
Hi,
Did you want to
a) redirect the user to https://www.domain.com/...
or
b) display the contents of https://www.domain.com/...?
I want to redirect the user. But as soon as I try with fopen (https://) 
I get the following error:

 Warning: 
fopen(https://tto.deutschepost.de/nexttonline/jsp/direct_access.do?v_benutzer=xxxv_passwort=xxxv_ic=xxxv_spr=deu): 
failed to open stream: No such file or directory in 
/var/www/catalog/blubb.php on line 2

It seems that fopen is not able to open it, because it is not redirected to 
a file...

Any solutions ?
Martin 

run phpinfo() and check if openssl is installed (--with-openssl in 
Configure Command, there is a openssl module section, Registered Stream 
Socket Transports contains ssl).

Also check if allow_url_fopen is on.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: how to post data to java servlet

2004-09-19 Thread QT
Hi,

When I send only one data such as

$str = DATA=abc;

it is working fine. So that I think, I do not need to use rawurlencode.

I made folowing change according your post; again same, when I post only one
data field, it works fine. But when use three of them, server comes with
error. I think server only receive third one.

Some body told me send data in the message body. Any idea how can we do it?

Best Regads

 $len = strlen($str);

$p = POST /httpsmspp/servlet/sms HTTP/1.0\r\n;
  $p.= Host: 217.31.228.206\r\n;
  $p.= Content-type: text/plain\r\n;
  $p .= \r\n;
  $p.= Content-length: $len\r\n;
  $p.= \r\n;
  $p.= $str\r\n;
 // $p.= \r\n;

Catalin Trifu [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

  $str = DATA=abcDATA=123DATA=xxx
 I believe you should encode the string with
http://www.php.net/rawurlencode
 but make sure u don't encode the  and = signs.
 
$len = strlen($str);
 
  $p = POST /httpsmspp/servlet/sms HTTP/1.0\r\n;
$p.= Host: 123.31.228.206\r\n;
$p.= Content-type: application/x-www-form-urlencoded\r\n;
 I think you the Content-Type here is wrong, since you don't encode your
 string to match the content type. Perhaps text/plain might do it.
$p.= Content-length: $len\n\n;
 here there should be another line
  $p .= \r\n;
 here the \n\n should be \r\n
$p.= $str\n;
 here \n should be \r\n
$p.= \r\n;
 the above line should not exist
  $server = 123.31.228.206;
  $connection_timeout = 10;
  $fp = fsockopen ($server, 80, $errno, $errstr, $connection_timeout);
 
fputs ($fp,$p);
  $recdata = ;
  while (!feof($fp))
   {
$recdata .= fgets ($fp,128);
   }
fclose ($fp);
 
 What is the response from the server ?

 Hope this helps,
 Catalin

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



[PHP] Re: how to post data to java servlet

2004-09-19 Thread QT
hi,

And I just realize that if we use text/plain instead of
application/x-www-form-urlencoded; gives error. When I use
application/x-www-form-urlencoded no problem to send single data

Catalin Trifu [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

  $str = DATA=abcDATA=123DATA=xxx
 I believe you should encode the string with
http://www.php.net/rawurlencode
 but make sure u don't encode the  and = signs.
 
$len = strlen($str);
 
  $p = POST /httpsmspp/servlet/sms HTTP/1.0\r\n;
$p.= Host: 123.31.228.206\r\n;
$p.= Content-type: application/x-www-form-urlencoded\r\n;
 I think you the Content-Type here is wrong, since you don't encode your
 string to match the content type. Perhaps text/plain might do it.
$p.= Content-length: $len\n\n;
 here there should be another line
  $p .= \r\n;
 here the \n\n should be \r\n
$p.= $str\n;
 here \n should be \r\n
$p.= \r\n;
 the above line should not exist
  $server = 123.31.228.206;
  $connection_timeout = 10;
  $fp = fsockopen ($server, 80, $errno, $errstr, $connection_timeout);
 
fputs ($fp,$p);
  $recdata = ;
  while (!feof($fp))
   {
$recdata .= fgets ($fp,128);
   }
fclose ($fp);
 
 What is the response from the server ?

 Hope this helps,
 Catalin

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



Re: [PHP] Nubie scripting question

2004-09-19 Thread Jason Wong
On Sunday 19 September 2004 23:36, revDAVE wrote:

[snip]

You have started a new thread by taking an existing posting and replying to
it while you changed the subject.

That is bad, because it breaks threading. Whenever you reply to a message,
your mail client generates a References: header that tells all recipients
which posting(s) your posting refers to. A mail client uses this information
to build a threaded view (tree view) of the postings.

With your posting style you successfully torpedoed this useful feature; your
posting shows up within an existing thread it has nothing to do with.

Always do a fresh post when you want to start a new thread. To achieve this,
click on New message instead of Reply within your mail client, and enter
the list address as the recipient. You can save the list address in your
address book for convenience.

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



Re: [PHP] Associative Array Benchmarking

2004-09-19 Thread Michal Migurski
 Although I'm not certain how well known this is, I thought I'd share
 this with everyone who might have wondered if there was a benefit to
 using or not using quotes when referencing associative arrays.

The benefit to using quotes is that it's the right thing to do, unless
you're looking for constants instead of strings. Sometimes a quick R of
the first few chapters in TFM beats a benchmark.

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html

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



RE: [PHP] Infinate looping

2004-09-19 Thread Stephen Craton
:: 
:: Personally, I think you're taking the wrong approach to solve your
:: problem.  PHP scripts were meant to execute in short fashion, to get
:: over and done with.  If you need something that checks for changes,
:: don't make the PHP script run from now until doomsday, set it up as a
:: scheduled task that runs every minute (or whatever interval you
:: require).  It's a much cleaner setup, and you're removing the
:: webserver from the equation since you'll be running PHP from the
:: command line.
:: 

Yes, I agree, if I were making a task to run every few minutes it would be
easier, but that's not exactly what I'm doing. I'm more or less streaming
content from the database to the end-user. It's basically a chat script that
I'm running.

I thought about setting up a socket, but I'm not sure if that's even aloud
on the mainstream web hosts, or is it?

Thanks,
Stephen Craton

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



Re: [PHP] password-protecting with PHP, help plz

2004-09-19 Thread Janet Valade
[EMAIL PROTECTED] wrote:
I appreciate the help, but unfortunately it still doesn't work. I changed 
testing2.php, the action page to do this:

?php
if ($_POST['user']) == me {
echo Andrew;
} else {
echo not me;
}
?
I still get a blank page. What's more I turned on Display Errors and 
restarted the server, but still got no error message.

Your errors are still not displaying. Recheck display errors and 
error_reporting. Your line with the if statement is generating a parse 
error. You have an = sign that PHP is sure to complain about.

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


Re: [PHP] List Etiquette

2004-09-19 Thread Curt Zirzow
* Thus wrote Octavian Rasnita:
 Hi,
 
 I have a very strong reason for top posting and a very strong one for not
 agreeing too much bottom posting at all, and this is the fact that I am
 blind and if I need to read a bottom post, I need to read again and again
 the whole original message, even though most of the time I remember what was
 it about, and I don't like to lose so much time to read it again so many
 times.

If your eyesite isn't that good, it might be wise to use a email
client that is more friendly, like a mail client that highlights in
differnent colors the quoted text vs the orginal text.

 
 I have read somewhere a Netiquette rule that advice top posting (I don't
 remember where, but could be on W3C site...) and the reasons for that rule
 were that:
 
 1. Most of the times, the members of the list remember the subject of the
 [...]

 2. People with dissabiliteies, that access the computer reading line by
 [...]

 3. Top posting is much easier to be done for most of the members of a list,
 because they don't have to trim the original message very selective, but
 [...]

The only valid reason to top-post is to provide to the reader the
response without having to scroll, but why this is bad (tm) will be
argued later on in my reply.


 [...]
 
 If I answer something like:
 
 Your problem can be solved by using the following code: ...
 
 Most of the users won't understand what problem was that answer for, because
 on the lists we use to talk about problems all the time.
 
 But if I answer something like:
 
 If you want to create a program for downloading and parsing a file, use the
 following code:...

This is a rather unfair argument, the first example should read
more like:

  * Somebody wrote:
   How do I create a program for downloading and parsing a file??

  With a program like this: ...


 
 Then I think that everyone will understand what is my answer for, and they
 don't need to read again the original message, because they even might
 remember that message.

So If I had top posted, and you dont remember what exactly why I
would be writing the paragraph, you would have to scroll down 4
pages and re-read/find out what context I am writing this paragraph for.


I can't find much info on why top-posting is good, but I did find
lots that suggested top-posting isn't well accepted, it stems
mostly from usenet behaviours:

http://www.faqs.org/rfcs/rfc1855.html
http://www.caliburn.nl/topposting.html
http://www.netmeister.org/news/learn2quote2.html
http://www.cs.tut.fi/~jkorpela/usenet/brox.html
http://www.caliburn.nl/topposting.html


Curt
-- 
The above comments may offend you. flame at will.

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



Re: [PHP] PHP5 Book Recommendation?

2004-09-19 Thread Matthew Sims
 I even started writing all of my functions in classes/objects because
 I thought that's what I was supposed to be doing, but never really
 understood why.

 Then I got a cheap paperback book called  THE OBJECT-ORIENTED THOUGHT
 PROCESS by Matt Weisfeld, and it *finally* all made sense!  This book
 is *so* well-written, that you really understand the whole OOP mindset
 after just the first 3 chapters.


Thanks for the tip. I just ordered the book through Amazon. :)

-- 
--Matthew Sims
--http://killermookie.org

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



Re: [PHP] Nubie scripting question - Newbie Guide for the benefit of new members

2004-09-19 Thread David Bevan
On Sun, 2004-09-19 at 11:36, revDAVE wrote:


Q: here is what I am unclear of: since I do not know PhP -  how do I get the
main display page to read this part of the URL?

img src=??? Url.pic ??? alt=deals - how do I write this?

 thanks  in advance for your help

Since you do not know PhP, how about picking up a book or try a google
search?  You might even find the code you need in a tutorial about forms
and posting to $_SELF.  But to ask a mailing list how to write a snip of
code which is covered in just about every beginning PHP book, you may
want to think about learning some basic PHP.

You may also want to review the Guide for new list members which
follows:

===
Please feel free to add more points and send 
to the list. 
===

1. If you have any queries/problems about PHP 
try http://www.php.net/manual/en first. You 
can download a copy and use it offline also. 

Please also try 
http://www.php.net/manual/faq.php 
for answers to frequently answered questions 
about PHP (added by Christophe Chisogne).

2. Try http://www.google.com next. Searching 
for php YOUR QUERY may fetch you relevant 
information within the first 10 results.

3. There is a searchable archive of the 
mailing list discussion at 
http://phparch.com/mailinglists. Many of the 
common topics are discussed repeatedly, and 
you may get answer to your query from the 
earlier discussions. 

For example: One of the repeatedly discussed 
question in the list is Best PHP editor. 
Everyone has his/her favourite editor. 
You can get all the opinions by going through 
the list archives. If you want a chosen list 
try this link : 
http://www.thelinuxconsultancy.co.uk/phpeditors/
(contributed by Christophe Chisogne).

4. Not sure if PHP is working or you want 
find out what extensions are available to 
you?

Just put the following code into a file with 
a .php extension and access it through your 
webserver:

?php
phpinfo();
? 

If PHP is installed you will see a page with 
a lot of information on it. If PHP is not 
installed (or not working correctly) your 
browser will try to download the file.

(contributed by Teren and reworded by Chris W 
Parker)

5. If you are stuck with a script and do not 
understand what is wrong, instead of posting 
the whole script, try doing some research 
yourself. One useful trick is to print 
the variable/sql query using print or echo 
command and check whether you get what you 
expected. 

After diagnosing the problem, send the 
details of your efforts (following steps 1, 
2  3) and ask for help.

6. PHP is a server side scripting language. 
Whatever processing PHP does takes place 
BEFORE the output reaches the client. 
Therefore, it is not possible to access 
users' computer related information (OS, 
screen size etc) using PHP. Nor can you 
modify any the user side settings. You need 
to go for JavaScript and ask the question in 
a JavaScript list.

On the other hand, you can access the 
information that is SENT by the user's 
browser when a client requests a page from 
your server. You can find details about 
browser, OS etc as reported by 
this request. - contributed by Wouter van 
Vliet and reworded by Chris W Parker.

7. Provide a clear descriptive subject line. 
Avoid general subjects like Help!!, A 
Question etc. Especially avoid blank 
subjects. 

8. When you want to start a new topic, open a 
new mail composer and enter the mailing list 
address [EMAIL PROTECTED] instead of 
replying to an existing thread and replacing 
the subject and body with your message.

9. Only quote the relevant parts of
an email when replying. Do not Quote
everything (including huge code snippets) 
only to say I agree, for instance.
[contribued by Paul Waring]

10. It's always a good idea to post back to 
the list once you've solved your problem. 
People usually add [SOLVED] to the subject 
line of their email when posting solutions. 
By posting your solution you're helping the 
next person with the same question. 
[contribued by Chris W Parker]

11. Ask smart questions 
http://catb.org/~esr/faqs/smart-questions.html
[contributed by Jay Blanchard)

12. Do not send your email to the list with 
attachments. If you don't have a place to 
upload your code, try the many pastebin 
websites (such as www.pastebin.com).
[contributed by Burhan Khalid]

Following these guidelines will ensure that 
you get effective responses from the list
members. Otherwise, your questions might not 
be answered.

Hope you have a good time programming with 
PHP.


-David


[PHP] Re: curl grabbing a website

2004-09-19 Thread Manuel Lemos
Hello,
On 09/19/2004 09:49 AM, Martin Justra wrote:
I finally managed to grab the website via curl. Now the problen is that I 
want to have a small piece of that site. I tried to cut that site by 
explode. Now the browser hangs. He says waiting for www.domain.de and 
does nothing.

Here is my listing:
?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 
https://www.example?benutzer=aaapasswort=bbbic=tracking;);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$test = curl_exec($ch);
$teil = explode(!-- rows --, $test);
echo $teil[0];
curl_close($ch);

What did I do wrong ?
It is hard to tell without seeing the actual page content returned by 
the browser.

You may also want to try this HTTP client class and see if the result is 
the same. If it is, just post the HTML returned by the returned page.

http://www.phpclasses.org/httpclient

--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] password-protecting with PHP, help plz

2004-09-19 Thread AceZero2790
You were right, my display_error function was turned off. I turned it on and 
get this:

Parse error: syntax error, unexpected T_IS_EQUAL in c:\TSW\pages\testing2.php 
on line 3

So it isn't working. How do I get to let me make comparisons between the post 
data and something else? I figure if I can get it so that this will work, 
it'll be an easy way to password protect my pages...

-Andrew


Re: [PHP] mysql_connect does not connect

2004-09-19 Thread Sam Hobbs
Raditha Dissanayake [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Sam Hobbs wrote:


I have posted over 12,000 messages in the CodeGuru.com Visual C++ forum,
 Do you have a life ?

I hope the moderators protest posts such as this. 

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



Re: [PHP] mysql_connect does not connect

2004-09-19 Thread Jason Davidson
Sam Hobbs [EMAIL PROTECTED] wrote: 
 
 Raditha Dissanayake [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
  Sam Hobbs wrote:
 
 
 I have posted over 12,000 messages in the CodeGuru.com Visual C++ forum,
  Do you have a life ?
 
 I hope the moderators protest posts such as this. 
 

i protest thats for sure, 
Raditha, please do not post rhetorical questions to the list :)

Jason


 -- 
 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] mysql_connect does not connect

2004-09-19 Thread Sam Hobbs
Jason Wong [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

 Would you mind spilling the beans? I'm sure everyone is dying to know what 
 the
 resolution of this thread is.

I definitely mind. I don't believe in rewarding bad behavior. It is 
reasonable to contribute to the productive development of solutions, but the 
attitude in this group is not productive. I have the impression that the 
real reason you want answers is so that you can continue in unproductive 
directions.

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



Re: [PHP] List Etiquette

2004-09-19 Thread John Nichel
Octavian Rasnita wrote:
The rules should be made to make the reading process easier for the readers
and the top posting versus bottom posting has nothing to do with the
trimming of the messages.
It is much easier to trim a message when top posting, just as I explained
you.
Easier for reading?  Yes, you're right.  Do you read a book from the 
bottom of the page up?  Trimming a message is easier if you top post? 
That's pretty weak.  Follow a top posted thread, you'll see that most 
top posters just leave everything in there, whereas bottom posters tend 
to trim the message.

I have *never* seen any site dealing with mailing lists/newsgroups that
suggested top posting over bottom posting.
--
Keep searching. :-)
You're the one making the claim, please point out your sources.
snip
And if we don't, it's up to us to scroll thru the mess of top and bottom
posted replies so that we can figure out what's going on, just to help
someone?
---
Yes, if you are not lazy. :-)
Ahhh, so you not only want help from a mailing list, but you want those 
helping you to do the work of reading backwards emails.  And if we, the 
helpers, don't want to do that, we're the lazy ones?

snip
Everyone on this list who falls into this category, raise your hand.
I'm sorry if you have a disability and all, but you're suggesting that
the good of the one outweighs the good of the many.
--
Do you think that I am the only one on this list that prefer top posting?
I think the way people like to post on a mailing list  depends on how they
were used to post and that way tend to be consider the best by them.
My response there wasn't asking everone who prefers top posting; my 
response was to a 'pro' for top posting was to help those with disabilities.

And that way depends on more things, like the email client used, and that
email client depend on the operating system used, and so on.
And I have seen that many people that use Unix use to like bottom posting
and I don't know why... who knows, maybe the Unix email clients automaticly
put the cursor at the bottom of the original message...
Check the headers of this email.  I'm using a Windows box right now, and 
my cursor was automatically at the end when I clicked reply.  Again, 
it's laziness if one doesn't want to configure their client to put the 
cursor at the end, or to manually move the cursor.

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] mysql_connect does not connect

2004-09-19 Thread John Nichel
Sam Hobbs wrote:
Raditha Dissanayake [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

Sam Hobbs wrote:

I have posted over 12,000 messages in the CodeGuru.com Visual C++ forum,
Do you have a life ?

I hope the moderators protest posts such as this. 

Moderators?  You're in the land of anarchy here. ;)
--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Recursion help?

2004-09-19 Thread Gerard Samuel
Im trying to dynamically construct a multidimensional array
to be used with PEAR's HTML_Menu.
http://pear.php.net/manual/en/package.html.html-menu.intro.php.
Basically, Im pulling the data from a DB table, and trying to
attempt to convert the original array to what is needed for HTML_Menu.
If you look at the output (at the bottom of this message),
you'll see that after Edit Account it breaks to hell.
Any help in this matter would be very much appreciated.
Thanks
-- Script --
?php
header('content-type: text/plain');
$m = array (
  0 =
  array (
'id' = '',
'pid' = '0',
'name' = 'Home',
'url' = 'index.php',
  ),
  1 =
  array (
'id' = 'AB4wFQI2QUewz3P7',
'pid' = '',
'name' = 'User',
'url' = 'modules/user/index.php',
  ),
  2 =
  array (
'id' = 'AB4wFQI2QU2iY4SP',
'pid' = 'AB4wFQI2QUewz3P7',
'name' = 'Admin',
'url' = 'modules/user/admin/index.php',
  ),
  3 =
  array (
'id' = 'AB4wFQI2QU2ihsz2',
'pid' = 'AB4wFQI2QU2iY4SP',
'name' = 'delete',
'url' = 'modules/user/admin/list_to_delete.php',
  ),
  4 =
  array (
'id' = 'AB4wFQI2QUp0uEk7',
'pid' = 'AB4wFQI2QUewz3P7',
'name' = 'Edit Account',
'url' = 'modules/user/edit_account.php',
  ),
  5 =
  array (
'id' = 'AB4wFQI2QUp2huwX',
'pid' = 'AB4wFQI2QUewz3P7',
'name' = 'Login',
'url' = 'modules/user/login.php',
  ),
  6 =
  array (
'id' = 'AB4wFQI2QUpzujZ8',
'pid' = 'AB4wFQI2QUewz3P7',
'name' = 'Register',
'url' = 'modules/user/register.php',
  ),
);
//var_export($m);die;
var_export(foo());
function foo($key = 0)
{
$data = array();
for($x = $key; $x  count($GLOBALS['m']); $x++)
{
$id = $GLOBALS['m'][$x]['id'];
$name = $GLOBALS['m'][$x]['name'];
$data[$id]['name'] = $name;
if (FALSE !== ($child = children( $id )))
{
$data[$id]['sub'] = foo( $child );
$x = $child;
}
else
{
break;
}
}
return $data;
}
function children($id)
{
foreach($GLOBALS['m'] as $key = $value)
{
if ($id === $value['pid'])
{
return $key;
}
}
return FALSE;
}
?
-- End Script --
-- Start Output --
array (
  '' =
  array (
'name' = 'Home',
'sub' =
array (
  'AB4wFQI2QUewz3P7' =
  array (
'name' = 'User',
'sub' =
array (
  'AB4wFQI2QU2iY4SP' =
  array (
'name' = 'Admin',
'sub' =
array (
  'AB4wFQI2QU2ihsz2' =
  array (
'name' = 'delete',
  ),
),
  ),
  'AB4wFQI2QUp0uEk7' =
  array (
'name' = 'Edit Account',
  ),
),
  ),
  'AB4wFQI2QU2ihsz2' =
  array (
'name' = 'delete',
  ),
),
  ),
  'AB4wFQI2QU2iY4SP' =
  array (
'name' = 'Admin',
'sub' =
array (
  'AB4wFQI2QU2ihsz2' =
  array (
'name' = 'delete',
  ),
),
  ),
  'AB4wFQI2QUp0uEk7' =
  array (
'name' = 'Edit Account',
  ),
)
-- End Output --
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Infinate looping

2004-09-19 Thread Stephen Craton
 i haven't paid a lot of attention to your setup. are you running this 
 through your web server or via the php-cli?

Basically I have a file that connects to a database, before the loop, and
then checks the database for new messages. If there are, it displays them
accordingly

 if via php through the 
 web server i suspect you're running into a maxclients problem (your 
 client connections aren't closing fast enough so you're using up all 
 the client connections).

I was thinking this could be the case. Is there any way not to use up
maxclients? I'm just running one loop, though it may be infinite.

 if you're running this through your web server, a much more efficient 
 approach would be via a php-cli or perl application. either of these 
 should be able to run as continuous tasks without causing other 
 problems.

I would run through command line but I'm not sure how. This is a chat script
anyway, and I'm not sure if I have command line abilities on my production
server.

Also, I was thinking of maybe using a socket server. Are socket servers
allowed by mainstream web hosts or do you need certain privileges to open a
socket and connect to them?

Thanks,
Stephen Craton



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



Re: [PHP] mysql_connect does not connect

2004-09-19 Thread Jason Davidson
uh huh.. was it your firewall :) :)  it was wasnt it.. im so bad, im so
bad it hurts, but i solved your problem, so come on, a cookie or
something..pat on the head, or how about, thanks for helping.

Jason

Sam Hobbs [EMAIL PROTECTED] wrote: 
 
 Jason Wong [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
 
  Would you mind spilling the beans? I'm sure everyone is dying to know what 
  the
  resolution of this thread is.
 
 I definitely mind. I don't believe in rewarding bad behavior. It is 
 reasonable to contribute to the productive development of solutions, but the 
 attitude in this group is not productive. I have the impression that the 
 real reason you want answers is so that you can continue in unproductive 
 directions.
 
 -- 
 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] List Etiquette

2004-09-19 Thread Robert Cummings
On Sun, 2004-09-19 at 14:49, John Nichel wrote:
 Check the headers of this email.  I'm using a Windows box right now, and 
 my cursor was automatically at the end when I clicked reply.  Again, 
 it's laziness if one doesn't want to configure their client to put the 
 cursor at the end, or to manually move the cursor.

This is such a ridiculous argument. I've never understood why you can't
just let people post how they prefer unmolested. I don't think I've ever
argued that one way is better than another, though I would generally
agree that bottom posting is better. However I think people shouldn't be
pounced on for choosing to top post. Top posting doesn't make you lazy,
it is a preference that many people choose to exert and for some reason
raises the ire of some of the regulars here. i think Greg Beaver put
things into succinct perspective in his recent response to this thread.

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] password-protecting with PHP, help plz

2004-09-19 Thread Janet Valade
[EMAIL PROTECTED] wrote:
You were right, my display_error function was turned off. I turned it on and 
get this:

Parse error: syntax error, unexpected T_IS_EQUAL in c:\TSW\pages\testing2.php 
on line 3

So it isn't working. How do I get to let me make comparisons between the post 
data and something else? I figure if I can get it so that this will work, 
it'll be an easy way to password protect my pages...

-Andrew
The syntax is:  if (comparison){
You have:
if ($_POST['user']) == me {
Part of your comparison is not inside the parentheses. You need to have:
if ($_POST['user'] == me) {
Also, your string isn't quoted. That's not causing the parse error in 
this message, but will cause a problem after you fix your parentheses. 
(e.g., me).

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


Re: [PHP] List Etiquette

2004-09-19 Thread Chris Shiflett
I think it might be best to let this topic die. The original question did
not seem to be an attempt to start a debate but rather to hear why
experienced users dislike top posting. I think I gave such reasons in my
initial reply, so there's no longer a question that needs to be answered.

This is now likely a pointless debate, but I'd like to respond to a few
points anyway. Stop reading here if the debate bores you, and please
accept my apologies if you consider this to be off-topic.

--- Robert Cummings [EMAIL PROTECTED] wrote:
 I've never understood why you can't just let people post how they
 prefer unmolested.

The first few responses were answering a question that was asked, not
molesting anyone.

 Top posting doesn't make you lazy, it is a preference that many
 people choose to exert

This is like arguing that people choose to use IE instead of Firefox.
Surely the flaws of this argument are obvious. For people who bother to
make a choice, Firefox is a clear winner. The same is true for formatted
email. People (who care) tend to agree on a few major points and only
disagree on minor details, such as line length and methods of attribution.

Those of us who handle several hundred emails a day appreciate it when
those who send them take the time to format them properly. In fact, I bet
most people would not mind whether you arrange your emails to be read from
top to bottom or bottom to top as long as you put forth a sincere effort
to format the email nicely so that it is easy to read. It just happens to
be that most English speakers are used to reading from top to bottom, so
that is why this is preferred.

The only reason I ever bother to speak on this topic in public is for the
benefit of those who care enough to want to format their emails properly.
A formatted email is much easier for me to read as I go through hundreds a
day, and thus I'm more likely to answer the question(s) therein. Many,
many other question answerers feel the same way, so those who extend this
courtesy on a mailing list such as this are more likely to have their
questions answered. Others can spend their time arguing about it. :-)

Chris

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

PHP Security - O'Reilly
 Coming December 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



Re: [PHP] List Etiquette

2004-09-19 Thread -{ Rene Brehmer }-
At 16:57 19-09-2004, Octavian Rasnita wrote:
Hi,
From: John Nichel [EMAIL PROTECTED]
Do the words get smaller at the bottom?  Having to scroll thru line
after line of message doesn't deal with top vs. bottom posting...that
stems from people not trimming non-releative parts out of the message.
---
The rules should be made to make the reading process easier for the readers
and the top posting versus bottom posting has nothing to do with the
trimming of the messages.
It is much easier to trim a message when top posting, just as I explained
you.
In other words it's easier for you to reach your Delete key when you top 
post than when you bottom post ???

--
Rene Brehmer
aka Metalbunny
If your life was a dream, would you wake up from a nightmare, dripping of 
sweat, hoping it was over? Or would you wake up happy and pleased, ready to 
take on the day with a smile?

http://metalbunny.net/
References, tools, and other useful stuff...
Check out the new Metalbunny forums at http://forums.metalbunny.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Recursion help?

2004-09-19 Thread Marek Kilimajer
your children function can return only one child, and one parent can 
have more children. You should create an array of all children and loop 
that.

Gerard Samuel wrote:
Im trying to dynamically construct a multidimensional array
to be used with PEAR's HTML_Menu.
http://pear.php.net/manual/en/package.html.html-menu.intro.php.
Basically, Im pulling the data from a DB table, and trying to
attempt to convert the original array to what is needed for HTML_Menu.
If you look at the output (at the bottom of this message),
you'll see that after Edit Account it breaks to hell.
Any help in this matter would be very much appreciated.
Thanks
-- Script --
?php
header('content-type: text/plain');
$m = array (
  0 =
  array (
'id' = '',
'pid' = '0',
'name' = 'Home',
'url' = 'index.php',
  ),
  1 =
  array (
'id' = 'AB4wFQI2QUewz3P7',
'pid' = '',
'name' = 'User',
'url' = 'modules/user/index.php',
  ),
  2 =
  array (
'id' = 'AB4wFQI2QU2iY4SP',
'pid' = 'AB4wFQI2QUewz3P7',
'name' = 'Admin',
'url' = 'modules/user/admin/index.php',
  ),
  3 =
  array (
'id' = 'AB4wFQI2QU2ihsz2',
'pid' = 'AB4wFQI2QU2iY4SP',
'name' = 'delete',
'url' = 'modules/user/admin/list_to_delete.php',
  ),
  4 =
  array (
'id' = 'AB4wFQI2QUp0uEk7',
'pid' = 'AB4wFQI2QUewz3P7',
'name' = 'Edit Account',
'url' = 'modules/user/edit_account.php',
  ),
  5 =
  array (
'id' = 'AB4wFQI2QUp2huwX',
'pid' = 'AB4wFQI2QUewz3P7',
'name' = 'Login',
'url' = 'modules/user/login.php',
  ),
  6 =
  array (
'id' = 'AB4wFQI2QUpzujZ8',
'pid' = 'AB4wFQI2QUewz3P7',
'name' = 'Register',
'url' = 'modules/user/register.php',
  ),
);
//var_export($m);die;
var_export(foo());
function foo($key = 0)
{
$data = array();
for($x = $key; $x  count($GLOBALS['m']); $x++)
{
$id = $GLOBALS['m'][$x]['id'];
$name = $GLOBALS['m'][$x]['name'];
$data[$id]['name'] = $name;
if (FALSE !== ($child = children( $id )))
{
$data[$id]['sub'] = foo( $child );
$x = $child;
}
else
{
break;
}
}
return $data;
}
function children($id)
{
foreach($GLOBALS['m'] as $key = $value)
{
if ($id === $value['pid'])
{
return $key;
}
}
return FALSE;
}
?
-- End Script --
-- Start Output --
array (
  '' =
  array (
'name' = 'Home',
'sub' =
array (
  'AB4wFQI2QUewz3P7' =
  array (
'name' = 'User',
'sub' =
array (
  'AB4wFQI2QU2iY4SP' =
  array (
'name' = 'Admin',
'sub' =
array (
  'AB4wFQI2QU2ihsz2' =
  array (
'name' = 'delete',
  ),
),
  ),
  'AB4wFQI2QUp0uEk7' =
  array (
'name' = 'Edit Account',
  ),
),
  ),
  'AB4wFQI2QU2ihsz2' =
  array (
'name' = 'delete',
  ),
),
  ),
  'AB4wFQI2QU2iY4SP' =
  array (
'name' = 'Admin',
'sub' =
array (
  'AB4wFQI2QU2ihsz2' =
  array (
'name' = 'delete',
  ),
),
  ),
  'AB4wFQI2QUp0uEk7' =
  array (
'name' = 'Edit Account',
  ),
)
-- End Output --
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] empty variable

2004-09-19 Thread Chris Mach
What is the best way to determine if a variable is empty?

I have a feeling there is a better way than the way I'm doing it now...

if ($variable == )


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.766 / Virus Database: 513 - Release Date: 18-Sep-2004

Re: [PHP] empty variable

2004-09-19 Thread Larry E . Ullman
What is the best way to determine if a variable is empty?
I have a feeling there is a better way than the way I'm doing it now...
if ($variable == )
You could try the empty() or isset() functions, depending upon exactly 
what you're wanting to test. See the manual for descriptions of both.

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


Re: [PHP] empty variable

2004-09-19 Thread -{ Rene Brehmer }-
At 01:54 20-09-2004, Chris Mach wrote:
What is the best way to determine if a variable is empty?
I have a feeling there is a better way than the way I'm doing it now...
if ($variable == )
there's 2:
if (isset($variable))
or
if (isempty($variable))
what's most appropriate depends on how the variable is set or not
--
Rene Brehmer
aka Metalbunny
If your life was a dream, would you wake up from a nightmare, dripping of 
sweat, hoping it was over? Or would you wake up happy and pleased, ready to 
take on the day with a smile?

http://metalbunny.net/
References, tools, and other useful stuff...
Check out the new Metalbunny forums at http://forums.metalbunny.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] empty variable

2004-09-19 Thread Jason Davidson
as suggeted the isset and empty functions are usefull, 
or if you know it may be set, but could be empty, how about just
if($variable) {

}

that is the same as
if($var == )

Chris Mach [EMAIL PROTECTED] wrote: 
 
 What is the best way to determine if a variable is empty?
 
 I have a feeling there is a better way than the way I'm doing it now...
 
 if ($variable == )
 
 
 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.766 / Virus Database: 513 - Release Date: 18-Sep-2004

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



Re: [PHP] password-protecting with PHP, help plz

2004-09-19 Thread John Taylor-Johnston
Try this. Add it to the very beginning.

?php
  if(!isset($PHP_AUTH_USER)){
   header( WWW-Authenticate: Basic realm=\Are you allowed?\);
   header( HTTP/1.0 401 Unauthorized);
   echo Consult your teacher to have a valid login ID and password to access this 
page!\n;
   exit;
  }else{
if (
 ( ($PHP_AUTH_USER == john)  ( $PHP_AUTH_PW == english ))
 ||
 ( ($PHP_AUTH_USER == eric)  ( $PHP_AUTH_PW == english ))
 )
{
#echo you are in;
?


[EMAIL PROTECTED] wrote:

 You were right, my display_error function was turned off. I turned it on and
 get this:

 Parse error: syntax error, unexpected T_IS_EQUAL in c:\TSW\pages\testing2.php
 on line 3

 So it isn't working. How do I get to let me make comparisons between the post
 data and something else? I figure if I can get it so that this will work,
 it'll be an easy way to password protect my pages...

 -Andrew

--
John Taylor-Johnston
-
If it's not open-source, it's Murphy's Law.

 ' ' 'Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - 819-569-2064

  °v°   Bibliography of Comparative Studies in Canadian, Québec and Foreign Literatures
 /(_)\  Université de Sherbrooke
  ^ ^   http://compcanlit.ca/ T: 819.569.2064

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



[PHP] Re: How can I re-code?

2004-09-19 Thread John Taylor-Johnston
No one?


 I had an $array, with a list of authors and an entry number. Below is the code I 
 used. Now I
 have compiled it all into a table. I don't know how to re-code these lines:

 foreach (array_count_values ($authors) as $author=$count)
 foreach ($author_list[$author] as $ausid)

 ---new code---
 $myconnection = mysql_connect($server,$user,$pass);
 mysql_select_db($db,$myconnection);

 $news = mysql_query(select ccl_id,AUS from $table ORDER by AUS);

 while ($mydata = mysql_fetch_object($news))
 {
 ??   foreach (array_count_values ($authors) as $author=$count)
{
 ??   foreach ($author_list[$author] as $ausid)
 {
 }
}
 }

 -- My old code -
 foreach (array_count_values ($authors) as $author=$count)
 {
   echo tr;
   echo th$author/th;
   echo th.$count. records found/trouvés)/th;
   echo/tr\n;
   echo tr bgcolor=\#F5F5F5\tdnbsp;/td;
   echo td align=\left\;
   $temp = ;
   foreach ($author_list[$author] as $ausid)
   {
   $temp .= $ausid, ;
   }
   $temp = substr($temp, 0, -2);#delete , 
   echo $temp/td;

   echo /tr\n;
 }

 --
 John Taylor-Johnston
 -
   °v°   Bibliography of Comparative Studies in Canadian, Québec and Foreign 
 Literatures
  /(_)\  Université de Sherbrooke
   ^ ^   http://compcanlit.ca/

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



[PHP] Re: How can I re-code?

2004-09-19 Thread John Taylor-Johnston
No one?


 I had an $array, with a list of authors and an entry number. Below is the code I 
 used. Now I
 have compiled it all into a table. I don't know how to re-code these lines:

 foreach (array_count_values ($authors) as $author=$count)
 foreach ($author_list[$author] as $ausid)

 ---new code---
 $myconnection = mysql_connect($server,$user,$pass);
 mysql_select_db($db,$myconnection);

 $news = mysql_query(select ccl_id,AUS from $table ORDER by AUS);

 while ($mydata = mysql_fetch_object($news))
 {
 ??   foreach (array_count_values ($authors) as $author=$count)
{
 ??   foreach ($author_list[$author] as $ausid)
 {
 }
}
 }

 -- My old code -
 foreach (array_count_values ($authors) as $author=$count)
 {
   echo tr;
   echo th$author/th;
   echo th.$count. records found/trouvés)/th;
   echo/tr\n;
   echo tr bgcolor=\#F5F5F5\tdnbsp;/td;
   echo td align=\left\;
   $temp = ;
   foreach ($author_list[$author] as $ausid)
   {
   $temp .= $ausid, ;
   }
   $temp = substr($temp, 0, -2);#delete , 
   echo $temp/td;

   echo /tr\n;
 }

 --
 John Taylor-Johnston
 -
   °v°   Bibliography of Comparative Studies in Canadian, Québec and Foreign 
 Literatures
  /(_)\  Université de Sherbrooke
   ^ ^   http://compcanlit.ca/

--
John Taylor-Johnston
-
If it's not open-source, it's Murphy's Law.

 ' ' 'Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - 819-569-2064

  °v°   Bibliography of Comparative Studies in Canadian, Québec and Foreign Literatures
 /(_)\  Université de Sherbrooke
  ^ ^   http://compcanlit.ca/ T: 819.569.2064

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



Re: [PHP] List Etiquette

2004-09-19 Thread Octavian Rasnita

Teddy

- Original Message - 
From: -{ Rene Brehmer }- [EMAIL PROTECTED]
To: Octavian Rasnita [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, September 20, 2004 1:12 AM
Subject: Re: [PHP] List Etiquette


At 16:57 19-09-2004, Octavian Rasnita wrote:
Hi,

From: John Nichel [EMAIL PROTECTED]

Do the words get smaller at the bottom?  Having to scroll thru line
after line of message doesn't deal with top vs. bottom posting...that
stems from people not trimming non-releative parts out of the message.
---

The rules should be made to make the reading process easier for the readers
and the top posting versus bottom posting has nothing to do with the
trimming of the messages.
It is much easier to trim a message when top posting, just as I explained
you.

In other words it's easier for you to reach your Delete key when you top
post than when you bottom post ???
--

Ok, I have bottom posted, and have trimmed the end of the message. But this
was a little text only, while the header of this message is still there, and
it is bigger.
Well, I said that is harder to delete the head of the message and then go to
the end and delete the tail also.
That's why is easier to trim the message when top posting.

It would be easier for everyone if everyone would use Outlook Express and
not many other email clients that use a different style of headers they put
in the message, or that put the cursor in other positions by default.

But most users use Outlook Express as the email client, and not other
programs...
And this not only because it is included by default in Windows, but because
for some features it is the best program, like the accessibilitty for the
blind for example.

Teddy

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



Re: [PHP] List Etiquette

2004-09-19 Thread Octavian Rasnita
From: Chris Shiflett [EMAIL PROTECTED]

This is like arguing that people choose to use IE instead of Firefox.
Surely the flaws of this argument are obvious. For people who bother to
make a choice, Firefox is a clear winner. The same is true for formatted
email. People (who care) tend to agree on a few major points and only
disagree on minor details, such as line length and methods of attribution.
--

I choose to use IE and I don't like Firefox because I cannot use Firefox.
Fortunately I hope I will be able to use Mozilla's programs because I have
seen that they also want to make it accessible for the blind, but for the
moment their programs are not accessible.

So I choose IE, and not just use it because I like its security flaws so
much. :-)

Teddy

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



Re: [PHP] List Etiquette

2004-09-19 Thread Octavian Rasnita
From: John Nichel [EMAIL PROTECTED]

 Easier for reading?  Yes, you're right.  Do you read a book from the
 bottom of the page up?  Trimming a message is easier if you top post?
 That's pretty weak.  Follow a top posted thread, you'll see that most
 top posters just leave everything in there, whereas bottom posters tend
 to trim the message.
--

Yes, this is true, and I see that you fight more not for the bottom post,
but for trimming the messages.
I also don't like those who just send a message without trimming it at all,
but they do that because it is more simple for them. If you don't care
that's more simple for them, they might not care that you don't like that.
And it is not easier to trim if I want to bottom post.
My email client (Outlook Express) puts a lot of information at the top of
the message automaticly, like:

The signature,
--- original message ---
The From line
- The to line
- The date line
- The subject line.

And if I want to bottom post, I won't just need to hit control+End and start
writing at the end of the message, but I will need to trim the beginning of
the message and after that go and trim the end of the message also.

 Check the headers of this email.  I'm using a Windows box right now, and
 my cursor was automatically at the end when I clicked reply.  Again,
 it's laziness if one doesn't want to configure their client to put the
 cursor at the end, or to manually move the cursor.
--

I've told you that it's not just moving the cursor, but deleting the headers
the email clients put at the top also.
And Outlook Express doesn't allow the configurations you have ask for.
I don't like those headers it puts there at the top and I also don't like
that it doesn't allow too many configuration options, but unfortunately I
don't have another solution  a better email client, because most of them
are very hard accessible for screen readers.

Teddy

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



[PHP] Media file browser cache question --- second try

2004-09-19 Thread Daniel Guerrier
I'm using this code to dynamically retrieve windows
media files and send it to the browser.  I thought the
cache header would prevent the file from being cached.

The only problems is the .wmv file still ends up in my
IE temp files folder.  How can I prevent this from
happening?


?php
require_once(../admin/constant.php);
header(Content-Type: video/x-ms-wmv);
header(Last-Modified:  . gmdate(D, d M Y H:i:s) .
 GMT);
header(Expires: Mon, 26 Jul 1997 05:00:00 GMT);
header(Cache-Control: no-store, no-cache,
must-revalidate); 
header(Cache-Control: post-check=0, pre-check=0,
false);
header(Pragma: no-cache);
$file = DATAURL . /media/ . $_GET['mediafile'];
?
ASX VERSION=3.0
ENTRY
REF HREF =?php echo $file; ? /
/ENTRY
/ASX
---


I am streaming it.  That code is in an .asx metafile.
I assume it is supposed to work like a .ram for real
media.

Microsoft suggests using an asx file to stream media.
It does stream, I just do not want it to be cached in
my IE temp files.



__
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail

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



Re: [PHP] Recursion help?

2004-09-19 Thread Gerard Samuel
Marek Kilimajer wrote:
your children function can return only one child, and one parent can 
have more children. You should create an array of all children and loop 
that.

As always, thanks for the nudge in the right direction.
I was in the middle of rewriting it, and applied your suggestion to it.
So here is the final *mock* code for the archives,
if anyone else runs into a similar situation...
?php
header('content-type: text/plain');
$array = array (
  '' =
  array (
'id' = '',
'pid' = '0',
'name' = 'Home',
'url' = 'index.php',
  ),
  'AB4wFQI2QUewz3P7' =
  array (
'id' = 'AB4wFQI2QUewz3P7',
'pid' = '',
'name' = 'User',
'url' = 'modules/user/index.php',
  ),
  'AB4wFQI2QU2iY4SP' =
  array (
'id' = 'AB4wFQI2QU2iY4SP',
'pid' = 'AB4wFQI2QUewz3P7',
'name' = 'Admin',
'url' = 'modules/user/admin/index.php',
  ),
  'AB4wFQI2QU2ihsz2' =
  array (
'id' = 'AB4wFQI2QU2ihsz2',
'pid' = 'AB4wFQI2QU2iY4SP',
'name' = 'delete',
'url' = 'modules/user/admin/list_to_delete.php',
  ),
  'AB4wFQI2QUp0uEk7' =
  array (
'id' = 'AB4wFQI2QUp0uEk7',
'pid' = 'AB4wFQI2QUewz3P7',
'name' = 'Edit Account',
'url' = 'modules/user/edit_account.php',
  ),
  'AB4wFQI2QUp2huwX' =
  array (
'id' = 'AB4wFQI2QUp2huwX',
'pid' = 'AB4wFQI2QUewz3P7',
'name' = 'Login',
'url' = 'modules/user/login.php',
  ),
  'AB4wFQI2QUpzujZ8' =
  array (
'id' = 'AB4wFQI2QUpzujZ8',
'pid' = 'AB4wFQI2QUewz3P7',
'name' = 'Register',
'url' = 'modules/user/register.php',
  ),
);
function foo($array)
{
$data = array();
foreach($array as $key = $value)
{
$data[ $key ]['name'] = $value['name'];
$data[ $key ]['url']  = $value['url'];
$child = has_child($value['id']);
if (!empty($child))
{
$data[ $key ]['sub'] = foo($child);
}
}
return $data;
}
$data = foo($array);
var_dump($data);
function has_child($id)
{
$data = array();
foreach($GLOBALS['array'] as $key = $value)
{
if ($value['pid'] === $id)
{
$data[$key] = $GLOBALS['array'][$key];
}
}
return $data;
}
?
Gerard Samuel wrote:
Im trying to dynamically construct a multidimensional array
to be used with PEAR's HTML_Menu.
http://pear.php.net/manual/en/package.html.html-menu.intro.php.
Basically, Im pulling the data from a DB table, and trying to
attempt to convert the original array to what is needed for HTML_Menu.
If you look at the output (at the bottom of this message),
you'll see that after Edit Account it breaks to hell.
Any help in this matter would be very much appreciated.
Thanks
-- Script --
?php
header('content-type: text/plain');
$m = array (
  0 =
  array (
'id' = '',
'pid' = '0',
'name' = 'Home',
'url' = 'index.php',
  ),
  1 =
  array (
'id' = 'AB4wFQI2QUewz3P7',
'pid' = '',
'name' = 'User',
'url' = 'modules/user/index.php',
  ),
  2 =
  array (
'id' = 'AB4wFQI2QU2iY4SP',
'pid' = 'AB4wFQI2QUewz3P7',
'name' = 'Admin',
'url' = 'modules/user/admin/index.php',
  ),
  3 =
  array (
'id' = 'AB4wFQI2QU2ihsz2',
'pid' = 'AB4wFQI2QU2iY4SP',
'name' = 'delete',
'url' = 'modules/user/admin/list_to_delete.php',
  ),
  4 =
  array (
'id' = 'AB4wFQI2QUp0uEk7',
'pid' = 'AB4wFQI2QUewz3P7',
'name' = 'Edit Account',
'url' = 'modules/user/edit_account.php',
  ),
  5 =
  array (
'id' = 'AB4wFQI2QUp2huwX',
'pid' = 'AB4wFQI2QUewz3P7',
'name' = 'Login',
'url' = 'modules/user/login.php',
  ),
  6 =
  array (
'id' = 'AB4wFQI2QUpzujZ8',
'pid' = 'AB4wFQI2QUewz3P7',
'name' = 'Register',
'url' = 'modules/user/register.php',
  ),
);
//var_export($m);die;
var_export(foo());
function foo($key = 0)
{
$data = array();
for($x = $key; $x  count($GLOBALS['m']); $x++)
{
$id = $GLOBALS['m'][$x]['id'];
$name = $GLOBALS['m'][$x]['name'];
$data[$id]['name'] = $name;
if (FALSE !== ($child = children( $id )))
{
$data[$id]['sub'] = foo( $child );
$x = $child;
}
else
{
break;
}
}
return $data;
}
function children($id)
{
foreach($GLOBALS['m'] as $key = $value)
{
if ($id === $value['pid'])
{
return $key;
}
}
return FALSE;
}
?
-- End Script --
-- Start Output --
array (
  '' =
  array (
'name' = 'Home',
'sub' =
array (
  'AB4wFQI2QUewz3P7' =
  array (
'name' = 'User',
'sub' =
array (
  'AB4wFQI2QU2iY4SP' =
  array (
'name' = 'Admin',
'sub' =
array (
  'AB4wFQI2QU2ihsz2' =
  array (
'name' = 'delete',
  ),
),
  ),
  'AB4wFQI2QUp0uEk7' =
  array (

Re: [PHP] empty variable

2004-09-19 Thread Pat
So, you have to know, first, what is your meaning of your empty variabe:
null, 0, , array()?

For example, $var = 0;, empty($var) says true... but you?

Jason Davidson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 as suggeted the isset and empty functions are usefull,
 or if you know it may be set, but could be empty, how about just
 if($variable) {

 }

 that is the same as
 if($var == )

 Chris Mach [EMAIL PROTECTED] wrote:
 
  What is the best way to determine if a variable is empty?
 
  I have a feeling there is a better way than the way I'm doing it now...
 
  if ($variable == )
 
 
  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.766 / Virus Database: 513 - Release Date: 18-Sep-2004

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



Re: [PHP] password-protecting with PHP, help plz

2004-09-19 Thread AceZero2790
Now moving on to using password protecting with more than one factor.

I'm trying to figure out how to password protect with more than two factors: 
username and password. Here's the form:

?php
echo _HTML_

form method=post action=http://www.thesonicworld.net/pages/testing2.php;
Username: input type=text name=userbr
form method=post action=http://www.thesonicworld.net/pages/testing2.php;
Password: input type=text name=pass
br
centerinput type=submit value=Log In/center
/form

_HTML_;
?

And here is the action page, testing2.php.

if ($_POST['user'] == 'Andrew')  ($_POST['pass'] == 'pass') {
echo Welcome, Andrew.; }

And (shocker!) I got a blank page. So I turned out display errors and got 
this:

Parse error: syntax error, unexpected T_BOOLEAN_AND in 
c:\TSW\pages\testing2.php on line 3

Line 3 being the line with the  stuff. I'm not sure if the whole  thing 
is right...obviously not. How do I password protect with more than one factor?

-Andrew



[PHP] turn on GD2 lib on php 4.3.4

2004-09-19 Thread Afan Pasalic
hi,
I have right now on my server php 4.3.4 without GD2 support. Actually, 
doesn't have GD support at all (nothing on phpinfo(); ).
How can I turn it on? :)

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


Re: [PHP] empty variable

2004-09-19 Thread Jason Davidson
if youdo 
if($var) {

}

and var doesnt exist at all, thats an error.

if(isset($var)) {

}

will test to see if $var exists, but will not test the value of var, so
$var could be blank...

Jason

Pat [EMAIL PROTECTED] wrote: 
 
 So, you have to know, first, what is your meaning of your empty variabe:
 null, 0, , array()?
 
 For example, $var = 0;, empty($var) says true... but you?
 
 Jason Davidson [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  as suggeted the isset and empty functions are usefull,
  or if you know it may be set, but could be empty, how about just
  if($variable) {
 
  }
 
  that is the same as
  if($var == )
 
  Chris Mach [EMAIL PROTECTED] wrote:
  
   What is the best way to determine if a variable is empty?
  
   I have a feeling there is a better way than the way I'm doing it now...
  
   if ($variable == )
  
  
   ---
   Outgoing mail is certified Virus Free.
   Checked by AVG anti-virus system (http://www.grisoft.com).
   Version: 6.0.766 / Virus Database: 513 - Release Date: 18-Sep-2004
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



[PHP] readdir behavior I cannot understand

2004-09-19 Thread Jason FB
PHP General List,
I am trying to read the contents of a directory on a server and 
perform imagemagick operations on each JPG found inside the 
directory. The area where I am stuck currently is not the image 
manipulation but the PHP function readdir().

Can anyone explain why I am having this behavior with PHP using the 
scripts out of the manual pages for readdir()

Hereis my script, I copied and pasted Example 1 from this page:
http://us4.php.net/manual/en/function.readdir.php
You will see that the only way that I changed I initialize two 
variables at the very top that set the directory of the directory to 
open. The script should read the contents of the directory and print 
them to the resulting page.

Instead, it returns a the following parse error
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in 
/Users/jason/Sites/images_exotic/REDESIGN2 FALL 
04/admin/check_set_local.php on line 4

I see this PHP behavior on both Windows Server running PHP 4.3.2 and 
on my own Mac (OS X client) running apache as a Personal Web 
Sharing PHP version 4.3.6

Any help is appreciated.  The contents of the script which I cannot 
get the parse error out of is below.

On this vein, can anyone tell me a succinct explanation of the 
bang-equal-equal (!==) operator in contrast to the bang-equal (!=) 
operator?

I've never seen that before, is it borrowed from other languages? I 
do not remember it from when I was learning C++.

Thanks.
-JFB-

?php
// Note that !== did not exist until 4.0.0-RC2
$root_dir = /Users/jason/Sites/;
$folder_on_server test;
if ($handle = opendir($root_dir . $folder_on_server)) {
echo Directory handle: $handle\n;
echo Files:\n;
 /* This is the correct way to loop over the directory. */
 while (false !== ($file = readdir($handle))) {
echo $file\n;
}
 closedir($handle);
 }
?




[PHP] Re: readdir behavior I cannot understand

2004-09-19 Thread Greg Beaver
Jason Fb wrote:
?php
// Note that !== did not exist until 4.0.0-RC2
$root_dir = /Users/jason/Sites/;
$folder_on_server test;
This should be:
$folder_on_server = test;
T_CONSTANT_ENCAPSED_STRING is a long way of saying a string that doesn't 
have any fanciness in it like test or 'hello', but not this $way 
because $way is a variable that will be interpreted.

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


[PHP] follow-up readdir behavior I cannot understand

2004-09-19 Thread Jason FB
PHP General List,
Regarding my the previous post -- the script had another bug in it 
which I felt silly for having posted since it's so obvious at the 
very top (a misisng = sign).

However, I am still having a problem with this script practically 
copied and pasted from the PHP manual.

The revised script is below, the parse error I am actually seeing now 
after adding the = sign is as follows:

 Parse error: parse error, unexpected T_ECHO in 
D:\Inetpub\wwwroot\imagesexotic\Fall04\admin\check_set.php on line 6

Thanks...
-JFB-
?php
// Note that !== did not exist until 4.0.0-RC2
$root_dir = /Users/jason/Sites/;
$folder_on_server  = ;

if ($handle = opendir($root_dir . $folder_on_server)) {
print Directory handle: $handle\n;
print Files:\n;
 /* This is the correct way to loop over the directory. */
 while (false !== ($file = readdir($handle))) {
echo $file\n;
}
 closedir($handle);
 }
?




Re: [PHP] List Etiquette

2004-09-19 Thread John Nichel
Octavian Rasnita wrote:
snip
In other words it's easier for you to reach your Delete key when you top
post than when you bottom post ???
--
Ok, I have bottom posted, and have trimmed the end of the message. But this
was a little text only, while the header of this message is still there, and
it is bigger.
Well, I said that is harder to delete the head of the message and then go to
the end and delete the tail also.
That's why is easier to trim the message when top posting.
It would be easier for everyone if everyone would use Outlook Express and
not many other email clients that use a different style of headers they put
in the message, or that put the cursor in other positions by default.
But most users use Outlook Express as the email client, and not other
programs...
And this not only because it is included by default in Windows, but because
for some features it is the best program, like the accessibilitty for the
blind for example.
Most use Outlook or Outlook Express?  I think you'd be hard pressed to 
find _most_ users of a mailing list which deals with something in the 
Open Source Community (like php) using a Microsoft mailer.  Most of the 
newbies, probably; but the people who are on this list, day in and day 
out, are more than likely not...even if they are using a Microsoft OS. 
However, the, my mail client puts the cursor at the top is still a 
pretty weak reason to top post.

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] References Explained... (This time Im stumped)

2004-09-19 Thread Gerard Samuel
I could have sworn that references and I used to get along...
In the menu::hasChild method, I cant seem to reference $this-_data.
$this-_data is supposed to be a reference to the original array $array
in the local scope.
The only way to make this script work is to call on the $GLOBALS array
in menu::hasChild.
Could anyone explain to me, why I'm unable to use $this-_data
in menu::hasChild?
Im using PHP 4.3.8.
Thanks for any info you can provide...
-- Code Snip --
?php
header('content-type: text/plain');
$array = array (
  '' =
  array (
'id' = '',
'pid' = '0',
'name' = 'Home',
'url' = 'index.php',
  ),
  'AB4wFQI2QUewz3P7' =
  array (
'id' = 'AB4wFQI2QUewz3P7',
'pid' = '',
'name' = 'User',
'url' = 'modules/user/index.php',
  ),
  'AB4wFQI2QU2iY4SP' =
  array (
'id' = 'AB4wFQI2QU2iY4SP',
'pid' = 'AB4wFQI2QUewz3P7',
'name' = 'Admin',
'url' = 'modules/user/admin/index.php',
  ),
  'AB4wFQI2QU2ihsz2' =
  array (
'id' = 'AB4wFQI2QU2ihsz2',
'pid' = 'AB4wFQI2QU2iY4SP',
'name' = 'delete',
'url' = 'modules/user/admin/list_to_delete.php',
  ),
  'AB4wFQI2QUp0uEk7' =
  array (
'id' = 'AB4wFQI2QUp0uEk7',
'pid' = 'AB4wFQI2QUewz3P7',
'name' = 'Edit Account',
'url' = 'modules/user/edit_account.php',
  ),
  'AB4wFQI2QUp2huwX' =
  array (
'id' = 'AB4wFQI2QUp2huwX',
'pid' = 'AB4wFQI2QUewz3P7',
'name' = 'Login',
'url' = 'modules/user/login.php',
  ),
  'AB4wFQI2QUpzujZ8' =
  array (
'id' = 'AB4wFQI2QUpzujZ8',
'pid' = 'AB4wFQI2QUewz3P7',
'name' = 'Register',
'url' = 'modules/user/register.php',
  ),
);
$menu = new menu;
$data = $menu-constructMenuData( $array );
var_dump($data);
class menu
{
var $_data = array();
function constructMenuData($raw_data)
{
$data = array();
$this-_data = $raw_data;
foreach($this-_data as $key = $value)
{
$data[ $key ]['name'] = $value['name'];
$data[ $key ]['url']  = $value['url'];
$child = $this-hasChild( $value['id'] );
if (!empty($child))
{
$data[ $key ]['sub'] = $this-constructMenuData( $child );
}
}
return $data;
}
function hasChild($id)
{
$data = array();
//foreach($this-_data as $key = $value)
foreach($GLOBALS['array'] as $key = $value)
{
if ($value['pid'] === $id)
{
//$data[ $key ] = $this-_data[ $key ];
$data[ $key ] = $GLOBALS['array'][ $key ];
}
}
return $data;
}
}
?
-- End Code snip --
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] References Explained... (This time Im stumped)

2004-09-19 Thread Gerard Samuel
Gerard Samuel wrote:
I could have sworn that references and I used to get along...
In the menu::hasChild method, I cant seem to reference $this-_data.
$this-_data is supposed to be a reference to the original array $array
in the local scope.
The only way to make this script work is to call on the $GLOBALS array
in menu::hasChild.
Could anyone explain to me, why I'm unable to use $this-_data
in menu::hasChild?
Nevermind.  I figured what was causing the problem...
New Code:
-- Code Snip --
?php
header('content-type: text/plain');
$array = array (
  '' =
  array (
'id' = '',
'pid' = '0',
'name' = 'Home',
'url' = 'index.php',
  ),
  'AB4wFQI2QUewz3P7' =
  array (
'id' = 'AB4wFQI2QUewz3P7',
'pid' = '',
'name' = 'User',
'url' = 'modules/user/index.php',
  ),
  'AB4wFQI2QU2iY4SP' =
  array (
'id' = 'AB4wFQI2QU2iY4SP',
'pid' = 'AB4wFQI2QUewz3P7',
'name' = 'Admin',
'url' = 'modules/user/admin/index.php',
  ),
  'AB4wFQI2QU2ihsz2' =
  array (
'id' = 'AB4wFQI2QU2ihsz2',
'pid' = 'AB4wFQI2QU2iY4SP',
'name' = 'delete',
'url' = 'modules/user/admin/list_to_delete.php',
  ),
  'AB4wFQI2QUp0uEk7' =
  array (
'id' = 'AB4wFQI2QUp0uEk7',
'pid' = 'AB4wFQI2QUewz3P7',
'name' = 'Edit Account',
'url' = 'modules/user/edit_account.php',
  ),
  'AB4wFQI2QUp2huwX' =
  array (
'id' = 'AB4wFQI2QUp2huwX',
'pid' = 'AB4wFQI2QUewz3P7',
'name' = 'Login',
'url' = 'modules/user/login.php',
  ),
  'AB4wFQI2QUpzujZ8' =
  array (
'id' = 'AB4wFQI2QUpzujZ8',
'pid' = 'AB4wFQI2QUewz3P7',
'name' = 'Register',
'url' = 'modules/user/register.php',
  ),
);
$menu = new menu;
$menu-setData( $array );
$data = $menu-constructMenuData( $array );
var_dump($data);
class menu
{
var $_data = array();
function setData($data)
{
$this-_data = $data;
}
function constructMenuData($raw_data)
{
$data = array();
foreach($raw_data as $key = $value)
{
$data[ $key ]['name'] = $value['name'];
$data[ $key ]['url']  = $value['url'];
$child = $this-hasChild( $value['id'] );
if (!empty($child))
{
$data[ $key ]['sub'] = $this-constructMenuData( $child );
}
}
return $data;
}
function hasChild($id)
{
$data = array();
foreach($this-_data as $key = $value)
{
if ($value['pid'] === $id)
{
$data[ $key ] = $this-_data[ $key ];
}
}
return $data;
}
}
?
-- End Code Snip --
-- Code Snip --
?php
header('content-type: text/plain');
$array = array (
  '' =
  array (
'id' = '',
'pid' = '0',
'name' = 'Home',
'url' = 'index.php',
  ),
  'AB4wFQI2QUewz3P7' =
  array (
'id' = 'AB4wFQI2QUewz3P7',
'pid' = '',
'name' = 'User',
'url' = 'modules/user/index.php',
  ),
  'AB4wFQI2QU2iY4SP' =
  array (
'id' = 'AB4wFQI2QU2iY4SP',
'pid' = 'AB4wFQI2QUewz3P7',
'name' = 'Admin',
'url' = 'modules/user/admin/index.php',
  ),
  'AB4wFQI2QU2ihsz2' =
  array (
'id' = 'AB4wFQI2QU2ihsz2',
'pid' = 'AB4wFQI2QU2iY4SP',
'name' = 'delete',
'url' = 'modules/user/admin/list_to_delete.php',
  ),
  'AB4wFQI2QUp0uEk7' =
  array (
'id' = 'AB4wFQI2QUp0uEk7',
'pid' = 'AB4wFQI2QUewz3P7',
'name' = 'Edit Account',
'url' = 'modules/user/edit_account.php',
  ),
  'AB4wFQI2QUp2huwX' =
  array (
'id' = 'AB4wFQI2QUp2huwX',
'pid' = 'AB4wFQI2QUewz3P7',
'name' = 'Login',
'url' = 'modules/user/login.php',
  ),
  'AB4wFQI2QUpzujZ8' =
  array (
'id' = 'AB4wFQI2QUpzujZ8',
'pid' = 'AB4wFQI2QUewz3P7',
'name' = 'Register',
'url' = 'modules/user/register.php',
  ),
);
$menu = new menu;
$data = $menu-constructMenuData( $array );
var_dump($data);
class menu
{
var $_data = array();
function constructMenuData($raw_data)
{
$data = array();
$this-_data = $raw_data;
foreach($this-_data as $key = $value)
{
$data[ $key ]['name'] = $value['name'];
$data[ $key ]['url']  = $value['url'];
$child = $this-hasChild( $value['id'] );
if (!empty($child))
{
$data[ $key ]['sub'] = $this-constructMenuData( $child );
}
}
return $data;
}
function hasChild($id)
{
$data = array();
//foreach($this-_data as $key = $value)
foreach($GLOBALS['array'] as $key = $value)
{
if ($value['pid'] === $id)
{
//$data[ $key ] = $this-_data[ $key ];
$data[ $key ] = $GLOBALS['array'][ $key ];
}
}
return $data;
}
}
?
-- End Code snip --
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] password-protecting with PHP, help plz

2004-09-19 Thread John Taylor-Johnston
Parse error: syntax error, unexpected T_BOOLEAN_AND in c:\TSW\pages\testing2.php on 
line 3
My code should do what you want? It uses authenticate? Any how :) I think you are 
missing acouple of brackets?

if (
($_POST['user'] == 'Andrew')  ($_POST['pass'] == 'pass')
)
{
echo Welcome, Andrew.;
}


[EMAIL PROTECTED] wrote:

 Now moving on to using password protecting with more than one factor.

 I'm trying to figure out how to password protect with more than two factors:
 username and password. Here's the form:

 ?php
 echo _HTML_

 form method=post action=http://www.thesonicworld.net/pages/testing2.php;
 Username: input type=text name=userbr
 form method=post action=http://www.thesonicworld.net/pages/testing2.php;
 Password: input type=text name=pass
 br
 centerinput type=submit value=Log In/center
 /form

 _HTML_;
 ?

 And here is the action page, testing2.php.

 if ($_POST['user'] == 'Andrew')  ($_POST['pass'] == 'pass') {
 echo Welcome, Andrew.; }

 And (shocker!) I got a blank page. So I turned out display errors and got
 this:

 Parse error: syntax error, unexpected T_BOOLEAN_AND in
 c:\TSW\pages\testing2.php on line 3

 Line 3 being the line with the  stuff. I'm not sure if the whole  thing
 is right...obviously not. How do I password protect with more than one factor?

 -Andrew

John

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