Re: [PHP] regular expression help

2004-09-29 Thread Petar Nedyalkov
On Wednesday 29 September 2004 08:46, Ed Lazor wrote:
 complain
 Today I discovered that my ISP can't upgrade to PHP 5.  They use Plesk for
 server Administration and PHP 5 apparently breaks Plesk.  Plesk says
 they'll make PHP 5 support available as soon as it starts coming default on
 RedHat Enterprise.
 /complain

 Unfortunately, I now have a bunch of scripts that require PHP 5.  I'd
 upgraded my beta server for testing and everything has been going so great
 that I went gungho.  Honestly, I tried to not too many of the new features,
 just so I could ease into it and do more testing.  I'm finding little
 differences that I didn't even realize I was taking advantage of.  For
 example, there are a lot of places in the code where I've done something
 like this:

 print Learn more about {$product-get_Title()}.br;

http://www.php.net/manual/en/function.preg-replace.php

$pattern = /\{\$(.+?)\}/i;
$replacement = \\.\$$1\.\;

Try this out ;-) I haven't tested it but it's the right direction ;-)


 I uploaded scripts like this to the production server for more testing and
 PHP4 flagged all of the code like this as parse errors.  I'm not sure, but
 now I'm stuck having to go through all of the code to change the coding
 style  my editor (Dreamweaver MX 2004) allows me to do a global search
 and replace using regular expressions.  I have no idea what regular
 expression I'd use for something like this.  Any recommendations?

 Thanks,

 Ed

-- 
Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)
-
Orbitel - the New Generation Telecom! See www.orbitel.bg.

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



[PHP] Re: simple date/now() question

2004-09-29 Thread Harlequin
I gave up with the timestamp feature because although it's accurate it's not 
English and needs to be reworked to make it presentable.

Despite finding code to do this I still moved on to using a date\time stamp 
using the US format of-course and this echoes much easier and will of-course 
be easier to perform calculations on.


Hope that helps some...

-- 
-
 Michael Mason
 Arras People
 www.arraspeople.co.uk
-
Mag [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hi,
 I have a field in the db called

 join_date_time(timestamp 14)

 which has data like:

 20040928170708
 20040916163619
 etc

 This keeps track of the customer join date, I need to
 know if the client has joined in the last 24hrs or
 more than 24hrs back...

 Anybody have a function for this? or can help? am a
 bit confused because reading on google I see that
 there are 2 possible problems as MySql has its own
 time and PHP its own time (most of the time!)

 Thanks,
 Mag

 =
 --
 - 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] Searching My Database

2004-09-29 Thread Harlequin
Morning everyone.

I've read around the subject of searching and although using the FULLTEXT 
capability of MySQL might be the proper way of doing this I feel it's 
somewhat limited and have decided to use a simple select procedure.

I'm sure there's a better way of doing this, as I'm quite new to MySQL and 
even newer to searches, However - here's my conundrum:

I'm declaring variables at the top of my query like so:

  Code:
  $WorkPermit  == ' . $_POST[WorkPermit] .  ';



And then execute the query like so:

  Code:
  SELECT * FROM MembersData
  WHERE `Work_Permit_Rqd`
  LIKE '$WorkPermit'



But I have many other fields that the searcher can use. What do I do if they 
leave this field blank...?

I appreciate that I should be using the MATCH function but I'm not entirely 
happy with the way it searches.

What I need to do is actually omit a field (s) from the search if the value 
the searcher submitted was NULL.

For example:

Search field X and Y and Z
and if x or Y are null
continue...

Am I explaining this OK...?

Any suggestions gratefully received.


-- 
-
 Michael Mason
 Arras People
 www.arraspeople.co.uk
- 

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



[PHP] PHP variables via SSL on IE5.x

2004-09-29 Thread Merlin
Hi there,
I am having trouble with posting a form to a php script through SSL on IE prior 
5.5 sp1. It works like a charm on all other browsers. In IE it works without 
SSL, but when SSL is enabled, the browser pops up with a message that he is 
switching to an unsecure site and then all then displays a 404 error with the 
correct php file url inside the Adressbar. I guess the browser is somehow 
loosing all variables submited via post.

Has anybody an idea how to solve that? I cant unfortunatelly provide a link, 
since I had to disable SSL on the productio server due to that error.

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


[PHP] PHP Data cache ideas/solutions

2004-09-29 Thread Niklas Ojala
Hello

I am kind of new to this news thing, but here goes.

I am looking for a class or some samples that would read a table from mysql
and store it in an array variable, so that it will be avilable to other
parts of the page without having to get it from the database again. So I
would like to only get the table once per page load but I must be able to
filter the table to get the data that I want.

I am looking for some similar code to get me started or other ideas on how
to make less queries to the database.

/Niklas Ojala

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



RE: [PHP] Re: grabbing information from websites

2004-09-29 Thread Graham Cossey

OK, I've tried it out. What is interesting is that the URL you have posted
results in the site's 'home' page, for me anyway, which obviously results in
no matches for the preg_match. It appears to redirect to
http://www.runescape.com/ somehow.

I am using the code:

?php
$content =
file_get_contents(http://hiscore.runescape.com/aff/runescape/hiscorepersona
l.cgi?username=champinoman);
if
(preg_match('#username=champinomancategory=13.*align=right(.*)/td#mi',
$content,$out))
{
echo $out;
}else{
echo $content;  // - results in home page
}
?

Graham

-Original Message-
From: champinoman [mailto:[EMAIL PROTECTED]
Sent: 29 September 2004 02:04
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: grabbing information from websites


i tried putting in fread() but still getting a blank screen. any other
errors in here?

?php
$file = fopen
(http://hiscore.runescape.com/aff/runescape/hiscorepersonal.cgi?username=ch
ampinoman,r);
$line = fread ($file, 1024);
if
(preg_match('#username=champinomancategory=13.*align=right(.*)/td#mi',
$line,$out))
{
$rune = $out;
}
fclose($file);
print $rune;
?



Graham Cossey [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

 fgets() will read in from file until end of line or end of file up to the
 No
 bytes given.

 Is there an end of line between the username=chapinoman and the td
 align=right70,277 ?

 If there is a line break then $line will never contain both strings.

 You may need to use fread() instead.

 HTH

 Graham

 -Original Message-
 From: champinoman [mailto:[EMAIL PROTECTED]
 Sent: 28 September 2004 14:47
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Re: grabbing information from websites


 i said i was learning this and didnt really understand it.
 so going by what has been said i have come up with the following but
 still doesnt want to work.
 heres what i have:

 ?php
 $file = fopen

(http://hiscore.runescape.com/aff/runescape/hiscorepersonal.cgi?username=ch
 ampinoman,r);
 $line = fgets ($file, 1024);
 if

(preg_match('#username=champinomancategory=13.*align=right(.*)/td#mi',
 $line,$out))
 {
 $rune = $out;
 }
 fclose($file);
 print $rune;
 ?

 and the source it is looking at is:

 trtdimg src=http://www.runescape.com/img/hiscores/crafting.gif;
 valign=bottom width=16 height=16 //tdtdnbsp;/td
 tda href=hiscoreuser.cgi?username=champinomancategory=13
 class=cCrafting/a/td
 td align=right70,277/tdtd align=right
 43
 /tdtd align=right
 53,630
 /td/tr

 I want it to get the 70,277 and store as $rune
 if someone can tell me where im wrong i would be extremely grateful

 thank you for your ongoing support.



 --
--
 --
 M. Sokolewicz [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 ugh, obviously I'm a bad typer :) The code should be:



preg_match('#username=champinomancategory=13.*align=right(.*)/td#mi',
 $text, $out);

 Or using any other patterndelimiter... ;)

 M. Sokolewicz wrote:

 I thought I clearly stated that for the m modifier you need to use PCRE
 functions!

 eg:



preg_match('/username=champinomancategory=13.*align=right(.*)/td/mi',
 $text, $out);

 Champinoman wrote:

 so does this look right:

 eregi


(username=champinomancategory=13.*align=\right\(.*)/tdm,$line,$out))

 is that where i am ment to put the 'm' modifier? or am i still off on
 the wrong track?




 Graham Cossey [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]

 From http://gnosis.cx/publish/programming/regular_expressions.html:

 Sometimes you have a programming problem and it seems like the best
 solution is to use regular expressions; now you have two problems.

 To me regular expressions are some kind of black art, I've been
 programming
 for 20 years and until recently have pretty much managed to avoid
 them.
 The
 above URL is a pretty good tutorial.

 HTH

 Graham

 -Original Message-
 From: champinoman [mailto:[EMAIL PROTECTED]
 Sent: 28 September 2004 09:35
 To: [EMAIL PROTECTED]
 Subject: [PHP] Re: grabbing information from websites




 instead of the POSIX regexp, tr using PERL style RegExps
 (www.php.net/pcre) Once you've done that, you can add the pattern
 modifier
 'm' to allow multilines .


 i think im lost now. i had a look at the site but im not sure what im
 looking at. any chance u could make a mock script up so i can see what
 your
 explaining?

 --
 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 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] GNU/Linux MacOsX Server different behaviour

2004-09-29 Thread Francesco Casalena



Hi Brent, hi list,



If you just run your command in the shell, you'll see that you 

get an operation not permitted error. Using the -r switch you

can provide the seconds since Epoch to just display a 'date'

you specify.

For instance:

date -r 97840 +%a

Returns 'Mon'



Ok, that's right!

But I also notice this strange behaviour on Mac:



date -r 049290 +%a   returns 'Wed'...ok

date -r 049280 +%a   returns 'Tue'...ok

date -r 049270 +%a   returns 'Mon'...ok

date -r 049260 +%a   returns 'Sat'...ok

date -r 049250 +%a   returns 'Sun'...ok

date -r 049240 +%a   returns 'Fri'...no!



I try for a test:



date -r 049241 +%a   returns 'Sat'...ok



(1 are hhmms from the Epoch, is it true?)

but:



date -r 049231 +%a   returns 'Fri'...ok

date -r 049221 +%a   returns 'Wed'...no!



The behaviour is the same via Bash and via PHP script

that invokes the shell...is it a my error or a X server

bug?



Regards, thanks!

Ciao

Francesco



 

---
Leggi la tua email con il tuo cellulare! Grazie a I.Box puoi
leggere la tua email di superEva da SMS e dalla segreteria!
http://webmail.supereva.it/ibox/
---

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



[PHP] Escaping Regex Chars with addcslashes()

2004-09-29 Thread Nick Wilson
Hi all, 

If i want to find a url on a page, there are some chars i need to escape
right?

like '/' and '?'

do i also need to escape '.'?
Are there any other things that might pop up in a url that I can escape
with addcslashes()?

Much thanks
-- 
Nick W

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



Re: [PHP] PHP Data cache ideas/solutions

2004-09-29 Thread Nick Wilson

* and then Niklas Ojala declared
 I am looking for a class or some samples that would read a table from mysql
 and store it in an array variable, so that it will be avilable to other
 parts of the page without having to get it from the database again. So I
 would like to only get the table once per page load but I must be able to
 filter the table to get the data that I want.
 
 I am looking for some similar code to get me started or other ideas on how
 to make less queries to the database.

It may be a little 'overkill' for this particular example but it'll
work, and it'll help you keep code and presentation separte (which is a
VERY good thing) - Take an hour or two to get to grips with the Smarty
template engine: http://smarty.php.net

Does exactly what you want and a whole bunch more ;-)  i wouldnt
build a site without it...

