[PHP] Re: searching date
[EMAIL PROTECTED] wrote: Hi , The user have to choose 2 date ($date_begin $date_last) and i want to know howcan i make to find field in mysql where field included between ($date_begin $date_last) SELECT * FROM `news` WHERE `date` included in ($date_begin $date_last) $q=mysql_query('select * from news where `date` = '.$date_begin.' and `date` '.$date_last.' + interval 1 day'); you should rename the field you have called `date` - it's ambiguous. Kae -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 15 Aug 2003 06:16:45 -0000 Issue 2237
php-general Digest 15 Aug 2003 06:16:45 - Issue 2237 Topics (messages 159608 through 159642): Re: project management php system 159608 by: Michael A Smith Re: email confirmation script 159609 by: Anthony Ritter 159626 by: Anthony Ritter 159638 by: olinux Newbie Session Question 159610 by: Tim Winters 159611 by: CPT John W. Holmes 159614 by: Analysis Solutions 159615 by: Tim Winters LAMP I need a good tutorial on how to install and configure GD2 159612 by: Matt Babineau Templates, custom functions, mysql 159613 by: Tyler Longren searching date 159616 by: bl1412.hotpop 159617 by: Jay Blanchard 159642 by: Kae Verens Category and sub-category logic 159618 by: Ryan A 159619 by: Chris W. Parker 159620 by: David Otton 159621 by: Chris W. Parker Generate Dates 159622 by: Ralph Guzman 159624 by: CPT John W. Holmes ldap_list + Novell eDirectory 159623 by: Daniel Bray Image with graduated fill using PHP 159625 by: Adrian Re: php.ini configuration can we have two include_path in php.in file 159627 by: Justin French host name 159628 by: viraj.ceynet.net 159631 by: Mike Migurski 159632 by: Justin French mail error 159629 by: merryE 159635 by: Jackson Miller configure smtp in php.ini 159630 by: merryE configure smtp error 159633 by: merryE 159636 by: Jackson Miller How can I load load Additional extensions ? 159634 by: Dennis Lee 159637 by: Leif K-Brooks 159639 by: Dennis Lee 159641 by: Dennis Lee How to Select 159640 by: John Taylor-Johnston Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- I've developed PrattCMS... (Try out the latest RC, it's quite stable and note that 2.0 will be out later today or tomorrow depending...). It's: -GPL'ed -PHP/MySQL (Could support other databases, with small amount of work.) -Has an error reporting class to send notes when a db query fails (by e-mail). -Has an in-line WYSIWYG editor that runs in IE 5.5+ and Mozilla 1.3+. -Has a _really_ easy way to install/switch templates. -Uses .xml files that exist inside the right directory to get information about each template. -Creating a new template is easy... just look at the four provided, use smarty templates, and look at and *.xml file in the templates/ directory. -Switching templates is as easy as clicking 1 button. -Has customizable style-sheet values. -Works fine with web spiders (uses ?id=num to get different files). -Doesn't require register_globals (never tested with register_globals on... ought to work though). -Has user groups so that only certain users are allowed to create new users/edit site-wide configuration/change templates and you can even restrict which pages they are allowed to modify as well as whether they are allowed to create new pages or not. -Has a front-page module so you can have an entry page (you can disable by emptying the modules table, but then you'll have to make a simple modification so that your home page will exist... you can ask me later if you want) -You can backup all your information (pages, database configuration, downloads you've uploaded, images you've uploaded... requires --with-zlib) -Has stats: Number of visitors, Country graph of where you're users come from, Browser detection, Most visited pages, Where the users came from, Graph of Hourly visits (does _not_ require GD). -Has a SELECT only Database viewer that runs in PEAR::DB (just like the rest of the CMS). It shouldn't be too hard to customize if you need to. You can create new templates/etc., obviously for yourself. Webpage: http://prattcms.sourceforge.net/ (You can try it out by visiting: http://opensourcecms.com/ and clicking the PrattCMS link on the left hand side.) HTH! -Michael [EMAIL PROTECTED] wrote: Hi guys ok i am doing it now, but i'm not asking for you to code something for me, i'm looking for a classy project management system possibly in an open source format in PHP and Mysql. I was wondering who has implemented such a system they could recommend, i am investigation to look into customising an already developed system or we have to develop one from scratch to suit our needs. Let me know. Thanks Dan ---End Message--- ---BeginMessage--- Thanks Jackson. I appreciate the assistance. Am I on the right track? Best... TR .. // this is the form html body form action=post method=process.php p Your e-mail address:br input type=text name=namebr input type=text name=emailbr input type=submit name=submit value=submit /body /form /html
Re: [PHP] Re: How can I load load Additional extensions ?
Dennis Lee wrote: Why it is wrong when I run php as module under apache 2.0.46 ? PHP and Apache 2 are currently unstable together. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: LAMP I need a good tutorial on how to install and configureGD2
Matt Babineau wrote: Anyone have a good place to help with this... Google was seeming a bit light on good help. I tried to get it going but there seemed to be some dependant libraries tha tI could not build myself, they were erroring out..blah blah. Is there any easier way to do this? Thanks, Matt try rpm, or even better, apt-get (http://apt-rpm.tuxfamily.org, I think) - simply install, and type apt-get update apt-get install gd2 Kae -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] If you ever had a Vic20
Ok ... so I can do it this way (below), but there must be a more intelligent way? This is like something I did with my Vic20, 19 years ago. (If you ever had a Vic20 ... :) you might sympathise) while ($mydata = mysql_fetch_object($news)) { if ($mydata-StudentId = $StudentId) {$found =1}else{$found=0} } if ($found==1){do this}else{do that} $myconnection = mysql_connect($server,$user,$pass); mysql_select_db($db,$myconnection); $news = mysql_query(select StudentId FROM $table); while ($mydata = mysql_fetch_object($news)) { } if exists {do this}else{do that} -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] If you ever had a Vic20
What about (just a slight change...)? $found = 0; while ($mydata = mysql_fetch_object($news)) { if ($mydata-StudentId == $StudentId) {$found = 1; break;} } if ($found==1){do this}else{do that} at least this way you don't need to go through all the other records if it's found near the start... [OT] - Vic-20 - hmmm, them were the days... Martin -Original Message- From: John Taylor-Johnston [mailto:[EMAIL PROTECTED] Sent: Friday, 15 August 2003 4:52 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] If you ever had a Vic20 Ok ... so I can do it this way (below), but there must be a more intelligent way? This is like something I did with my Vic20, 19 years ago. (If you ever had a Vic20 ... :) you might sympathise) while ($mydata = mysql_fetch_object($news)) { if ($mydata-StudentId = $StudentId) {$found =1}else{$found=0} } if ($found==1){do this}else{do that} $myconnection = mysql_connect($server,$user,$pass); mysql_select_db($db,$myconnection); $news = mysql_query(select StudentId FROM $table); while ($mydata = mysql_fetch_object($news)) { } if exists {do this}else{do that} -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] host name
echo $HTTP_HOST; did the job perfectly thanks Justin Viraj Quoting Justin French [EMAIL PROTECTED]: pre ?print_r($_SERVER);? /pre Have a look at the output, find the variable you need, then manipulate it if needed. Justin French On Friday, August 15, 2003, at 01:32 PM, [EMAIL PROTECTED] wrote: Hi all, I want to get the current domain name in to a PHP variable. This is the case.. I have a web site and four diferent domian names pointing to that site. I want to redirect users from the four domains to their specific home pages. eg: if a visitor from http://domain1.com the header should be passed to domain1.php, if the visitor from http://domain2.com the header hould be pass to domain2.php. thanks Viraj -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- [This E-mail scanned for viruses] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php, search engine that index via local filesystem?
Do you know any? --- - Thanks, Louie Miranda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] LAST DAY OF MONTH
How can I get the last day for the current month? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php, search engine that index via local filesystem?
Hi, Do you want to provide a web interface to your local file system? well the easiest would then be to just exec locate, which will make use of the slocate db. Alternatively you can try to exec find. These can be done painlessly and you don't have to install any software. If you need a more sophisticated solution i belive htdig has the facility to index from local files. If you are looking to build a full fledged search engine aspseek and mnogosearch (both open source) are some of the best around. all the best Louie Miranda wrote: Do you know any? --- - Thanks, Louie Miranda -- Raditha Dissanayake - http://www.radinks.com/sftp/ Lean and mean Secure FTP applet with Graphical User Inteface. just 150 Kilo Bytes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php, search engine that index via local filesystem?
Might want to take a look at: http://www.htdig.org/ Using the PHP wrapper class: http://sourceforge.net/projects/htphp/ -Original Message- From: Louie Miranda [mailto:[EMAIL PROTECTED] Sent: Friday, August 15, 2003 12:42 AM To: [EMAIL PROTECTED] Subject: [PHP] php, search engine that index via local filesystem? Do you know any? --- - Thanks, Louie Miranda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Turck MMCache Feedback, Please
Hi, I am going to use Turck MMCache with Encoder. Anyone on the list have used it on Linux, MacOS X, Windows? Any caveats and/or side effect? Your feedback will be greatly appreciated. Thanks in advance. * * Best Regards --- Andrei Verovski * * Personal Home Page * http://snow.prohosting.com/guru4mac * Mac, Linux, DTP, Development, IT WEB Site * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] LAST DAY OF MONTH
? print date(t) ? rgds. Quoting Ralph Guzman [EMAIL PROTECTED]: How can I get the last day for the current month? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Sign Up for free Email at http://ureg.home.net.my/ --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] LAST DAY OF MONTH
wow. I missed that one in the manual. I guess it's time for me to call it a night. Thanks. -Original Message- From: Sn!per [mailto:[EMAIL PROTECTED] Sent: Friday, August 15, 2003 1:21 AM To: Ralph Guzman Cc: PHP General Mailing List Subject: Re: [PHP] LAST DAY OF MONTH ? print date(t) ? rgds. Quoting Ralph Guzman [EMAIL PROTECTED]: How can I get the last day for the current month? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Sign Up for free Email at http://ureg.home.net.my/ --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] LAST DAY OF MONTH
I just noticed, this will give me total days for current month. But let's say I want to look up the total days for another month? -Original Message- From: Sn!per [mailto:[EMAIL PROTECTED] Sent: Friday, August 15, 2003 1:21 AM To: Ralph Guzman Cc: PHP General Mailing List Subject: Re: [PHP] LAST DAY OF MONTH ? print date(t) ? rgds. Quoting Ralph Guzman [EMAIL PROTECTED]: How can I get the last day for the current month? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Sign Up for free Email at http://ureg.home.net.my/ --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Directory Size
Greetings learned PHP(eople); Is there a way to calculate the size of directory in PHP ? I searched php.net and only found ways of opening directories and reading file sizes One suggestion on there was to do the following : $mstrng = shell_exec('du -sc /backup/'); echo 'pre' . $mstrng . 'pre'; When I do that my browser hangs endlesslymind you, it also hangs when I run du -sc from the command line... Any pointers muchly appreciated... -- Chris Blake Office : (011) 782-0840 Cell : 083 985 0379 Anger kills as surely as the other vices. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to Select
John Taylor-Johnston wrote: Ok, this is a basic MySQL question, but I don't know how to code it in PHP. I want to check in StudentId. If it exists, ... Anyone good humoured who would help me fill in the blank. Like I should know this, but haven't even thought of coding SQL in a while :) $myconnection = mysql_connect($server,$user,$pass); mysql_select_db($db,$myconnection); $news = mysql_query(select StudentId $table); while ($mydata = mysql_fetch_object($news)) { } if exists {do this}else{do that} if(mysql_num_rows(mysql_query('select * from '.$table.' where StudentId='.$studentid.'')){ // do this }else{ // do that } Kae -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] LAST DAY OF MONTH
play with mktime to get the months that you want. the code snippet below is for July 2003: --- start code --- ? $xMonths = mktime (0,0,0, date(m)-1,1,date(Y)); print total days in .date(M,$xMonths). = .date(t,$xMonths).BR; print and that WAS on .date(D,$xMonths); ? --- end code --- rgds. Quoting Ralph Guzman [EMAIL PROTECTED]: wow. I missed that one in the manual. I guess it's time for me to call it a night. Thanks. -Original Message- From: Sn!per [mailto:[EMAIL PROTECTED] Sent: Friday, August 15, 2003 1:21 AM To: Ralph Guzman Cc: PHP General Mailing List Subject: Re: [PHP] LAST DAY OF MONTH ? print date(t) ? rgds. Quoting Ralph Guzman [EMAIL PROTECTED]: How can I get the last day for the current month? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Sign Up for free Email at http://ureg.home.net.my/ --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Sign Up for free Email at http://ureg.home.net.my/ --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] saving mail attachment to another server
i am using Horde's IMP. i am playing with the idea of saving mail attachment(s) into another server. the mail server is like mail.example.com on server-A and the 2nd server is like photos.example.com on server-B. is this _normally_ done with cURL and/or snoopy ? appreciate some guidelines. rgds. --- Sign Up for free Email at http://ureg.home.net.my/ --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] LAST DAY OF MONTH
I *think* if you feed it the unix timestamp for the 1st day of the month, it will give you the last day, *untested* though. ? $firstDay = strtotime('2003-05-01'); $lastDay = date('t',$firstDay); ? Justin On Friday, August 15, 2003, at 06:40 PM, Ralph Guzman wrote: I just noticed, this will give me total days for current month. But let's say I want to look up the total days for another month? -Original Message- From: Sn!per [mailto:[EMAIL PROTECTED] Sent: Friday, August 15, 2003 1:21 AM To: Ralph Guzman Cc: PHP General Mailing List Subject: Re: [PHP] LAST DAY OF MONTH ? print date(t) ? rgds. Quoting Ralph Guzman [EMAIL PROTECTED]: How can I get the last day for the current month? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Sign Up for free Email at http://ureg.home.net.my/ --- -- 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 --- [This E-mail scanned for viruses] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] images with gd for printing?
Hi there, I want to create images with GD and freetype ttf which are good enough for printing .. about 150 dpi. Does anybody know how to output the jpg with a higher resolution and a determined output size? Thanx in advance, merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to get data from database with a click
Dear Friends, When we click a combo box, in a perticular file, the output from the database should display in the same screen, in a text box or a combo box (We want this to happen without pressing the submit button). Any clue please Subodh -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, August 15, 2003 1:27 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] php, search engine that index via local filesystem? Hi, Do you want to provide a web interface to your local file system? well the easiest would then be to just exec locate, which will make use of the slocate db. Alternatively you can try to exec find. These can be done painlessly and you don't have to install any software. If you need a more sophisticated solution i belive htdig has the facility to index from local files. If you are looking to build a full fledged search engine aspseek and mnogosearch (both open source) are some of the best around. all the best Louie Miranda wrote: Do you know any? --- - Thanks, Louie Miranda -- Raditha Dissanayake - http://www.radinks.com/sftp/ Lean and mean Secure FTP applet with Graphical User Inteface. just 150 Kilo Bytes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Directory Size
Are you sure it hangs? It might take a long time to get occupied size. This also depends on the filesystem used, I heard reserfs is best at this. Chris Blake wrote: Greetings learned PHP(eople); Is there a way to calculate the size of directory in PHP ? I searched php.net and only found ways of opening directories and reading file sizes One suggestion on there was to do the following : $mstrng = shell_exec('du -sc /backup/'); echo 'pre' . $mstrng . 'pre'; When I do that my browser hangs endlesslymind you, it also hangs when I run du -sc from the command line... Any pointers muchly appreciated... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to Select
$news = mysql_query(select StudentId FROM $table); if($mydata=mysql_fetch_object($news)) { //got it } else { // no such StudentId } John Taylor-Johnston wrote: Ok, this is a basic MySQL question, but I don't know how to code it in PHP. I want to check in StudentId. If it exists, ... Anyone good humoured who would help me fill in the blank. Like I should know this, but haven't even thought of coding SQL in a while :) $myconnection = mysql_connect($server,$user,$pass); mysql_select_db($db,$myconnection); $news = mysql_query(select StudentId $table); while ($mydata = mysql_fetch_object($news)) { } if exists {do this}else{do that} -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Directory Size
On Fri, 2003-08-15 at 12:36, Marek Kilimajer wrote: Are you sure it hangs? It might take a long time to get occupied size. This also depends on the filesystem used, I heard reserfs is best at this. Well, I thought it was hanging cuz 15 mins went past without any return...then I figured it had something to do with the fact that its reading 20Gb of directories and files... I`m busy investigating some other options : `du $file -c` seems to workI`ll try playing around a bit and will report back later... I`m not sure what you mean re the filsystem type, I`m using MDK, which I understand uses ext3 (newbie) Thanks for trying to assist... -- Chris Blake Office : (011) 782-0840 Cell : 083 985 0379 If we men married the women we deserved, we should have a very bad time of it. -- Oscar Wilde -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] regex problem
Hi there, I have a regex problem. Basicly I do not want to match: /dir/test/contact.html But I do want to match: /test/contact.html I tryed this one: ^[!dir]/(.*)/contact(.*).html$ but it does not work and I tryed thousands of other ways plus read tutorials. Can anybody please help? Thanx in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] If you ever had a Vic20
[snip] $found = 0; while ($mydata = mysql_fetch_object($news)) { if ($mydata-StudentId == $StudentId) {$found = 1; break;} } if ($found==1){do this}else{do that} [/snip] Why two if's? Isn't if the student is found in the first if, don't you want to do stuff then? Just curious... I had a Vic20 sitting next to a Lisa... :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: regex problem
Merlin wrote: Hi there, I have a regex problem. Basicly I do not want to match: /dir/test/contact.html But I do want to match: /test/contact.html I tryed this one: ^[!dir]/(.*)/contact(.*).html$ but it does not work and I tryed thousands of other ways plus read tutorials. Can anybody please help? ^\/test\/contact.html$ Kae -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: images with gd for printing?
Merlin wrote: Hi there, I want to create images with GD and freetype ttf which are good enough for printing .. about 150 dpi. Does anybody know how to output the jpg with a higher resolution and a determined output size? Thanx in advance, merlin output an image with dimensions, say, 320x200, but in the HTML, write it as img src=image.php width=160 height=100 alt=an image / Kae -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How to get data from database with a click
[snip] When we click a combo box, in a perticular file, the output from the database should display in the same screen, in a text box or a combo box (We want this to happen without pressing the submit button). Any clue please [/snip] You appear to be looking for something called Javascript. PHP is server-side and will have to be called with some form of submit. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: regex problem
^\/test\/contact.html$ does not work. I am sorry, I just found that it has to be: test/contact.html and not dir/test/contact.html there is no leading slash. Do you have any other suggestion? -- lt;IFRAME SRC=http://saratoga.globosapiens/associates/report_member.php?u=3color=EEE EEE scrolling=no frameborder=0 TITLE=My travel articles width=330 height=155 ALLOWTRANSPARENCY=truea href=http://www.globosapiens.net; title=Worldwide Travel CommunityaTravel Communitya/ /IFRAME Kae Verens [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Merlin wrote: Hi there, I have a regex problem. Basicly I do not want to match: /dir/test/contact.html But I do want to match: /test/contact.html I tryed this one: ^[!dir]/(.*)/contact(.*).html$ but it does not work and I tryed thousands of other ways plus read tutorials. Can anybody please help? ^\/test\/contact.html$ Kae -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] logging data to xml
Hi there. I have been trying to log some data to an xml file. Whta my problem is now is that the /root tag needs to be either replaced (overwritten) or i need to get the data in before EOF-1. I have spend some time on the manual, but could not find out hoe exactly i should get the last row and then move one up again to log the stuff to the file. Well ... this is my idea anyway. If anyone can suggest to me (point me) to another solution i will certainly investigate this. NB: i am not looking for some code, just let me know where i can find the right answers. Thomas -- COMPUTERBILD 15/03: Premium-e-mail-Dienste im Test -- 1. GMX TopMail - Platz 1 und Testsieger! 2. GMX ProMail - Platz 2 und Preis-Qualitätssieger! 3. Arcor - 4. web.de - 5. T-Online - 6. freenet.de - 7. daybyday - 8. e-Post -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: regex problem
Merlin wrote: ^\/test\/contact.html$ does not work. I am sorry, I just found that it has to be: test/contact.html and not dir/test/contact.html there is no leading slash. Do you have any other suggestion? Are you making this too hard? if($string = 'test/contact.html') { echo 'good'; } else { echo 'bad'; } ?? -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ PHP|Architect: A magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] If you ever had a Vic20
Hi, $found =3D 0; while ($mydata =3D mysql_fetch_object($news)) { if ($mydata-StudentId =3D=3D $StudentId) {$found =3D 1; break;} } if ($found=3D=3D1){do this}else{do that} Why not re-oganise your SQL statement so it only returns the required data ?. select * from table where StudentID = $StudentID; if (mysql_num_rows() == 1) do this; else do that; Vic 20's were for wimps ;-) TTFN Dave mail/php/2003-08-15.tx [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] ++ | Dave Restall, IIRC Limited, PO Box 46, Skelton, Cleveland, TS12 2GT. | | Tel. +44 (0) 1287 639309 Mob. +44 (0) 7973 831245 Fax. +44 (0) 1287 635955 | | email : [EMAIL PROTECTED] [EMAIL PROTECTED] Web : http://www.iirc.net | ++ | I owe the public nothing. | | -- J.P. Morgan | ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] logging data to xml
[snip] I have been trying to log some data to an xml file. Whta my problem is now is that the /root tag needs to be either replaced (overwritten) or i need to get the data in before EOF-1. I have spend some time on the manual, but could not find out hoe exactly i should get the last row and then move one up again to log the stuff to the file. [/snip] A couple of things occured to me, but I am not sure that they're desirable... With /root being the last tag (does it occupy its own line?) you could (pseudo-code, not tested and certain to be incomplete)... while(!feof($theXMLLogFile)){ $theXMLLine = fgets($theXMLLogFile, 255); if($theXMLLine == /root){ $theNewLogLine = stuff you need to write \n /root; ereg_replace(/root, $theNewLogLine, $theXMLLogFile); } } Now, makes you read the file all the way through each time, but you could open the file for appending, (fopen with a+) which places the file pointer at the EOL. You can test this last line pointer to make sure it is /root and do the replace... HTH! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Graduated fills using PHP Images
Hi all! Is it possible to have PHP creates an image that graduates 1 color to another, such as create and images 100 pixels wide and in height which fades red to green top to bottom? Any help or suggestions would be really helpful. Thanks Adrian [EMAIL PROTECTED]
RE: [PHP] Graduated fills using PHP Images
[snip] Is it possible to have PHP creates an image that graduates 1 color to another, such as create and images 100 pixels wide and in height which fades red to green top to bottom? [/snip] http://us3.php.net/image You could set the color index and the loop through (while incrementing) each new index. Seems awfully intensive though. I know that jpgraph (http://www.aditus.nu/jpgraph/) can use gradiated backgrounds for some of its output...perhaps you could look at the code included with the class HTH! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: regex problem
Merlin wrote: ^\/test\/contact.html$ does not work. I am sorry, I just found that it has to be: test/contact.html and not dir/test/contact.html there is no leading slash. Do you have any other suggestion? *sigh* ^test\/contact.html$ Kae -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: regex problem
John W. Holmes wrote: Merlin wrote: ^\/test\/contact.html$ does not work. I am sorry, I just found that it has to be: test/contact.html and not dir/test/contact.html there is no leading slash. Do you have any other suggestion? Are you making this too hard? if($string = 'test/contact.html') That's if($string == 'test/contact.html') of course... :) ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ PHP|Architect: A magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: regex problem
[snip] if($string = 'test/contact.html') That's if($string == 'test/contact.html') of course... :) [/snip] it could be if($string == test/contact.html) couldn't resist :) Jay P.S. John, nothing on that thing yet. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] regex problem
On 15 August 2003 12:02, Merlin wrote: Hi there, I have a regex problem. Basicly I do not want to match: /dir/test/contact.html But I do want to match: /test/contact.html I tryed this one: ^[!dir]/(.*)/contact(.*).html$ Well, that's not going to work because the construct [!dir] means match any single character that is ! or d or i or r. Even if you use the correct negation character, to give [^dir], that's still not going to work as it means match any ONE character which is neither d nor i nor r. I *think* what you want here is what's called a lookahead assertion, but I've never tried to use one of those so I'm not even going to attempt a suggestion; however, they are documented in the PHP manual at http://www.php.net/pcre.pattern.syntax#regexp.reference.assertions, so a good peruse through that section may set you on the way. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] searching date
select * from 'news' where 'date' between '$date_begin' and '$date_last'; i hope this code is ok? my english is very poor ! - Original Message - From: [EMAIL PROTECTED] [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 14, 2003 5:36 PM Subject: [PHP] searching date Hi , The user have to choose 2 date ($date_begin $date_last) and i want to know howcan i make to find field in mysql where field included between ($date_begin $date_last) SELECT * FROM `news` WHERE `date` included in ($date_begin $date_last) -- Best salutations, Admin mailto:[EMAIL PROTECTED] http://clubafricain.partout.org Post-Joint : none. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: regex problem
ufff.. sorry guys, but I have to explain that better. I appreciate your help, maybe I did not give enough info. I am trying to redirect with apache modrewrite. To do this you have to use regex (not if functions:-) My problem is, that there are member accounts which look like that: membername/contact.html and there are partner accounts which look like this: partner/name/contact.html The goal is to redirect only if it is a member account. If I put a (.*)/contact.html it also matches the partner/ I tryed putting a root / infront, but there is not / root for the url from apaches point of view. So I would need a regex which will match the member account, but if the first word is partner it should not terminate. This seems to be a tough one! Thanx for any help, Merlin Kae Verens [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Merlin wrote: ^\/test\/contact.html$ does not work. I am sorry, I just found that it has to be: test/contact.html and not dir/test/contact.html there is no leading slash. Do you have any other suggestion? *sigh* ^test\/contact.html$ Kae -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: regex problem
Jay Blanchard wrote: if($string == 'test/contact.html') it could be if($string == test/contact.html) not to start a flame war or anything, but isn't the apostrophe version quicker, as it doesn't ask the server to parse the string? Kae -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Turck MMCache Feedback, Please
Hello Andrei, I've been using Turck MMCache for over 6 months now. I use it on several severs including FreeBSD (2), Windows (1) and Linux (3). I've been very happy with Turck MMCache and as of the last few releases it is actually faster than Zend's product though not by very much (granted could be within margin of error but it is still very nice and neat). Turck also has the Turck Loader for clients that don't want the full power of Turck MMCache but need to be able to run Turck MMCache encoded scripts. You can use the command line php file to encode scripts or I also wrote Turck MMCache PHPCoder, a web based front end to Turck MMCache that also allows you to restrict execution and prepend/append code to each file such as licensing control code or copyright stuff (http://phpcoder.shadonet.com). Bottom line I don't have a machine running PHP I don't have Turck MMCache installed on and I have aeen a tremendous performance increase since I installed it. Jason Andrei Verovski (aka MacGuru) wrote: Hi, I am going to use Turck MMCache with Encoder. Anyone on the list have used it on Linux, MacOS X, Windows? Any caveats and/or side effect? Your feedback will be greatly appreciated. Thanks in advance. * * Best Regards --- Andrei Verovski * * Personal Home Page * http://snow.prohosting.com/guru4mac * Mac, Linux, DTP, Development, IT WEB Site * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: regex problem
Merlin wrote: ufff.. sorry guys, but I have to explain that better. I appreciate your help, maybe I did not give enough info. I am trying to redirect with apache modrewrite. To do this you have to use regex (not if functions:-) My problem is, that there are member accounts which look like that: membername/contact.html and there are partner accounts which look like this: partner/name/contact.html The goal is to redirect only if it is a member account. If I put a (.*)/contact.html it also matches the partner/ I tryed putting a root / infront, but there is not / root for the url from apaches point of view. So I would need a regex which will match the member account, but if the first word is partner it should not terminate. This seems to be a tough one! ah - maybe a chain of rewrites would do? send all matches of /^partner\/(.*)\/contact.html$/ to partner\/\1\/blah send all matches of /^(.*)\/contact.html$/ to NEWLOCATION send all matches of /^partner\/(.*)\/blah$/ to partner\/\1\/contact.html Kae -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: regex problem
So ^[^/]+/[^/]* or ^!(partner/) Merlin wrote: ufff.. sorry guys, but I have to explain that better. I appreciate your help, maybe I did not give enough info. I am trying to redirect with apache modrewrite. To do this you have to use regex (not if functions:-) My problem is, that there are member accounts which look like that: membername/contact.html and there are partner accounts which look like this: partner/name/contact.html The goal is to redirect only if it is a member account. If I put a (.*)/contact.html it also matches the partner/ I tryed putting a root / infront, but there is not / root for the url from apaches point of view. So I would need a regex which will match the member account, but if the first word is partner it should not terminate. This seems to be a tough one! Thanx for any help, Merlin Kae Verens [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Merlin wrote: ^\/test\/contact.html$ does not work. I am sorry, I just found that it has to be: test/contact.html and not dir/test/contact.html there is no leading slash. Do you have any other suggestion? *sigh* ^test\/contact.html$ Kae -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Determining where a function is called from..
Howdy Fellas, I've got this problem .. not really a problem but still some thing to my disliking. For a project I wrote some database handling class, no big deal. When a function from this module is called with a query containing an error, or some other error occurs inside this class it reports to my that an error occured inside that class. Line blabla of class.database.inc.php. But what I really want to know is on what line the $Database-select() or such was called so that I can effectively trace the error. So, for effective error reporting I would like to know if there are functions or constants containing - the script-name a user-function is called from - the linenumber of this script a user-function is called from - And maybe it would even be doable to get an entire stack-trace of files and lines and functions to the point an error (or any other thing I would like to trace to) occurrs. Thanks, Wouter ps. or do I want too much now? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Category and sub-category logic
I'm trying to get a handle on this algorithm as well. If you add additional children to a parent record, doesn't that require renumbering all the rgt and lft values in the lineage? For example (table shamelessly stolen from a website): Personnel emp lft rgt == 'Albert' 1 12 'Bert'23 'Chuck' 4 11 'Donna' 56 'Eddie' 78 'Fred'9 10 If I want to add 'Joe' as a subordinate to 'Fred', doesn't that mean I have to change the lft values for Fred, Chuck, and Albert? Yes, deleting definitely seems easier. I'm curious about adding... Mark --- Chris W. Parker [EMAIL PROTECTED] wrote: David Otton mailto:[EMAIL PROTECTED] on Thursday, August 14, 2003 4:58 PM said: The advantage of doing it this way is that your tree structure is generic and can have many levels. The disadvantage is that you may need many SQL queries to fully traverse the tree (though people rarely want to do this, and sub-selects, clever joins or post-query processing can reduce the overhead). Which is why you should use the Modified Preorder Tree Traversal method instead. With that method you've got one table that defines the categories AND their relationships to each other. Your SQL queries end up looking something like this. SELECT name FROM categories WHERE lft = x AND rgt = y Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php = Mark Weinstock [EMAIL PROTECTED] *** You can't demand something as a right unless you are willing to fight to death to defend everyone else's right to the same thing. *** __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: regex problem
does not work. Is there not a way to exclude the word partner like you triede with !(partner) ? merlin Marek Kilimajer [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] So ^[^/]+/[^/]* or ^!(partner/) Merlin wrote: ufff.. sorry guys, but I have to explain that better. I appreciate your help, maybe I did not give enough info. I am trying to redirect with apache modrewrite. To do this you have to use regex (not if functions:-) My problem is, that there are member accounts which look like that: membername/contact.html and there are partner accounts which look like this: partner/name/contact.html The goal is to redirect only if it is a member account. If I put a (.*)/contact.html it also matches the partner/ I tryed putting a root / infront, but there is not / root for the url from apaches point of view. So I would need a regex which will match the member account, but if the first word is partner it should not terminate. This seems to be a tough one! Thanx for any help, Merlin Kae Verens [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Merlin wrote: ^\/test\/contact.html$ does not work. I am sorry, I just found that it has to be: test/contact.html and not dir/test/contact.html there is no leading slash. Do you have any other suggestion? *sigh* ^test\/contact.html$ Kae -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: regex problem
Good idea, but does not work either - surprisingly! - There should be a clean way with regex for this task. Andy regex expert in here? Merlin Kae Verens [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Merlin wrote: ufff.. sorry guys, but I have to explain that better. I appreciate your help, maybe I did not give enough info. I am trying to redirect with apache modrewrite. To do this you have to use regex (not if functions:-) My problem is, that there are member accounts which look like that: membername/contact.html and there are partner accounts which look like this: partner/name/contact.html The goal is to redirect only if it is a member account. If I put a (.*)/contact.html it also matches the partner/ I tryed putting a root / infront, but there is not / root for the url from apaches point of view. So I would need a regex which will match the member account, but if the first word is partner it should not terminate. This seems to be a tough one! ah - maybe a chain of rewrites would do? send all matches of /^partner\/(.*)\/contact.html$/ to partner\/\1\/blah send all matches of /^(.*)\/contact.html$/ to NEWLOCATION send all matches of /^partner\/(.*)\/blah$/ to partner\/\1\/contact.html Kae -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: regex problem
* Thus wrote Merlin ([EMAIL PROTECTED]): ufff.. sorry guys, but I have to explain that better. I appreciate your help, maybe I did not give enough info. I am trying to redirect with apache modrewrite. To do this you have to use regex (not if functions:-) I'm not sure what you expect since this *is* a php mailing list. My problem is, that there are member accounts which look like that: membername/contact.html and there are partner accounts which look like this: partner/name/contact.html The goal is to redirect only if it is a member account. If I put a (.*)/contact.html it also matches the partner/ I tryed putting a root / infront, but there is not / root for the url from apaches point of view. So I would need a regex which will match the member account, but if the first word is partner it should not terminate. This seems to be a tough one! Mod rewrite is a powerful tool and you can accomplish what you are doing several different ways. As you can tell most people have been giving attempts to fix your problem without success. This is because it is not entirely clear what you need done. Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: regex problem
* Thus wrote Kae Verens ([EMAIL PROTECTED]): Jay Blanchard wrote: if($string == 'test/contact.html') it could be if($string == test/contact.html) not to start a flame war or anything, but isn't the apostrophe version quicker, as it doesn't ask the server to parse the string? heh, that is true. Although I havn't benched marked it but it prolly is somewhere around .01 difference :) your not the one that needs to be flamed, it seems that everytime a topic of 'regex' is posted there is always 20+ in the thread with 101% of them not doing what the person wants. Not to mention the OT'ness of the post. cheers, Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] configure smtp error
--- Jackson Miller [EMAIL PROTECTED] wrote: It looks like sendmail_from should be an smtp server, not an email address. Try setting it to your outgoing mail server that you use with your email client (i.e. Outlook). If you can send email from your email client then the firewall will have no bearing. -Jackson On Thursday 14 August 2003 11:24, merryE wrote: I am using LAN in my college and there is firewall. will it effect my mail function in php. I configure my server name as localhost at apache http.conf. and inphp.ini i configure my SMTP like this: [mail function] ; For Win32 only. SMTP= POP ; for Win32 only This should be the fully qualified domain name or IP address ofhte SMTP server that you want to use. If you look in your configuration in Outlook, you should be able to find the SMTP server that you have access to. But note that if that server requires SMTP AUTH (username and password to send mail), you can;t use PHP's mail function directly,. You'll need to use one of the mail classes. ; For Win32 only. sendmail_from= [EMAIL PROTECTED] ; for Win32 only This is correct. It should be the email address from which teh mail should be sent. I beleive PHP uses this as the SMTP MAIL FROM parameter (not to be confused with the From: mail header ). but i got warning: mail(): Failed to connect to mailserver at POP port 25, verify your SMTP and smtp_port setting in php.ini or use ini_set() in c:\program files\apache group\apache\htdocs\do_feedback.php on line 12 -- jackson miller cold feet creative 615.321.3300 / 800.595.4401 [EMAIL PROTECTED] cold feet presents Emma the world's easiest email marketing Learn more @ http://www.myemma.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php = Mark Weinstock [EMAIL PROTECTED] *** You can't demand something as a right unless you are willing to fight to death to defend everyone else's right to the same thing. *** __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Determining where a function is called from..
Thanks David, I noticed the __LINE__ and __FUNCTION__ magic constants too, but they don't really contain the values I was looking for, as they have the current function and line in it. But what I want my Logging class (I have one too :D) to display is what I am about to illustrate with an example: script: index.php - 01 $Database-connect('host', 'database', 'username', 'password'); (...) 20 $Database-execute('DELETE news WHERE id IN ()'); - this would produce an error in my Database class, error in sql syntax script: class.database.inc.php -- 2 class Database { 3 4 var $C; # Connection resource 5 var $S; # Settings 6 var $L; # Log Object 7 var $R; # Result 8 9 function Database($Host, $Database, $Username, $Password) { 10 global $Log; 11 12 $this-S = Array( 'host'= $Host, 13 'database'= $Database, 14 'username'= $Username, 15 'password'= $Password 16 ); 17 18 $this-L = $Log; 19 20 return true; 21 } (...) 55 function execute() { 56 $this-connect(false); 57 58 # Prepare 59 $Query = $this-prepare(func_get_args()); 60 $this-dblog($Query); 61 62 # Execute the query 63 $this-R['resource'] = @mysql_query($Query, $this-C) or $this-dberror(); 64 $this-R['affectedrows'] = @mysql_affected_rows($this-C) or $this-dberror(); 65 66 return $this-R['affectedrows']; 67 } (...) 171 function dberror() { 172 if ($String = mysql_error($this-C)) { 173 $OldType = $this-L-setLogType(L_STDOUT); 174 $this-L-Error('[database] '.$String); 175 $this-L-setLogType($OldType); 176 }; 177 } 178 }; I could fairly live with passing __LINE__ and __FUNCTION__ at some places, but not in my index.php (seperating front- and backend). What I want dberror() to pass to my logging module is something like You have an error in your sql syntax at line 1, called from index.php on line 20. The first part being just the mysql error, after the comma from where the errorfull query was called .. Thanks once more, Wouter Ps. or am I really wanting too much now? -Oorspronkelijk bericht- Van: David Otton [mailto:[EMAIL PROTECTED] Verzonden: vrijdag 15 augustus 2003 16:13 Aan: Wouter van Vliet Onderwerp: Re: [PHP] Determining where a function is called from.. On Fri, 15 Aug 2003 16:02:24 +0200, you wrote: I've got this problem .. not really a problem but still some thing to my disliking. For a project I wrote some database handling class, no big deal. When a function from this module is called with a query containing an error, or some other error occurs inside this class it reports to my that an error occured inside that class. Line blabla of class.database.inc.php. But what I really want to know is on what line the $Database-select() or such was called so that I can effectively trace the error. So, for effective error reporting I would like to know if there are functions or constants containing - the script-name a user-function is called from - the linenumber of this script a user-function is called from - And maybe it would even be doable to get an entire stack-trace of files and lines and functions to the point an error (or any other thing I would like to trace to) occurrs. It's just about possible, but you have to do it by hand. You need the __LINE__ and __FUNCTION__ magic constants. Eg function makeerror ($errorstring, $function, $line) { die (Error: $errorstring on line $line in $function); } makeerror(Can't connect to database, __FUNCTION__, __LINE__); I have a fairly standard way of handling errors in classes that I can discuss in more detail, if you want. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Graduated fills using PHP Images
At 2003-08-15 08:14 -0400, Adrian wrote: Is it possible to have PHP creates an image that graduates 1 color to another, such as create and images 100 pixels wide and in height which fades red to green top to bottom? It's possible. I have just been experimenting with it using ImageCreateTrueColor(). See the manual: http://www.php.net/manual/en/function.imagecreatetruecolor.php You still have to use ImageColorAllocate() to get a color but you can deallocate it right after usage and you can use as many colors as you like (whereas with normal 256 color images you can't use more than 256). The process didn't noticably slow my 1 Ghz PC down. I made some nice fades in two directions too: http://www.chipdir.nl/adprov/adb/cdb/468_60/08en.png BTW. I made it look like the upper text has been pressed downward into the material and the lower text has been pressed upward out of the material. (Using alpha channel coloring.) Let me know if you want to see the source code... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: How can I load load Additional extensions ?
[EMAIL PROTECTED] Leif K-Brooks: Dennis Lee wrote: Why it is wrong when I run php as module under apache 2.0.46 ? PHP and Apache 2 are currently unstable together. They might crash on any high traffic, but they start fine, at least when I've tried it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: regex problem
So, what you want is to pretty much use this regex /^(.*)([^\/]+)\/([^\/]+)$/ when matched on this URI, the backreferences will contain \\1 partner/ \\2 name \\3 contact.html \\4 .html partner/name/contact.html I have not tested it, but I just guess it will work ;) Wanna know why? I'll tell you :D - It first looks at the beginning of the string and will go on untill a the next pair of () start (partner/) - That happens there where there is a string containing any character, but not a slash (partner) - as a seperator another slash is added - it starts to match the last part of the url and looks up untill the end. Again a string containing no slashes Hope it does do what I expect it to do .. ;) Wouter -Oorspronkelijk bericht- Van: Merlin [mailto:[EMAIL PROTECTED] Verzonden: vrijdag 15 augustus 2003 16:21 Aan: [EMAIL PROTECTED] Onderwerp: [PHP] Re: regex problem Good idea, but does not work either - surprisingly! - There should be a clean way with regex for this task. Andy regex expert in here? Merlin Kae Verens [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Merlin wrote: ufff.. sorry guys, but I have to explain that better. I appreciate your help, maybe I did not give enough info. I am trying to redirect with apache modrewrite. To do this you have to use regex (not if functions:-) My problem is, that there are member accounts which look like that: membername/contact.html and there are partner accounts which look like this: partner/name/contact.html The goal is to redirect only if it is a member account. If I put a (.*)/contact.html it also matches the partner/ I tryed putting a root / infront, but there is not / root for the url from apaches point of view. So I would need a regex which will match the member account, but if the first word is partner it should not terminate. This seems to be a tough one! ah - maybe a chain of rewrites would do? send all matches of /^partner\/(.*)\/contact.html$/ to partner\/\1\/blah send all matches of /^(.*)\/contact.html$/ to NEWLOCATION send all matches of /^partner\/(.*)\/blah$/ to partner\/\1\/contact.html Kae -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PCRE regexp bug ?
I use preg_match to validate the Middle Initial field of a form and so far it works, except yesterday a user submitted a 0 (zero) as a middle initial! My regexp is: if (!empty($_POST[MI]) (preg_match('/^[[:alpha:]]{1,1}$/', $_POST[MI]) == 0)) I tested it with 0-9 and my regexp catches every digit except 0. Curious... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Determining where a function is called from..
Use debug_backtrace(): if($error=mysql_error()) { $bt=debug_backtrace(); echo $bt[0]['file'].':'.$bt[0]['line'].'br' .$error.'br'.$query; } hope i got everything right Wouter van Vliet wrote: Thanks David, I noticed the __LINE__ and __FUNCTION__ magic constants too, but they don't really contain the values I was looking for, as they have the current function and line in it. But what I want my Logging class (I have one too :D) to display is what I am about to illustrate with an example: script: index.php - 01 $Database-connect('host', 'database', 'username', 'password'); (...) 20 $Database-execute('DELETE news WHERE id IN ()'); - this would produce an error in my Database class, error in sql syntax script: class.database.inc.php -- 2 class Database { 3 4 var $C; # Connection resource 5 var $S; # Settings 6 var $L; # Log Object 7 var $R; # Result 8 9 function Database($Host, $Database, $Username, $Password) { 10 global $Log; 11 12 $this-S = Array( 'host'= $Host, 13 'database'= $Database, 14 'username'= $Username, 15 'password'= $Password 16 ); 17 18 $this-L = $Log; 19 20 return true; 21 } (...) 55 function execute() { 56 $this-connect(false); 57 58 # Prepare 59 $Query = $this-prepare(func_get_args()); 60 $this-dblog($Query); 61 62 # Execute the query 63 $this-R['resource'] = @mysql_query($Query, $this-C) or $this-dberror(); 64 $this-R['affectedrows'] = @mysql_affected_rows($this-C) or $this-dberror(); 65 66 return $this-R['affectedrows']; 67 } (...) 171 function dberror() { 172 if ($String = mysql_error($this-C)) { 173 $OldType = $this-L-setLogType(L_STDOUT); 174 $this-L-Error('[database] '.$String); 175 $this-L-setLogType($OldType); 176 }; 177 } 178 }; I could fairly live with passing __LINE__ and __FUNCTION__ at some places, but not in my index.php (seperating front- and backend). What I want dberror() to pass to my logging module is something like You have an error in your sql syntax at line 1, called from index.php on line 20. The first part being just the mysql error, after the comma from where the errorfull query was called .. Thanks once more, Wouter Ps. or am I really wanting too much now? -Oorspronkelijk bericht- Van: David Otton [mailto:[EMAIL PROTECTED] Verzonden: vrijdag 15 augustus 2003 16:13 Aan: Wouter van Vliet Onderwerp: Re: [PHP] Determining where a function is called from.. On Fri, 15 Aug 2003 16:02:24 +0200, you wrote: I've got this problem .. not really a problem but still some thing to my disliking. For a project I wrote some database handling class, no big deal. When a function from this module is called with a query containing an error, or some other error occurs inside this class it reports to my that an error occured inside that class. Line blabla of class.database.inc.php. But what I really want to know is on what line the $Database-select() or such was called so that I can effectively trace the error. So, for effective error reporting I would like to know if there are functions or constants containing - the script-name a user-function is called from - the linenumber of this script a user-function is called from - And maybe it would even be doable to get an entire stack-trace of files and lines and functions to the point an error (or any other thing I would like to trace to) occurrs. It's just about possible, but you have to do it by hand. You need the __LINE__ and __FUNCTION__ magic constants. Eg function makeerror ($errorstring, $function, $line) { die (Error: $errorstring on line $line in $function); } makeerror(Can't connect to database, __FUNCTION__, __LINE__); I have a fairly standard way of handling errors in classes that I can discuss in more detail, if you want. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Determining where a function is called from..
At 2003-08-15 16:35 +0200, Wouter van Vliet wrote: I noticed the __LINE__ and __FUNCTION__ magic constants too, but they don't really contain the values I was looking for, as they have the current function and line in it. But what I want my Logging class (I have one too :D) to display is what I am about to illustrate with an example: script: index.php - 01 $Database-connect('host', 'database', 'username', 'password'); (...) 20 $Database-execute('DELETE news WHERE id IN ()'); - this would produce an error in my Database class, error in sql syntax ...etc. Have you studied this: http://www.php.net/manual/en/function.debug-backtrace.php You may also want to invoke phpinfo() at the place the error is occuring. There are more nice functions on: http://www.php.net/manual/en/ref.errorfunc.php Greetings, Jaap -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PCRE regexp bug ?
- Original Message - From: [EMAIL PROTECTED] I use preg_match to validate the Middle Initial field of a form and so far it works, except yesterday a user submitted a 0 (zero) as a middle initial! My regexp is: if (!empty($_POST[MI]) (preg_match('/^[[:alpha:]]{1,1}$/', $_POST[MI]) == 0)) I tested it with 0-9 and my regexp catches every digit except 0. Curious... Maybe it thinks it's the letter O, have you tried using a font that puts a line through the zero;-) [sorry couldn't resist] Cheers, Greg. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Category and sub-category logic
From: Mark [EMAIL PROTECTED] I'm trying to get a handle on this algorithm as well. If you add additional children to a parent record, doesn't that require renumbering all the rgt and lft values in the lineage? For example (table shamelessly stolen from a website): Personnel emp lft rgt == 'Albert' 1 12 'Bert'23 'Chuck' 4 11 'Donna' 56 'Eddie' 78 'Fred'9 10 If I want to add 'Joe' as a subordinate to 'Fred', doesn't that mean I have to change the lft values for Fred, Chuck, and Albert? Yes, deleting definitely seems easier. I'm curious about adding... Yes, you will have to update all of the right and left numbers to the right (or higher) than the node where you are inserting. Deleting is basically the same method done in reverse, but can get complicated when you delete a node and have to determine what to do with the children. I'd recommend, if you're really interested in this, to do some searching on nested set tutorials. You could specifically search for Joe Celko who has written a lot of information on the topic. While it seems like a big deal to have to update all of the numbers, it's really not. It can be done with a single query (with subselects). Yes, it's more costly than inserting a name into an adjacentcy list model, but it's worth it for all that you gain from the nested set model. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] logging data to xml
* Thus wrote Jay Blanchard ([EMAIL PROTECTED]): A couple of things occured to me, but I am not sure that they're desirable... With /root being the last tag (does it occupy its own line?) you could (pseudo-code, not tested and certain to be incomplete)... while(!feof($theXMLLogFile)){ $theXMLLine = fgets($theXMLLogFile, 255); if($theXMLLine == /root){ $theNewLogLine = stuff you need to write \n /root; ereg_replace(/root, $theNewLogLine, $theXMLLogFile); } } A little quicker: fseek($fh, -(strlen(/root)), SEEK_END); fwrite($fh, $yourdata); fwrite($fh, \n/root); Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PCRE regexp bug ?
Not an answer but '/^[[:alpha:]]{1,1}$/' could be writen as '/^[[:alpha:]]$/' [EMAIL PROTECTED] wrote: I use preg_match to validate the Middle Initial field of a form and so far it works, except yesterday a user submitted a 0 (zero) as a middle initial! My regexp is: if (!empty($_POST[MI]) (preg_match('/^[[:alpha:]]{1,1}$/', $_POST[MI]) == 0)) I tested it with 0-9 and my regexp catches every digit except 0. Curious... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PCRE regexp bug ?
From: [EMAIL PROTECTED] I use preg_match to validate the Middle Initial field of a form and so far it works, except yesterday a user submitted a 0 (zero) as a middle initial! My regexp is: if (!empty($_POST[MI]) (preg_match('/^[[:alpha:]]{1,1}$/', $_POST[MI]) == 0)) I tested it with 0-9 and my regexp catches every digit except 0. Curious... empty(0) is going to be true. So, !empty(0) is going to be false, so you won't catch the zero. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Determining where a function is called from..
Nope .. I hadn't studiet the ref.errorfunc.php in this search.. I did some other time and the backtrace function didn't stick around in my head. Thank you all for helping me .. of course, debug_backtrace() was what I needed ;) .. what a magnificent new function in PHP4.3 that is.. Only too bad my vim syntax file doesn't yet recognize it.. Wouter -Oorspronkelijk bericht- Van: Jaap van Ganswijk [mailto:[EMAIL PROTECTED] Verzonden: vrijdag 15 augustus 2003 16:51 Aan: [EMAIL PROTECTED] Onderwerp: RE: [PHP] Determining where a function is called from.. At 2003-08-15 16:35 +0200, Wouter van Vliet wrote: I noticed the __LINE__ and __FUNCTION__ magic constants too, but they don't really contain the values I was looking for, as they have the current function and line in it. But what I want my Logging class (I have one too :D) to display is what I am about to illustrate with an example: script: index.php - 01 $Database-connect('host', 'database', 'username', 'password'); (...) 20 $Database-execute('DELETE news WHERE id IN ()'); - this would produce an error in my Database class, error in sql syntax ...etc. Have you studied this: http://www.php.net/manual/en/function.debug-backtrace.php You may also want to invoke phpinfo() at the place the error is occuring. There are more nice functions on: http://www.php.net/manual/en/ref.errorfunc.php Greetings, Jaap -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Determining where a function is called from..
WHOW .. what a great new function in PHP4.3 .. I now have my errorlog populated with stuff like: [Fri 15 Aug 2003 17:34] [error] [database] You have an error in your SQL syntax near 'DELETESBLAH' at line 1 -- - database-execute() @ HTML/tmp/test.php line 3 - database-dberror() @ lib/class.database.inc.php line 63 -- - logging-error() @ lib/class.database.inc.php line 173 only 'bad' thing is that it converts my function names to all lowercase .. logging-error() should actually be Logging-Error() .. well, think I'll have to live with that :( Thanks you all ! Wouter Ps. invoking phpinfo() on a production website? I don't think so ;P -Oorspronkelijk bericht- Van: Jaap van Ganswijk [mailto:[EMAIL PROTECTED] Verzonden: vrijdag 15 augustus 2003 16:51 Aan: [EMAIL PROTECTED] Onderwerp: RE: [PHP] Determining where a function is called from.. At 2003-08-15 16:35 +0200, Wouter van Vliet wrote: I noticed the __LINE__ and __FUNCTION__ magic constants too, but they don't really contain the values I was looking for, as they have the current function and line in it. But what I want my Logging class (I have one too :D) to display is what I am about to illustrate with an example: script: index.php - 01 $Database-connect('host', 'database', 'username', 'password'); (...) 20 $Database-execute('DELETE news WHERE id IN ()'); - this would produce an error in my Database class, error in sql syntax ...etc. Have you studied this: http://www.php.net/manual/en/function.debug-backtrace.php You may also want to invoke phpinfo() at the place the error is occuring. There are more nice functions on: http://www.php.net/manual/en/ref.errorfunc.php Greetings, Jaap -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ereg preg
is there any syntax difference between ereg() and preg() except preg needs / and /? -- - Eddy Wong __ inframatrix internet solutions http://www.inframatrix.com/ ¥¿¤KEddy Regular Octa-Eddy [EMAIL PROTECTED]@ [EMAIL PROTECTED]@¡½¢ª¢© [EMAIL PROTECTED]@[EMAIL PROTECTED]@¡½ É\¿ß¡G [EMAIL PROTECTED] [EMAIL PROTECTED]@¡½ É\¨¦¡G news://news.fixip.net/chat.ed [EMAIL PROTECTED]@[EMAIL PROTECTED]@¡½ É\®Þ¤Æ¡G news://news.fixip.net/ [EMAIL PROTECTED]@¡½¢¨¢« [EMAIL PROTECTED]@
[PHP] Function arguments
Hi Group, I have a question on overloaded function. What is the best way to pass the arguments so it is easy to maintain in future if function behaviour changes by adding/removing one or more arguments? Currently i am passing arguments in array. But i think it is not the clean way to do it and another approach i am using is functionName(arg1, arg2='', arg3='') but here again i think it is not easy to maintain. Please let me know if you guys have other options or improved version of above options. Thanks Hardik __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Function arguments
Hello, If you are worried about this issue your best option is to switch to an object oriented approach. all the best Hardik Doshi wrote: Hi Group, I have a question on overloaded function. What is the best way to pass the arguments so it is easy to maintain in future if function behaviour changes by adding/removing one or more arguments? Currently i am passing arguments in array. But i think it is not the clean way to do it and another approach i am using is functionName(arg1, arg2='', arg3='') but here again i think it is not easy to maintain. Please let me know if you guys have other options or improved version of above options. Thanks Hardik __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com -- Raditha Dissanayake - http://www.radinks.com/sftp/ Lean and mean Secure FTP applet with Graphical User Inteface. just 150 Kilo Bytes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] howto set locale only once
Hi, setting locale with setlocale() to subsequently get localized time strings e.g. works fine. But this way the setlocale function gets executed every time. How can i set the locale only once? Can i specify the locale in the config file php.ini? I'm using php as apache module on a linux debian system. -- Regards, martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Category and sub-category logic
Wouldn¹t it just be easier to do a relationship table as in Personnel emp ID parent 'Albert' 1 0 'Bert'2 1 'Chuck' 3 1 'Donna' 4 0 'Eddie' 5 4 'Fred'6 0 'Joe' 7 6 This way you know the ID of the person and the parentID if they have one, otherwise they are a 0 which means they are the parent.. Seems like this would be a much easier way of doing it doesn¹t it? And only one SQL query... Rick The only way to have a friend is to be one. - Ralph Waldo Emerson From: Mark [EMAIL PROTECTED] Date: Fri, 15 Aug 2003 07:18:41 -0700 (PDT) To: Chris W. Parker [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RE: [PHP] Category and sub-category logic I'm trying to get a handle on this algorithm as well. If you add additional children to a parent record, doesn't that require renumbering all the rgt and lft values in the lineage? For example (table shamelessly stolen from a website): Personnel emp lft rgt == 'Albert' 1 12 'Bert'23 'Chuck' 4 11 'Donna' 56 'Eddie' 78 'Fred'9 10 If I want to add 'Joe' as a subordinate to 'Fred', doesn't that mean I have to change the lft values for Fred, Chuck, and Albert? Yes, deleting definitely seems easier. I'm curious about adding... Mark --- Chris W. Parker [EMAIL PROTECTED] wrote: David Otton mailto:[EMAIL PROTECTED] on Thursday, August 14, 2003 4:58 PM said: The advantage of doing it this way is that your tree structure is generic and can have many levels. The disadvantage is that you may need many SQL queries to fully traverse the tree (though people rarely want to do this, and sub-selects, clever joins or post-query processing can reduce the overhead). Which is why you should use the Modified Preorder Tree Traversal method instead. With that method you've got one table that defines the categories AND their relationships to each other. Your SQL queries end up looking something like this. SELECT name FROM categories WHERE lft = x AND rgt = y Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php = Mark Weinstock [EMAIL PROTECTED] *** You can't demand something as a right unless you are willing to fight to death to defend everyone else's right to the same thing. *** __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PCRE regexp bug ?
* Thus wrote [EMAIL PROTECTED] ([EMAIL PROTECTED]): I use preg_match to validate the Middle Initial field of a form and so far it works, except yesterday a user submitted a 0 (zero) as a middle initial! My regexp is: if (!empty($_POST[MI]) (preg_match('/^[[:alpha:]]{1,1}$/', $_POST[MI]) == 0)) I tested it with 0-9 and my regexp catches every digit except 0. Curious... actaually 0-9 will never match that regexp. print preg_match('/^[[:alpha:]]{1,1}$/', '1'); yields: 0 The reason is that 0-9 is not alpha. You should use [[:alnum:]] instead. Or better yet /^\w{1,1}$/ HTH, Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ereg preg
* Thus wrote Eddy-Das ([EMAIL PROTECTED]): is there any syntax difference between ereg() and preg() except preg needs / and /? There are a lot of differences in syntax. Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to get data from database with a click
* Thus wrote Subodh Gupta ([EMAIL PROTECTED]): Dear Friends, When we click a combo box, in a perticular file, the output from the database should display in the same screen, in a text box or a combo box (We want this to happen without pressing the submit button). Any clue please I'm confused, does this message have anything to do with what the original message, below, is asking? Subodh -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, August 15, 2003 1:27 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] php, search engine that index via local filesystem? Hi, Do you want to provide a web interface to your local file system? well Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Category and sub-category logic
--- CPT John W. Holmes [EMAIL PROTECTED] wrote: From: Mark [EMAIL PROTECTED] I'm trying to get a handle on this algorithm as well. If you add additional children to a parent record, doesn't that require renumbering all the rgt and lft values in the lineage? For example (table shamelessly stolen from a website): Personnel emp lft rgt == 'Albert' 1 12 'Bert'23 'Chuck' 4 11 'Donna' 56 'Eddie' 78 'Fred'9 10 If I want to add 'Joe' as a subordinate to 'Fred', doesn't that mean I have to change the lft values for Fred, Chuck, and Albert? Yes, deleting definitely seems easier. I'm curious about adding... Yes, you will have to update all of the right and left numbers to the right (or higher) than the node where you are inserting. Deleting is basically the same method done in reverse, but can get complicated when you delete a node and have to determine what to do with the children. I'd recommend, if you're really interested in this, to do some searching on nested set tutorials. You could specifically search for Joe Celko who has written a lot of information on the topic. Thanks. I'll take a look. I'm considering changing to this algorithm from my basic parent-ID table. While it seems like a big deal to have to update all of the numbers, it's really not. It can be done with a single query (with subselects). Yes, it's more costly than inserting a name into an adjacentcy list model, but it's worth it for all that you gain from the nested set model. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php = Mark Weinstock [EMAIL PROTECTED] *** You can't demand something as a right unless you are willing to fight to death to defend everyone else's right to the same thing. *** __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] redhat 8: upgrade php from 4.2.2 to 4.3.2
Hello eveyone. I want to upgrade my php install from 4.2.2 to 4.3.2. I'm pretty new to linux so I don't know how to install from source and I haven't been able to find any Redhat 8 rpm's. Can someone please give me instructions as to what I should do? (Maybe links to a site where I can find the correct rpm file or instructions on how to install a new version of php from source.. etc.) Thanks a lot! Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PCRE regexp bug ?
* Thus wrote Curt Zirzow ([EMAIL PROTECTED]): * Thus wrote [EMAIL PROTECTED] ([EMAIL PROTECTED]): I use preg_match to validate the Middle Initial field of a form and so far it works, except yesterday a user submitted a 0 (zero) as a middle initial! My regexp is: if (!empty($_POST[MI]) (preg_match('/^[[:alpha:]]{1,1}$/', $_POST[MI]) == 0)) I tested it with 0-9 and my regexp catches every digit except 0. Curious... actaually 0-9 will never match that regexp. Oops after reading my post to your post I see that is what you wanted. sorry. the 0 problem can be fixed by checking strlen($_POST[MI]) or isset() instead of !empty(). Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Acessing session vars
I just started using sessions and am having some trouble understanding how to pull values out of sessions to use in another page. I set the values as: session_start(); session_register{'magazine'); session_register('company'); The data is saved as a session because I can read the file located in my /tmp directory. Now I click on a link and go to a different page and I do: session_start() Magazine: ? echo $magazine; ? Company: ? echo $company; ? Should I be able to retrieve the values in this fashion? I'm using php 4.1.2. Thanks, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: cookies and redirection
Ok, I have changed my code so the headers are sent as: header(HTTP/1.0 302 Redirect); header(Location: index2.php); header(Set-Cookie: USER_COOKIE=$sUser); I have changed the file name to nph-unsecure.php It successfully sends me to the index2.php page, but no cookie... any ideas Joaco [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have a small problem was wondering if anyone out there knew anyhting about this. I set a cookie in my code and then redirect the user using a header function. When I do this, my cookie is not created. If i remove the header function, then it is. Is there a way around this?
[PHP] cron
Not specific to PHP really, but it all started with a simple PHP script I was automating... I've used cron/crontab on a zillion machines, and it always worked flawlessly. Well, once I'd get the actual shell commands and permissions right anyway. But this time... The cron jobs just aren't having any effect. crond is running, and has been /etc/rc.d/init.d/crond restart 'ed tail /var/log/crond shows the jobs happening /etc/cron.allow and /etc/cron.deny did not exist adding the user to /etc/cron.allow had no effect The 'root' user is being used MAILTO= is set, with no output Using the simplest stupidest cronline: 0 * * * * echo -e .\n | mail -s test [EMAIL PROTECTED] it doesn't work. There are no 'bounced' emails for the 'root' user on this box. It's as if some higher power is intercepting any cron job and killing it without letting cron know about it. Weird. The machine is a dual 64-bit (quad?) CPU, which I guess I've never used before, but I'll be damned if I can see how that would screw up cron... Linux localhost.localdomain 2.4.20-19.8smp #1 SMP Tue Jul 15 15:01:43 EDT 2003 i686 i686 i386 GNU/Linux RedHat 8.0, with all (?) up2date's I'm bemused and defuddled. Any ideas? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP.ini file and register_globals
I have a quick simple question. I am using PHP 4.2.3 on Linux. I am trying to turn register_globals from off to on. Is all that I need to do change it from off to on in the php.ini file? Do you I need to reboot to have the changes go into effect? Sorry for a simple question but I am new at configuring PHP. Thanks for the help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP.ini file and register_globals
never reboot !! is not necessary ! - Original Message - From: Ben C. [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, August 15, 2003 2:14 PM Subject: [PHP] PHP.ini file and register_globals I have a quick simple question. I am using PHP 4.2.3 on Linux. I am trying to turn register_globals from off to on. Is all that I need to do change it from off to on in the php.ini file? Do you I need to reboot to have the changes go into effect? Sorry for a simple question but I am new at configuring PHP. Thanks for the help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP.ini file and register_globals
[snip] never reboot !! is not necessary ! [/snip] But you might want to restart your web server. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] PHP.ini file and register_globals
Is the change in the php.ini file the only thing that I need to change to turn on register_globals? From: Jonatan Pugliese. [EMAIL PROTECTED] Date: 2003/08/15 Fri PM 01:18:01 EDT To: Ben C. [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: Re: [PHP] PHP.ini file and register_globals never reboot !! is not necessary ! - Original Message - From: Ben C. [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, August 15, 2003 2:14 PM Subject: [PHP] PHP.ini file and register_globals I have a quick simple question. I am using PHP 4.2.3 on Linux. I am trying to turn register_globals from off to on. Is all that I need to do change it from off to on in the php.ini file? Do you I need to reboot to have the changes go into effect? Sorry for a simple question but I am new at configuring PHP. Thanks for the help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] PHP.ini file and register_globals
Is the change in the php.ini file the only thing that I need to change to turn on register_globals? From: Jonatan Pugliese. [EMAIL PROTECTED] Date: 2003/08/15 Fri PM 01:18:01 EDT To: Ben C. [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: Re: [PHP] PHP.ini file and register_globals never reboot !! is not necessary ! - Original Message - From: Ben C. [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, August 15, 2003 2:14 PM Subject: [PHP] PHP.ini file and register_globals I have a quick simple question. I am using PHP 4.2.3 on Linux. I am trying to turn register_globals from off to on. Is all that I need to do change it from off to on in the php.ini file? Do you I need to reboot to have the changes go into effect? Sorry for a simple question but I am new at configuring PHP. Thanks for the help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP.ini file and register_globals
yes you must to restart your webserver !! type /etc/init.d/httpd restart - Original Message - From: Jay Blanchard [EMAIL PROTECTED] To: Jonatan Pugliese. [EMAIL PROTECTED]; Ben C. [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, August 15, 2003 2:18 PM Subject: RE: [PHP] PHP.ini file and register_globals [snip] never reboot !! is not necessary ! [/snip] But you might want to restart your web server. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: Re: [PHP] PHP.ini file and register_globals
[snip] Is the change in the php.ini file the only thing that I need to change to turn on register_globals? [/snip] Yes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Acessing session vars
From: Ed Curtis [EMAIL PROTECTED] I just started using sessions and am having some trouble understanding how to pull values out of sessions to use in another page. I set the values as: session_start(); session_register{'magazine'); session_register('company'); The data is saved as a session because I can read the file located in my /tmp directory. Now I click on a link and go to a different page and I do: session_start() Magazine: ? echo $magazine; ? Company: ? echo $company; ? Should I be able to retrieve the values in this fashion? I'm using php 4.1.2. As you sit there and wait for us to answer, you could have taken the 5 second to run this yourself and test it. If register_globals is ON, then yes, that's how you do it. You may want to actually assign a value to $magazine and $company in the first script, though, if you want to see any results. If register_globals is OFF, then you should do it this way: Page 1: session_start(); $_SESSION['magazine'] = 'some value'; $_SESSION['company'] = 'some other value'; Page 2: ?php session_start(); ? Magazine: ?php echo $_SESSION['magazine']; ? Company: ?php echo $_SESSION['company']; ? ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Category and sub-category logic
From: Richard Baskett [EMAIL PROTECTED] Wouldn¹t it just be easier to do a relationship table as in Personnel emp ID parent 'Albert' 1 0 'Bert'2 1 'Chuck' 3 1 'Donna' 4 0 'Eddie' 5 4 'Fred'6 0 'Joe' 7 6 This way you know the ID of the person and the parentID if they have one, otherwise they are a 0 which means they are the parent.. Seems like this would be a much easier way of doing it doesn¹t it? And only one SQL query... Possibly. It depends on what you're trying to model. We're getting way off topic for PHP, though. What you gave above is called an adjacency list model and the other example given was a nested set (or tree) model. Each has it's advantages and disadvantages. I recommend counsulting your good friend Google if you're interested in the details. :) ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] preg_match issue
I have a function that checks the syntax of a string using preg_match. This function is used in a loop and always hangs on the same string (7 out of many more). However, the function acts as expected when used individually on that string (ie when the array of strings to loop on is reduced to just the problem string. The string and the preg_match are: $text = 'C56_3, C55_3, C57_3, C59_3, C58_3, C52_3, C50_3, C53_3, C54_3, C51_3, C60_3, C2_3, C3_2, C7_2, C8_2, C5_2, C64_3, C61_3, C65_3, C67_3, C66_3, C28_3, C29_3, C26_3, C27_3, C32_3, C33_3, C30_3, C31_3, C1_2, C4_2, C6_2, C9_3, C24_3, C25_3, C22_3, C23_3, C44_3, C45_3, C42_3, C43_3, C48_3, C49_3, C46_3, C47_3, C36_3, C37_3, C34_3, C35_3, C40_3, C41_3, C38_3, C39_3, C41_2, C40_2, C43_2, C42_2, C39_2, C36_2, C35_2, C38_2, C37_2, C7_0, C48_2, C11_0, C16_0, C47_2, C18_0, C44_2, C46_2, C45_2, C4_1, C27_2, C8_1, C3_1, C26_2, C1_1, C23_2, C25_2, C24_2, C32_2, C31_2, C34_2, C33_2, C30_2, C6_1, C28_2, C29_2, C5_1, C10_0, C19_0, C21_0, C22_0, C23_0, C59_2, C56_2, C55_2, C58_2, C57_2, C66_2, C65_2, C1_0, C67_2, C64_2, C60_2, C20_0, C61_2, C15_0, C12_0, C13_0, C17_0, C6_0, C14_0, C8_0, C9_0, C2_0, C3_0, C24_0, C52_2, C54_2, C53_2, C51_2, C5_0, C4_0, C50_2, C49_2, C47_1, C48_1, C45_1, C46_1, C49_1, C52_1, C53_1, C50_1, C51_1, C44_1, C37_1, C38_1, C35_1, C36_1, C39_1, C42_1, C43_1, C40_1, C41_1, C5_3, C6_3, C66_1, C67_1, C8_3, C1_3, C7_3, C3_3, C4_3, C65_1, C56_1, C57_1, C54_1, C55_1, C58_1, C61_1, C64_1, C59_1, C60_1, C27_1, C26_1, C25_1, C28_1, C2_2, C30_1, C29_1, C2_1, C9_2, C7_1, C22_1, C24_1, C23_1, C22_2, C31_1, C32_1, C33_1, C9_1, C34_1'; var_dump(preg_match('/^\W*(?:[A-Z]{1,4}\d{1,3}(?:_\d{1,2})?(?(?!\Z)\W+))+$/' , $text)); Does anybody have any tips on what to try/look for? Thanks, Pascal -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redhat 8: upgrade php from 4.2.2 to 4.3.2
You can use apachetoolbox.com to install apache and php... Chris W. Parker wrote: I want to upgrade my php install from 4.2.2 to 4.3.2. I'm pretty new to linux so I don't know how to install from source and I haven't been able to find any Redhat 8 rpm's. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Foreach POST VARS problem
It seems to me that this used to work but I guess something has changed somewhere between PHP 4.2 and 4.3? I am running PHP 4.3.2 as an Apache DSO on an FBSD box. If it is not obvious, I am trying to parse checkbox form POST results as seen below: $colors=; foreach($HTTP_POST_VARS as $ThisVar=$ThisVal){ if(ereg(color-, $ThisVar) AND $ThisVal==on OR $ThisVal==1){ $newVarA=explode(-, $ThisVar); $colors.=$newVarA[1]:; } } *Warning*: Invalid argument supplied for foreach() in */devda1/htdocs/2binteractive.com/htdocs/0new/content/lanskyShopAdmin.php* on line 2 I guess I just need to know what this variable name has been changed to. I searched the PHP.NET manual for $HTTP_POST_VARS and got no results. Thanks in advance sorry for the dumb question.. Kris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to disable html postings?
Hi there, I am wondering how to prevent that users can post html through a form. I process the form with php and save the date to a db. There are a couple of sites I have already seen such thing. No matter what you do, it is not possible to submit html commands. Thats exacly what I want to do for my site. Can anybody point me into the right direction on how to disable that? Thanx for your help, Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] how to disable html postings?
[snip] I am wondering how to prevent that users can post html through a form. I process the form with php and save the date to a db. There are a couple of sites I have already seen such thing. No matter what you do, it is not possible to submit html commands. Thats exacly what I want to do for my site. Can anybody point me into the right direction on how to disable that? [/snip] You will want to use regular expressions and functions associated with regex (such as ereg) to match the tags and remove them from the posts. Start here http://us2.php.net/manual/en/ref.regex.php Have a productive and positve day -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] redhat 8: upgrade php from 4.2.2 to 4.3.2
Cesar Cordovez mailto:[EMAIL PROTECTED] on Friday, August 15, 2003 11:01 AM said: You can use apachetoolbox.com to install apache and php... Does this require that I uninstall everything I've already got? Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Segmentation Fault
I am running a PHP script from the command line that is returning Segmentation Fault. I run a lot of script from the command line and have never seen this before. I don't even know where to begin. I know that PHP is set up to run scripts from the command line and plent of other scripts run. This particular script is not doing anything out of the ordinary. It is opening a database connection, opening a .csv file and inserting rows into the database. How in the world could this Seg Fault? -Jackson -- jackson miller cold feet creative 615.321.3300 / 800.595.4401 [EMAIL PROTECTED] cold feet presents Emma the world's easiest email marketing Learn more @ http://www.myemma.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to disable html postings?
Merlin wrote: I am wondering how to prevent that users can post html through a form. I process the form with php and save the date to a db. There are a couple of sites I have already seen such thing. No matter what you do, it is not possible to submit html commands. Thats exacly what I want to do for my site. Can anybody point me into the right direction on how to disable that? If you want to display the tags (actually show tag), use htmlentities(). If you want to remove the tags, use striptags(). -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Function arguments
What is the best way to pass the arguments so it is easy to maintain in future if function behaviour changes by adding/removing one or more arguments? Currently i am passing arguments in array. But i think it is not the clean way to do it and another approach i am using is functionName(arg1, arg2='', arg3='') but here again i think it is not easy to maintain. According to http://php.net/manual/en/functions.arguments.php, Variable-length argument lists PHP 4 has support for variable-length argument lists in user-defined functions. This is really quite easy, using the func_num_args(), func_get_arg(), and func_get_args() functions. No special syntax is required, and argument lists may still be explicitly provided with function definitions and will behave as normal. - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php