|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general-digest-help_at_lists.php.net
Date: Wed Aug 14 2002 - 16:41:27 CDT
php-general Digest 14 Aug 2002 21:41:27 -0000 Issue 1525
Topics (messages 112505 through 112608):
Re: How to make it use blowfish?
112505 by: Jean-Christian Imbeault
Re: SSL/sessions & password question
112506 by: Wayne
112510 by: Jean-Christian Imbeault
Re: Session, error occurs
112507 by: Per
Re: determining which link was clicked
112508 by: Moose Magin
112544 by: Gui Guy
Destroy session variable when IE close
112509 by: Christian Ista
112515 by: Christian Ista
112524 by: lallous
fopen and sort by date modified
112511 by: electroteque
112512 by: lallous
112519 by: Bas Jobsen
112543 by: electroteque
112546 by: electroteque
help with making appropriate indexes.
112513 by: lallous
Header utilisation problem
112514 by: Christian Ista
112516 by: Peter Hicks
Redhat Linux 7.2
112517 by: Tim Haynes
112525 by: Jason Wong
112532 by: Daniel Masson
Retrieving variables
112518 by: Michael Hazelden
112520 by: Bogdan Stancescu
112522 by: Michael Hazelden
Re: mailing list managers
112521 by: David T-G
php classes
112523 by: Tom Kohnen
Is Voice Over IP possible in PHP
112526 by: usha
112528 by: Adam Voigt
imagecreatfrompng() only work for 24bits png ?
112527 by: NoWhErEMan
Setting the line number for debugging
112529 by: Thomas Lochmatter
112531 by: Chris Boget
112540 by: Thomas Lochmatter
112542 by: Chris Boget
112545 by: Thomas Lochmatter
[Class] Behaviour global variables
112530 by: Tim Stoop
112533 by: Richard Black
112534 by: Bas Jobsen
112535 by: lallous
Persistant Connections
112536 by: John Wards
112578 by: Nick Oostveen
Re: $HTTP_SESSION_VARS vs $_SESSION - cont.
112537 by: Analysis & Solutions
Credit Card Transactions and Micropayment
112538 by: Sascha Braun
Introducing eNetwizard Server: An Open Source Project for Users of PHP
112539 by: Robert Samuel White
Re: newbie PHP/HTML pull down menu problem
112541 by: Justin French
Shared network server failing to include files
112547 by: Julio Nobrega
112548 by: Julio Nobrega
112555 by: Andrew Brampton
112561 by: . Edwin
112591 by: Julio Nobrega
online petition
112549 by: M.E. Suliman
112570 by: César Aracena
Re: ldap_rename refused to work
112550 by: Stig Venaas
regex match problem
112551 by: Dave [Hawk-Systems]
112588 by: Bas Jobsen
Re: requesting sites running OS X
112552 by: Jerry
problem with mail()
112553 by: Gui Guy
fgets question
112554 by: Monte Ohrt
112556 by: Kevin Stone
112565 by: Monte Ohrt
112568 by: Jay Blanchard
112571 by: DL Neil
112582 by: Monte Ohrt
Detecting Browser Closing...
112557 by: Kondwani Spike Mkandawire
112559 by: Chris Boget
112563 by: Kondwani Spike Mkandawire
112564 by: Chris Boget
Detecting Browser Closing (2)...
112558 by: Kondwani Spike Mkandawire
addslashes() and stripslashes()
112560 by: ed
112562 by: Matt Schroebel
how many files are in a directory
112566 by: Harry.de
112572 by: Bas Jobsen
ADVANCED PHP (SOCKETS)
112567 by: Gustavo Almeida
112595 by: Philip Hallstrom
112606 by: J Smith
error reporting
112569 by: Georgie Casey
112573 by: Bas Jobsen
!== (was Re: [PHP] how many files are in a directory)
112574 by: Chris Boget
112579 by: Jay Blanchard
112583 by: Justin Garrett
Sessions...
112575 by: Kondwani Spike Mkandawire
problem with $_POST
112576 by: Adam Williams
112593 by: Bas Jobsen
PHP - class question
112577 by: Mark Armendariz
112580 by: Steve Bradwell
112581 by: Nick Oostveen
112585 by: Mark Armendariz
112586 by: Mark Armendariz
112589 by: Mark Armendariz
Array question
112584 by: Brad Harriger
112592 by: Bas Jobsen
php and xml problem
112587 by: Pafo
PHP AND JAVA
112590 by: Alexandra Aguiar
112601 by: Tim Stoop
sessions
112594 by: apollo
112596 by: Adam Williams
apache seg fault (sig 11)
112597 by: Pete James
mysql statement (still a semi newbie)
112598 by: Alexander Ross
112602 by: vic
112603 by: Tim Stoop
112607 by: César Aracena
[Class] "global" again, not working?
112599 by: Tim Stoop
Simple Mail
112600 by: Dave Leather
112604 by: Tim Stoop
html parsing from html file through php
112605 by: victor.argilent.com
112608 by: JJ Harrison
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
Dan Hardiker wrote:
>
> Use mcrypt. See the manual.
I don't want to use mcrypt :) It requires me install a separate library.
Or do you mean that the only to get crypt() to use Blowfish is to
install mcrypt?
What does crypt() require, on a RH7.2 Linux machine, in order to use
Blowfish?
Jc
attached mail follows:
Hi,
All you need is:
<form action=https://domain/filename method=post>
https is for SSL.
Wayne
attached mail follows:
Wayne wrote:
>
> All you need is:
> <form action=https://domain/filename method=post>
Sounds too easy, there must be a catch ;)
Thanks!
Jc
attached mail follows:
Daniel Canil wrote:
> I have jsut recently installed a php development kit on my windows platform.
> Im interested in using the session functions but I am recieving this error
> when I use session_start():
>
> Warning: open(/tmp\sess_540ded508edf231c47fe85bd970f936a, O_RDWR) failed: m
> (2) in d:\phpdev\www\phpdev4\samples\samp13.htm on line 4
Run a phpinfo() to see what session.save_path you have registred. It
seems like php tries to open from the default directory /tmp.
Maybe you have not restarted the web server after altering the php.ini.
/Per
attached mail follows:
If I understand what you're trying to do, just put an identifier in the url,
and on the page you link to, use an if statement to display the part you
want.
eg
<a href='newpage.php?content=emailform'>email form</a><br />
<a href='newpage.php?content=forum'>Forum</a>
and on the 'newpage.php'
if($content == "emailform") {
//Put your stuff to be displayed here
}
elseif ($content == "forum") {
//Again, more stuff to be displayed
}
And so on ;)
-----Original Message-----
From: Gui Guy [mailto:gui_guy
hotmail.com]
Sent: Wednesday, 14 August 2002 10:08 AM
To: php-general
lists.php.net
Subject: [PHP] determining which link was clicked
if I have a page full of links and I want to generate another page. The
contents of the new page will depend on the link I click.
How can I determine which link was clicked?
Thanks.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Thanks for your help Thats what I am trying to do but the variable $content does not get over to newpage.php
----- Original Message -----
From: "Moose Magin" <mmagin
moose.homelinux.org>
To: "Gui Guy" <gui_guy
hotmail.com>
Cc: <php-general
lists.php.net>
Sent: Wednesday, August 14, 2002 3:52 AM
Subject: RE: [PHP] determining which link was clicked
> If I understand what you're trying to do, just put an identifier in the
url,
> and on the page you link to, use an if statement to display the part you
> want.
>
> eg
>
> <a href='newpage.php?content=emailform'>email form</a><br />
> <a href='newpage.php?content=forum'>Forum</a>
>
> and on the 'newpage.php'
>
> if($content == "emailform") {
> //Put your stuff to be displayed here
>
> }
> elseif ($content == "forum") {
> //Again, more stuff to be displayed
> }
>
> And so on ;)
>
>
>
> -----Original Message-----
> From: Gui Guy [mailto:gui_guy
hotmail.com]
> Sent: Wednesday, 14 August 2002 10:08 AM
> To: php-general
lists.php.net
> Subject: [PHP] determining which link was clicked
>
>
> if I have a page full of links and I want to generate another page. The
> contents of the new page will depend on the link I click.
> How can I determine which link was clicked?
>
> Thanks.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
Hello,
Is it possible to set to null (or destroy) the session variables when I close IE ?
Bye
attached mail follows:
Hello,
Is it possible to set to null (or destroy) the session variables when I close IE ?
Bye
attached mail follows:
Afaik, the session will die automatically when IE gets closed. Or at least the cookie that links to that session.
Elias
"Christian Ista" <christian.ista
teledisnet.be> wrote in message
news:000101c24384$442ab9b0$c000a8c0
p3portable...
> Hello,
>
> Is it possible to set to null (or destroy) the session variables when I
> close IE ?
>
> Bye
>
attached mail follows:
hi there i was wondering how i could fopen a directory and then sort the files by date modified is there a way ?
attached mail follows:
checkout:
opendir() readdir() fstat() closedir()
Elias
"Electroteque" <daniel
electroteque.org> wrote in message
news:20020814110731.70440.qmail
pb1.pair.com...
> hi there i was wondering how i could fopen a directory and then sort the
> files by date modified is there a way ?
>
>
attached mail follows:
Op woensdag 14 augustus 2002 13:04, schreef electroteque: > hi there i was wondering how i could fopen a directory and then sort the > files by date modified is there a way ?
<?php // Note that !== did not exist until 4.0.0-RC2 $dir='/home'; if ($handle = opendir($dir)) { echo "Directory handle: $handle\n"; $lasttime=0; $temp=array(); while (false !== ($file = readdir($handle))) { echo $file; if(is_file($file))$temp[$file]=filemtime($file); } } asort($temp,SORT_NUMERIC); reset($temp); while(list($k,$v)=each($temp)) echo $k.':'.date('r',$v)."\n"; ?>
attached mail follows:
sweet , damn filemtime this was hiding from me :)
-----Original Message-----
From: Bas Jobsen [mailto:bas
startpunt.cc]
Sent: Wednesday, August 14, 2002 8:48 PM
To: electroteque; php-general
lists.php.net
Subject: Re: [PHP] fopen and sort by date modified
Op woensdag 14 augustus 2002 13:04, schreef electroteque: > hi there i was wondering how i could fopen a directory and then sort the > files by date modified is there a way ?
<?php // Note that !== did not exist until 4.0.0-RC2 $dir='/home'; if ($handle = opendir($dir)) { echo "Directory handle: $handle\n"; $lasttime=0; $temp=array(); while (false !== ($file = readdir($handle))) { echo $file; if(is_file($file))$temp[$file]=filemtime($file); } } asort($temp,SORT_NUMERIC); reset($temp); while(list($k,$v)=each($temp)) echo $k.':'.date('r',$v)."\n"; ?>
attached mail follows:
unfortunately this isnt sorting by date modified ?
-----Original Message-----
From: Bas Jobsen [mailto:bas
startpunt.cc]
Sent: Wednesday, August 14, 2002 8:48 PM
To: electroteque; php-general
lists.php.net
Subject: Re: [PHP] fopen and sort by date modified
Op woensdag 14 augustus 2002 13:04, schreef electroteque: > hi there i was wondering how i could fopen a directory and then sort the > files by date modified is there a way ?
<?php // Note that !== did not exist until 4.0.0-RC2 $dir='/home'; if ($handle = opendir($dir)) { echo "Directory handle: $handle\n"; $lasttime=0; $temp=array(); while (false !== ($file = readdir($handle))) { echo $file; if(is_file($file))$temp[$file]=filemtime($file); } } asort($temp,SORT_NUMERIC); reset($temp); while(list($k,$v)=each($temp)) echo $k.':'.date('r',$v)."\n"; ?>
attached mail follows:
give this query:
SELECT table_routing.id AS routeid, table_pricing.units AS price, table_routing.provider AS providerid, table_country.name AS countryname, table_country.id AS countrycode FROM table_pricing, table_routing, table_country WHERE table_country.id = table_routing.country AND table_routing.country = table_pricing.country AND table_routing.provider = table_pricing.provider AND table_country.enabled = 1 ORDER BY routeid
what keys / indexes should I create on whatever tables to make this query efficient? I don't know if this query can be re-written even with JOINs and stuff.
Please advise,
If you've got an online doc. about that it will help too.
Elias
attached mail follows:
Hello,
I'd like to know why this code not work : case " xxxx ": include("act_create_new_compte.php"); header("Location: ../manager/index.php"); break;
I receive this error : Warning: Cannot add header information - headers already sent by (output started at d:\inetpub\wwwroot\website\test2\login\act_create_new_compte.php:31) in d:\inetpub\wwwroot\ website\test2\login\index.php on line 18
But when I place header("Location: ../manager/index.php"); in the end of the file act_create_new_compte.php and remove the line in the case, like that : case "xxxx": include("act_create_new_compte.php"); break;
That's work.
Could you explain me that ?
Bye
attached mail follows:
Hi Christian
I suspect act_create_new_compte.php is sending headers. Once HTTP headers have been sent, and HTML has started to be sent, you can send no more headers.
Try using another method of causing the browser to reload - maybe a META tag? (urgh).
Peter.
On Wed, 14 Aug 2002, Christian Ista wrote:
> Hello, > > I'd like to know why this code not work : > case " xxxx ": > include("act_create_new_compte.php"); > header("Location: ../manager/index.php"); > break; > > I receive this error : > Warning: Cannot add header information - headers already sent by (output > started at > d:\inetpub\wwwroot\website\test2\login\act_create_new_compte.php:31) in > d:\inetpub\wwwroot\ website\test2\login\index.php on line 18 > > But when I place header("Location: ../manager/index.php"); > in the end of the file act_create_new_compte.php and remove the line in > the case, like that : > case "xxxx": > include("act_create_new_compte.php"); > break; > > That's work. > > Could you explain me that ? > > Bye > > > >
attached mail follows:
I have just installed Redhat Linux 7.2, the installation was fine at it installed apache with php 4.0.6 as default, that runs without problems. Unfortunately I noticed that PHP was not compiled with mysql support and there was no distribution of mysql with linux so please can anyone help by explaining what I need to do to resolve these problems.
Many Thanks
Tim
attached mail follows:
On Wednesday 14 August 2002 19:21, Tim Haynes wrote: > I have just installed Redhat Linux 7.2, the installation was fine at it > installed apache with php 4.0.6 as default, that runs without problems. > Unfortunately I noticed that PHP was not compiled with mysql support and > there was no distribution of mysql with linux so please can anyone help by > explaining what I need to do to resolve these problems.
RH7.2 does come with everything to get Apache/MySQL/PHP working together. To get MySQL support in PHP, install the php-mysql-XXXXX.rpm.
For further help ask on the RH7.2 (Enigma) mailing list.
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* The wise man seeks everything in himself; the ignorant man tries to get everything from somebody else. */
attached mail follows:
Usually in the RedHat cd´s you can find php-mysql-*.*.rpm, after installing this package you´re ready to go !!
=> Daniel.
On Wednesday 14 August 2002 19:21, Tim Haynes wrote: > I have just installed Redhat Linux 7.2, the installation was fine at > it installed apache with php 4.0.6 as default, that runs without > problems. Unfortunately I noticed that PHP was not compiled with mysql
> support and there was no distribution of mysql with linux so please > can anyone help by explaining what I need to do to resolve these > problems.
RH7.2 does come with everything to get Apache/MySQL/PHP working together. To get MySQL support in PHP, install the php-mysql-XXXXX.rpm.
For further help ask on the RH7.2 (Enigma) mailing list.
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* The wise man seeks everything in himself; the ignorant man tries to get everything from somebody else. */
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Hi all,
I'm attempting to store variables inside a database and then recall them.
What I want to do is store them dynamically though - so for instance - a path to a file will be stored in the DB as $_SERVER[DOCUMENT_ROOT]."/path/to/file"
But, obviously, when I retrieve this value, it retrieves it as a literal ... not much help because I want to parse it as a proper value.
Is there any way to retrieve that value and then parse it within the PHP to create the "c:/webconsole/path/to/file" string that can be stored within another variable?
Anybody got any thoughts?
Cheers,
Michael.
This message has been checked for all known viruses by the MessageLabs Virus Control Centre.
*********************************************************************
Notice: This email is confidential and may contain copyright material of Ocado Limited (the "Company"). Opinions and views expressed in this message may not necessarily reflect the opinions and views of the Company. If you are not the intended recipient, please notify us immediately and delete all copies of this message. Please note that it is your responsibility to scan this message for viruses.
Company reg. no. 3875000. Swallowdale Lane, Hemel Hempstead HP2 7PY
*********************************************************************
attached mail follows:
You may add "\$_SERVER[DOCUMENT_ROOT].\"/path/to/file\"" to the database and then use eval() to evaluate. The better solution is obviously to store "/path/to/file" and append it to $_SERVER[DOCUMENT_ROOT] whenever you need the full path.
Bogdan
Michael Hazelden wrote: > Hi all, > > I'm attempting to store variables inside a database and then recall them. > > What I want to do is store them dynamically though - so for instance - a > path to a file will be stored in the DB as > $_SERVER[DOCUMENT_ROOT]."/path/to/file" > > But, obviously, when I retrieve this value, it retrieves it as a literal ... > not much help because I want to parse it as a proper value. > > Is there any way to retrieve that value and then parse it within the PHP to > create the "c:/webconsole/path/to/file" string that can be stored within > another variable? > > Anybody got any thoughts? > > Cheers, > > Michael. > > This message has been checked for all known viruses by the MessageLabs Virus Control Centre. > > > ********************************************************************* > > Notice: This email is confidential and may contain copyright material of Ocado Limited (the "Company"). Opinions and views expressed in this message may not necessarily reflect the opinions and views of the Company. > If you are not the intended recipient, please notify us immediately and delete all copies of this message. Please note that it is your responsibility to scan this message for viruses. > > Company reg. no. 3875000. Swallowdale Lane, Hemel Hempstead HP2 7PY > > *********************************************************************
attached mail follows:
Thanks to all,
What I've come up with in the end (since I want the flexibility of being able to store the $_SERVER portion or not depending on the need of the variable) is this:
I retrieve the variable from the database in the following way:
select concatenate('$',name,'=',value,';') as a from variables
I can then eval() that result with no problems.
Cheers,
Michael.
-----Original Message-----
From: Bogdan Stancescu [mailto:mgv
canad.ro]
Sent: 14 August 2002 12:56
To: php-general
lists.php.net
Subject: [PHP] Re: Retrieving variables
You may add "\$_SERVER[DOCUMENT_ROOT].\"/path/to/file\"" to the database and then use eval() to evaluate. The better solution is obviously to store "/path/to/file" and append it to $_SERVER[DOCUMENT_ROOT] whenever you need the full path.
Bogdan
Michael Hazelden wrote: > Hi all, > > I'm attempting to store variables inside a database and then recall them. > > What I want to do is store them dynamically though - so for instance - a > path to a file will be stored in the DB as > $_SERVER[DOCUMENT_ROOT]."/path/to/file" > > But, obviously, when I retrieve this value, it retrieves it as a literal ... > not much help because I want to parse it as a proper value. > > Is there any way to retrieve that value and then parse it within the PHP to > create the "c:/webconsole/path/to/file" string that can be stored within > another variable? > > Anybody got any thoughts? > > Cheers, > > Michael. > > This message has been checked for all known viruses by the MessageLabs Virus Control Centre. > > > ********************************************************************* > > Notice: This email is confidential and may contain copyright material of Ocado Limited (the "Company"). Opinions and views expressed in this message may not necessarily reflect the opinions and views of the Company. > If you are not the intended recipient, please notify us immediately and delete all copies of this message. Please note that it is your responsibility to scan this message for viruses. > > Company reg. no. 3875000. Swallowdale Lane, Hemel Hempstead HP2 7PY > > *********************************************************************
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php_____________________________________________________________________ This message has been checked for all known viruses by the MessageLabs Virus Control Centre.
This message has been checked for all known viruses by the MessageLabs Virus Control Centre.
*********************************************************************
Notice: This email is confidential and may contain copyright material of Ocado Limited (the "Company"). Opinions and views expressed in this message may not necessarily reflect the opinions and views of the Company. If you are not the intended recipient, please notify us immediately and delete all copies of this message. Please note that it is your responsibility to scan this message for viruses.
Company reg. no. 3875000. Swallowdale Lane, Hemel Hempstead HP2 7PY
*********************************************************************
attached mail follows:
Justin, Michael, et al --
...and then Michael Sims said... % % On Wed, 14 Aug 2002 01:09:32 +1000, you wrote: % % >I was hoping that maybe there's an opensource or commercial product out % >there that I can install in my doc root (ie, PHP + MySQL support) which will % >handle this in a more effective manner (ie, space the mailout across an hour % >or so, etc etc). % % Take a look at some of the dedicated mailing list managers, and see if
I would agree here. Use a real mailing list manager instead of trying to roll your own.
% perhaps you can modify them to get their subscriber list from your % database. EZMLM by all accounts is very nice, although I believe it % requires Qmail. Majordomo is another option.
While it doesn't truly *require* qmail, that's nonetheless a fairly accurate statement. It is, however, very robust and easy to use.
% % If you don't want the complexity of those types of programs, look at % some Perl-based solutions. I've been learning Perl as time allows, % and I've found that it's not too difficult if you're already a PHP % person to pick up Perl. A search on www.hotscripts.com or % www.freshmeat.net may turn up something.
Absolutely agreed; the languages are very similar. [Rumor has it that php is perl-based or perl-inspired, but I haven't done any independent digging to see one way or another -- and there are *some* noticeable differences.]
HTH & HAND
:-D
-- David T-G * It's easier to fight for one's principles (play) davidtgjustpickone.org * than to live up to them. -- fortune cookie (work) davidtgwork
justpickone.org http://www.justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (FreeBSD)
iD8DBQE9WkXPGb7uCXufRwARAmLCAJ9hi/+D3/kAx2VmnW0Z891ZOi7F/ACfX25l AcIDbY+xzkENxtVGJwSS2ks= =QgB7 -----END PGP SIGNATURE-----
attached mail follows:
Hi!
Can anyone recommend me some entry-level php-classes tutorials, because the php.net page about classes is not that helpful and difficult to understand IMO.
Thanks in advance, - Tom
attached mail follows:
Hi
Can anyone tell me if Voice Over IP is possible in PHP. Such that a client machine can voice chat to My apache Web Server. I want this to be done via web based so that the client has no overhead of installing any softwares.
Regards
attached mail follows:
Umm, I'm fairly sure you can't do this unless you wanted to rig up a client side application in PHP, but if you want it so they don't have to get any software, I would suggest Java, check out www.dialpad.com they do something fairly cool like this.
Adam Voigt
adam.voigt
cryptocomm.com
On Wed, 2002-08-14 at 13:32, usha wrote: > Hi > > Can anyone tell me if Voice Over IP is possible in PHP. Such that a client machine can voice chat to My apache Web Server. I want this to be done via web based so that the client has no overhead of installing any softwares. > > Regards
attached mail follows:
Hi all, I use following script to generate a resized png image on the fly. I tried for several hours and found that it not works for every png image. And finally i found that the imagecreatfrompng() only works for 24bits png. i.e my script does not works on my abc.png which is 8bpp(bitsperpixel), after i increased it;s color depth to 24bits, it works perfectly. Is it true that the png function only works on 24bpp png image? (i'm not sure...)
Or put it on this way, how can i increase the color depth in php before process following script?
I use apache 2.x on win2k, php4.2.2 with php_gd.dll enabled.
<?php $image = imagecreatefrompng("abc.png"); $newimage = imagecreate(300, 300);
$black = imagecolorallocate($newimage, 0,0,0);
imagecopyresized($newimage, $image, 0, 0, 0, 0, 300, 300, 400, 300);
imagedestroy($image); imagestring($newimage, 2, 10, 10, "Copyright 2001", $black);
header("Content-type: image/png"); imagepng($newimage); imagedestroy($newimage);
?>
Thanks in advance. NoWhErEMaN
attached mail follows:
Is it possible to set the line number and file name to show in error messages?
I'm looking for something similar to the perl's expression #line 298 myscript.pl which tells the compiler explicitely that here is line 298 of myscript.pl. If an error occurs 5 lines later, it would show something like "compile error at line 303 in myscript.pl", whatever the real line number and filename is.
Thomas
thl
lothosoft.ch
attached mail follows:
> Is it possible to set the line number and file name to show in error > messages?
__FILE__ __LINE__
Chris
attached mail follows:
As far as I know, __LINE__ and __FILE__ are "magic constants" which return the current line number and file name.
But what I'm looking for is a way to set these two things. I want to say on line 30 that this is not line 30, but line 40 for example. And php should then return all following errors with the new line numbering.
The reason for this is that I have a kind of preprocessor which puts some php code parts of code in one large script and then runs the whole script. If now an error occurs on line 362 for example, it is not easy to find the buggy code part, because this might be on line 15 in one of the source scripts.
Perl has a nice feature to achieve this, and I was wondering if something similar exists in php.
- Thomas
"Chris Boget" <chris
wild.net> schrieb im Newsbeitrag
news:008801c24396$580393a0$8c01a8c0
ENTROPY...
> > Is it possible to set the line number and file name to show in error
> > messages?
>
> __FILE__
> __LINE__
>
> Chris
>
>
attached mail follows:
> As far as I know, __LINE__ and __FILE__ are "magic constants" which > return the current line number and file name.
Sorry, I misunderstood exactly what you were looking for. > whole script. If now an error occurs on line 362 for example, it is > not easy to find the buggy code part, because this might be on line > 15 in one of the source scripts.
How do you include the source scripts into the main scripts? By using include() or require()? IIRC, __LINE__ and __FILE__ should work in cases like that telling you the line and file name of the source script, not the main script.
> Perl has a nice feature to achieve this, and I was wondering if > something similar exists in php.
Apart from those two variables, none that I know of. Though, that's not to say something similar doesn't exist.
Chris
attached mail follows:
> How do you include the source scripts into the main scripts? By using > include() or require()? IIRC, __LINE__ and __FILE__ should work in > cases like that telling you the line and file name of the source script, > not the main script.
Unfortunately none of them. I really put them together in the same file. The reason is that there are many small pieces of code which all together give a complete script. Technically, I could use require/include instead, but this would mean that every generated script consists of a dozen of files.
Thank you anyway.
- Thomas
attached mail follows:
Hi there,
I'm forgetting something, but I can't seem to get to it... Consider the following Class.
class Test { var $a; var $b;
function Test() { $this->a = 2; $this->b = 5; }
function Show() { global $a, $b;
echo("a: ".$a); echo("a: ".$this->a); echo("b: ".$b); echo("b: ".$this->b); } }
After proper initialisation, calling the function Show() gives:
a: a: 2 b: b: 5
What am I forgetting here? Tia for answers!
-- Kind regards, Tim
attached mail follows:
Not done any OO stuff with PHP, but I would hazard a guess that the problem is one of scope.
Rather than global making available class variables, it makes available GLOBAL variables. And I'm guessing there isn't a global variable a or b, which is why they show up blank.
HTH,
Richy
==========================================
Richard Black
Systems Programmer, DataVisibility Ltd - http://www.datavisibility.com
Tel: 0141 435 3504
Email: rblack
datavisibility.co.uk
-----Original Message-----
From: Tim Stoop [mailto:tim
cidev.nl]
Sent: 14 August 2002 14:27
To: php-general
lists.php.net
Subject: [PHP] [Class] Behaviour global variables
Hi there,
I'm forgetting something, but I can't seem to get to it... Consider the following Class.
class Test { var $a; var $b;
function Test() { $this->a = 2; $this->b = 5; }
function Show() { global $a, $b;
echo("a: ".$a); echo("a: ".$this->a); echo("b: ".$b); echo("b: ".$this->b); } }
After proper initialisation, calling the function Show() gives:
a: a: 2 b: b: 5
What am I forgetting here? Tia for answers!
-- Kind regards, Tim-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
$TEST= new TEST; $a=3; $b=4; $TEST->Show();
works, fine
better to use $GLOBALS['a'] instead of global $a
Op woensdag 14 augustus 2002 15:27, schreef Tim Stoop: > Hi there, > > I'm forgetting something, but I can't seem to get to it... Consider the > following Class. > > class Test > { > var $a; > var $b; > > function Test() > { > $this->a = 2; > $this->b = 5; > } > > function Show() > { > global $a, $b; > > echo("a: ".$a); > echo("a: ".$this->a); > echo("b: ".$b); > echo("b: ".$this->b); > } > } > > After proper initialisation, calling the function Show() gives: > > a: > a: 2 > b: > b: 5 > > What am I forgetting here? Tia for answers!
attached mail follows:
hmmm....what are you missing?
globals $a and $b are not defined!
try to set error reporting to E_ALL and try running your code again.
Elias
"Tim Stoop" <tim
cidev.nl> wrote in message
news:20020814132724.92896.qmail
pb1.pair.com...
> Hi there,
>
> I'm forgetting something, but I can't seem to get to it... Consider the
> following Class.
>
> class Test
> {
> var $a;
> var $b;
>
> function Test()
> {
> $this->a = 2;
> $this->b = 5;
> }
>
> function Show()
> {
> global $a, $b;
>
> echo("a: ".$a);
> echo("a: ".$this->a);
> echo("b: ".$b);
> echo("b: ".$this->b);
> }
> }
>
> After proper initialisation, calling the function Show() gives:
>
> a:
> a: 2
> b:
> b: 5
>
> What am I forgetting here? Tia for answers!
>
> --
> Kind regards,
> Tim
attached mail follows:
I am running a website which generates around 100,000 pageviews a day and I am wondering if I stop using persistent conections to the database and use normal open and close conections this would reduce the load onto my server?
Most conections are either made through my "main" file or the phorum message board system.
Thanks in advance John Wards
attached mail follows:
Persistent connections are typically a good thing to use on high traffic sites as they offer better performance than opening and closing connections for each database request. The reason for this is the overhead used in opening a database connection is actually quite high.
While keeping them open when they are no longer needed may seem counter-intuitive, the connection isn't being saved for a particular user or page, instead it remains open and will automatically be used by any page requiring database connectivity on your site. If there are no free connections when a page request comes in, a new one is open. Conversely if a connection has not been utilized for a specific period of time (usually a couple minutes) it will be closed.
At 02:46 PM 8/14/2002 +0100, John Wards wrote: >I am running a website which generates around 100,000 pageviews a day and I >am wondering if I stop using persistent conections to the database and use >normal open and close conections this would reduce the load onto my server? > >Most conections are either made through my "main" file or the phorum message >board system. > >Thanks in advance >John Wards > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
On Tue, Aug 13, 2002 at 10:07:57AM -0700, Rasmus Lerdorf wrote: > > while ( list($Key, $Val) = each($_SESSION) ) { > > $$Key = $Val; > > } > > extract($_SESSION) is a better way to do that.
Yeah. Old habits die hard! :)
--Dan
--
PHP classes that make web design easier
SQL Solution | Layout Solution | Form Solution
sqlsolution.info | layoutsolution.info | formsolution.info
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
attached mail follows:
Hello,
while I'm building a very nive page for buying images over the web, but there are some parts of the site where the development not is evaluated to the end. (Hope you all understand this sentence.)
One part will be the payment module. I read the parts about the creditcard security in this mailinglist very carefully and got some new questions about that theme.
Are there some ways of using a micropayment system together with PHP? - Maybe something where Customers can see the Amount of Money they have to pay, and then they do a phonecall to e specific number and then the page redirects teh customer to a downloads page where the user can receive his picturepackage.
Or how does the cybercash module in PHP work? I saw it in the php.ini, but could not find it in the extensions dir.
What else can I do for my customers to have an secure payment possibility?
It would be very usefull for me and maybe for others to discuss these points in the list.
So I hope, somebody will share his or hers knowledge.
Thanks
Sascha Braun
----------------------------- www.weitsicht.org
attached mail follows:
INTRODUCTION
eNetwizard is a cutting-edge web application server and content management system. It includes an advanced runtime engine capable of rendering and managing an unlimited number of websites across an unlimited number of domains (referred to as the matrix), all from a central web space environment. eNetwizard is platform independent and runs on both public and private networks, making it suitable for Internet, Intranet, and Extranet solutions. Indeed, by its very design, eNetwizard can run all three of them (in unlimited numbers) with a single running copy of the distribution. eNetwizard is ideal for the individual to the largest of enterprises, as well as for internet service providers who wish to offer truly unique web hosting and web design services.
FEATURES
eNetwizard was designed with five main concepts in mind: security, flexibility, configurability, efficiency, and expandability.
eNetwizard includes its own API and registry that allow programmers to interact with the system; the API is expanded using an included components library, which can be easily added to; this allows programmers to expand the capabilities of eNetwizard without interfering with the core API.
eNetwizard includes modules (as part of the core class library) for advanced session management, complete error handling, thorough user authentication, and the following of precise security protocols. Nothing gets past eNetwizard. An example of one of the components is an entire suite of logging functions which are so comprehensive it can even log attempts at treachery! And, if you want it to, block the user immediately.
eNetwizard includes a full set of wizards (which are automatically available to all of the websites in the matrix.) An example of one of the wizards is the Sign Up Wizard, which allows a user to sign up for membership to the matrix; users have the ability to indicate which websites in the matrix may have access to their personal information, and what information they may have access to; if a website needs this information to offer a customized service and the user has not yet given the website permission, eNetwizard will prompt the user and ask if it is okay. This is just one of the many wizards available as part of the standard distribution.
eNetwizard itself is fully-customizable, as is all of the content that it is responsible for rendering. Individual websites (and even groups of websites) can be owned by different individuals, unlimited in number of course, giving each of them access to their own Website Wizard. The main administrator makes use of the Matrix Wizard to govern eNetwizard.
eNetwizard also contains a full set of plug-in applications (referred to as objects) which add to the functionality of individual websites; a simple object would be a newsletter or web directory; once an object is added to a web matrix, it runs flawlessly, even in the style and colors that have already been chosen as the theme of the website.
These are just a few of the many wonderful things that eNetwizard can do!
SYSTEM REQUIREMENTS
eNetwizard is primarily written in PHP and uses MySQL as its backend database server. In the future, eNetwizard will provide support for other databases as well. eNetwizard runs best on Apache, regardless of platform, and makes use of the mod_rewrite module to force Apache to serve all requests through the eNetwizard Runtime Engine; it's a very simple setup. It may be possible to use eNetwizard with other web servers, such as IIS, if the web server contains a similar method to mod_rewrite. So in essence, eNetwizard is designed to work on most standard web server configurations. Future projects that will complement eNetwizard will be written in Perl and Java as well. eNetwizard licensing is based on the Open Source Artistic License.
BACKGROUND INFORMATION
I began eNetwizard as an independent project at the age of twenty-one as a way to simplify my role as a web programmer and as a workaround to the limitations I found myself facing on a shared hosting server. eNetwizard began its life at Swift eNetwork <http://www.swifte.net/default.html>, presently offline. Over the course of four years, I would develop it to a certain point when suddenly I would have a revelation about how to substantially improve the product; several times, five or six so far, I have completely scrapped the code and completely started it all over again! I wanted it to be perfect before I ever considered releasing it to the public.
Now, at the age of twenty-five, over four years later, eNetwizard has finally begun to live up to the grand vision in my mind that it was always meant to become. It has become a stable solution that I honestly believe will become an invaluable resource to the web programming community.
The latest version of eNetwizard is used on several different systems already, Windows and Linux, including internally by one of the largest cable companies in America.
CALL FOR HELP
I will be releasing the first Alpha release of eNetwizard within the next few weeks.
eNetwizard still has a long way to go before it meets its full potential. I am currently actively seeking competent volunteer programmers who would like to contribute to this project. Those programmers whom I select to work on this project side-by-side with me will receive substantial recognition for their efforts. If you are interested, please contact me with detailed information about your skills and the projects that you have been involved in. If you are an active SourceForge user, even better! I need assistance with many of the different sub projects as well as individuals who can translate English into other languages; I would like to make eNetwizard portable to as many languages as possible. If you have experience in documentation or other areas of project development, I would love to hear from you as well. Some of the things that need to be done are simple, while others are quite complex. For instance, eNetwizard needs a multifaceted parser for dealing with dynamic content. There are many, many different things that need to be done.
For those of you who are curious about just trying out the software, it will be available for download very soon; the core of eNetwizard is pretty much a complete project, now it's just time for expanding it.
For information about its release, you can sign up for the mailing list by following the links below. I look forward to hearing from you!
Robert Samuel White
rswfire
users.sourceforge.net
webmaster
swifte.net
eNetwizard Open Source Project Website: http://enetwizard.sourceforge.net
eNetwizard Project Information: http://sourceforge.net/projects/enetwizard/
eNetwizard General Mailing List: http://lists.sourceforge.net/lists/listinfo/enetwizard-general
eNetwizard Developers Mailing List: http://lists.sourceforge.net/lists/listinfo/enetwizard-developers
attached mail follows:
You have a while loop that pulls values out of the MySQL table row by row, and for each row, you output an option in the select box.
Something like:
<form name="tester" action="script.php" method="get"> <select name="color"> <? $sql = "SELECT color_id, color FROM colors_table ORDER BY id"; $result = mysql_query($sql); while($myrow = mysql_fetch_array($result)) { $color_id = $myrow['color_id']; $color = $myrow['color'] echo "<option value=\"{$color_id}\">{$color}</option>"; } ?> </select> </form>
Season to taste :) Justin French
on 14/08/02 2:30 PM, Brian & Shannon Windsor (bwindsor
mindspring.com)
wrote:
> Hi, > > I want to pull information out of my mySQL database and use it as a pull > down menu ona web page. There are two sets of information that I need, one > is a color, and the other is the color_id, so I want to use it in the way > below but without having to physically enter all the data. I'd like to use > color_id as the value and the actual color name as the text in the pull down > button. Can someone please help me on how to pass the info into a useable > way to get the info out of PHP and into HTML? I've haad no problems going > from HTML to PHP, but can't seem to grasp going the other way, especially > with a list of things. I've been banging my head against this for two days, > but something tells me it's extremely easy. > > Thanks, > > Brian > > <form name="tester" action="script.php" method="get"> > <select name="color"> > <option value="1">red > <option value="2">blue > <option value="3">black > <option value="4">ice > <option value="5">purple > </select> > </form> > > >
attached mail follows:
Hi all,
I am not 100% sure if this is a PHP problem, so I apologize in advance if it is an off-topic problem.
I have a Linux server where I develop my websites. A Windows 2000 takes care of our network internet connectivity. I need to show to a client the progress of our work, so I've shared through Samba a directory from Linux, and installed Apache on the Windows 2000 and used the Alias option to point to this Linux share:
Alias /cs/ //192.168.0.253/apachedir/
When I access my development website locally, or use a browser and input the IP address, everything goes fine. But when I am on the Windows 2000 and type:
An include error occurs:
Fatal error: Failed opening required 'gerador.inc.php' (include_path='') in //192.168.0.253\apachedir\index.php on line 3
Anyone knows the fix? Perhaps I should ask what basically I have in mind since the beggining: How can I server webpages from a networked Linux through the Windows 2000 that is connected to the Internet?
Any help is sincerely appreciated.
Thanks,
-- Julio Nobrega
attached mail follows:
Hi all,
I am not 100% sure if this is a PHP problem, so I apologize in advance if it is an off-topic problem.
I have a Linux server where I develop my websites. A Windows 2000 takes care of our network internet connectivity. I need to show to a client the progress of our work, so I've shared through Samba a directory from Linux, and installed Apache on the Windows 2000 and used the Alias option to point to this Linux share:
Alias /cs/ //192.168.0.253/apachedir/
When I access my development website locally, or use a browser and input the IP address, everything goes fine. But when I am on the Windows 2000 and type:
An include error occurs:
Fatal error: Failed opening required 'gerador.inc.php' (include_path='') in //192.168.0.253\apachedir\index.php on line 3
Anyone knows the fix? Perhaps I should ask what basically I have in mind since the beggining: How can I server webpages from a networked Linux through the Windows 2000 that is connected to the Internet?
Any help is sincerely appreciated.
Thanks,
-- Julio Nobrega
attached mail follows:
Hi, I don't think this is a PHP question, but the line Alias /cs/ //192.168.0.253/apachedir/ try Alias /cs/ \\192.168.0.253/apachedir/
Because //isn't valid for UNCs, but \\ is..
If this doesn't work, then with dos map \\192.168.0.253/apachedir/ to a network drive and point apache at that
Andrew
----- Original Message -----
From: "Julio Nobrega" <inerte
hotmail.com>
To: <php-general
lists.php.net>
Sent: Wednesday, August 14, 2002 4:58 PM
Subject: [PHP] Shared network server failing to include files
> Hi all, > > I am not 100% sure if this is a PHP problem, so I apologize in advance if > it is an off-topic problem. > > I have a Linux server where I develop my websites. A Windows 2000 takes > care of our network internet connectivity. I need to show to a client the > progress of our work, so I've shared through Samba a directory from Linux, > and installed Apache on the Windows 2000 and used the Alias option to point > to this Linux share: > > Alias /cs/ //192.168.0.253/apachedir/ > > When I access my development website locally, or use a browser and input > the IP address, everything goes fine. But when I am on the Windows 2000 and > type: > > http://localhost/cs/ > > An include error occurs: > > Fatal error: Failed opening required 'gerador.inc.php' (include_path='') in > //192.168.0.253\apachedir\index.php on line 3 > > Anyone knows the fix? Perhaps I should ask what basically I have in mind > since the beggining: How can I server webpages from a networked Linux > through the Windows 2000 that is connected to the Internet? > > Any help is sincerely appreciated. > > Thanks, > > -- > Julio Nobrega > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
attached mail follows:
And still, if this doesn't work, why not install PHP as well--with Apache... (Perhaps, there must really be some good reason why not...)
I'm not sure what was meant by
> > A Windows 2000 takes > > care of our network internet connectivity
but if a router is present, why not just map HTTP request to the linux server?
Just wondering,
- E
>
>Hi, I don't think this is a PHP question, but the line
>Alias /cs/ //192.168.0.253/apachedir/
>try
>Alias /cs/ \\192.168.0.253/apachedir/
>
>Because //isn't valid for UNCs, but \\ is..
>
>If this doesn't work, then with dos map \\192.168.0.253/apachedir/ to a
>network drive and point apache at that
>
>Andrew
>
>----- Original Message -----
>From: "Julio Nobrega" <inerte
hotmail.com>
>To: <php-general
lists.php.net>
>Sent: Wednesday, August 14, 2002 4:58 PM
>Subject: [PHP] Shared network server failing to include files
>
>
> > Hi all,
> >
> > I am not 100% sure if this is a PHP problem, so I apologize in
advance
>if
> > it is an off-topic problem.
> >
> > I have a Linux server where I develop my websites. A Windows 2000
takes
> > care of our network internet connectivity. I need to show to a client
the
> > progress of our work, so I've shared through Samba a directory from
Linux,
> > and installed Apache on the Windows 2000 and used the Alias option to
>point
> > to this Linux share:
> >
> > Alias /cs/ //192.168.0.253/apachedir/
> >
> > When I access my development website locally, or use a browser and
input
> > the IP address, everything goes fine. But when I am on the Windows 2000
>and
> > type:
> >
> > http://localhost/cs/
> >
> > An include error occurs:
> >
> > Fatal error: Failed opening required 'gerador.inc.php'
(include_path='')
>in
> > //192.168.0.253\apachedir\index.php on line 3
> >
> > Anyone knows the fix? Perhaps I should ask what basically I have in
mind
> > since the beggining: How can I server webpages from a networked Linux
> > through the Windows 2000 that is connected to the Internet?
> >
> > Any help is sincerely appreciated.
> >
> > Thanks,
> >
> > --
> > Julio Nobrega
> >
> >
> >
> >
> >
> > --
> > 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
_________________________________________________________________ $B$-$C$H8+$D$+$k$"$J$?$N?75o!!ITF0;:>pJs$O(B MSN $B=;Bp$G(B http://house.msn.co.jp/
attached mail follows:
Edwin em Wednesday 14 August 2002 14:51 foi agraciado com uma resposta
por:
> And still, if this doesn't work, why not install PHP as well--with > Apache... (Perhaps, there must really be some good reason why not...)
Yes ;-)
It connects to 12 different mysql databases and has a few Linux-only tweaks.
> > I'm not sure what was meant by> >> > A Windows 2000 takes >> > care of our network internet connectivity > server?
I meant our Adsl modem is connected to the Windows 2000 machine, and the rest of the network use it.
Anyway, now I am 100% it's a php configuration issue because HTML pages are served normally. The problem is when I use require() (and similar) functions. It can't find the files. I've edited php.ini and used .htaccess to specify the include_path() but no luck yet...
Still researching!
-- Julio Nobrega http://gnet.inerciasensorial.com.br
attached mail follows:
Hi
Anyone know of a online petition system in PHP similar to what is offered on www.PetitionOnline.com
Thanks
Mohamed
attached mail follows:
I guess you could search for "petition" on hotscripts.com but it could take you longer to find and configure one properly, than making your own one.
C.
> -----Original Message-----
> From: M.E. Suliman [mailto:essa
netactive.co.za]
> Sent: Wednesday, August 14, 2002 1:04 PM
> To: php-general
lists.php.net
> Subject: [PHP] online petition
>
> Hi
>
> Anyone know of a online petition system in PHP similar to what is
offered
> on
> www.PetitionOnline.com
>
> Thanks
>
> Mohamed
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
On Wed, Aug 14, 2002 at 02:18:58AM -0700, Roger Thomas wrote: > built: php-4.2.2 with openldap 2.0.25 > > i tried using the ldap_rename function to modify the dn of my ldap db but > nothing seems to happen. the record was not change at all. i have followed > closely the code-snippet that was given by Mr Stig Venaas at: > http://marc.theaimsgroup.com/?l=php-general&m=100949195224325&w=2
But you're not doing what I wrote...
> // we want to transfer user roger from Civil Engineering to Credit section in > Finance > $r=ldap_rename($ds, > "uid=roger,ou=People,ou=Civil,o=Engineering,dc=mydomain,dc=net", > "uid=roger,ou=People,ou=Credit,o=Finance,dc=mydomain,dc=net", > "dc=mydomain,dc=net",TRUE);
The third parameter should be the new rdn (which is the same as the old), and the fourth should be new parent. So it should look like this:
$r=ldap_rename($ds, "uid=roger,ou=People,ou=Civil,o=Engineering,dc=mydomain,dc=net", "uid=roger", "ou=People,ou=Credit,o=Finance,dc=mydomain,dc=net", TRUE);
Stig
attached mail follows:
as part of a larger application we have a bit of code that processes whois to determine domain name expiry dates. Most formats are easily parsed, but Register.Com has thrown the little regex for a loop and I am unsure as to a clean workaround.
Here is what we have;
...
$pregmatchstring="/([\s])*(Renewal\DDate|Registered\sthrough|Expires|Record\sExp ires|Domain\sExpires|Expiry\sDate)([\D\s]*)(.*)/i";
...
exec($command,$cresult,$cstatus); # puts all lines into array $expire=''; for($i=0;$i<count($cresult);$i++){ if(preg_match($pregmatchstring,$cresult[$i], $matches)){ $expire.=strtotime(trim($matches[4],". \t\n\r")); }else{ $expire.=''; } }
...
This regex handles pretty much everything... / > strip space characters from the front (some indent) ([\s])* > identify the exipery date line from other verbose entries containing "expir" or similar
(Renewal\DDate|Registered\sthrough|Expires|Record\sExpires|Domain\sExpires|Expir y\sDate) > any other spaces, .....:, or other verbose crap afterwards **except for numbers** > essentially grabs everything else up to the first number > thought I was being slick with this one ([\D\s]*) > grab numbers/date - gets the 2002/12/01, 09-APR-03, 2002-08-19 00:00:00.000 (.*) > and make case insensitive /i
takes care of Renewal-Date: 2002/12/01 Registered through- 08/16/02 00:00:00 Expires on: 09-APR-03 expires: 2003-01-17 02:16:03 Domain expires on 03-Apr-2003 Record expires on 2002-08-19 00:00:00.000 Record expires on 29-Mar-2003. Record expires on 2003-03-25. DOMAIN EXPIRES : 2003-03-25. Expiry Date..........2003.03.25
HOWEVER... this simple solution breaks for register.com because of their date format Expires on..............: Tue, Jul 29, 2003
because the regex only returns "29, 2003" as the date which barfs for the strtotime()
not the regex fault of the strtotime fault, as they are doing what instructed...
Any ideas on a way to simply overcome the register.com format and still keep a simple all inclusive regex for all registrars?
Thanks
Dave
attached mail follows:
To Match: Tue, Jul 29, 2003
> $pregmatchstring="/([\s])*(Renewal\DDate|Registered\sthrough|Expires|Record >\sExp ires|Domain\sExpires|Expiry\sDate)([\D\s]*)(.*)/i";
You can change the last part of $pregmatchstring in:
........Expiry\sDate)([\D\s]*|\w{3},\s\w{3}\s\d{2},\s\d{4})(.*)/i"; You can feed this match also to strtotime().
See: <?php
$testdate='works: Tue, Jul 29, 2003 works';
$pregmatchstring="/(.*)(\w{3},\s\w{3}\s\d{2},\s\d{4})(.*)/i";
preg_match($pregmatchstring,$testdate,$matches); echo strtotime($matches[2])-strtotime('29 July 2003');
?>
this will echos zero, zo i think it works.
attached mail follows:
In article <A854BB3A-AED9-11D6-8E56-003065B85DAA
gearyweb.com>,
listmail
gearyweb.com (Michael Geary) wrote:
> I have been asked by a rep at a large software dev company about any
> websites live-to-the-world running OS X. We are, but we're not exactly
> huge (max hits/day = approx. 1000, mostly internal).
>
> So, what sites are you aware of? They don't even have to be running PHP.
> Please let me know.
We're running our search engine on OS X Server (http://spike.sandiego.edu/); it's great--there's practically no system administration that needs to be done (that's all handled by Apple), and I can concentrate on the search engine software (we use ht://Dig).
We do use PHP on it, but for legacy links--I've got a PHP script that translates requests to the old search engine into requests that ht://Dig understands.
We've just purchased an XServe to replace our main web server, but have not yet installed it. That will use PHP extensively.
We're also using OS X Server to handle our mysql databases. (http://www.sandiego.edu/ac/classes/ to see one front end to one of the databases)
Jerry
-- http://www.hoboes.com/jerry/ "Give a man a fish and you feed him for a day. Teach him to fish, and you've depleted the lake."--It Isn't Murder If They're Yankees (http://www.hoboes.com/jerry/Murder/)
attached mail follows:
I'm trying to send email from php and nothing happens. Sendmail is correctly setup in php.ini. When I checked the maillog file I see:
...: SYSERR(nobody): Can't create transcript file ./xfg7E9Jlr03988: Permission denied ....: SYSERR(nobody): Cannot create ./dfg7E9Jlr03988: Permission denied
Does it mean that php is trying to send mail from user nobody? How do I set up nobody as mail user? Thanks
attached mail follows:
Hi, I have a question about fgets(), it seems to pick up an extra line at the end of a text file.
example, I open a new file named "test" with the vi editor and make it 8 lines long like so (showing newlines as \n):
1\n 2\n 3\n 4\n 5\n 6\n 7\n 8\n
I create this PHP program and run it:
<?php $fd = fopen ("test","r"); while (!feof ($fd)) { $buffer = fgets($fd, 4096); echo "buffer is $buffer"; } fclose ($fd); ?>
Here is the output (showing newlines as \n):
buffer is 1\n buffer is 2\n buffer is 3\n buffer is 4\n buffer is 5\n buffer is 6\n buffer is 7\n buffer is 8\n buffer is
My question, why is there an extra line? Or in other words, how do I get this to loop exactly 8 times if there are only 8 lines?
TIA Monte
attached mail follows:
The only explaination is that 'vi' is putting an extra line in there that you're not seeing. -Kevin
----- Original Message -----
From: "Monte Ohrt" <monte
ispi.net>
To: <php-general
lists.php.net>
Sent: Wednesday, August 14, 2002 11:05 AM
Subject: [PHP] fgets question
> Hi, I have a question about fgets(), it seems to pick up an extra line > at the end of a text file. > > example, I open a new file named "test" with the vi editor and make it 8 > lines long like so (showing newlines as \n): > > 1\n > 2\n > 3\n > 4\n > 5\n > 6\n > 7\n > 8\n > > I create this PHP program and run it: > > <?php > $fd = fopen ("test","r"); > while (!feof ($fd)) { > $buffer = fgets($fd, 4096); > echo "buffer is $buffer"; > } > fclose ($fd); > ?> > > Here is the output (showing newlines as \n): > > buffer is 1\n > buffer is 2\n > buffer is 3\n > buffer is 4\n > buffer is 5\n > buffer is 6\n > buffer is 7\n > buffer is 8\n > buffer is > > > My question, why is there an extra line? Or in other words, how do I get > this to loop exactly 8 times if there are only 8 lines? > > TIA > Monte > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
attached mail follows:
That was my first thought but that wasn't it. To be sure, I urlencoded the file and looked at it:
1%0A2%0A3%0A4%0A5%0A6%0A7%0A8%0A
No extra newlines that I could see.
FYI, if you run the program from the command line, you have to pipe the output to a pager or you will not see the last (extra) line since there is no newline character.
I'm using PHP 4.2.2 on Solaris sparc.
Monte
Kevin Stone wrote:
> The only explaination is that 'vi' is putting an extra line in there that
> you're not seeing.
> -Kevin
>
> ----- Original Message -----
> From: "Monte Ohrt" <monte
ispi.net>
> To: <php-general
lists.php.net>
> Sent: Wednesday, August 14, 2002 11:05 AM
> Subject: [PHP] fgets question
>
>
>
>>Hi, I have a question about fgets(), it seems to pick up an extra line
>>at the end of a text file.
>>
>>example, I open a new file named "test" with the vi editor and make it 8
>>lines long like so (showing newlines as \n):
>>
>>1\n
>>2\n
>>3\n
>>4\n
>>5\n
>>6\n
>>7\n
>>8\n
>>
>>I create this PHP program and run it:
>>
>><?php
>>$fd = fopen ("test","r");
>>while (!feof ($fd)) {
>> $buffer = fgets($fd, 4096);
>> echo "buffer is $buffer";
>>}
>>fclose ($fd);
>>?>
>>
>>Here is the output (showing newlines as \n):
>>
>>buffer is 1\n
>>buffer is 2\n
>>buffer is 3\n
>>buffer is 4\n
>>buffer is 5\n
>>buffer is 6\n
>>buffer is 7\n
>>buffer is 8\n
>>buffer is
>>
>>
>>My question, why is there an extra line? Or in other words, how do I get
>>this to loop exactly 8 times if there are only 8 lines?
>>
>>TIA
>>Monte
>>
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
>
attached mail follows:
[snip] 1%0A2%0A3%0A4%0A5%0A6%0A7%0A8%0A No extra newlines that I could see. >> >>1\n >>2\n >>3\n >>4\n >>5\n >>6\n >>7\n >>8\n >> >>I create this PHP program and run it: >> >><?php >>$fd = fopen ("test","r"); >>while (!feof ($fd)) { >> $buffer = fgets($fd, 4096); >> echo "buffer is $buffer"; >>} >>fclose ($fd); >>?>
The only way that I can see to do this is to test the output before printing while (!feof ($fd)) { $buffer = fgets($fd, 4096); if($buffer > 0){ echo "buffer is $buffer"; } }
Or I suppose you could say if(!$buffer), will make for less code
HTH!
Jay
***********************************************************
* Texas PHP Developers Conf Spring 2003 *
* T Bar M Resort & Conference Center *
* New Braunfels, Texas *
* San Antonio Area PHP Developers Group *
* Interested? Contact jay.blanchard
niicommunications.com *
***********************************************************
attached mail follows:
Hi Monte,
> Hi, I have a question about fgets(), it seems to pick up an extra line > at the end of a text file. ... > 8\n ... > Here is the output (showing newlines as \n): > buffer is 1\n > buffer is 2\n > buffer is 3\n > buffer is 4\n > buffer is 5\n > buffer is 6\n > buffer is 7\n > buffer is 8\n > buffer is > My question, why is there an extra line? Or in other words, how do I get > this to loop exactly 8 times if there are only 8 lines?
The answer is that there isn't an 'extra' line, there are as many as you put/PHP reads! The question to ask is: how does a stream file end? Answer: with an EOF character (not an LF).
Lines in a (*nix) stream file are separated by LF or \n character, therefore there is a ninth 'line' (of absolutely nothing) between the last LF and the EOF. Take out that last \n and things should work the way you want.
Regards, =dn
attached mail follows:
I don't have the option of editing the text files to work right. I want to be able to read an arbitrary text file line by line and process each one. So I suppose I could do this (?)
<?php $fd = fopen ("test","r"); while (!feof ($fd)) { $buffer = fgets($fd, 4096); if($buffer == '') { // no \n, must be EOF break; } echo "buffer is $buffer"; } fclose ($fd); ?>
DL Neil wrote: > Hi Monte, > > >>Hi, I have a question about fgets(), it seems to pick up an extra line >>at the end of a text file. > > ... > >>8\n > > ... > >>Here is the output (showing newlines as \n): >>buffer is 1\n >>buffer is 2\n >>buffer is 3\n >>buffer is 4\n >>buffer is 5\n >>buffer is 6\n >>buffer is 7\n >>buffer is 8\n >>buffer is >>My question, why is there an extra line? Or in other words, how do I get >>this to loop exactly 8 times if there are only 8 lines? > > > > The answer is that there isn't an 'extra' line, there are as many as you > put/PHP reads! > The question to ask is: how does a stream file end? > Answer: with an EOF character (not an LF). > > Lines in a (*nix) stream file are separated by LF or \n character, therefore > there is a ninth 'line' (of absolutely nothing) between the last LF and the > EOF. Take out that last \n and things should work the way you want. > > Regards, > =dn > > >
attached mail follows:
Is there a function that can detect if anyone has closed the browser?
attached mail follows:
> Is there a function that can detect if anyone has closed > the browser?
Not in PHP. You can using JavaScript, however.
Chris
attached mail follows:
"Chris Boget" <chris
wild.net> wrote in message
news:075f01c243ba$2a9d11b0$8c01a8c0
ENTROPY...
> > Is there a function that can detect if anyone has closed
> > the browser?
>
> Not in PHP. You can using JavaScript, however.
>
> Chris
>
Thanks for the prompt response... Would this mean I would
embedd the Java Script in my php Script and alter the php
variable accordingly... Now I am aware that this is not a
JavaScript Forum and I don't want to have to subscribe to one
for one simple Q which I will probably never have use for again
but how would I detect this via Java Script and then embed change
back to php mode (if that's possible)?
Folks please non of the smart 'This is not a JavaScript group!" I am aware of that but there should be someone who knows how to use php and Java Script hand in hand... I don't want to have to convert a PHP variable to and HTML variable then to JavaScript then back to HTML then to PHP...
Thanks in advance...
attached mail follows:
> Thanks for the prompt response... Would this mean I would > embedd the Java Script in my php Script and alter the php > variable accordingly...
No, because JS is client side and PHP is server side. What you would need to do is have JS detect when the browser closed and make one last server request and whatever page you go to with that would do whatever you needed done. That means you'd have to open up another browser instance on the user's machine and that might really annoy said user.
Chris
attached mail follows:
Sorry I din't quite phrase that right... Here goes I am manipulating variables according to various user reactions... I want to be able to alter a certain variable to its default if the user decides to say, well "to hell with it" and closes his browser...
Are there any php functions that would determine if the browser on which the code is being viewed has just been closed?
Thanks in Advance...
Spike...
attached mail follows:
Is it a good idea to always use addslashes() on a value gathered from a text field or textarea? If you use addslashes() to "INSERT" the stuff into a db, should you always use stripslashes() when you "SELECT" it from the database?
tia, --ed
__________________________________________________ Do You Yahoo!? HotJobs - Search Thousands of New Jobs http://www.hotjobs.com
attached mail follows:
> -----Original Message-----
> From: ed [mailto:coo_t2
yahoo.com]
> Sent: Wednesday, August 14, 2002 1:48 PM
> To: php-general
lists.php.net
> Subject: [PHP] addslashes() and stripslashes()
>
>
> Is it a good idea to always use addslashes() on a
> value gathered from a text field or textarea?
Yes, always.
> If you use addslashes() to "INSERT" the stuff into a > db, should you always use stripslashes() when you > "SELECT" it from the database?
No, the slashes are there for so the SQL engine can separate the data from the sql statement. What's inserted or updates is the pre-addslashes value. Generally, if you don't addslashes() the sql statement won't execute.
attached mail follows:
does anybody now a way in php to read out, how many files are in a directory
attached mail follows:
Op woensdag 14 augustus 2002 20:00, schreef Harry.de: > does anybody now a way in php to read out, > how many files are in a directory
<?php // Note that !== did not exist until 4.0.0-RC2 clearstatcache(); $dir='/home/'; if ($handle = opendir($dir)) { echo "Directory handle: $handle\n"; $counter=0; while (false !== ($file = readdir($handle))) { if(is_file($dir.'/'.$file))$counter++; } }
echo $counter."\n"; ?>
attached mail follows:
I would like to know, what I have to do to make my application handle multiple connections?
My current application only handle one user per time.
Sorry about my English, but i live in Brazil, if anybody could help me
answer me gustavo
medsys.com.br .
Thanky you
attached mail follows:
Take a look at the pcntl functions. In particular the pcntl_fork() function.
On Wed, 14 Aug 2002, Gustavo Almeida wrote:
>
>
> I would like to know, what I have to do to make my application handle
> multiple connections?
>
> My current application only handle one user per time.
>
> Sorry about my English, but i live in Brazil, if anybody could help me
> answer me gustavo
medsys.com.br .
>
> Thanky you
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
Although pcntl and fork() were mentioned, you might want to look at socket_select() as an alternative. Using socket_select(), you can set up a multiplexer to handle multiple sockets at the same time. (Or roughly the same time...)
J
Gustavo Almeida wrote:
>
>
> I would like to know, what I have to do to make my application handle
> multiple connections?
>
> My current application only handle one user per time.
>
> Sorry about my English, but i live in Brazil, if anybody could help me
> answer me gustavo
medsys.com.br .
>
> Thanky you
attached mail follows:
rite,
without access to the php.ini file, how can i get php to print all errors on my web server. it runs linux
-- Regards, Georgie Casey webmasterfilmfind.tv
*************************** http://www.filmfind.tv Online Film Production Directory ***************************
attached mail follows:
start your file with : error_reporting(E_ALL);
Op woensdag 14 augustus 2002 20:09, schreef Georgie Casey:
> rite,
>
> without access to the php.ini file, how can i get php to print all errors
> on my web server. it runs linux
> --
> Regards,
> Georgie Casey
> webmaster
filmfind.tv
>
> ***************************
> http://www.filmfind.tv
> Online Film Production Directory
> ***************************
attached mail follows:
> // Note that !== did not exist until 4.0.0-RC2
I took a quick look at the docs to find out what !== meant (because I'd never seen it before). I'm not sure I understand what it's use is. Could someone explain why you would use it and for what purpose? I couldn't really infer from the example that was included in the previous message.
thnx, Chris
attached mail follows:
[snip] > // Note that !== did not exist until 4.0.0-RC2
I took a quick look at the docs to find out what !== meant (because I'd never seen it before). I'm not sure I understand what it's use is. Could someone explain why you would use it and for what purpose? [/snip]
$a !== $b Not identical TRUE if $a is not equal to $b, or they are not the same data type
$a = 2 $b = "2" If $a and $b are not the same data type they ARE NOT IDENTICAL $a is an integer, $b is a string
or
$a = 2 $b = 3
They are the same data type (integer), but they ARE NOT EQUAL
I would use strcomp() to compare strings against other strings though, since data types like this may cause problems since PHP variables are loosely typed.
HTH!
Jay
attached mail follows:
Here is an example that might help.
$a = 1;
if($a) echo '1';
if($a == true) echo '2';
if($a === true) echo '3';
The first and second conditional statements execute but the third doesn't. This is because $a evaluates to true but is not of type 'boolean'. === and !== not only compare value but type as well.
Justin Garrett
"Chris Boget" <chris
wild.net> wrote in message
news:07bb01c243c2$1b3045a0$8c01a8c0
ENTROPY...
> > // Note that !== did not exist until 4.0.0-RC2
>
> I took a quick look at the docs to find out what !== meant
> (because I'd never seen it before). I'm not sure I understand
> what it's use is. Could someone explain why you would use
> it and for what purpose?
> I couldn't really infer from the example that was included in
> the previous message.
>
> thnx,
> Chris
>
>
attached mail follows:
<? setcookie("cookie", "Job Postings Psyc... Created by Kondwani Mkandawire", time()+3600); session_start(); session_register("MySession"); $counter=0;?>
<?php
$file = fopen(basename($PHP_SELF), "r+"); if((SomeCondition is Satisfied)&&($counter < 4)){ echo '<form name="formName" action = "ThisSamePHPFile.php" method="post">';
if(empty($verif)){
Display Some message... $counter++; fputs($file, "<?\r\nsetcookie(\"cookie\", \"Created by Kondwani Mkandawire\", time()+3600);\n"); fputs($file, "session_start();\n"); fputs($file, "session_register(\"MySession\");\n"); fputs($file, "\$counter=$counter;?>\r\n");
} else{ Display SomeOther message... $counter++; fputs($file, "<?\r\nsetcookie(\"cookie\", \"Created by Kondwani Mkandawire\", time()+3600);\n"); fputs($file, "session_start();\n"); fputs($file, "session_register(\"MySession\");\n"); fputs($file, "\$counter=$counter;?>\r\n"); } } else{ reset counter to 0 destroy session... }
I want this set up such that given someone hits the close button on the browser, the counter is set to 0... Coz at the moment if someone gets fed up of trying and closes the browser, the next person has less than 4 attempts to login in... Any idea of how I can go about using this sessions idea coupled with the self modifying code to achieve this? I can't exactly stick in an: if(session_is_registered) statement, coz it appears as though the session is restarted every time the code is modified..
attached mail follows:
Hi,
I am having a problem with $_POST which I will explain below. My configuration is Redhat 7.3 Linux 2.4.18 with Apache 2.0.39, PHP 4.2.2, and MySQL 3.23.49.
I have an SQL table which was created by:
CREATE TABLE testTable (id nut null primary key aut_increment, testField varchar (75));
I have an HTML form using POST:
<!-- insert_form.html --> <HTML> <HEAD><TITLE>Insert Form</TITLE> </HEAD> <BODY> <FORM ACTION="insert.php" METHOD=POST> <P>Text to add:<br> <input type=text name=testField size=30> <p><input type=submit value="Insert Record"></p> </FORM> </BODY> </HTML>
and I have a PHP script that uses $_POST to put the value from the form into the SQL table:
<!-- insert.php --> <?
$conn = mysql_connect("localhost", "supercontact", "tical123");
mysql_select_db("contactDB", $conn);
$sql = "INSERT INTO testTable VALUES ('', '$_POST[testField]')";
echo "the value is $_POST[testField]<BR>"; echo "$sql<BR>";
if ($result = mysql_query($sql, $conn)) { echo "record added!"; } else { echo "something went wrong"; }
?>
when I open up insert_form.html in a browser and put in a value of "Testing the form" and then submitting it to insert.php, this is the result:
the value is Testing the formtestField=Testing the form INSERT INTO testTable VALUES ('', 'Testing the formtestField=Testing the form') record added!
and when I go to MySQL to see what was inserted into the table I have:
mysql> select * from testTable; +----+--------------------------------------------+ | id | testField | +----+--------------------------------------------+ | 19 | Testing the formtestField=Testing the form | +----+--------------------------------------------+ 1 row in set (0.00 sec)
Which that is not correct, it should be | 19 | Testing the Form |
If I change the method=POST to method=GET and the $_POST to $_GET and use "Testing the form" it works correctly:
the value is Testing the form INSERT INTO testTable VALUES ('', 'Testing the form') record added!
mysql> select * from testTable; +----+--------------------------------------------+ | id | testField | +----+--------------------------------------------+ | 20 | Testing the form | | 19 | Testing the formtestField=Testing the form | +----+--------------------------------------------+ 2 rows in set (0.00 sec)
Does anyone know why it is not working with $_POST but works fine with $_GET?
Thanks, Adam
attached mail follows:
Op woensdag 14 augustus 2002 20:57, schreef Adam Williams: > Does anyone know why it is not working with $_POST but works fine with > $_GET?
I don't know, but maybe you has to put "" around POST, method="POST". It works then with GET, cause that's default.
Maybe something else is wrong, so method isn't set to post. The same fault with get doesn't matter cause the default method.
You can test it. Use your post method and read out $_GET. I think you find your value.
attached mail follows:
Hello, To begin.. i'm new to the list...
I'm trying to learn good practices in OOP based PHP. I'm actually a bit new to OOP in general, but I've done quite a bit of reading and playing around with it in the past couple of months.
What I'm trying to figure out is the proper way to call a class from a class. I dont mean by extending the class, but actaully just getting the functions...
For instance...
I'm trying to connect to a Database (database class) from my gen_XML class. Do I include the database class in the gen_XML constructor? Do I set a gen_XML variable as a database object (i.e. $this->mydb)?
I hope my question makes some sense...
Your help is appreciated...
Mark Armendariz
attached mail follows:
I would suggest you write a method (called mydb() for example) that connects to your database, and if needed, call it from your constructor like: $this->mydb(); This way you can always reuse the method from other code.
hth, Steve.
-----Original Message-----
From: Mark Armendariz [mailto:PHP
enobrev.com]
Sent: Wednesday, August 14, 2002 2:44 PM
To: php-general
lists.php.net
Subject: [PHP] PHP - class question
Hello, To begin.. i'm new to the list...
I'm trying to learn good practices in OOP based PHP. I'm actually a bit new to OOP in general, but I've done quite a bit of reading and playing around with it in the past couple of months.
What I'm trying to figure out is the proper way to call a class from a class. I dont mean by extending the class, but actaully just getting the functions...
For instance...
I'm trying to connect to a Database (database class) from my gen_XML class. Do I include the database class in the gen_XML constructor? Do I set a gen_XML variable as a database object (i.e. $this->mydb)?
I hope my question makes some sense...
Your help is appreciated...
Mark Armendariz
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
If you are just trying to access a classes functions without creating an instance of it you're probably looking to use the scope resolution operator ::. For this to work all you have to do is ensure that the definition for the class you wish to use is included into the file containing the class you are trying to call the functions from.
You would then call the functions as follows:
ClassName::FunctionName();
At 02:43 PM 8/14/2002 -0400, you wrote: >Hello, To begin.. i'm new to the list... > >I'm trying to learn good practices in OOP based PHP. I'm actually a bit new >to OOP in general, but I've done quite a bit of reading and playing around >with it in the past couple of months. > >What I'm trying to figure out is the proper way to call a class from a >class. I dont mean by extending the class, but actaully just getting the >functions... > >For instance... > >I'm trying to connect to a Database (database class) from my gen_XML class. >Do I include the database class in the gen_XML constructor? Do I set a >gen_XML variable as a database object (i.e. $this->mydb)? > >I hope my question makes some sense... > >Your help is appreciated... > >Mark Armendariz > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Well, I actually have a full db class which has a connect and close method as well as query, fetch_array, etc... What I really want to know is how to use the methods in my db class from another class (myclass for example)..
Do I include the db class from the myclass constructor and then set a myclass variable = to the db object?
ie.
class my_class { var $db;
function my_class() { include('class_database.php');
$this->db = new database; }
... }
or is there a differnet or better way?
Thanks
Mark
"Steve Bradwell" <SteveB
compxnet.com> wrote in message
news:57A1618E7109D311A97D0008C7EBB3A10119EF03
KITCHENER...
> I would suggest you write a method (called mydb() for example) that
connects
> to your database, and if needed, call it from your constructor like:
> $this->mydb(); This way you can always reuse the method from other code.
>
> hth,
> Steve.
>
> -----Original Message-----
> From: Mark Armendariz [mailto:PHP
enobrev.com]
> Sent: Wednesday, August 14, 2002 2:44 PM
> To: php-general
lists.php.net
> Subject: [PHP] PHP - class question
>
>
> Hello, To begin.. i'm new to the list...
>
> I'm trying to learn good practices in OOP based PHP. I'm actually a bit
new
> to OOP in general, but I've done quite a bit of reading and playing around
> with it in the past couple of months.
>
> What I'm trying to figure out is the proper way to call a class from a
> class. I dont mean by extending the class, but actaully just getting the
> functions...
>
> For instance...
>
> I'm trying to connect to a Database (database class) from my gen_XML
class.
> Do I include the database class in the gen_XML constructor? Do I set a
> gen_XML variable as a database object (i.e. $this->mydb)?
>
> I hope my question makes some sense...
>
> Your help is appreciated...
>
> Mark Armendariz
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
That seems more like what I'm looking for..
Thank you, Nick...
Mark
"Nick Oostveen" <nicko-ml
hpmarketing.com> wrote in message
news:5.1.1.6.0.20020814121000.039d34e8
pop.hpmarketing.com...
> If you are just trying to access a classes functions without creating an
> instance of it you're probably looking to use the scope resolution
operator
> ::. For this to work all you have to do is ensure that the definition for
> the class you wish to use is included into the file containing the class
> you are trying to call the functions from.
>
> You would then call the functions as follows:
>
> ClassName::FunctionName();
>
> At 02:43 PM 8/14/2002 -0400, you wrote:
> >Hello, To begin.. i'm new to the list...
> >
> >I'm trying to learn good practices in OOP based PHP. I'm actually a bit
new
> >to OOP in general, but I've done quite a bit of reading and playing
around
> >with it in the past couple of months.
> >
> >What I'm trying to figure out is the proper way to call a class from a
> >class. I dont mean by extending the class, but actaully just getting the
> >functions...
> >
> >For instance...
> >
> >I'm trying to connect to a Database (database class) from my gen_XML
class.
> >Do I include the database class in the gen_XML constructor? Do I set a
> >gen_XML variable as a database object (i.e. $this->mydb)?
> >
> >I hope my question makes some sense...
> >
> >Your help is appreciated...
> >
> >Mark Armendariz
> >
> >
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
Do you know where I can find more info on how to use the scope resolution operator?
My searches aren't giving much (at leant not mcuh regarding php) and in the manual, it only shows up momentarily as a note in the operators section...
Mark
"Nick Oostveen" <nicko-ml
hpmarketing.com> wrote in message
news:5.1.1.6.0.20020814121000.039d34e8
pop.hpmarketing.com...
> If you are just trying to access a classes functions without creating an
> instance of it you're probably looking to use the scope resolution
operator
> ::. For this to work all you have to do is ensure that the definition for
> the class you wish to use is included into the file containing the class
> you are trying to call the functions from.
>
> You would then call the functions as follows:
>
> ClassName::FunctionName();
>
> At 02:43 PM 8/14/2002 -0400, you wrote:
> >Hello, To begin.. i'm new to the list...
> >
> >I'm trying to learn good practices in OOP based PHP. I'm actually a bit
new
> >to OOP in general, but I've done quite a bit of reading and playing
around
> >with it in the past couple of months.
> >
> >What I'm trying to figure out is the proper way to call a class from a
> >class. I dont mean by extending the class, but actaully just getting the
> >functions...
> >
> >For instance...
> >
> >I'm trying to connect to a Database (database class) from my gen_XML
class.
> >Do I include the database class in the gen_XML constructor? Do I set a
> >gen_XML variable as a database object (i.e. $this->mydb)?
> >
> >I hope my question makes some sense...
> >
> >Your help is appreciated...
> >
> >Mark Armendariz
> >
> >
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
I have a program containing an array called $thisArray. At some point in the program, the value of next($thisArray) is an array ($subArray). How can I echo the name of the of the second array (subArray)? The name of the sub array may change at any time, so I can't just hard code it.
Thanks in advance,
Brad
attached mail follows:
> How can I echo the name of the of the second array (subArray)? The name for value <?php
$test=array ( 'a'=>array('1','2'.'3'), 'c'=>array('6','5'.'4'), 'd'=>array('8','9'.'10'), );
$r=next($test); echo $r[0].' or :'."\n"; foreach (next($test) as $value) echo $value; ?>
or do you need the keys? something like: echo implode(",",array_keys(next($test)));
attached mail follows:
i got 2 problems with this code:
<?php $insideitem = false; $insidekeep = false; $insiderelic = false; $printed = false; $printedkeep = false; $tag = ""; $server = false; $da_server = ""; $da_lastguildupdate = ""; $da_lastcharupdate = ""; $da_population = ""; $da_type = ""; $da_status = ""; $da_relicorig = ""; $da_relicname = ""; $da_relictype = ""; $da_relicowner = ""; $da_keeporig = ""; $da_keepname = ""; $da_keepowner = ""; $da_keepclaimant = "";
function startElement($parser, $tagName, $attrs) { global $insideitem, $insidekeep, $insiderelic, $tag, $da_server, $da_type, $da_lastguildupdate, $da_lastcharupdate, $server, $da_relictype, $da_relicname, $da_relicorig, $da_keepname, $da_keeporig;
if ($insideitem || $insiderelic || $insidekeep) { $tag = $tagName; }
elseif ($tagName == "SERVER") { $insideitem = true;
// PROBLEM 1, LOOK BELOW FOR DESCRIPTION! while (list ($key, $val) = each ($attrs)) { if ($key == "NAME" && $val == "Guinevere") { $server = true; $da_server = $val; print "Sant, $key - $val"; } else { $server = false; } } // end WHILE // ENDS HERE!!!
if ($server) { while (list ($key, $val) = each ($attrs)) { switch($key) { case "TYPE" : $da_type = $val; break; case "LASTGUILDUPDATE" : $da_lastguildupdate = $val; break; case "LASTCHARUPDATE" : $da_lastcharupdate = $val; break; } } // end WHILE } }
// PROBLEM 2,, LOOK BELOW FOR DESCRIPTION! elseif ($tagName == "RELIC" && $server) { $insiderelic = true; while (list ($key, $val) = each ($attrs)) { if ($key == "TYPE") { $da_relictype = $val; } if ($key == "NAME") { $da_relicname = $val; } if ($key == "REALM") { $da_relicorig = $val; } } // End While } // ENDS HERE!!!
elseif ($tagName == "KEEP" && $server) { $insidekeep = true; while (list ($key, $val) = each ($attrs)) { if ($key == "NAME") { $da_keepname = $val; } if ($key == "REALM") { $da_keeporig = $val; } } // End While } }
function characterData($parser, $data) { global $insideitem, $insidekeep, $insiderelic, $tag, $da_population, $da_status, $da_relicowner, $da_keepowner, $da_keepclaimant; if ($insideitem) { switch ($tag) { case "POPULATION": $da_population .= $data; break; case "STATUS": $da_status .= $data; break; } } if ($insiderelic) { $da_relicowner .= $data; } if ($insidekeep) { switch ($tag) { case "OWNER" : $da_keepowner .= $data; break; case "CLAIMANT" : $da_keepclaimant .= $data; break; } } }
function endElement($parser, $tagName) { global $insideitem, $insidekeep, $insiderelic, $tag, $da_server, $da_population, $da_type, $da_status, $da_lastguildupdate, $da_lastcharupdate, $da_relicname, $da_relicowner, $da_relicorig, $da_relictype, $printed, $printedkeep, $da_keeporig, $da_keepname, $da_keepowner, $da_keepclaimant; if ($tagName == "SERVER" && $server == true) { print "<TR><TD><b>Server</b></TD><TD><b>Status</b></TD><TD><b>Population</b></TD>< /TR>\n"; print "<TR><TD>$da_server"; if ($da_type) { print "(<i>$da_type</i>)"; } print "</TD>"; print "<TD>$da_status</TD>"; print "<TD>$da_population</TD></TR>\n"; print "<TR><TD></TD></TR>\n"; print "<TR><TD><b>Lastguildupdate</b></TD><TD><b>Lastcharupdate</b></TD><TD></TD>< /TR>\n"; print "<TR><TD>$da_lastguildupdate</TD><TD>$da_lastcharupdate</TD></TR>\n"; } elseif ($tagName == "RELIC" && $server == true) { if (!$printed) { print "<TR><TD></TD></TR>\n"; print "<TR><TD><b>Relic Name</b></TD><TD><b>Relic Owner</b></TD><TD><b>Relic Type</b></TD></TR>\n"; $printed = true; } print "<TR><TD>"; if ($da_relicorig == "Albion") { print "<font color=\#ff0000>$da_relicname</font>"; } elseif ($da_relicorig == "Midgard") { print "<font color=\#0000ff>$da_relicname</font>"; } else { print "<font color=\#00ff00>$da_relicname</font>"; } print "</TD><TD>"; if ($da_relicowner == "Albion") { print "<font color=\#ff0000>$da_relicowner</font>"; } elseif ($da_relicowner == "Midgard") { print "<font color=\#0000ff>$da_relicowner</font>"; } else { print "<font color=\#00ff00>$da_relicowner</font>"; } print "</TD><TD>$da_relictype</TD></TR>\n"; } elseif ($tagName == "KEEP" && $server == true) { if (!$printedkeep) { print "<TR><TD></TD></TR>\n"; print "<TR><TD><b>Keep Name</b></TD><TD><b>Keep Owner</b></TD><TD><b>Claimant</b></TD></TR>\n"; $printedkeep = true; } print "<TR><TD>"; if ($da_keeporig == "Albion") { print "<font color=\#ff0000>$da_keepname</font>"; } elseif ($da_keeporig == "Midgard") { print "<font color=\#0000ff>$da_keepname</font>"; } else { print "<font color=\#00ff00>$da_keepname</font>"; } print "</TD><TD>"; if ($da_keepowner == "Albion") { print "<font color=\#ff0000>$da_keepowner</font>"; } elseif ($da_keepowner == "Midgard") { print "<font color=\#0000ff>$da_keepowner</font>"; } else { print "<font color=\#00ff00>$da_keepowner</font>"; } print "</TD><TD>$da_keepclaimant</TD></TR>\n"; }
$da_server = ""; $da_lastguildupdate = ""; $da_lastcharupdate = ""; $da_population = ""; $da_type = ""; $da_status = ""; $da_relicorig = ""; $da_relicname = ""; $da_relictype = ""; $da_relicowner = ""; $da_keeporig = ""; $da_keepname = ""; $da_keepowner = ""; $da_keepclaimant = ""; $insideitem = false; $insiderelic = false; $insidekeep = false; }
// gotta have this for the php-NUKE block stuff to work global $da_totalpop;
// Create an XML parser $xml_parser = xml_parser_create();
// Set the functions to handle opening and closing tags xml_set_element_handler($xml_parser, "startElement", "endElement");
// Set the function to handle blocks of character data xml_set_character_data_handler($xml_parser, "characterData");
// print "<hr>\n"; print "<TABLE BORDER=0 WIDTH=0%>\n"; print "<TR>Guild: Obliteration/Midgard</TD></TR>\n\n";
// Open the XML file for reading $fp = fopen("http://www.camelotherald.com/xml/servers.xml","r") or die("Error reading RSS data.");
// Read the XML file 4KB at a time while ($data = fread($fp, 4096)) // Parse each 4KB chunk with the XML parser created above xml_parse($xml_parser, $data, feof($fp)) or die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); // Close the XML filef fclose($fp);
print "</TABLE>\n";
// Free up memory used by the XML parser xml_parser_free($xml_parser);
?>
this code is suppose to take SOME information from http://www.camelotherald.com/xml/servers.xml and print it out as HTML-text...
'********************************************************'' problem 1: while (list ($key, $val) = each ($attrs)) { if ($key == "NAME" && $val == "Guinevere") { $server = true; $da_server = $val; } else { $server = false; } } // end WHILE
i am trying to find a way to only retrive the information in <server name="Guinevere" type="Roleplay" lastguildupdate="2002-08-14 12:40:11" lastcharupdate="2002-08-13 05:54:27"> // copied from the url above
</server> there is alot of servers and i only need to retrive the information from this server. So i am trying to see if this is the server and if it is the server the flag, $server will be true,, but i dunno if it works as it should... ?
'********************************************************' problem 2: this is alittle bit of the xml code: - <server name="Guinevere" type="Roleplay" lastguildupdate="2002-08-14 12:40:11" lastcharupdate="2002-08-13 05:54:27"> <population>1002</population> <status>Up</status> - <relic name="Scabbard of Excalibur" type="Melee" realm="Albion"> <owner>Midgard</owner> </relic> - <relic name="Merlin's Staff" type="Magic" realm="Albion"> <owner>Hibernia</owner> </relic> - <relic name="Thor's Hammer" type="Melee" realm="Midgard"> <owner>Midgard</owner> </relic> - <relic name="Horn of Valhalla" type="Magic" realm="Midgard"> <owner>Hibernia</owner> </relic> - <relic name="Lug's Spear of Lightning" type="Melee" realm="Hibernia"> <owner>Midgard</owner> </relic> - <relic name="Cauldron of Dagda" type="Magic" realm="Hibernia"> <owner>Hibernia</owner> </relic>
i want to get the information about the relics, but that dosent work with this code: elseif ($tagName == "RELIC" && $server) { $insiderelic = true; while (list ($key, $val) = each ($attrs)) { if ($key == "TYPE") { $da_relictype = $val; } if ($key == "NAME") { $da_relicname = $val; } if ($key == "REALM") { $da_relicorig = $val; } } // End While }
any ideas of how to solve this?? '**************************************************************'
any help would be appresiated!
regards patrick
attached mail follows:
may i use php with JAVA (note. not JAVASCRIPT , but JAVA APPLETS) !?! any helps !? thx
xanda
attached mail follows:
Alexandra Aguiar wrote:
> may i use php with JAVA (note. not JAVASCRIPT , but JAVA APPLETS) !?!
Depends on what you want to achieve. As long as the final <embed> is correct (i.e. the one that is sent to the client, after php-parsing), no problem at all.
-- Kind regards, Tim
attached mail follows:
hi,
after submit i use:
if (isset($submit)) header ("Location: url?".sid);
i want continue my session in next page, but SID (my session's unique id) is lost in nex page, so i can't. What's wrong ? Any ideas ?
apollo, just me
attached mail follows:
I think you'll need to use header ("Location: url?".print SID);
Adam
On Wed, 14 Aug 2002, apollo wrote:
> hi, > > after submit i use: > > if (isset($submit)) > header ("Location: url?".sid); > > i want continue my session in next page, but SID (my session's unique id) is > lost in nex page, so i can't. What's wrong ? Any ideas ? > > apollo, just me > > > >
attached mail follows:
Wondering if any of the gurus out there have any insight...
I'm running a set of php scripts using nested output buffering + sessions and I'm getting sporadic seg faults. If I turn off output buffering it seems to work fine, which would be great if I didn't need it.
I'd post code, but there's a lot of it... I'm gonna see if I can pare it down to a simple test case.
I saw a very similar situation to this on the CURL mailing list back in April. Here's the link to that thread:
http://curl.haxx.se/mail/archive-2002-04/0042.html
Anybody run into this issue before, and have a thought or two?
attached mail follows:
What is wrong with the statement below? Am I using DEFAULT incorrectly? That first column is an auto_incrementing column so i don't want any data to get inserted there. Thanks for you help.
INSERT INTO cast VALUES(DEFAULT, 'Rick', 'Blaine', 'Humphrey', 'Bogart', 'male');
Thanks! Alex
attached mail follows:
U must write:
mysql_query(INSERT INTO cast SET Rick='$Rick', Blaine='$Blaine', Humphrey='$Humphrey', Bogart='$Bogart', male='$male');
The stuff with the $ before them are variable that contain the info u want to put into the word that don't have the $ those words are the cells in your database.
I don't know about the DEFAULT thing or the VALUES thing.
- Vic
-----Original Message-----
From: Alexander Ross [mailto:alexross
bleen.net]
Sent: Wednesday, August 14, 2002 4:50 PM
To: php-general
lists.php.net
Subject: [PHP] mysql statement (still a semi newbie)
What is wrong with the statement below? Am I using DEFAULT incorrectly? That first column is an auto_incrementing column so i don't want any data to get inserted there. Thanks for you help.
INSERT INTO cast VALUES(DEFAULT, 'Rick', 'Blaine', 'Humphrey', 'Bogart', 'male');
Thanks! Alex
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php______________________________________________________________________ Post your ad for free now! http://personals.yahoo.ca
attached mail follows:
Alexander Ross wrote:
> That first column is an auto_incrementing column so i don't want any data > INSERT INTO cast VALUES(DEFAULT, 'Rick', 'Blaine', 'Humphrey', 'Bogart', > 'male');
I think you need to use NULL instead of DEFAULT... I'm not 100% sure. Just try it :)
-- Kind regards, Tim
attached mail follows:
Tim's right about NULL. You can either specify what exactly are the fields of the row you want to update/insert using SET before VALUE (seek the manual at www.mysql.com for more info) or you can just write NULL (without any quotes) where the fields are automatic like *auto_increment* or like *timestamp*. I would suggest that you read more about syntax before you go on, and to place this kind of questions to the PHP Database list to get proper help. It is also a good idea for you to subscribe to the MySQL lists which are very crowded with MySQL gurus.
HTH, C.
> -----Original Message-----
> From: Tim Stoop [mailto:tim
cidev.nl]
> Sent: Wednesday, August 14, 2002 6:00 PM
> To: php-general
lists.php.net
> Subject: [PHP] Re: mysql statement (still a semi newbie)
>
> Alexander Ross wrote:
>
> > That first column is an auto_incrementing column so i don't want any
> data
> > INSERT INTO cast VALUES(DEFAULT, 'Rick', 'Blaine', 'Humphrey',
'Bogart',
> > 'male');
>
> I think you need to use NULL instead of DEFAULT... I'm not 100% sure.
Just
> try it