-- 
Nick W

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



Re: [PHP] Escaping Regex Chars with addcslashes()

2004-09-29 Thread Marek Kilimajer
Nick Wilson wrote:
Hi all, 

If i want to find a url on a page, there are some chars i need to escape
right?
like '/' and '?'
do i also need to escape '.'?
Are there any other things that might pop up in a url that I can escape
with addcslashes()?
Much thanks
Don't use posix regexp, but use perl compatible instead. It has
preg_quote() function that is intended for this purpose.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Escaping Regex Chars with addcslashes()

2004-09-29 Thread Nick Wilson

* and then Marek Kilimajer declared
 If i want to find a url on a page, there are some chars i need to escape
 right?
 
 like '/' and '?'
 
 do i also need to escape '.'?
 Are there any other things that might pop up in a url that I can escape
 with addcslashes()?

 Don't use posix regexp, but use perl compatible instead. It has
 preg_quote() function that is intended for this purpose.

I'll go look it up, thanks Marek ;-)


-- 
Nick W

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



Re: [PHP] Multiple pages of data.

2004-09-29 Thread Silvio Porcellana
You can solve it totally with SQL, using the FOUND_ROWS() function 
[http://dev.mysql.com/doc/mysql/en/Information_functions.html]

I think this is the most efficient way of doing it...
HTH, cheers
Silvio Porcellana
Nick Patsaros wrote:
I'm trying to build a bulletin style system right now.  I have topics
and replies to each topic.  If a topic gets more than 15 replies I
want them to start carrying over onto page 2 and then 3 and so on with
15 replies per page.
The key that I'm missing I guess is, how do I keep track of the last
accessed row in the database?  So if I run a LIMIT 15 I can go back
and pick up where I left on previously?  Using the primary key isn't
going to help because if posts get deleted I would have less than 15
per page.
Maybe I'm totally lost on this though, if someone could give me a bit
of help on the most efficient way to accomplish this.
--Nick
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: Re: [PHP] GNU/Linux MacOsX Server different behaviour

2004-09-29 Thread Francesco Casalena

Hi Brent, hi list,



Oooopsss...;)



date -r 049290 +%a   returns 'Wed'...ok

date -r 049280 +%a   returns 'Tue'...ok

date -r 049270 +%a   returns 'Mon'...ok

date -r 049260 +%a   returns 'Sun'...ok

   ^^^ 

date -r 049250 +%a   returns 'Sat'...ok

   ^^^

date -r 049240 +%a   returns 'Fri'...no!



Sorry!

Ciao

Francesco

---
Leggi la tua email con il tuo cellulare! Grazie a I.Box puoi
leggere la tua email di superEva da SMS e dalla segreteria!
http://webmail.supereva.it/ibox/
---

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



Re: [PHP] GNU/Linux MacOsX Server different behaviour

2004-09-29 Thread Francesco Casalena

Hi Brent, hi list,



Oooopsss...;)



date -r 049290 +%a   returns 'Wed'...ok

date -r 049280 +%a   returns 'Tue'...ok

date -r 049270 +%a   returns 'Mon'...ok

date -r 049260 +%a   returns 'Sun'...ok

   ^^^ 

date -r 049250 +%a   returns 'Sat'...ok

   ^^^

date -r 049240 +%a   returns 'Fri'...no!



Sorry!

Ciao

Francesco

---
Leggi la tua email con il tuo cellulare! Grazie a I.Box puoi
leggere la tua email di superEva da SMS e dalla segreteria!
http://webmail.supereva.it/ibox/
---

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



Re: [PHP] Searching My Database

2004-09-29 Thread Silvio Porcellana
I don't think this is the best list to ask questions about SQL, try 
http://lists.mysql.com
Cheers!
Silvio Porcellana
Harlequin wrote:
Morning everyone.
I've read around the subject of searching and although using the FULLTEXT 
capability of MySQL might be the proper way of doing this I feel it's 
somewhat limited and have decided to use a simple select procedure.

I'm sure there's a better way of doing this, as I'm quite new to MySQL and 
even newer to searches, However - here's my conundrum:

I'm declaring variables at the top of my query like so:
  Code:
  $WorkPermit  == ' . $_POST[WorkPermit] .  ';

And then execute the query like so:
  Code:
  SELECT * FROM MembersData
  WHERE `Work_Permit_Rqd`
  LIKE '$WorkPermit'

But I have many other fields that the searcher can use. What do I do if they 
leave this field blank...?

I appreciate that I should be using the MATCH function but I'm not entirely 
happy with the way it searches.

What I need to do is actually omit a field (s) from the search if the value 
the searcher submitted was NULL.

For example:
Search field X and Y and Z
and if x or Y are null
continue...
Am I explaining this OK...?
Any suggestions gratefully received.

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


RE: [PHP] Multiple pages of data.

2004-09-29 Thread Graham Cossey
Prev 1 2 3 Next tutorial at phpfreaks.com:

http://www.phpfreaks.com/tutorials/73/0.php

HTH

Graham.

-Original Message-
From: Silvio Porcellana [mailto:[EMAIL PROTECTED]
Sent: 29 September 2004 10:53
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Multiple pages of data.


You can solve it totally with SQL, using the FOUND_ROWS() function 
[http://dev.mysql.com/doc/mysql/en/Information_functions.html]

I think this is the most efficient way of doing it...

HTH, cheers

Silvio Porcellana

Nick Patsaros wrote:
 I'm trying to build a bulletin style system right now.  I have topics
 and replies to each topic.  If a topic gets more than 15 replies I
 want them to start carrying over onto page 2 and then 3 and so on with
 15 replies per page.
 
 The key that I'm missing I guess is, how do I keep track of the last
 accessed row in the database?  So if I run a LIMIT 15 I can go back
 and pick up where I left on previously?  Using the primary key isn't
 going to help because if posts get deleted I would have less than 15
 per page.
 
 Maybe I'm totally lost on this though, if someone could give me a bit
 of help on the most efficient way to accomplish this.
 
 --Nick
 

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

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



Re: [PHP] PHP Data cache ideas/solutions

2004-09-29 Thread raditha dissanayake
Niklas Ojala wrote:
Hello
I am kind of new to this news thing, but here goes.
I am looking for a class or some samples that would read a table from mysql
and store it in an array variable, so that it will be avilable to other
parts of the page without having to get it from the database again. So I
would like to only get the table once per page load but I must be able to
filter the table to get the data that I want.
 

Retrievals are usually fast so you might find that you are saving only a 
few milliseconds by doing this.
Did you know that most mysql has a 'query cache'  where instead of re 
running the same query over and over it stores a little bit in memory?

The best example of caching data from a DB into files I have seen is in 
the mediawiki project.

I am looking for some similar code to get me started or other ideas on how
to make less queries to the database.
/Niklas Ojala
 


--
Raditha Dissanayake.

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


RE: [PHP] PHP Data cache ideas/solutions

2004-09-29 Thread Graham Cossey
A bit rough and ready but I think this is kind of what you asked for:

** THIS IS UNTESTED CODE **
?php
$user_array = array();
$form_input = $_GET['namesearch'];
$sql = SELECT id, name FROM user WHERE name LIKE '%$form_input%' ORDER BY
id;
$result = mysql_query($sql) or die (Query failed:  . mysql_error());
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
  $id = $row['id'];
  $name = $row['name'];
  $user_array[$id] = $name; // Or simply $user_array[] = $name
}

...some code...

foreach ($user_array as $id2 = $name2)
{
  echo $id2 $name2 br/;
}

...some code...

// Determine a valid value for $x and then:
$name3 = $user_array[$x];

?



HTH

Graham

-Original Message-
From: Niklas Ojala [mailto:[EMAIL PROTECTED]
Sent: 29 September 2004 10:04
To: [EMAIL PROTECTED]
Subject: [PHP] PHP Data cache ideas/solutions


Hello

I am kind of new to this news thing, but here goes.

I am looking for a class or some samples that would read a table from mysql
and store it in an array variable, so that it will be avilable to other
parts of the page without having to get it from the database again. So I
would like to only get the table once per page load but I must be able to
filter the table to get the data that I want.

I am looking for some similar code to get me started or other ideas on how
to make less queries to the database.

/Niklas Ojala

--
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] classes in php5

2004-09-29 Thread Daniel Watrous
Thank you all for your responses.  It was indeed an error elsewhere in my
code.

Daniel Watrous


- Original Message - 
From: Matthew Fonda [EMAIL PROTECTED]
To: Curt Zirzow [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, September 28, 2004 8:30 PM
Subject: Re: [PHP] classes in php5


 ?php
 class Foo
 { }
 $className = Foo;
 $fooInstance = new $className;
 ?
 Works fine for me. It still works if you add methods or properties to
 Foo as well, I'm not sure why it wouldn't work for you, possibly you
 have another error along the lines somewhere. I am on PHP 5.0.1 BTW


 On Tue, 2004-09-28 at 19:42, Curt Zirzow wrote:
  * Thus wrote Daniel Watrous:
   Hello all,
  
   I have a class Foo.  In PHP4 I could create an instance of Foo in the
following manner:
   $className = Foo;
   $fooInstance = new $className;
  
   This would yield the same result as:
   $fooInstance = new Foo;
 
  Can you provide the definition of your class Foo. what you describe
  works find in php5.
 
  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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] can't upload files

2004-09-29 Thread blackwater dev
What should I look for?  I know globals are off...file_upload is on.




On Wed, 29 Sep 2004 10:08:31 +0600, raditha dissanayake
[EMAIL PROTECTED] wrote:
 blackwater dev wrote:
 
 Doesn't print out anything.
 
 
 
 
 then try phpinfo() it will tell you everything about your server, your
 script and data that is being passed to it. Look for anything amiss.
 
 print_r() those two variables (and any others you can think of).
 
 
 
 
 
 -- 
 Raditha Dissanayake.
 
 http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
 Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
 Graphical User Inteface. Just 128 KB | with progress bar.
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



[PHP] I have a really stupid question, just trying to debug a script though.

2004-09-29 Thread Brent Clements
I know what this means, but what are some reasons why we would get this error?

Warning: fsockopen(): unable to connect to 128.42.244.20:80

Thanks,
Brent

[PHP] splitting string into array

2004-09-29 Thread blackwater dev
How can I take a string and create an array?

Example,
A12B05C45D34

I need to split this into chunks of three A12,B05,C45..etc?

Thanks!

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



RE: [PHP] I have a really stupid question, just trying to debug a script though.

2004-09-29 Thread Gryffyn, Trevor
Can you connect to the same address from the same machine with a web
browser?  That should help troubleshoot this.  If you can and you're
still getting the error, maybe post a section of your code and maybe we
can get a better idea if why it's failing.

-TG

 -Original Message-
 From: Brent Clements [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, September 29, 2004 9:42 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] I have a really stupid question, just trying 
 to debug a script though.
 
 
 I know what this means, but what are some reasons why we 
 would get this error?
 
 Warning: fsockopen(): unable to connect to 128.42.244.20:80
 
 Thanks,
 Brent
 

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



RE: [PHP] Searching My Database

2004-09-29 Thread Jay Blanchard
[snip]
I've read around the subject of searching and although using the
FULLTEXT 
capability of MySQL might be the proper way of doing this I feel it's 
somewhat limited and have decided to use a simple select procedure.
[/snip]


Once again, might this not be better on the MySQL list? They may explain
a way to eliminate the limitations you perceive, but I digress...

Depending upon how your users will be entering the search term you could
build the query dynamically using PHP. We most often do something like
this where we have to retrieve a list of values from one table and then
run that dynamic list against other tables.

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



Re: [PHP] I have a really stupid question, just trying to debug a script though.

2004-09-29 Thread Brent Clements
I'm going to change this question up a bit. The error is this one:

Warning: fsockopen(): unable to connect to www.example.com:80 in
/home/u5/lentesta/html/socket.php on line 2
Permission denied (13)

What are some reasons we'd get this? Would a firewall or local system tcp/ip
filtering prevent socket operations from occuring?

Thanks,
Brent


- Original Message - 
From: Brent Clements [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, September 29, 2004 8:41 AM
Subject: [PHP] I have a really stupid question, just trying to debug a
script though.


I know what this means, but what are some reasons why we would get this
error?

Warning: fsockopen(): unable to connect to 128.42.244.20:80

Thanks,
Brent

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



Re: [PHP] I have a really stupid question, just trying to debug a script though.

2004-09-29 Thread raditha dissanayake
Brent Clements wrote:
I know what this means, but what are some reasons why we would get this error?
Warning: fsockopen(): unable to connect to 128.42.244.20:80
 

firewall
server not listening
network cable unplugged :-)
can you access the site hosted on that server wtih your browser can you 
ping it?

Thanks,
Brent
 


--
Raditha Dissanayake.

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


RE: [PHP] I have a really stupid question, just trying to debug a script though.

2004-09-29 Thread Jay Blanchard
[snip]
I know what this means, but what are some reasons why we would get this
error?

Warning: fsockopen(): unable to connect to 128.42.244.20:80
[/snip]

The primary reason that you would get this error is because you were
unable to connect to the host using sockets. 

The causes may be varied, firewalls, non-existent host, incorrect port,
authentication, the cable is not plugged in, power is off, etc.

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



Re: [PHP] splitting string into array

2004-09-29 Thread raditha dissanayake
blackwater dev wrote:
How can I take a string and create an array?
Example,
A12B05C45D34
I need to split this into chunks of three A12,B05,C45..etc?
 

split()
chunk_split()
substr()
preg_split()
Thanks!
 


--
Raditha Dissanayake.

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


Re: [PHP] splitting string into array

2004-09-29 Thread Chris Dowell
In PHP4
$array = explode(';', chunk_split(A12B05C45D34, 3, ';'));
In PHP4
$array = str_split(A12B05C45D34, 3);
RTFM
Cheers
Chris
blackwater dev wrote:
How can I take a string and create an array?
Example,
A12B05C45D34
I need to split this into chunks of three A12,B05,C45..etc?
Thanks!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] splitting string into array

2004-09-29 Thread Marek Kilimajer
blackwater dev wrote:
How can I take a string and create an array?
Example,
A12B05C45D34
I need to split this into chunks of three A12,B05,C45..etc?
Thanks!
$chunks = preg_split('/(.{3})/', $str, -1, PREG_SPLIT_NO_EMPTY | 
PREG_SPLIT_DELIM_CAPTURE);

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


Re: [PHP] splitting string into array

2004-09-29 Thread Martin Holm
blackwater dev wrote:
How can I take a string and create an array?
Example,
A12B05C45D34
I need to split this into chunks of three A12,B05,C45..etc?
Thanks!
|
use str_split()
if you dont have php5, you can use the following code:
|
?php
if (!function_exists('str_split')) {
   function str_split ($str, $size = 1) {
   $arr = array();
   for ($i = 0 ; $i  strlen($str) ; $i += $size) {
   $arr[] = substr($str,$i,$size);
   }
   return $arr;
   }
}
$array = str_split('A12B05C45D34',3)
print_r($array);
?
||
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] splitting string into array

2004-09-29 Thread Gareth Williams
Try something like this:
$string = 'A12B05C45D34';
$string = chunk_split($string, 3, ':');
//Should give you 'A12:B05:C45:D34';
$array = explode(:,$string);
Cheers,
Gareth
On 29 Sep 2004, at 15:40, blackwater dev wrote:
How can I take a string and create an array?
Example,
A12B05C45D34
I need to split this into chunks of three A12,B05,C45..etc?
Thanks!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP Data cache ideas/solutions

2004-09-29 Thread Matthew Fonda
You could do something like:
$result = mysql_query(SELECT * FROM whatever, $link);
while ($topic = mysql_fetch_assoc($result)) {
$all[] = $topic;
}

The array $all will contain all of the things fetched.

On Wed, 2004-09-29 at 02:04, Niklas Ojala wrote:
 Hello
 
 I am kind of new to this news thing, but here goes.
 
 I am looking for a class or some samples that would read a table from mysql
 and store it in an array variable, so that it will be avilable to other
 parts of the page without having to get it from the database again. So I
 would like to only get the table once per page load but I must be able to
 filter the table to get the data that I want.
 
 I am looking for some similar code to get me started or other ideas on how
 to make less queries to the database.
 
 /Niklas Ojala

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



RE: [PHP] I have a really stupid question, just trying to debug a script though.

2004-09-29 Thread Gryffyn, Trevor
Permission denied could also probably indicate (in addition to what's
already been mentioned) that there's authentication needed.  If you
connect with a web browser, do you get a login prompt window pop up?
Not an HTML one, but one of the the basic HTML Auth type stuff?

Try pointing  your script to a site that you know doesn't have anything
funky with it and see if you get the same issue.

-TG

 -Original Message-
 From: Brent Clements [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, September 29, 2004 9:49 AM
 To: Brent Clements; [EMAIL PROTECTED]
 Subject: Re: [PHP] I have a really stupid question, just 
 trying to debug a script though.
 
 
 I'm going to change this question up a bit. The error is this one:
 
 Warning: fsockopen(): unable to connect to www.example.com:80 in
 /home/u5/lentesta/html/socket.php on line 2
 Permission denied (13)
 
 What are some reasons we'd get this? Would a firewall or 
 local system tcp/ip
 filtering prevent socket operations from occuring?
 
 Thanks,
 Brent
 
 
 - Original Message - 
 From: Brent Clements [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, September 29, 2004 8:41 AM
 Subject: [PHP] I have a really stupid question, just trying to debug a
 script though.
 
 
 I know what this means, but what are some reasons why we 
 would get this
 error?
 
 Warning: fsockopen(): unable to connect to 128.42.244.20:80
 
 Thanks,
 Brent
 
 -- 
 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] splitting string into array

2004-09-29 Thread Matt M.
 Example,
 A12B05C45D34
 
 I need to split this into chunks of three A12,B05,C45..etc?

not sure if your string will always be the same patter but this might work

$string = 'A12B05C45D34';

$array = preg_split ( '/([a-zA-Z]\d{2})/', $string,
-1,PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
print_r($array);

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



RE: [PHP] Need some ideas

2004-09-29 Thread Yoed Anis
Of course! Brilliant - why didn't I think of building my own parser from the
ground up? ;-)

Thanks though, this is definitely a starting point.

Thanks,
Yoed

-Original Message-
From: Curt Zirzow [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 28, 2004 10:13 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Need some ideas


* Thus wrote Yoed Anis:
 Hi guys,
 
   OK I need some ideas.
 
   Somebody created the stupidest XML file I've ever seen. And of
course 
 they can't change it, and I *must* be able to read it. I'm all out of 
 brain power on thinking how to go about reading it. I typically use 
 simplexml to read xml and that's where my knowledge end.
 
 Heres the problem:
 
 Catalog
  Rate
   RateCode1/RateCode
   RateCurrencyUSDRateCurrency
   RateValue123/RateValue
  /Rate
  RateDescription
   DescThis is dumn/Desc
  /RateDescription

I've seen worse :)


You'll have to set up a class that can keep track of the state of your xml
file:

class StupidCatalog {
  var $code = 0;
  var $current = 'USD';
  var $value = '';
  var $description = array();
}

class StupidCatalogParser {
  var $catalog;  // Collection of rates
  var $current_catalog;  // building this one
  var $state;// tag we're working on

  function startElement($parser, $name, $attr) {

   $this-state = $name;
   switch($name) {
 case 'Rate':
   // start working on a new 
   $this-current_catalog = new StupidCatalog();
   break;

//...
   }

  }

  function endElement($parser, $name) {
if($name == 'Rate') {
  // reference is important.
  $this-catalog[] = $this-current_catalog;
}
  }

  function elementData($parser, $data) {
switch ($this-state) {
  case 'RateDescription':
// tricky...
$this-current_catalog-{$this-state}[] = $data;
break;

  case 'RateCode':  // passthrough
  case 'RateValue': // and the rest...
// more tricky...
$this-current_cataglog-{$this-state} = $data;
break;
  }
}

Just create a new StupidCatalogParser() and assign the methods to the
appropriate call backs in http://php.net/xml

btw, the above is untested and only theory :)

HTH,

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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Input to PHP from Java

2004-09-29 Thread Rajesh Batchu
Hi,
 
I have a page with SSL enables as below.
 
https://email.website.com/usrfolder/one.php
 
For this page, my customer is posting some XML data using a java output stream as 
below. ( pseudo code)
  URL url = new URL(_url);
_httpsConnection= (HttpsURLConnection) url.openConnection();

 _httpsConnection.setDoInput(true);
 _httpsConnection.setDoOutput(true);
 _httpsConnection.setUseCaches(false);
 _httpsConnection.setRequestProperty(Connection, Keep-Alive);
// send transaction
 _outputStream = new DataOutputStream(new 
BufferedOutputStream(_httpsConnection.getOutputStream()));
 _outputStream.write(xmlString.getBytes());
 _outputStream.flush();
 _outputStream.close();

// receive response
  _inputStream = new DataInputStream(new 
BufferedInputStream(_httpsConnection.getInputStream()));
  BufferedReader in= new BufferedReader(new InputStreamReader(_inputStream));
  String inputLine ;
  while ((inputLine = in.readLine()) != null){
rcvMsg = rcvMsg + inputLine;
  }
in.close();


 Now the issue for me is , i need to capture the data that is posted by the java code 
above in my php page.  I am not getting the value in any of the standard variables.
 
Can some one suggest me how i should read the data..
 
Thanks in advance,
Regards,
Rajesh B.
 


-
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!

RE: [PHP] Searching My Database

2004-09-29 Thread David Arkell
Maybe what you want is 

if (isset($_POST['WorkPermit'])) {
$WorkPermit = $_POST['WorkPermit'];
// do the select statement
} else
echo pno search/p;
}


-Original Message-
From: Harlequin [mailto:[EMAIL PROTECTED]
Sent: 29 September 2004 08:15
To: [EMAIL PROTECTED]
Subject: [PHP] Searching My Database


Morning everyone.

I've read around the subject of searching and although using the FULLTEXT 
capability of MySQL might be the proper way of doing this I feel it's 
somewhat limited and have decided to use a simple select procedure.

I'm sure there's a better way of doing this, as I'm quite new to MySQL and 
even newer to searches, However - here's my conundrum:

I'm declaring variables at the top of my query like so:

  Code:
  $WorkPermit  == ' . $_POST[WorkPermit] .  ';



And then execute the query like so:

  Code:
  SELECT * FROM MembersData
  WHERE `Work_Permit_Rqd`
  LIKE '$WorkPermit'



But I have many other fields that the searcher can use. What do I do if they 
leave this field blank...?

I appreciate that I should be using the MATCH function but I'm not entirely 
happy with the way it searches.

What I need to do is actually omit a field (s) from the search if the value 
the searcher submitted was NULL.

For example:

Search field X and Y and Z
and if x or Y are null
continue...

Am I explaining this OK...?

Any suggestions gratefully received.


-- 
-
 Michael Mason
 Arras People
 www.arraspeople.co.uk
- 

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


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__

DDB London - Effectiveness Agency of the Year
DDB Worldwide - Global Network of the Year

The Information given in the above email 
and / or attachment is provided without warranty of
any kind, either expressed or implied on the part 
of the writer or the Agency.

__
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit http://www.messagelabs.com


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



[PHP] Class PHP4 problem

2004-09-29 Thread kioto
?php
//db_class.php
error_reporting(E_ALL);
class Db_Connect {
   var $host;
   var $user;
   var $pasw;
   var $MYSQL_ERRNO;
   var $MYSQL_ERROR;
   var $query;
   function make_connect($host, $user, $pasw) {
  $this-host = $host;
  $this-user = $user;
  $this-pasw = $pasw;
  $link_id = mysql_connect($this-host, $this-user, $this-pasw);
  if (!$link_id) {
   die(Impossibile connettersi al server mysql  . br .
   Dettagli:  . $this-MYSQL_ERROR . Errore No:  . 
$this-MYSQL_ERRNO);
  }
  else {
   return $link_id;
  }
   }

   function select_db($db_name) {
  if (!(mysql_select_db($db_name))) {
   die(Impossibile selezionare il database  . $db_name . 
br .
   Dettagli:  . $this-MYSQL_ERROR . br . Errore 
No:  . $this-MYSQL_ERRNO);
   }
   }

   function sql_query($query) {
  if (!(mysql_query($query))) {
 die(Impossibile eseguire query al database  . br .
 Dettagli:  . $this-MYSQL_ERROR . br . Errore 
No:  . $this-MYSQL_ERRNO);
 }
  else $result = mysql_query($query);

  return $result;
   }
   function close_connection() {
   mysql_close($this-make_connect());
   }
}
class Result_Db extends Db_Connect {
 function get_data() {
 $res = $this-sql_query($query);
 while($db_data = mysql_fetch_array($res)) {
   echo $db_data[tot] . br;
 }
 }
}
$obj = new Result_Db;
$obj-make_connect('localhost', 'root', '');
$obj-select_db('sottilelinearossa');
$obj-sql_query('select count(id) as tot from articoli');
$obj-get_data();
?
I get this message because the variable is not valid when call the 
method sql_query in
the child class Result_Db.
How to fix this problem ?

Notice: Undefined variable: query in c:\programmi\apache 
group\apache\users\kioto\db_class2.php on line 66
Impossibile eseguire query al database
Dettagli:
Errore No:

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


RE: [PHP] regular expression help

2004-09-29 Thread Ed Lazor
Thanks to everyone who sent in patterns =)  They worked like a charm =)

 
 $pattern = /\{\$(.+?)\}/i;
 $replacement = \\.\$$1\.\;

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



Re: [PHP] can't upload files

2004-09-29 Thread Jason Wong
Please do not top post.

On Wednesday 29 September 2004 21:39, blackwater dev wrote:
 What should I look for?  I know globals are off...file_upload is on.

read manual  Handling file uploads

Find out whether your version of php supports $_FILES, if so use it. If not 
use $HTTP_POST_FILES.

Do:

print_r($_FILES); // or $HTTP_POST_FILES

at the *beginning* of the page that processes the uploaded files.

and if you're still getting:

  Doesn't print out anything.

Then go back to basics and try out the example in the above chapter. If you 
can't get the example to work then re-read that chapter again (paying 
particular attention to Error Messages Explained and Common Pitfalls).

If you still can't get it to work then read the user notes in the online 
manual.

If you still can't get it to work then search the archives.

-- 
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
--
/*
Half Moon tonight.  (At least it's better than no Moon at all.)
*/

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



[PHP] Re: Subversion

2004-09-29 Thread Matthew Weier O'Phinney
* Kevin Williams [EMAIL PROTECTED]:
 Would some generous soul please create an extension for Subversion,
 please?  I would do it myself if I knew how. People are starting to
 ask for PHP-based web apps for Subversion, and wrapping the
 command-line tool is such a hack. 

Ummm... they already exist. On the subversion site itself is WebSVN,
which is a PHP frontend for browsing SVN. PEAR also has an SVN library,
although I think it's in alpha or beta stage right now. If you want
things more stable, offer your help to the developers (though I find
WebSVN quite stable already).

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

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



RE: [PHP] I have a really stupid question, just trying to debug a script though.

2004-09-29 Thread Mark

--- Gryffyn, Trevor [EMAIL PROTECTED] wrote:

 Permission denied could also probably indicate (in addition to
 what's
 already been mentioned) that there's authentication needed.  If you
 connect with a web browser, do you get a login prompt window pop
 up?
 Not an HTML one, but one of the the basic HTML Auth type stuff?
 
 Try pointing  your script to a site that you know doesn't have
 anything
 funky with it and see if you get the same issue.
 
 -TG
 
  -Original Message-
  From: Brent Clements [mailto:[EMAIL PROTECTED] 
  Sent: Wednesday, September 29, 2004 9:49 AM
  To: Brent Clements; [EMAIL PROTECTED]
  Subject: Re: [PHP] I have a really stupid question, just 
  trying to debug a script though.
  
  
  I'm going to change this question up a bit. The error is this
 one:
  
  Warning: fsockopen(): unable to connect to www.example.com:80 in
  /home/u5/lentesta/html/socket.php on line 2
  Permission denied (13)
  
  What are some reasons we'd get this? Would a firewall or 
  local system tcp/ip
  filtering prevent socket operations from occuring?
  

Is this site yours? 128.42.244.20 (the IP from the original post)? If
it's not, you should probably ask the site owner why you would get
that. It seems to work fine going in with a browser. If it's your
site, I agree that you should try disabling your firewall to test and
see if that is what is interfering.


  Thanks,
  Brent
  
  
  - Original Message - 
  From: Brent Clements [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Wednesday, September 29, 2004 8:41 AM
  Subject: [PHP] I have a really stupid question, just trying to
 debug a
  script though.
  
  
  I know what this means, but what are some reasons why we 
  would get this
  error?
  
  Warning: fsockopen(): unable to connect to 128.42.244.20:80
  
  Thanks,
  Brent
  
  -- 
  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
 
 


=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a right unless you are willing to fight to death to 
defend everyone else's right to the same thing.
***



___
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



Re: [PHP] Input to PHP from Java

2004-09-29 Thread Marek Kilimajer
Rajesh Batchu wrote:
Hi,
 
I have a page with SSL enables as below.
 
https://email.website.com/usrfolder/one.php
 
For this page, my customer is posting some XML data using a java output stream as below. ( pseudo code)
  URL url = new URL(_url);
_httpsConnection= (HttpsURLConnection) url.openConnection();

 _httpsConnection.setDoInput(true);
 _httpsConnection.setDoOutput(true);
 _httpsConnection.setUseCaches(false);
 _httpsConnection.setRequestProperty(Connection, Keep-Alive);
// send transaction
 _outputStream = new DataOutputStream(new 
BufferedOutputStream(_httpsConnection.getOutputStream()));
 _outputStream.write(xmlString.getBytes());
 _outputStream.flush();
 _outputStream.close();
// receive response
  _inputStream = new DataInputStream(new 
BufferedInputStream(_httpsConnection.getInputStream()));
  BufferedReader in= new BufferedReader(new InputStreamReader(_inputStream));
  String inputLine ;
  while ((inputLine = in.readLine()) != null){
rcvMsg = rcvMsg + inputLine;
  }
in.close();
 Now the issue for me is , i need to capture the data that is posted by the java code above in my php page.  I am not getting the value in any of the standard variables.
 
Can some one suggest me how i should read the data..
 
Thanks in advance,
Regards,
Rajesh B.
http://sk2.php.net/manual/en/wrappers.php.php
php://input allows you to read raw POST data. It is a less memory 
intensive alternative to $HTTP_RAW_POST_DATA and does not need any 
special php.ini directives.

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


Re: [PHP] Input to PHP from Java

2004-09-29 Thread raditha dissanayake
Rajesh Batchu wrote
_outputStream.flush();
_outputStream.close();
   // receive response
 _inputStream = new DataInputStream(new BufferedInputStream(_httpsConnection.getInputStream()));
 

OT: if you close the outputstream from URLConnection you will not be 
able to read the inputstream either.

Now the issue for me is , i need to capture the data that is posted by the java code above in my php page.  I am not getting the value in any of the standard variables.
 

If your java code is sending a standard http request it will show up 
either in the $_REQUEST variable. You might want to write to the log 
file using error_log() so that you can get debuging information that way 
in case the response is not picked up by the java app.

 


--
Raditha Dissanayake.

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


[PHP] Re: Searching My Database

2004-09-29 Thread Daniel Kullik
Harlequin wrote:
Morning everyone.
I've read around the subject of searching and although using the FULLTEXT 
capability of MySQL might be the proper way of doing this I feel it's 
somewhat limited and have decided to use a simple select procedure.

I'm sure there's a better way of doing this, as I'm quite new to MySQL and 
even newer to searches, However - here's my conundrum:

I'm declaring variables at the top of my query like so:
  Code:
  $WorkPermit  == ' . $_POST[WorkPermit] .  ';

And then execute the query like so:
  Code:
  SELECT * FROM MembersData
  WHERE `Work_Permit_Rqd`
  LIKE '$WorkPermit'

But I have many other fields that the searcher can use. What do I do if they 
leave this field blank...?

I appreciate that I should be using the MATCH function but I'm not entirely 
happy with the way it searches.

What I need to do is actually omit a field (s) from the search if the value 
the searcher submitted was NULL.

For example:
Search field X and Y and Z
and if x or Y are null
continue...
Am I explaining this OK...?
Any suggestions gratefully received.

Hello Michael!
Try this script if you want (just a quick-and-dirty hack):
[code]
?php
if (!empty($_POST)) {
  $where = '';
  foreach ($_POST['search'] as $field = $value)   {
if ('' == $value) {
  continue;
}
$where .= $field.' LIKE '.$value.' AND ';
  }
  if ('' != $where) {
  $where = substr($where, 0, -5);
  print 'SELECT * FROM Work_Permit_Rqd WHERE '.$where;
  }
}
?
form action=?php print $_SERVER['PHP_SELF']; ? method=post
input type=text name=search[field1]br
input type=text name=search[field2]br
input type=text name=search[field3]br
input type=submit name=submit value=submit
/form
[/code]
Daniel
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Searching My Database

2004-09-29 Thread Jeff McKeon
It sounds like what you need to do is create several different queries
based upon what the user selects from a form..

For instance...

Form fields:

A,B,C,D

(Drop downs are best for these field entries because you can control
them, if not it's just a little tougher.)

IF(isset($_POST['A']))
{
$whereA =  Blah = .$_POST['A'];
}
IF(isset($_POST['B']))
{
$whereB =  Bloh = .$_POST['B'];
}
IF(isset($_POST['C']))
{
$whereC =  Blih = .$_POST['C'];
}
IF(isset($_POST['D']))
{
$whereD =  Bluh = .$_POST['D'];
}

$query = select * from table where something = somthingelse $whereA
$whereB $whereC $whereD;

This is the general idea.  If there is no $_POST['B'] then $whereB will
be nothing and not interfer.  You can expand the if statements above to
include settings for grouping etc..

Someone out there prob has a better way but that's generally how I do
it.

Just a note, with mysql you can use a $_POST[] type variable directly in
a query if you surround it with {}

So...

$query = Select * from table where field1 = '{$_POST['blah']}';

Jeffrey S. McKeon
Manager of Information Technology
Telaurus Communications LLC
[EMAIL PROTECTED]
+1 (973) 889-8990 ex 209


-Original Message-
From: David Arkell [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 29, 2004 9:35 AM
To: Harlequin; [EMAIL PROTECTED]
Subject: RE: [PHP] Searching My Database


Maybe what you want is 

if (isset($_POST['WorkPermit'])) {
$WorkPermit = $_POST['WorkPermit'];
// do the select statement
} else
echo pno search/p;
}


-Original Message-
From: Harlequin [mailto:[EMAIL PROTECTED]
Sent: 29 September 2004 08:15
To: [EMAIL PROTECTED]
Subject: [PHP] Searching My Database


Morning everyone.

I've read around the subject of searching and although using the
FULLTEXT 
capability of MySQL might be the proper way of doing this I feel it's 
somewhat limited and have decided to use a simple select procedure.

I'm sure there's a better way of doing this, as I'm quite new to MySQL
and 
even newer to searches, However - here's my conundrum:

I'm declaring variables at the top of my query like so:

  Code:
  $WorkPermit  == ' . $_POST[WorkPermit] .  ';



And then execute the query like so:

  Code:
  SELECT * FROM MembersData
  WHERE `Work_Permit_Rqd`
  LIKE '$WorkPermit'



But I have many other fields that the searcher can use. What do I do if
they 
leave this field blank...?

I appreciate that I should be using the MATCH function but I'm not
entirely 
happy with the way it searches.

What I need to do is actually omit a field (s) from the search if the
value 
the searcher submitted was NULL.

For example:

Search field X and Y and Z
and if x or Y are null
continue...

Am I explaining this OK...?

Any suggestions gratefully received.


-- 
-
 Michael Mason
 Arras People
 www.arraspeople.co.uk
- 

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


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__

DDB London - Effectiveness Agency of the Year
DDB Worldwide - Global Network of the Year

The Information given in the above email 
and / or attachment is provided without warranty of
any kind, either expressed or implied on the part 
of the writer or the Agency.

__
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit http://www.messagelabs.com


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

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



Re: [PHP] PHP Data cache ideas/solutions

2004-09-29 Thread Niklas
Thank you for your ideas, this is an example of what I came up with. When
the application is complete I will turn on the query cache in mysql to have
even better performance.

function filter($var)
{
if ($var[active])
{
return true;
}
}

$link = mysql_pconnect(localhost, foo, bar);
mysql_select_db(stuff, $link);
$result = mysql_query(SELECT * FROM table, $link) or die(Error);
$data = array();
while ($row = mysql_fetch_array($result))
$data[] = $row;

$filtered_data = array_filter($data,filter);

/Niklas Ojala

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



[PHP] POST data corrupted

2004-09-29 Thread Ilja Polivanovas
Hello guys,
I don't know if this question is PHP related or not, but, maybe someone  
remember, have the PHP script be processed if POST request is broken in  
the middle?

For example: User POSTs 60 KB of text, and then his browser or internet  
connection crashes, when only 30 of 60 KB was sent to server. Server  
recieves 30 KB, and think that it is complete POST, then updates some data  
in Database, and the text is corrupted at the result of this action.

I was surprised that such thing happens. Is this real feature ? or some  
kind of bug in http/apache/php chain? ://

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


[PHP] Best way to allow a user to indicate formatting to be displayed but stored.

2004-09-29 Thread GH
I am looking for the best way to have a user enter information and
format it ... i.e. Bold, Italics, etc... with out havng to use the
HTML commands...

Using PHP4.

Any suggestions...

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



[PHP] Re: PHP Data cache ideas/solutions

2004-09-29 Thread Manuel Lemos
Hello,
On 09/29/2004 06:04 AM, Niklas Ojala wrote:
I am kind of new to this news thing, but here goes.
I am looking for a class or some samples that would read a table from mysql
and store it in an array variable, so that it will be avilable to other
parts of the page without having to get it from the database again. So I
would like to only get the table once per page load but I must be able to
filter the table to get the data that I want.
I am looking for some similar code to get me started or other ideas on how
to make less queries to the database.
You may want to look at the this generic data cache class that can cache 
any type of data in disk files. If you want to cache variables, just use 
it in conjunctions with serialize and unserialize functions.

The class employs safe locking to prevent that more than one access 
tries to update the cache file when the cache is generated for the first 
time or it has expired and leave it corrupted. This is very important, 
especially for busy sites.

http://www.phpclasses.org/filecache

--
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] Best way to allow a user to indicate formatting to be displayed but stored.

2004-09-29 Thread Chris Boget
 I am looking for the best way to have a user enter information and
 format it ... i.e. Bold, Italics, etc... with out havng to use the
 HTML commands...
 Using PHP4.
 Any suggestions...

Take a look at the way phpBB does this.

thnx,
Chris

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



Re: [PHP] Re: Mass Mailing Using PHP

2004-09-29 Thread Manuel Lemos
Hello,
On 09/28/2004 03:54 AM, Roger Thomas wrote:
You may just need to tune qmail to maximize the number of
simultaneous deliveries according to the available bandwidth.

How do I tune qmail in that manner ? If the answer is too long and
complicated, pls flame me softly as this is already OT.
Usually, increasing the concurrencyremote control option is what makes 
most of the difference. The default is 20 simultaneous deliveries. You 
can increase to 120 without patching qmail. If you realize that such 
change exhausts your memory, you may have to use a smaller value.

Using a DNS query caching daemon also helps if your DNS is a little slow 
to react.


For this reason, during deliveries of messages to many recipients,
it is better to pause once in a while to let the queue be fully
processed and do not stall other programs.

Do you mean, say we fetched 100,000 addresses from database, we make
our script sleep for a while after sending, say 1000 mails ?
Right, you need to test with qmail-qstat how long it needs to rest to 
give qmail time to process all queued messages during a period. This is 
may also be important if your available disk space is limited.

--
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] splitting string into array

2004-09-29 Thread blackwater dev
Thanks all!


On Wed, 29 Sep 2004 14:55:58 +0100, Chris Dowell [EMAIL PROTECTED] wrote:
 In PHP4
 
 $array = explode(';', chunk_split(A12B05C45D34, 3, ';'));
 
 In PHP4
 
 $array = str_split(A12B05C45D34, 3);
 
 RTFM
 
 Cheers
 
 Chris
 
 
 
 blackwater dev wrote:
 
  How can I take a string and create an array?
 
  Example,
  A12B05C45D34
 
  I need to split this into chunks of three A12,B05,C45..etc?
 
  Thanks!
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



[PHP] safe mode?

2004-09-29 Thread blackwater dev
Hello all...

I finally have an upload script partly working but am not running into
this problem.

I have this code which executes when the user visits the image upload page:

snip
 if (!file_exists(../images/property_$id)){
 mkdir(../images/property_$id, 0700);}

 $upload_dir = ../images/property_$id;
/snip

When the user executes the script, it returns and runs this code:

snip
if($_FILES['file']['name'][$i])
  {
  $file_to_upload = $upload_dir./.$_FILES['file']['name'][$i];
  $thisName=$_FILES['file']['name'][$i];
  move_uploaded_file($_FILES['file']['tmp_name'][$i],$file_to_upload); }
/snip

And I get these errors::

Warning: move_uploaded_file(): SAFE MODE Restriction in effect. The
script whose uid is 1044 is not allowed to access
/images/property_128873 owned by uid 1002 in /imageupload.inc.php on
line 39

then a bunch of other related errors.  I have tried to using 0777
also.  How can I get around SAFE MODE as I can't easily change the ini
file as it is on my hosts server.

Thanks!

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



Re: [PHP] Best way to allow a user to indicate formatting to be displayed but stored.

2004-09-29 Thread Matthew Fonda
Typically people use BBCode to do this.
This mean the user will enter something like
[b]this is bold[/b] or [i]italic[/u] and the BBCode will be parsed and
transformed into HTML when the page is displayed. There are many parsers
already written to do this, or you could make your own, or use PEAR:
http://pear.php.net/package/HTML_BBCodeParser


On Wed, 2004-09-29 at 10:51, GH wrote:
 I am looking for the best way to have a user enter information and
 format it ... i.e. Bold, Italics, etc... with out havng to use the
 HTML commands...
 
 Using PHP4.
 
 Any suggestions...

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



Re: [PHP] safe mode?

2004-09-29 Thread Marek Kilimajer
blackwater dev wrote:
Hello all...
I finally have an upload script partly working but am not running into
this problem.
I have this code which executes when the user visits the image upload page:
snip
 if (!file_exists(../images/property_$id)){
 mkdir(../images/property_$id, 0700);}
 $upload_dir = ../images/property_$id;
/snip
When the user executes the script, it returns and runs this code:
snip
if($_FILES['file']['name'][$i])
  {
  $file_to_upload = $upload_dir./.$_FILES['file']['name'][$i];
  $thisName=$_FILES['file']['name'][$i];
  move_uploaded_file($_FILES['file']['tmp_name'][$i],$file_to_upload); }
/snip
And I get these errors::
Warning: move_uploaded_file(): SAFE MODE Restriction in effect. The
script whose uid is 1044 is not allowed to access
/images/property_128873 owned by uid 1002 in /imageupload.inc.php on
line 39
then a bunch of other related errors.  I have tried to using 0777
also.  How can I get around SAFE MODE as I can't easily change the ini
file as it is on my hosts server.
Thanks!
Use ftp function to create the upload directory. Login as userid 1044, 
create the directory, change it's permission, and you are done

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


[PHP] Zend PHP Certification test

2004-09-29 Thread Greg Donald
I was wondering if anyone on the list has taken the Zend PHP Certification test?

I bought the Zend study guide and have read it cover to cover, then I
went back and re-read a bunch of it again in areas where I felt weak. 
I've been studying heavily the past two weeks and I have the test
tomorrow morning.  So I'm wondering what anyone who has taken the test
might recommend studying the most during my last 24 hours prior?

Most of the security stuff I've known and practiced for a long time
now, so I'm pretty comfortable there.  But there seems to be a lot of
gotchas working with the string and regular expression functions.. I
don't know, maybe that's just my perception.  I'm definatly not a
regular expression master, even with years of working with Perl, so
I've been hitting that part pretty hard.  The open ended 'name that
function' questions worry me, as I've always relied on the fine PHP
manual for quick lookups when I can't recall something.

What areas did any of you find particularly challenging? 

TIA for your input..


-- 
Greg Donald
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] safe mode?

2004-09-29 Thread blackwater dev
so do this each time?

I need a routine that will dynamically create a folder, then use that
folder to upload images.  This problem doesn't exists just on one
directory but on all directories dynamically created.

Thanks!


On Wed, 29 Sep 2004 21:48:05 +0200, Marek Kilimajer [EMAIL PROTECTED] wrote:
 
 
 blackwater dev wrote:
  Hello all...
 
  I finally have an upload script partly working but am not running into
  this problem.
 
  I have this code which executes when the user visits the image upload page:
 
  snip
   if (!file_exists(../images/property_$id)){
   mkdir(../images/property_$id, 0700);}
 
   $upload_dir = ../images/property_$id;
  /snip
 
  When the user executes the script, it returns and runs this code:
 
  snip
  if($_FILES['file']['name'][$i])
{
$file_to_upload = $upload_dir./.$_FILES['file']['name'][$i];
$thisName=$_FILES['file']['name'][$i];
move_uploaded_file($_FILES['file']['tmp_name'][$i],$file_to_upload); }
  /snip
 
  And I get these errors::
 
  Warning: move_uploaded_file(): SAFE MODE Restriction in effect. The
  script whose uid is 1044 is not allowed to access
  /images/property_128873 owned by uid 1002 in /imageupload.inc.php on
  line 39
 
  then a bunch of other related errors.  I have tried to using 0777
  also.  How can I get around SAFE MODE as I can't easily change the ini
  file as it is on my hosts server.
 
  Thanks!
 
 
 Use ftp function to create the upload directory. Login as userid 1044,
 create the directory, change it's permission, and you are done
 
 --
 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] safe mode?

2004-09-29 Thread Marek Kilimajer
blackwater dev wrote:
so do this each time?
I need a routine that will dynamically create a folder, then use that
folder to upload images.  This problem doesn't exists just on one
directory but on all directories dynamically created.
I mean PHP ftp functions. http://www.php.net/ftp
Thanks!
On Wed, 29 Sep 2004 21:48:05 +0200, Marek Kilimajer [EMAIL PROTECTED] wrote:
blackwater dev wrote:
Hello all...
I finally have an upload script partly working but am not running into
this problem.
I have this code which executes when the user visits the image upload page:
snip
if (!file_exists(../images/property_$id)){
mkdir(../images/property_$id, 0700);}
$upload_dir = ../images/property_$id;
/snip
When the user executes the script, it returns and runs this code:
snip
if($_FILES['file']['name'][$i])
 {
 $file_to_upload = $upload_dir./.$_FILES['file']['name'][$i];
 $thisName=$_FILES['file']['name'][$i];
 move_uploaded_file($_FILES['file']['tmp_name'][$i],$file_to_upload); }
/snip
And I get these errors::
Warning: move_uploaded_file(): SAFE MODE Restriction in effect. The
script whose uid is 1044 is not allowed to access
/images/property_128873 owned by uid 1002 in /imageupload.inc.php on
line 39
then a bunch of other related errors.  I have tried to using 0777
also.  How can I get around SAFE MODE as I can't easily change the ini
file as it is on my hosts server.
Thanks!
Use ftp function to create the upload directory. Login as userid 1044,
create the directory, change it's permission, and you are done
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Class PHP4 problem

2004-09-29 Thread j kensler
Try adding 
function getQuery() {
return $this-query;
}

to the first class, then in the second class, replace $query with
$this-getQuery()

Like I have below.


On Wed, 29 Sep 2004 17:08:49 +0200, kioto
[EMAIL PROTECTED] wrote:
 ?php
 //db_class.php
 
 error_reporting(E_ALL);
 
 class Db_Connect {
 
 var $host;
 var $user;
 var $pasw;
 var $MYSQL_ERRNO;
 var $MYSQL_ERROR;
 var $query;
 
 function make_connect($host, $user, $pasw) {
 
$this-host = $host;
$this-user = $user;
$this-pasw = $pasw;
 
$link_id = mysql_connect($this-host, $this-user, $this-pasw);
 
if (!$link_id) {
 die(Impossibile connettersi al server mysql  . br .
 Dettagli:  . $this-MYSQL_ERROR . Errore No:  .
 $this-MYSQL_ERRNO);
}
else {
 return $link_id;
}
 }
 
 function select_db($db_name) {
 
if (!(mysql_select_db($db_name))) {
 die(Impossibile selezionare il database  . $db_name .
 br .
 Dettagli:  . $this-MYSQL_ERROR . br . Errore
 No:  . $this-MYSQL_ERRNO);
 }
 }
 
 function sql_query($query) {
 
if (!(mysql_query($query))) {
   die(Impossibile eseguire query al database  . br .
   Dettagli:  . $this-MYSQL_ERROR . br . Errore
 No:  . $this-MYSQL_ERRNO);
   }
else $result = mysql_query($query);
 
return $result;
 }
 
 function close_connection() {
 
 mysql_close($this-make_connect());
 }

function getQuery() {
return $this-query;
}

 }
 
 class Result_Db extends Db_Connect {
 
   function get_data() {
 

   $res = $this-sql_query($this-getQuery());

 
   while($db_data = mysql_fetch_array($res)) {
 
 echo $db_data[tot] . br;
 
   }
   }
 }
 
 $obj = new Result_Db;
 $obj-make_connect('localhost', 'root', '');
 $obj-select_db('sottilelinearossa');
 $obj-sql_query('select count(id) as tot from articoli');
 $obj-get_data();
 
 ?
 
 I get this message because the variable is not valid when call the
 method sql_query in
 the child class Result_Db.
 How to fix this problem ?
 
 Notice: Undefined variable: query in c:\programmi\apache
 group\apache\users\kioto\db_class2.php on line 66
 Impossibile eseguire query al database
 Dettagli:
 Errore No:
 
 --
 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] How do I make an 'email this page' feature?

2004-09-29 Thread PHP Tech
Hi.

I am on a tight deadline here- I am trying to get a feature on a website I
am creating where you click a link on a page which says 'email this page'
and it takes you to a new page with a form asking you to enter your name,
email and an email address and name of a person you would like to email the
link of the page together with a message.

In theory this is easy to do- but what would be the best and secure way of
doing it?

I thought by clicking the link this would be a form sending the url of the
page to the next page and so I could then use $_GET to retrieve this.  I
also thought of using $_SERVER and getting the referer web address. Then I
could use this in a hidden field and use the mail() function to mail it off.

Aren't both these options open to abuse?  I was impressed with a feature I
saw on this website- http://www.chesternovello.com/composer/606/main.html  -
at the bottom of the page when you click on Email this page it takes you to
another page without using a form, and it seems to use just html.  How do
they do that?  I would really like to use a nice PHP script to do this.

Any ideas? Would be grateful for any thoughts.

I. Gray

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



Re: [PHP] Zend PHP Certification test

2004-09-29 Thread Chris Shiflett
[Disclaimer: I am on the Zend Advisory Board and helped create the
Zend Certification exam.]

--- Greg Donald [EMAIL PROTECTED] wrote:
 I bought the Zend study guide and have read it cover to cover

That's a good approach. I don't think the guide is a good substitute for
experience, but it's as broad as the exam itself, so you get a good idea
about what topics are covered, and the discussion on those topics is there
in case you feel like you need a refresher. In a few cases, the author of
a particular chapter in the guide also wrote the exam questions on that
topic.

 I went back and re-read a bunch of it again in areas where I
 felt weak. I've been studying heavily the past two weeks and I
 have the test tomorrow morning. So I'm wondering what anyone
 who has taken the test might recommend studying the most during
 my last 24 hours prior?

Zend has a few questions available here:

http://zend.com/store/education/certification/self-test.php

They're obviously not on the exam, but they give you an idea about how the
questions might be worded and such. The first question is:

What is the value of $a?

?php
$a = 123 == 0123;
?

I think this question is a little tricky, so I don't like it. It requires
you to realize that 0123 is going to be interpreted as an octal value due
to the leading zero. While we tried to avoid trick questions, a few of
them
are just a bit tricky. Don't let that leading zero thing mess you up. :-)

Another one on Zend's site is what I consider a very good question:

What is the value of $result in the following PHP code?

?php
function timesTwo($int) {
$int = $int * 2;
}

$int = 2;
$result = timesTwo($int);
?

This question requires that you realize how functions and return values
work. This would be difficult for someone who wasn't an experienced PHP
developer, but for anyone who has much experience with PHP, it's easy.

Another question I like is this:

What will be the output of the following PHP code:

?php
echo count(strlen(http://php.net;));
?

Now, I would expect someone like John Holmes (or any of the other major
contributors to this list) to note that you may as well use single quotes
there, because no interpretation of the string is necessary. :-) But,
that's not the point of the question.

Answering this requires that you can deduce what strlen() and count() do,
or that you happen to remember - whatever works. :-) This is also the type
of question that I think inexperienced developers will have trouble
answering correctly, while experienced developers are unlikely to miss.

Because strlen() returns the length of the string (one thing), the count
of that return is going to be 1.

 I'm definatly not a regular expression master

I bet you can miss every regular expression question and still pass the
exam. Don't worry too much about a single topic, unless you're confident
in every other area. Keep in mind that the exam is as broad as PHP itself,
and there are only 70 questions. So, no single topic is going to be very
important overall - you want to be fairly proficient in all areas.

 The open ended 'name that function' questions worry me, as I've
 always relied on the fine PHP manual for quick lookups when I
 can't recall something.

We kept this in mind when writing the questions. In general, when a quick
reference to http://www.php.net/foo would tell you an answer, the question
was thrown out. This includes the order of the arguments for most things,
especially since PHP has a reputation for being inconsistent in this
regard. :-)

However, you should know the names of the common functions. I know that's
vague, but I seriously doubt anyone who has been developing in PHP would
not know what functions trims whitespace (trim), what function returns the
length of a string (strlen), or what function can be used to set an HTTP
header (header). On the other hand, it would be ridiculous to expect
people to know what functions like cpdf_set_current_page(), crack_check(),
or pfpro_init() do. You might be familiar with these functions, but I
don't think anyone would consider them mainstream.

Hope that helps, and good luck on the exam.

Chris

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

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

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



Re: [PHP] Zend PHP Certification test

2004-09-29 Thread James McGlinn
On Sep 30, 2004, at 8:01 AM, Greg Donald wrote:
I was wondering if anyone on the list has taken the Zend PHP 
Certification test?

I bought the Zend study guide and have read it cover to cover, then I
went back and re-read a bunch of it again in areas where I felt weak.
I've been studying heavily the past two weeks and I have the test
tomorrow morning.  So I'm wondering what anyone who has taken the test
might recommend studying the most during my last 24 hours prior?
Hi Greg,
I sat the test last Wednesday after going through the guide cover to 
cover.  Whilst there were a number of questions which were definitely 
experience-based, I found the questions were generally somewhat easier 
than the chapter questions and practice exam questions in the guide.  
If you're happy with those you should have no trouble in the exam.

All the best for tomorrow morning!
James McGlinn
Project Manager
BCom, BSc, Zend Certified Engineer (PHP)
Servers.co.nz Ltd
68 Shortland St PO Box 3688 Shortland St, Auckland, New Zealand
Phone: 0800 4 SERVERS   Fax: +64 9 358 5187
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Zend PHP Certification test

2004-09-29 Thread Greg Donald
On Wed, 29 Sep 2004 14:01:22 -0700 (PDT), Chris Shiflett
[EMAIL PROTECTED] wrote:
 [Disclaimer: I am on the Zend Advisory Board and helped create the
 Zend Certification exam.]

Thanks for your insite.  Knowing you were involved, I was actually
hoping you might reply to my post.

I got 4/5 on the practice test, which makes me feel a _little_ better.
 I sure wish it would have told me the one I missed though.  :(


-- 
Greg Donald
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] Zend PHP Certification test

2004-09-29 Thread Greg Donald
On Wed, 29 Sep 2004 16:36:50 -0500, Greg Donald [EMAIL PROTECTED] wrote:
 insite

insight too!

I'm a nervous wreck today..


-- 
Greg Donald
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] Zend PHP Certification test

2004-09-29 Thread Greg Donald
On Thu, 30 Sep 2004 09:25:09 +1200, James McGlinn [EMAIL PROTECTED] wrote:
 I sat the test last Wednesday after going through the guide cover to
 cover.  Whilst there were a number of questions which were definitely
 experience-based, I found the questions were generally somewhat easier
 than the chapter questions and practice exam questions in the guide.
 If you're happy with those you should have no trouble in the exam.

I'm glad to hear that, cause some of them did seem a bit difficult.  I
understood perfectly after seeing the correct answer and the
explanation, but they were a little tricky.

 All the best for tomorrow morning!

Thanks!  :)


-- 
Greg Donald
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] How do I make an 'email this page' feature?

2004-09-29 Thread Matthew Fonda
Check out the PHP mail function:
http://www.php.net/manual/en/ref.mail.php
http://www.php.net/manual/en/function.mail.php

On Wed, 2004-09-29 at 14:03, PHP Tech wrote:
 Hi.
 
 I am on a tight deadline here- I am trying to get a feature on a website I
 am creating where you click a link on a page which says 'email this page'
 and it takes you to a new page with a form asking you to enter your name,
 email and an email address and name of a person you would like to email the
 link of the page together with a message.
 
 In theory this is easy to do- but what would be the best and secure way of
 doing it?
 
 I thought by clicking the link this would be a form sending the url of the
 page to the next page and so I could then use $_GET to retrieve this.  I
 also thought of using $_SERVER and getting the referer web address. Then I
 could use this in a hidden field and use the mail() function to mail it off.
 
 Aren't both these options open to abuse?  I was impressed with a feature I
 saw on this website- http://www.chesternovello.com/composer/606/main.html  -
 at the bottom of the page when you click on Email this page it takes you to
 another page without using a form, and it seems to use just html.  How do
 they do that?  I would really like to use a nice PHP script to do this.
 
 Any ideas? Would be grateful for any thoughts.
 
 I. Gray

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



Re: [PHP] How do I make an 'email this page' feature?

2004-09-29 Thread Andrew Kreps
On Wed, 29 Sep 2004 22:03:07 +0100, PHP Tech [EMAIL PROTECTED] wrote:
 
 I thought by clicking the link this would be a form sending the url of the
 page to the next page and so I could then use $_GET to retrieve this.  I
 also thought of using $_SERVER and getting the referer web address. Then I
 could use this in a hidden field and use the mail() function to mail it off.
 

I would try to limit the list of items I'm sending via email.  For
example, have a set list of keywords that you generate the emails
based on, such as a product id, or a category name.  Then you generate
the email based on that id, rather than doing, say, an fopen
(http://yoursite.com/page.php;) with the referring page.  The latter
option would be insecure, especially if you don't sanity check the
referrer first.  If you're dealing with a static site, and have to
grab actual HTML files, passing the the page name as a variable and
then doing a local fopen would be a better option.  Checking for
problems before using the form data is the key to keeping this secure.

I imagine having pre-built templates for whatever I'm sending via
email, as I likely wouldn't want the exact same page that's displayed
on my website to be sent via email.  I'd love to hear more specifics
on what you're trying to accomplish.

As for chesternovello.com, there is an awful lot of Javascript magic
happening.  Not to mention that suspicious looking __VIEWSTATE
variable in the form.  There's definitely something happening behind
the scenes there, it's more than just HTML.

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



Re: [PHP] Zend PHP Certification test

2004-09-29 Thread Chris Shiflett
--- Greg Donald [EMAIL PROTECTED] wrote:
 Knowing you were involved, I was actually hoping you might reply
 to my post.

I'd be interested in hearing your honest feedback after you take it,
whether privately or on this list. Hopefully ZCE becomes a respected
acronym, unlike MCSE. :-)

 I got 4/5 on the practice test, which makes me feel
 a _little_ better. I sure wish it would have told me the one I
 missed though.

Yeah, that's annoying. Let me run through it and tell you the answers...

1. B
2. null
3. B
4. D
5. 1

Hope that helps.

Chris

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

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

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



Re: [PHP] Zend PHP Certification test

2004-09-29 Thread Chris Shiflett
--- James McGlinn [EMAIL PROTECTED] wrote:
 I sat the test last Wednesday after going through the guide
 cover to cover. Whilst there were a number of questions which
 were definitely experience-based, I found the questions were
 generally somewhat easier than the chapter questions and
 practice exam questions in the guide.

Those questions in the guide are harder than the ones on the exam for
sure. I think some of them are ridiculously hard myself. If you can do
reasonably well on those things, then you're sure to pass the real thing.

Chris

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

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

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



Re: [PHP] Zend PHP Certification test

2004-09-29 Thread j kensler
How long is the Zend certification 'good' for?

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



Re: [PHP] Zend PHP Certification test

2004-09-29 Thread James McGlinn
On Sep 30, 2004, at 12:20 PM, j kensler wrote:
How long is the Zend certification 'good' for?
Daniel Kushner (Director of Education at Zend) has said: [1]
[The] certifcation doesn't expire. The Education Advisory Board 
believe that a new exam should be released on every major version of 
PHP once it becomes main stream. In my opinion, the PHP 5 certification 
will be release in late 2005.

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

[1] http://www.phparch.com/discuss/index.php/m/3421/0/#msg_3421

Re: [PHP] Zend PHP Certification test

2004-09-29 Thread Alawi Albaity
I purchase the guide before month and because I am outside US it will
be inn my country after another month ( I actually bought it pdf
version from phparch but because of the issue between Sams they cancel
pdf version and sent the print on thier own charge for the shipment) 
, when I see Zend offer I take it directly but ofcourse I now must
read from manual because the last day is 30th September , so I read
hard , but of course not all the manual , but what I feel its
important to read in the manual .
I do not figure out that zend write the objective untill the last day
, I take the self test and it make me feel better but the self test
making you feel like if you get 3 from 5 you will success ,  I arrive
at the center , do what it have to be done , and log in the room and I
was very excited about exam when I get the test I found out its very
simple and easy but because I read from manual I have confused in a
lot of things in exam .

Example 1 : they give 4 function and ask you to choose 2 , in all my
life I was just one function and for first time now I hear there are
another function which help you to calc the file size , so I choose
random function .

Example 2 :
they give you some space to fill some text from your experience , I
think I must write what they think its truth , inn example one of
space I confuse what to write (object or class) because I do not get
the situation of the code or thing they talk about , and think what if
you write the spelling wrong but you get the idea.

Example 3:
they ask you about the possibility of validate user input if its for
only unTrusted person or on the internet or also give you 2 choice, I
think this thing is belong to me to decide on my work experience and
not the opinion of the testers .


at the final I feel and believe in my heart like I get 60 or 50 of
exam at least correct but the I end I figure out my grade is FAILED .
I have 3 years experience with php , I build a script of thousands of
lines , but the really point that I do not read thing in manual untill
I feel I must read and I need it, I make lot of scripts on php from 3
years , I do not work ever with streams , and i get what I need in
regular expression by test and test and test for the code , if you
want my advice read a lot about arrays and if the function will give
you the new value or will do the process in the same array and which
type of array the function must use and return and how much of arrays
they can handle.

I write a book in php in arabic of more than 100 and it was the first
book for arabs, , I make scripts for writers , sellers , shops And now
i figure out that I must read good and install manual in my brain to
be success .

but what the benefit of this when I read I figure out that there are a
lot of thinngs usefel in php that I do not know about .
and give me a keys for a new things in php that I was do not care
about it in the past .

I encourage the people have a good brain to save information to get
the test , and encourage the people to complete thier road of
development , your work is the strongest approve of your Exprience and
your hardwork . the problem that youu will not be in the yellow pages
in the Zend site .

finally , thanks to the people who write the test they make it very
good and very simple and easy , they was so fair , who got good
knowldge will pass .

-- 
Alawi Albaity
Jeddah - KSA
Mobile : +966506660442

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



Re: [PHP] Zend PHP Certification test

2004-09-29 Thread Chris Shiflett
--- j kensler [EMAIL PROTECTED] wrote:
 How long is the Zend certification 'good' for?

It doesn't expire, but it's for a specific version of PHP (minor version
number, not point release). The yellow pages at Zend will be enhanced to
indicate the version number as well as the date once it becomes relevant.
Right now, every ZCE is current. :-)

Hope that helps.

Chris

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

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

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



[PHP] Resetting result sets after looping

2004-09-29 Thread Steve Douville
After cycling through a result set using mysql_fetch_assoc, I need to cycle
through the result set again. However, it's acting like it's maybe already
at the end of the result set and can't be looped again. I've looked for
something simple, like a result resetter, but I seem to be missing
something.

Any Ideas?

TIA,
Steve

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



Re: [PHP] Resetting result sets after looping

2004-09-29 Thread John Holmes
Steve Douville wrote:
After cycling through a result set using mysql_fetch_assoc, I need to cycle
through the result set again. However, it's acting like it's maybe already
at the end of the result set and can't be looped again. I've looked for
something simple, like a result resetter, but I seem to be missing
something.
Yep, you are: http://us2.php.net/manual/en/function.mysql-data-seek.php
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] RE: Resetting result sets after looping

2004-09-29 Thread Michael Purdy
Steve

Take a look at

mysql_data_seek

Mike

Re: [PHP] Zend PHP Certification test

2004-09-29 Thread Daniel Kushner
Dear Alawi,

I would like to thank you for your complements on the exam. The guys
that wrote it definitely did an excellent job and produced a test of
the highest quality.

Your experience shows that even seasoned developers can enhance their
PHP skills by studying for the exam. This is something I have heard
numerous times and hope it will increase the quality of PHP
development in the market.

Best,
Daniel Kushner


__
Director of Education
Zend Technologies Ltd.

[EMAIL PROTECTED]
http://www.zend.com

==
Learn PHP from the experts, sign up for Zend's 
online training starting October 11th
http://www.zend.com/store/education/zend-online-training.php

==  


On Thu, 30 Sep 2004 04:03:22 +0300, Alawi Albaity [EMAIL PROTECTED] wrote:
 I purchase the guide before month and because I am outside US it will
 be inn my country after another month ( I actually bought it pdf
 version from phparch but because of the issue between Sams they cancel
 pdf version and sent the print on thier own charge for the shipment)
 , when I see Zend offer I take it directly but ofcourse I now must
 read from manual because the last day is 30th September , so I read
 hard , but of course not all the manual , but what I feel its
 important to read in the manual .
 I do not figure out that zend write the objective untill the last day
 , I take the self test and it make me feel better but the self test
 making you feel like if you get 3 from 5 you will success ,  I arrive
 at the center , do what it have to be done , and log in the room and I
 was very excited about exam when I get the test I found out its very
 simple and easy but because I read from manual I have confused in a
 lot of things in exam .
 
 Example 1 : they give 4 function and ask you to choose 2 , in all my
 life I was just one function and for first time now I hear there are
 another function which help you to calc the file size , so I choose
 random function .
 
 Example 2 :
 they give you some space to fill some text from your experience , I
 think I must write what they think its truth , inn example one of
 space I confuse what to write (object or class) because I do not get
 the situation of the code or thing they talk about , and think what if
 you write the spelling wrong but you get the idea.
 
 Example 3:
 they ask you about the possibility of validate user input if its for
 only unTrusted person or on the internet or also give you 2 choice, I
 think this thing is belong to me to decide on my work experience and
 not the opinion of the testers .
 
 at the final I feel and believe in my heart like I get 60 or 50 of
 exam at least correct but the I end I figure out my grade is FAILED .
 I have 3 years experience with php , I build a script of thousands of
 lines , but the really point that I do not read thing in manual untill
 I feel I must read and I need it, I make lot of scripts on php from 3
 years , I do not work ever with streams , and i get what I need in
 regular expression by test and test and test for the code , if you
 want my advice read a lot about arrays and if the function will give
 you the new value or will do the process in the same array and which
 type of array the function must use and return and how much of arrays
 they can handle.
 
 I write a book in php in arabic of more than 100 and it was the first
 book for arabs, , I make scripts for writers , sellers , shops And now
 i figure out that I must read good and install manual in my brain to
 be success .
 
 but what the benefit of this when I read I figure out that there are a
 lot of thinngs usefel in php that I do not know about .
 and give me a keys for a new things in php that I was do not care
 about it in the past .
 
 I encourage the people have a good brain to save information to get
 the test , and encourage the people to complete thier road of
 development , your work is the strongest approve of your Exprience and
 your hardwork . the problem that youu will not be in the yellow pages
 in the Zend site .
 
 finally , thanks to the people who write the test they make it very
 good and very simple and easy , they was so fair , who got good
 knowldge will pass .
 
 --
 Alawi Albaity
 Jeddah - KSA
 Mobile : +966506660442
 
 
 
 --
 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