Re: [PHP] asianwhiteskin beauty product
On Tuesday 13 December 2005 04:09, Raz wrote: Can I have some breast enlarger please? Larger is not always better ;) Is there any other men who prefer smaller/normal sized breasts? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] get XSLT on server without Sablotron
should come default with PHP5 http://www.php.net/manual/en/ref.xsl.php On Friday 09 December 2005 07:56, Gerben wrote: Is there a way to get some sort of XSLT working on my server? safe-mode is off run under apache (php_sapi_mode=apache) dl() is enabled I only have FTP access server runs under linux Can I download sablotron.so somewhere an load it using dl() ??? Is there some PHP code that can transform XML using XSLT ??? (like http://www.dopscripts.com/doc/description.html) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CSS and Tables
Not IE friendly but you could always do table.table1trtd { css here; } IE will simply ignore it.. even if you set other rules that it _does_ understand. :) On Friday 09 December 2005 21:07, Curt Zirzow wrote: On Fri, Dec 09, 2005 at 09:16:32PM -0500, Michael B Allen wrote: This question is a little OT but no doubt everyone and their brother is generating tables here so heres my question. well, i try to only use tables when I present tabular data, i wonder mabey if i'm a cousin or something. And, yes, it is a bit OT. I'm a little frustrated with CSS. Sure I can define styles for TH, TD, and so on. But mildly sophisticated pages are buried in tables within tables. Specifying global styles for these tags is useless. Likewise I can define a class like: The thing is, well, consider how frustrating it was to make a complicated table of data. I think CSS appears to be complicated cause it has to interact with HTML in wich people tend to belive that HTML is too output: layout, markup, and presentation. HTML and CSS are two sperate languages. HTML/CSS is going/has been more leaning towards the concept of XML/XSLT. Where, the html (xml) is the data and the CSS (xslt) is how to present it. I always use this site to show the power of css and how html is rather unimportant for presentation but for data structure: http://www.csszengarden.com/ .t { font-size: small; border-bottom: 1px lightgrey solid; border-right: 1px lightgrey solid; } Anyway... Change the definition to: table.t td, table.t th { And Add: table.t th { text-align: left; } and add a class=t to EVER SINGLE TH and TD tag like: echo table cellpadding=\0\ cellspacing=\0\; Assign the class of 't' to the table. echo trtd class=\t\ID/tdtd class=\t\Username/tdtd class=\t\Name/tdtd class=\t\Email/tdtd class=\t\Options/tdtd class=\t\Date/td; techincally i would define these as th's they are headers for the data set. while ($row = mysql_fetch_row($result)) { echo trtd class=\t\$row[0]/td td class=\t\$row[1]/td td class=\t\$row[2]/td td class=\t\$row[5]/td td class=\t\$row[6]/td td class=\t\$row[7]/td tr/; and here you just have td HTH, Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CSS and Tables
On Friday 09 December 2005 21:53, Chris wrote: I believe, for IE (though I haven't tested it) this would work: table.table1 tbody tr td { css here; } How I wish this would work. it doesn't handle the parentchild at all. I've tested it. found it to be good to use to -fix- other problems. do a few css changes.. then fix it for the other browsers using this approach. I think IE assumes a tbody, even when there isn't one specified. table.table1 td { css here; } hmm.. never tried doing this approach before. thanks ;) Would also do fairly well, but , since this would apply to all tds within the table tag (even the cells of any embedded tables) may require some creative spefification of values to work properly Chris Stephen Leaf wrote: Not IE friendly but you could always do table.table1trtd { css here; } IE will simply ignore it.. even if you set other rules that it _does_ understand. :) On Friday 09 December 2005 21:07, Curt Zirzow wrote: On Fri, Dec 09, 2005 at 09:16:32PM -0500, Michael B Allen wrote: This question is a little OT but no doubt everyone and their brother is generating tables here so heres my question. well, i try to only use tables when I present tabular data, i wonder mabey if i'm a cousin or something. And, yes, it is a bit OT. I'm a little frustrated with CSS. Sure I can define styles for TH, TD, and so on. But mildly sophisticated pages are buried in tables within tables. Specifying global styles for these tags is useless. Likewise I can define a class like: The thing is, well, consider how frustrating it was to make a complicated table of data. I think CSS appears to be complicated cause it has to interact with HTML in wich people tend to belive that HTML is too output: layout, markup, and presentation. HTML and CSS are two sperate languages. HTML/CSS is going/has been more leaning towards the concept of XML/XSLT. Where, the html (xml) is the data and the CSS (xslt) is how to present it. I always use this site to show the power of css and how html is rather unimportant for presentation but for data structure: http://www.csszengarden.com/ .t { font-size: small; border-bottom: 1px lightgrey solid; border-right: 1px lightgrey solid; } Anyway... Change the definition to: table.t td, table.t th { And Add: table.t th { text-align: left; } and add a class=t to EVER SINGLE TH and TD tag like: echo table cellpadding=\0\ cellspacing=\0\; Assign the class of 't' to the table. echo trtd class=\t\ID/tdtd class=\t\Username/tdtd class=\t\Name/tdtd class=\t\Email/tdtd class=\t\Options/tdtd class=\t\Date/td; techincally i would define these as th's they are headers for the data set. while ($row = mysql_fetch_row($result)) { echo trtd class=\t\$row[0]/td td class=\t\$row[1]/td td class=\t\$row[2]/td td class=\t\$row[5]/td td class=\t\$row[6]/td td class=\t\$row[7]/td tr/; and here you just have td HTH, Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anyone getting bounces from
had about 15 in my inbox this morning :) On Wednesday 07 December 2005 08:36, Jay Blanchard wrote: [EMAIL PROTECTED] ? I am getting failure notices out the wazoo for some very old messages to the general list. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Class Constant PHP 5
Dynamically setting a constant would break the very rule of it being a constant in the first place. a constant is something that does not change it cannot be dynamic. On Wednesday 07 December 2005 12:00, Jeffrey Sambells wrote: is there a way to dynamically define a class constant during runtime in PHP 5? for example I would like to achieve the result of something like: class Example { const FOO = bar(); } However this would obviously give a parse error. I know it is possible with variables but I would like it to be a constant. Thanks. - Jeff ~~ Jeffrey Sambells Director of Research and Development Zend Certified Engineer (ZCE) We-Create Inc. [EMAIL PROTECTED] email 519.745.7374 office 519.897.2552 mobile ~~ Get Mozilla Firefox at http://spreadfirefox.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What software do you use for writing PHP?
KWrite part of KDE. Notepad with Syntax Highlighting and AutoIndention. And because it's part of KDE all the kioslaves come with. Which means editing sites over ftp, ftps, ssh and many others is possible. Like the Vim guy said. DEs? who needs them :) On Tuesday 06 December 2005 08:15, Jeff McKeon wrote: Hey all, Forever now I've been using Frontpage for all my web work including php. I'm sure there's better software out there that is more suited to writing and editing PHP pages. What do you all use? Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What software do you use for writing PHP?
As far as I can tell kate has a kwrite embedded :) I'm sure that's not the case but it seems like it. everything kwrite can do so can kate. only it has more options that I'd never used. And yes Code folding is nice don't use it much tho. On Tuesday 06 December 2005 09:48, David Grant wrote: Stephen Leaf wrote: KWrite part of KDE. Notepad with Syntax Highlighting and AutoIndention. And because it's part of KDE all the kioslaves come with. Which means editing sites over ftp, ftps, ssh and many others is possible. Like the Vim guy said. DEs? who needs them :) Mmmm, reminds me of Kate! When I use KDE, I used Kate for all non-PHP coding tasks, because it has great highlighting, and code folding too. :) Cheers, David Grant -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What software do you use for writing PHP?
Wow.. Linux must really be real then.. look at all the distributions , kernel patch sets, Window managers, etc./sarcasm # of programs means nothing. it's the quality of the programs. And yes I am a linux user ;) On Tuesday 06 December 2005 13:24, Jay Blanchard wrote: [snip] FlameBateAnd for those interested in using a real computer/FlameBate, it's GUI also runs under MacOSX. [/snip] If they are real why aren't there more of them? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How would you write this?
I personally would use javascript to evaluate the form and highlight the fields onsubmit. However as a backup I'd do the evaluating in php and add an error label under the field. echo td; if ($noPass) echo color='red'; echo Password/td; if ($noPass) echo td color='red'You must supply a password/td; Something along those lines. On Saturday 03 December 2005 21:00, Michael B Allen wrote: The following code works but I'm a little new to PHP and I'd like to know if there are better ways to achive the same thing. In the below form example, if the user supplies one or more fields but not all that are required, the form is redisplayed but fields that were supplied are prepopulated and the ones that are required but are missing are highlighted in red. Can anyone recommend a better technique or elighten me about features of the language that I've missed? Mike html body ?php $set = 0; $username = ; $password = ; if (isset($_POST['username'])) { $username = trim($_POST['username']); if (strlen($username) 0) { $set |= 0x01; } } if (isset($_POST['password'])) { $password = trim($_POST['password']); if (strlen($password) 0) { $set |= 0x02; } } if (($set 0x03) == 0x03) { echo Logging in with: . $username . ':' . $password; } else { ? form action=login.php method=post table trtd colspan=2Login:/td/tr trtdUsername:/td ?php if ($set != 0 ($set 0x01) == 0) { echo td bgcolor=\#ff\; } else { echo td; } echo input type=\username\ name=\username\ value=\ . $username . \/; ? /td/tr trtdPassword:/td ?php if ($set != 0 ($set 0x02) == 0) { echo td bgcolor=\#ff\; } else { echo td; } ? input type=password name=password/ /td/tr trtd colspan=2input type=submit value=Login//td/tr /table /form ?php } ? p/a href=login.phpclick me/a /body /html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Client-side file uploading
You can change values of the php.ini file within a .htaccess http://www.php.net/manual/en/ini.core.php For example. php_value upload_max_filesize 50M php_value post_max_size 50M On Sunday 27 November 2005 05:59, Ajree wrote: Errata: I don't know what I was thinking about when I wrote 'Apache' and 'httpd.conf'. It should be php.ini and upload_max_filesize option of course. Anyway it's not the point. I don't want to use this particular mechanism but make some kind of client-server application for uploading or use existing one. Any suggestions? Thanks in advance, Ajree -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A basic question
because the time.php is parsed by php before it's sent to the client. the time.html is not it's assumed to be a static webpage and just sent as-is to the client. On Sunday 27 November 2005 12:46, Oil Pine wrote: Hi, I am new to php scripting and would like to ask you a basic question. Could you kindly explain to me why time.php works but time.html does not? pine time.php -- ?php $serverdate = date(l, d F Y h:i a); print ($serverdate); print ( nbsp; p); ? - time.html --- !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; html head titleLocal Time/title meta name=GENERATOR content=Text Editor meta http-equiv=Content-Type content=text/html; charset=utf-8 /head body pThis is a test./p ?php $serverdate = date(l, d F Y h:i a); print ($serverdate); print ( nbsp; br); ? p/ppThis is the end./p /body /html --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question
On Sunday 27 November 2005 12:34, cheeto borje wrote: Hello, I wanna ask you about : 1. When you say server, does it mean my CPU? By CPU I assume you mean your computer and not the Central Processing Unit. being a CPU is the small chip inside your computer attached into the motherboard which every instruction gets sent to for processing. And yes a server is a computer. Technically what makes a server a server is the fact that it serves something. Take any computer out there say a 133MHz install a web server on it (apache) and boom you now have a server that serves webpages. 2. Do i have to buy a seperate server besides my computer CPU? No but generally it's recommended if your wanting good server performance and a unshakable uptime. By using the computer for every day you work you expose the server/computer to performance hits and possible program crashes that may also affect the underlaying OS. 3. Can i use the software to multiple web-domain that i will create and launch online? I assume you mean you want to be able to host websites from multiple domains and the answer is yes. Apache has that functionality and is well documented all over the place. 4. How will i be able store those data coming from the threads? You store them using those threads however you feel like it? I guess I don't really understand this question. 5. Can you provide a remote server to serve as a database? Php has support to connect to remote database servers yes. you may also run the database server locally to the server. I personally recommend PostgreSQL. Others I'm sure will recommend MySQL. Hoping for your kind response. Thank you. LOUIE - Yahoo! Music Unlimited - Access over 1 million songs. Try it free. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there an alternative for $_FILES['guildimage']['type'] == image/jpeg
I'd say because it's been depreciated. LXXVI. Mimetype Functions Introduction Warning This extension has been deprecated as the PECL extension fileinfo provides the same functionality (and more) in a much cleaner way. On Wednesday 23 November 2005 12:45 pm, Ben wrote: Curt Zirzow wrote: You should really consider using the fileinfo extension, or mabey even http://php.net/getimagesize. The ['type'] information can't be trusted to be what it says it is. Any reason why no one is suggesting the use of mime_content_type? http://ca.php.net/mime_content_type It seems to work well for me and there's no need to trust whatever the browser claims a file is or having to worry about different browsers inconsistently describing a mime type. - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there an alternative for $_FILES['guildimage']['type'] == image/jpeg
I use the fileinfo pecl. http://pecl.php.net/Fileinfo how to get a mime type: $info = new finfo( FILEINFO_MIME ); $mime = $info-file($filename); then my extention grabber: function getExtention() { switch ( $this-mimeType ) { case image/jpeg: return 'jpg'; break; case image/png: return 'png'; break; case image/gif: return 'gif'; break; default: throw new ImageTypeNotSupportedException(); } } This is all done in a Image Object. On Tuesday 22 November 2005 08:15 pm, twistednetadmin wrote: I use this line in a script for uploading pictures to a website: $_FILES['guildimage']['type'] == image/jpeg This works fine when using Mozilla, but it doesn't work with IE. How should I do it to get it working with both/all browsers? if (isset($_POST['submit']))//If you press submit { $sysfolder=/guildimages/; $filename=.$_FILES['guildimage']['name'].; if (file_exists($sysfolder . $filename)) //And the file exists or there is no file chosen { echo Filename exists or no file selected. Please rename the file or select a file; } elseif ($_FILES['guildimage']['type'] == image/jpeg) //If the filetype is correct (this is where the change should be I think) { copy ($_FILES['guildimage']['tmp_name'], /guildimages/.$_FILES['guildimage']['name'])//Copy the file to folder (/guildimages) or die(Could not copy file); //Or die echo Result:br\n; echo Filename: .$_FILES['guildimage']['name'].br\n; echo Filesize: .$_FILES['guildimage']['size']. bytebr\n; echo Filtype: .$_FILES['guildimage']['type'].br\n; echo Congrats! It worked!\n; } else { echo Result:br\n; echo Now that didn't seem to work... br\n Have you checked the size and filetype? br\n File that failed-- (.$_FILES['guildimage']['name'].)br; } } Does anyone know the answer to this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there an alternative for $_FILES['guildimage']['type'] == image/jpeg
The reason why I suggested the fileinfo idea was because IE and mozilla report the mime type differently. image/x-jpeg vs image/jpeg I believe it is. using fileinfo just standardizes what you need to check for. On Tuesday 22 November 2005 09:56 pm, twistednetadmin wrote: I don't think that is quite what I'm after... I have restriction on only jpg images and filesize 300kb. The problem I have is that the IE browser doesn't recognize a =300kb jpg mage as a valid file while Mozilla do. The switch statement though seems interesting. Not sure how I should use it in this case. The fileupload is just a simple form with a browsebutton. I am not trying to get more fileinfo or anything like that. Only to get IE to understand that it actually IS a valid file and then upload it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: please shed some light on SQLsyntax error
I believe it's proper SQL syntax to use a double quote tho for column names. I've heard of backtick working.. but in any example I've ever seen both in classes and on mysql and postgresql sites they always use I don't use `` so I'm not sure how widely they are accepted. Just ran a test in sqlite and postgresql `` are not accepted. On Sunday 13 November 2005 06:31 pm, Jasper Bryant-Greene wrote: Bruce Gilbert wrote: for the table name you mean like this? $table_name = 'Contact List' ; No, backticks. I gave an example of the backtick in my email (in brackets). It is on the same key as the tilde, and looks like this: ` Also, I would probably left $table_name as it was and put the backticks in the SQL statement, like this: $sql = INSERT INTO `$table_name` values ('', '$_POST[f_name]', [...] Jasper On 11/13/05, Jasper Bryant-Greene [EMAIL PROTECTED] wrote: Bruce Gilbert wrote: You would need to show us the SQL that was causing that error. Otherwise it is fairly meaningless. hope this helps... ? //check for required form variables if ((!$_POST[f_name]) || (!$_POST[l_name])) { Unrelated, but you should have quotes here. Like $_POST['f_name'] header(Location:http://www.inspired-evolution.com/show_addcontact.php; ); There should also probably be a space between the : and the start of the URL here. exit; }else { //if form variables are present,start a session session_start(); } //check for validity of user if ($_SESSION[valid] != yes) { Again, quotes on the array subscript. header(Location:http://www.inspired-evolution.com/contact_menu.php;); And space between colon and URL here. exit; } //set up table and database names $db_name =bruceg_contactlist; $table_name =Contact List; //connect to server and select database $connection = @mysql_connect(69.90.6.198,database_username,password) or die(mysql_error()); $db = @mysql_select_db($db_name,$connection) or die(mysql_error()); //build and issue query $sql = INSERT INTO $table_name values ('', '$_POST[f_name]', You'll be wanting to put backticks (`) around the table name, because it contains a space. Jasper -- ::Bruce:: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php session in ie
For security.. *never* store the password in a cookie.. if you must... instead do some sort of encryption on it and some other value store that and use it for verification. On Friday 11 November 2005 05:43 am, sunaram patir wrote: Hi, i am having problem with internet explorer. i am working on a project on building a website where i need to keep track of the users i.e. i use a login system in there in short. with the following code i check whether the user is logged in or not. ?php session_start(); $_SESSION['myurl']=$_SERVER['PHP_SELF']; if(!isset($_SESSION['student_username']) !isset($_SESSION['student_password'])) header(Location: login.php); ? if the user is not logged in, it redirects to the login page login.php as is shown in the above code. now the user is allowed to log in through the following code: ?php session_cache_limiter('private_no_expire'); session_set_cookie_params(0,/,schools.zenrays.com); session_start(); $auth=false; if($auth){ $_SESSION[student_username]=$Effectivelogin; $_SESSION[student_password]=$pass; if(isset($_SESSION['myurl'])) header(Location: http://schools.zenrays.com.$_SESSION['myurl']); else header(Location: http://schools.zenrays.com/students;); } it works fine in firefox and msn explorer. in internet explorer, when i visit to a link in any page it asks for the login details again. could anyone please help me out?! regards, sunaram -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php session in ie
if it's a risk then it's in my never get into the practice of doing this category. Passwords should always be used to verify and discarded. never saved in any form which can be seen directly or decoded. And true $_SESSION isn't a cookie.. however there are some systems that a cookie is used like a session. in both cases I'd personally feel uneasy storing a password like that. On Friday 11 November 2005 12:23 pm, Richard Lynch wrote: He's not storing the password in a Cookies. He's storging it in a $_SESSION Which is still a Risk, especially on a shared server, but it's not necessarily in the category of Never do this On Fri, November 11, 2005 9:48 am, Stephen Leaf wrote: For security.. *never* store the password in a cookie.. if you must... instead do some sort of encryption on it and some other value store that and use it for verification. On Friday 11 November 2005 05:43 am, sunaram patir wrote: Hi, i am having problem with internet explorer. i am working on a project on building a website where i need to keep track of the users i.e. i use a login system in there in short. with the following code i check whether the user is logged in or not. ?php session_start(); $_SESSION['myurl']=$_SERVER['PHP_SELF']; if(!isset($_SESSION['student_username']) !isset($_SESSION['student_password'])) header(Location: login.php); ? if the user is not logged in, it redirects to the login page login.php as is shown in the above code. now the user is allowed to log in through the following code: ?php session_cache_limiter('private_no_expire'); session_set_cookie_params(0,/,schools.zenrays.com); session_start(); $auth=false; if($auth){ $_SESSION[student_username]=$Effectivelogin; $_SESSION[student_password]=$pass; if(isset($_SESSION['myurl'])) header(Location: http://schools.zenrays.com.$_SESSION['myurl']); else header(Location: http://schools.zenrays.com/students;); } it works fine in firefox and msn explorer. in internet explorer, when i visit to a link in any page it asks for the login details again. could anyone please help me out?! regards, sunaram -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] form question??
I wrote a xsl stylesheet to do this. takes the xml and whips it up, into a standard layout. Don't believe I mentioned this but I might have at some point. Register example: formData formTitle=Register action=/ method=post captionThank you for Registering!/caption fields field type=hidden var=register default=yes/ field type=text title=Login name var=name required=yes len=50 maxlength=50/ field type=password title=Password var=passwd required=yes len=50/ field type=text title=E-Mail var=email required=no len=50/ field type=checkbox title=Show Email var=Show Email required=no default=yes/ field type=submit title=Register / /fields /formData On Monday 07 November 2005 12:24 pm, bruce wrote: hi... a while ago, i saw an app that allowed the user to create a form, based on various fields, and to setup/create the database schema to create the form. the app provided the user with predefined fields, as well as allowed the user to define their own fields in order to create the form. unfortunately, i can't seem to find this app, or any other app that would allow me to do this. can anybody point me towards an app that could/would do this? thanks -bruce [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Template style question
One idea that you might try. is XSL. instead of doing %var1% and doing a replace. you can do things like xsl:value-of select=var1/ Doing this also completely separates presentation logic from the code. you can do other fun things like loops also. I will warn you by saying that XSL in the beginning is a real headache to figure out. but after you get things down, it's very nice. I currently have things in my sites setup to init an Object that when echo'd will do the XSL translation for me. After that all I do is gather the data into an XML document and stylize it. Simplifies websites considerably. Gather the data you need... stylize it how you want it.. and if you want to swap out the entire layout on the fly. On Saturday 05 November 2005 01:10 pm, Leonard Burton wrote: Greetings, HI All, I hope all is well. I have set up a template parser. Basically, it parses the template and finds tags with tag_name.dat file and then includes the tag_name.dat file. I have considered a few other options but as of now I think I like what I have come up with. The only problem that I have in my design is that I have to hard code tables in the dat file mixing php and html. I would prefer to be able to do something like: [[tag with db query]] table trtdcolname/tdtdcolname/tdtdcolname/td/tr trtd%var1%/tdTd%var2%/tdtd%var3%/td/tr /table [[/tag with db query]] I would like it to be able to parse the line with the %var1% (which is the column name with % or some other indicator on each side) in it and then have it generate how many ever rows as nessecary. Currently, my parsing engine loads the template, preg_splits() it so each template tag is on a new line, and then passes through the resulting array and executes the code for whatever tag is chosen. There are a couple ideas that I have thought of but have not thought of any real good way so I am turning to the list. Thanks for all of your help on this list! -- Leonard Burton, N9URK [EMAIL PROTECTED] The prolonged evacuation would have dramatically affected the survivability of the occupants. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple CopyOf XSLT translation
Last I checked XHTML *is* HTML only with my stricter rules applied. most notably the XML rules. XHTML is a stricter and cleaner version of HTML. -- W3C XHTML tutorial. (http://www.w3schools.com/xhtml/default.asp) As for using PHP to transform the XSL. I've been doing this with a lot of success for around a year. All my php scripts do anymore is generate the XML needed to be stylized by the XSL. which of course is done prior to being echo'd I found this site to be very useful while learning XSL. http://www.w3schools.com/xsl/xsl_w3celementref.asp Keep in mind tho a lot of the XPath functions are still not implemented in PHP. you will have to implement these in PHP and then tell PHP's XSL transformer to use PHP functions. On Wednesday 02 November 2005 04:42 am, Andy Pieters wrote: Hi list I made an entire site in xhtml for a client but now complaints are comming from the m$ explorer front. Broken layouts, long loading times etc. Would it be possible for php to do the xslt translation? All that is currently in my xslt is stylesheet template match=/ copy-of select=. / /template /stylesheet And serve those pages as html 4.01 instead of xhtml on internet explorer? With kind regards Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fopen
if all you want to do is read the entire file try $contents = file_get_contents($filename); On Tuesday 25 October 2005 11:54 pm, John Taylor-Johnston wrote: It does what I want, but I worry 4096 may not be big enough. Possible? Is there a way to detect the filesize and insert a value for 4096? $buffer = fgets($dataFile, $filesize); Is this what it is for? John ?php #http://ca3.php.net/fopen $filename = /var/www/html2/assets/about.htm ; $dataFile = fopen( $filename, r ) ; while (!feof($dataFile)) { $buffer = fgets($dataFile, 4096); echo $buffer; } $sql = insert into table ... $buffer; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OOP Newbie - why does this not work?
would have to be. http://smileaf.org/bob.php as you can see it's working great. did make few more changes: class Test { public $saying = ; function __construct() { $this-saying = I'm in the Test Class. ; } function get() { return $this-saying ; } } when accessing a class variable _always_ in php use $this- On Friday 21 October 2005 04:42 am, Bob Hartung wrote: Stephen, I copied your code and ran it. Same thing - a totally blank page. Therefore I have to surmise that there is a a) bug in the rpm I downloaded or more likely b) I have a conf setting wrong. I will investigate further -- boy oh boy what a way to start! Every line of code is a new chance to learn. Thanks again, Bob snip all before -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OOP Newbie - why does this not work?
Try removing the /* and */ Other than that, check your brackets. you never closed the get() function's On Thursday 20 October 2005 09:35 pm, Bob Hartung wrote: Hi all, I'm trying to get started in OOP with PHP. I have the following short code snipped. I'f I comment out the 'class Test' definition and the following references to it, it prints This is outside the php code block and Start defining the class here: If I do not comment out the code as noted, then the page returned is totally blank. It does this with or without using the constructor. PHP 5 on apache. Same behavior both on Win32 and FC4. All help appreciated to get me going. Code Snippet: html head titlePHP Class testing/title /head body br PThis is outside the php code block/P br ?php echo Start defining the class here: BR ; /* class Test { function __constructor() { var $saying ; $saying = Im in the Test Class ; } function get() { return $saying ; } var $liveclass ; $liveclass = new Test ; echo $liveclass-get() ; echo BR ; echo This is in the php code block ; */ ? /body /html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OOP Newbie - why does this not work?
Sorry.. 1 more thing. php5 does not use var. use public $variable=value; instead. public is only within a class however. you cannot use it outside. On Thursday 20 October 2005 09:35 pm, Bob Hartung wrote: Hi all, I'm trying to get started in OOP with PHP. I have the following short code snipped. I'f I comment out the 'class Test' definition and the following references to it, it prints This is outside the php code block and Start defining the class here: If I do not comment out the code as noted, then the page returned is totally blank. It does this with or without using the constructor. PHP 5 on apache. Same behavior both on Win32 and FC4. All help appreciated to get me going. Code Snippet: html head titlePHP Class testing/title /head body br PThis is outside the php code block/P br ?php echo Start defining the class here: BR ; /* class Test { function __constructor() { var $saying ; $saying = Im in the Test Class ; } function get() { return $saying ; } var $liveclass ; $liveclass = new Test ; echo $liveclass-get() ; echo BR ; echo This is in the php code block ; */ ? /body /html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OOP Newbie - why does this not work?
Here is the working code You had __constructor() it's __construct() notice I also moved your saying declaration outside of the constructor. this is to make it a class level variable. the way that you had it set it was only in scope until you finished the construct code. I guess I was wrong about the var bit. I do remember having lots of issues with it back a few months ago. perhaps theses were fixed in newer versions. most likely var is depreciated in php5. (can someone confirm this?) html head titlePHP Class testing/title /head body br/ pThis is outside the php code block/p br/ ?php echo Start defining the class here: br/ ; class Test { public $saying = ; function __construct() { $saying = Im in the Test Class ; } function get() { return $saying ; } } $liveclass = new Test ; echo $liveclass-get() ; echo br/ ; echo This is in the php code block ; ? /body /html On Thursday 20 October 2005 09:53 pm, Bob Hartung wrote: Changed to: var $saying ; public $saying = . Again, blank page. Funny though, even the title.../title html block is not rendered. Again, same beavior on 2 FC4 and 1 Win32 install. Tnx Bob Stephen Leaf wrote: Sorry.. 1 more thing. php5 does not use var. use public $variable=value; instead. public is only within a class however. you cannot use it outside. On Thursday 20 October 2005 09:35 pm, Bob Hartung wrote: Hi all, I'm trying to get started in OOP with PHP. I have the following short code snipped. I'f I comment out the 'class Test' definition and the following references to it, it prints This is outside the php code block and Start defining the class here: If I do not comment out the code as noted, then the page returned is totally blank. It does this with or without using the constructor. PHP 5 on apache. Same behavior both on Win32 and FC4. All help appreciated to get me going. Code Snippet: html head titlePHP Class testing/title /head body br PThis is outside the php code block/P br ?php echo Start defining the class here: BR ; /*class Test { function __constructor() { var $saying ; $saying = Im in the Test Class ; } function get() { return $saying ; } var $liveclass ; $liveclass = new Test ; echo $liveclass-get() ; echo BR ; echo This is in the php code block ; */ ? /body /html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is DOM the right thing for the job?
On Thursday 13 October 2005 12:30 am, Chris wrote: Snag #1) The DOMDocument seems to represent an entire page, all I'd like to do is represent a Form tag and it's internal HTML. I can actually get it to work that way, but it seems like it's the wrong way to go about things. being how XML works you can only have 1 Document Node. So I don't see how this would be an issue. You can however create a form DOM Element. it will be associated with the document node however again you can't really have more than 1 to begin with so? Snag #2) The creation of a DOMElement object is very limited without being associated with a DOMDocument, I'd like to create an independent DOMElement inside the Element class, including possible sub-DOMElements, without having to create the DOMDocument in the Form object.. Why? I don't see any reason to have an Element be separate from the main Document? Even tho it will be associated with that Document. you still have full access as to where it goes. you could even make that form the main node. $form = DOMDocument('form'); I realize after writing this that these don't seem like very serious snags, but I jsut dont' have a fuzzy feeling about the way this would work if I implemented it knowing what I've stated here. Any assistance would be greatly appreciated. Thanks! Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with Javascript:...submit()
On Thursday 13 October 2005 01:13 am, Johan Grobler wrote: while ($row = mysql_fetch_array($sql_result)) { echoForm name=\.$row['LITERATURE_title'].\ action=\searchlit.php\ method=\post\ font face=\arial\ size=\2\ a href=\javascript:.$row['LITERATURE_title']..submit();\ .$row['LITERATURE_title']. - .$row['res_fname']. .$row['res_lname']./a ... Everything works as long as $row['LITERATURE_title'] is one word, see this variable contains the names of books, and if the books name is Heaven for instance it works fine but as soon as the title is something like PHP for Dummies it doesnt work and i get a error on page message, I tried using numbers as the form name but then the same thing happens. Another way you can access these is by using this function. document.getElementByName('name'); or document.getElementById('id'); As I recall w3 sees ByName as standard but Mozilla(and many others) only support ById, the last time I checked. Any ways around this? thanx Disclaimer This e-mail transmission contains confidential information, which is the property of the sender. The information in this e-mail or attachments thereto is intended for the attention and use only of the addressee. Should you have received this e-mail in error, please delete and destroy it and any attachments thereto immediately. Under no circumstances will the Cape Peninsula University of Technology or the sender of this e-mail be liable to any party for any direct, indirect, special or other consequential damages for any use of this e-mail. For the detailed e-mail disclaimer please refer to http://www.ctech.ac.za/polic or call +27 (0)21 460 3911 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] outputting xml with DOM and ampersands
On Wednesday 12 October 2005 12:40 pm, jonathan wrote: I am trying to output a file using DOM with php5. It gives me an error with something like the following: item_namefarm lettuces with reed avocado, cregrave;me fraicirc;che, radish and cilantro/item_name Are you doing a: DOMDocument::loadXML('item_namefarm lettuces with reed avocado, cregrave;me fraicirc;che, radish and cilantro/item_name'); You may have to manually convert the to amp; tho I thought it did an automatic convertion. It does have the encoding set to utf-8. When I switch it to utf-16, it gives me an error on the $dom-saveXML(); Any ideas about how to fix this? -jonathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Obsession with BC
On Tuesday 11 October 2005 01:56 pm, GamblerZG wrote: On the final hand, if you pass the pages off from apache to a php exe or module.. How does Apache know which one to pass it to? Php4 or Php5? By the processing instruction target. That's what it's there for. I guess php 5 and 4 are not the best examples, since php5 already uses '?php' PITarget. Let's say '?php6' means PHP6, and '?php' means 4/5. If I have both php4 and php5 code in a page should i run both sections or only the sections listed for php5(if it's on php5)? You shouldn't run any sections, and give an error. The whole point is to separate different versions of the language instead of mixing them. Do you know a lot of scripts which use features specific to both php4 and php5? I don't. And it's an awful practice anyway. I personally know that my code will break if ran on php4. This is not because I have bad practices. it's because I choose to use the better functions of php5 verse the older and not so good functions of php4. specifically I am talking about the XSL and DOM functions. I also know that I had to update my php4 scripts because they removed the older functions in php5. this again is not bad practice it was using the available functions in php4 and the devs removing them in 5. http://www.php.net/manual/en/ref.xslt.php http://www.php.net/manual/en/ref.xsl.php right there you have examples of how 4 scripts break in 5 and 5 breaks in 4. anyone who uses/used these functions is stuck in 1 version or the other. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and XML
On Wednesday 05 October 2005 06:20 pm, [EMAIL PROTECTED] wrote: My company recently installed google's search appliance and I am working on some scripts to display the search results on our various websites. The problem I'm having is using the XML parsing functions I've used on other pages is not working because the returned XML has invalid xml characters in it. For example, the data between the xml tags include html tags that are supposed to be displayed. But when I parse the xml, the parse sees these tags as new start tags. Is there a way to work around this or a different way to parse this document? I've heard a little about XSLT really don't know anything about it and am wondering if that is the way to deal with it? XSL can display the contents using a xsl:copy-of select=node/ bear in mind tho that it also copies the node name. example: nodecopied stuffbr//node copying only the inner content can be achieved by doing a select=. however you'll need to have the current node be the one that you want copied. this can be done by using a xsl:for-each select=node xsl:copy-of select=./ /xsl:for-each If anyone else knows of a better way _please_ let me know :) When working with XML and going to HTML .. IMO XSL is the best way to accomplish it. Here is a part of the XML returned by the google appliance: GSP VER=3.2 TM0.008398/TM Qinformation services/Q PARAM name=q value=information services original_value=information+services/ PARAM name=site value=shpolicy original_value=shpolicy/ PARAM name=client value=shpolicy original_value=shpolicy/ PARAM name=output value=xml_no_dtd original_value=xml_no_dtd/ PARAM name=btnG value=Google_Search original_value=Google+Search/ PARAM name=ip value=10.2.4.44 original_value=10.2.4.44/ PARAM name=access value=p original_value=p/ - RES SN=1 EN=10 M86/M FI/ - NB - NU /search?q=information+servicessite=shpolicyhl=enoutput=xml_no_dtdclient =shpolicyaccess=psort=date:D:L:d1start=10sa=N /NU /NB - R N=1 MIME=application/pdf - U http://shpolicy.shservices.org/administrative/InformationServices/housewide applicable/Information%20Services%20Software%20Purchasing%20Policy.pdf /U - UE http://shpolicy.shservices.org/administrative/InformationServices/housewide applicable/Information%2520Services%2520Software%2520Purchasing%2520Policy.p df /UE - T bInformation/b bServices/b Software Purchasing /T RK5/RK FS NAME=date VALUE=2005-09-07/ - S b.../b Administrative Housewide Policy bInformation/b bServices/b Software Purchasing Applicablebr Campus: Salem and West Valley Hospitals Department Name: bInformation/b b.../b /S - HAS L/ C SZ= CID=4_wracnOVC8:/ /HAS /R I can send the parsing code but it's fairly straight forward and I didn't want to needlessly fill up the email. Any suggestions? Thanks, Robbert van Andel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and XML
On Wednesday 05 October 2005 09:46 pm, Robbert van Andel wrote: Thanks, I'm investigating XSL and it looks pretty good. We use an RPM based installation of PHP version 5.0.4. I see on PHP.net's website that XSL comes standard with PHP 5 and you need to enable it by adding the argument --with-xsl to the configure line. How do I do this when we did not build PHP from source? Is there another way to get XSL activated? Compiling it from source will be your best choice. If you have a test server compile it there and create the rpm. then install on the production server. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] domit and XML
On Tuesday 04 October 2005 12:42 am, Erik Barba wrote: hi im new in the list i dont know where to write the email so i did it here, i am having a problem I have a xml file and im parsing with domit 1.0 but im from mexico, and we use é í ó ú á ñ the xml acept it but when the php show the code in html, i cant see the letters Some characters are encoded. I've never used domit but I have used php5's DOM. http://us2.php.net/manual/en/ref.dom.php To get them back to the characters simple run it through htmlspecialchars_decode http://us2.php.net/manual/en/function.htmlspecialchars-decode.php If your still using PHP4 use this instead. function htmlspecialchars_decode_PHP4($uSTR) { return strtr($uSTR, array_flip(get_html_translation_table(HTML_ENTITIES, ENT_QUOTES))); } I've not personally tested it but it's found on that page. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Warning: Cannot send session cookie
On Tuesday 04 October 2005 08:15 pm, John Taylor-Johnston wrote: Any idea why I'm getting this error, and only on this page? I have the same header on every other page? http://testesp.flsh.usherb.ca/thingstodo.html The page contains a \n before I start my ?php. Is this doing it? yup ?php session_name( 'CCLTrolley' ); session_start(); // Initialize the trolley. if( !isset( $_SESSION['TrolleyContents'] ) ) { $_SESSION['TrolleyContents'] = array(); } ? Warning: Cannot send session cookie - headers already sent by (output started at /var/www/html2/thingstodo.html:2) in /var/www/html2/thingstodo.html on line 4 Warning: Cannot send session cache limiter - headers already sent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error with DOMDocument-saveXML()
On Thursday 29 September 2005 04:20 am, Andy Pieters wrote: Hi bFatal error/b: Method Document::__toString() must return a string value in b/srv/www/localhost/htdocs/db/index.php/b on line b140/bbr / That's just what it says, check your program flow. You overrided the tostring function and somewhere in that new function you jump out of it because of a flag that is set, and thus not returning anything, which is equal to return null. I'd love to say that is possible however it's not. function __toString() { # Transform... if (!$this-outXML) { $XSlt = new xsltprocessor(); $XSlt-registerPHPFunctions(); $XSlt-importStyleSheet(DomDocument::load($this-style)); return $XSlt-transformToXML($this-Dom); } else { return $this-Dom-saveXML(); } } As you can see there is nothing that could make it jump out. very straight forward and all cases handled via else. The line: return $this-Dom-saveXML(); is somehow returning null. Thank you for the advice on how to enable notices. being I always include my Document script I just added error_reporting(E_ALL); to the top. Sadly I'm getting no Notices about my problem. Am getting 1 notice but nothing of any interest -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error with DOMDocument-saveXML()
On Thursday 29 September 2005 09:37 am, Scott Fletcher wrote: It is just that not many work with XML often enough to know well enough how to use it. I noticed many folks have different way of using XML that doesn't best fit our need. It is a newer idea of how to do things. I have this same problem as well. So, you're not the only one here as I have this same problem as well. Glad I'm not in this boat alone! I almost have a sneaky suspicion that it has something to do with the __toString() I've noticed in the past I couldn't do somethings that I normally could do in custom functions. think it had something to do with constants but then that was when I didn't have much experience with php5 objects so it's very likely that was just stupidity on my behalf. Not played around with it too much since then however. So I guess nows a better time than ever. hopefully I can duplicate this behavior in a smaller class that I can just post to the list. Stephen Leaf [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Thursday 29 September 2005 04:20 am, Andy Pieters wrote: Hi bFatal error/b: Method Document::__toString() must return a string value in b/srv/www/localhost/htdocs/db/index.php/b on line b140/bbr / That's just what it says, check your program flow. You overrided the tostring function and somewhere in that new function you jump out of it because of a flag that is set, and thus not returning anything, which is equal to return null. I'd love to say that is possible however it's not. function __toString() { # Transform... if (!$this-outXML) { $XSlt = new xsltprocessor(); $XSlt-registerPHPFunctions(); $XSlt-importStyleSheet(DomDocument::load($this-style)); return $XSlt-transformToXML($this-Dom); } else { return $this-Dom-saveXML(); } } As you can see there is nothing that could make it jump out. very straight forward and all cases handled via else. The line: return $this-Dom-saveXML(); is somehow returning null. Thank you for the advice on how to enable notices. being I always include my Document script I just added error_reporting(E_ALL); to the top. Sadly I'm getting no Notices about my problem. Am getting 1 notice but nothing of any interest -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error with DOMDocument-saveXML()
On Thursday 29 September 2005 12:26 pm, Stephen Leaf wrote: I have figured it out! My guess couldn't have been more _wrong_. Here is all you need to recreate the Error. There is only 1 value that is off. in the DOMDocument I gave it the wrong encoding type. uft-8 .. it should read utf-8. Interesting that PHP doesn't tell you about a bad encoding type. ?php class test { private $Dom; function __construct ($rootName) { $this-Dom = new DOMDocument('1.0', 'uft-8'); $this-Dom-appendChild($this-Dom-createElement($rootName)); } function __toString() { return $this-Dom-saveXML(); } } $test = new test(test); echo $test; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Error with DOMDocument-saveXML()
Ok how I have things set up is I have a Document Object which when instantiated creates a root element and adds it to the DOM object. After that all population of this node is done on the requested page. When I'm done populating I output my header()'s and then echo my Document Object. I've overridden the __toString() method. Once here it does 1 of 2 things. Transform via XSL or just dump the XML via saveXML() to do this either I do a: $this-outXML = isset($_GET['xml']); This makes it so on any page I can add a ?xml and get the raw untransformed XML. So first I don't have that switch on and I get my fully populated website nicely done up by XSL. Then I throw that switch on and I get: br / bFatal error/b: Method Document::__toString() must return a string value in b/srv/www/localhost/htdocs/db/index.php/b on line b140/bbr / which is very interesting because as I just said the transform via XSL was done just fine which proves that I do in fact have a fully populated node. So thinking I might have made an error with that ?xml switch I check my code over.. everything is in order but for the sake of testing I commented out the transformXML line and paste my return saveXML line refresh... same error. So now we know that there is nothing wrong my ?xml switch. So now it could still be the method saveXML(). I've not tested this functionality of my site in a while I did recently upgrade to 5.0.5 I'm not positive but I'm pretty sure it's worked since then tho. But anyway to test the method I did a: $this-Dom = DOMDocument::loadXML(aasdf/a); echo $this-Dom-saveXML(); // Same line that's always been there. and it works. So the function does work... Now what? Is there anything else I can try? could this be a PHP bug? I am completely confused on what is going on... I've not checked my E_NOTICE's yet.. actually not quite sure how to turn these on, on a per site basis (if that's even possible.) I'll take even a server wide solution if it means getting more on how to fix this. I'd figure this part out myself but I'm due to get off to work in... -4 mins (or 4 mins ago :)). Thanks, Stephen Leaf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Subtracting dates w/o database interaction (MySQL)
$date = mysql date field 2005-09-23 for example $difference =ceil((strtotime($date) - time()) / 86400); strtotime is far nicer than mktime when you already have a date field ready. On Friday 23 September 2005 03:10 pm, Philip Thompson wrote: On Sep 23, 2005, at 11:16 AM, Chris W. Parker wrote: Philip Thompson mailto:[EMAIL PROTECTED] on Friday, September 23, 2005 9:12 AM said: I'm needing to find the number of days between two dates without using an database functions (DATE_SUB, etc)... only PHP. Is there an easy way to accomplish this? I have searched the PHP site, but have not been successful in finding anything that will assist me. Any help would be appreciated. There might be an easier way but... convert to timestamp, subtract smaller number from bigger number, figure out how much time has passed. Chris. I actually discovered how to do this right after I made the post. I looked at some archives and worked this out. code // today - 9/23/05 $start = mktime(0, 0, 0, date(m), date(d), date(Y)); // the objective day - 3/15/06 $end = mktime(0, 0, 0, 3, 15, 2006); // subtract today from the objective and divide by 24*60*60 to get days $difference = ceil(($end - $start) / (86400)); /code Thanks for your assistance. ~Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with headers
On Thursday 22 September 2005 12:10 am, David Robley wrote: Not sure if you can attach files however to make 100% sure I'm attaching a working copy of your script. I did modify it just a bit. However the code that you gave us initially worked flawlessly under CLI PHP. Graham Anderson wrote: I checked that too :( No spaces in the ?php line I am running PHP Version 4.4.0 Out of curiosity, I removed the line: $xml .= '?quicktime type=application/x-qtskin?'.\n; and got the same error message Is this one of those situations for ob_start ? Kind of bizarre to my Newbie mind ?php $quote = \; $xml = ''; $xml .= '?xml version=1.0?'.\n; $xml .= '?quicktime type=application/x-qtskin?'.\n; $xml .= 'skin'.\n; $xml .= 'movie src=' . $quote. ../../fonovisa.mov . $quote. '/'.\n; $xml .= 'contentregion src=' .$quote. ../images/mask.gif . $quote. '/'.\n; $xml .= 'dragregion src=' . $quote. ../images/drag.gif . $quote. '/'.\n; $xml .= '/skin'; header('Content-Type: video/quicktime'); header (Content-Length: .strlen($xml)); echo $xml; ? I am still getting the : bWarning/b: Cannot modify header information - headers already sent by (output started at /home/www/siren/siren/fonovisa/skintest/Library/php/ fonovisa_simple.php:1) in b/home/www/siren/siren/fonovisa/skintest/Library/php/ fonovisa_simple.php/b on line b12/bbr / Actually, I think it might be something quite unexpected. Try commenting out the two calls to header, then run the script and do a 'view source'. My guess is there is a syntax error message being output which will of course cause header to bleat. My second guess is that the syntax error will be caused by line 2 (but won't appear in that line) $quote = \; which may not be doing what you hope it is. The solution for this is left as an exercise for the student :-) Cheers -- David Robley The most expensive component is the one that breaks. a.php Description: application/php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] security/sql issues with php
On Wednesday 21 September 2005 07:45 pm, bruce wrote: i agree with what you're saying... my primary concern was to make sure that there wasn't/isn't something going on that i haven't seen... up to know, i'm ok with what you're saying. however, i still don't have a good answer to my question regarding how easy (or hard) it is to detect if a query that should have originated with your app's form is coming from a 3rd party/external site? am i missing something here? I think it'd be good to point out here that you cannot trust the referral sent by the browser. usually yes it's correct however some browsers do not send this. plus it can be spoofed. so validating where it came from shouldn't really be a thing to consider, because you cannot validate this reliably. What _does_ matter however is the actual data we got. -bruce -Original Message- From: Chris Shiflett [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 21, 2005 5:27 PM To: [EMAIL PROTECTED] Cc: 'Robert Cummings'; 'Mikey'; 'PHP Mailing Lists' Subject: Re: [PHP] security/sql issues with php bruce wrote: but in all honesty, if you're going to write an app, and you're going to do something with the data, it makes sense to me that you 'know'/ensure that you're dealing with the correct kind of data. as i see it, this allows you another way (low entropy) to determine that the information you're getting is correct/valid. Sure, but it's easy to make a mistake. Previously, you made this statement: the app could do something like $_GET['username'] = reg_check($_GET['username']) Even if reg_check() does a perfect job of filtering the data (I'm guessing it returns FALSE if the data is invalid), this practice heightens the risk of making an error, becuse you can have code like this: echo $_GET['username']; Is that a XSS vulnerability? Any security-conscious developer should scream at such code, so by placing filtered data back into an array that contains only tainted data deteriorates a developer's suspicion of any data within $_GET, $_POST, etc. In other words, I think the sheer volume of XSS vulnerabilities out there demonstrates that it's far too easy to mistakenly trust and use tainted data. Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http://brainbulb.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] Problems with headers
On Wednesday 21 September 2005 09:34 pm, Graham Anderson wrote: it doesn't look like there is anything wrong with your code. what you might check however is, is there a space or a newline before ?php _nothing_ should come before ?php thanks Chris :) I changed the spaces but am still getting the same output errors: bWarning/b: Cannot modify header information - headers already sent by (output started at /home/www/siren/siren/fonovisa/skintest/Library/php/ fonovisa_simple.php:1) in b/home/www/siren/siren/fonovisa/skintest/Library/php/ fonovisa_simple.php/b on line b11/bbr / br / bWarning/b: Cannot modify header information - headers already sent by (output started at /home/www/siren/siren/fonovisa/skintest/Library/php/ fonovisa_simple.php:1) in b/home/www/siren/siren/fonovisa/skintest/Library/php/ fonovisa_simple.php/b on line b12/bbr / Because I am echoing the $xml string AFTER the header info, I would assume the headers would work ? Is there some way to ensure that the headers come first ? many thanks g ?php $quote = \; $xml = ''; $xml .= '?xml version=1.0?'.\n; $xml .= '?quicktime type=application/x-qtskin?'.\n; $xml .= 'skin'.\n; $xml .= 'movie src=' . $quote. ../../fonovisa.mov . $quote. '/'.\n; $xml .= 'contentregion src=' .$quote. ../images/mask.gif . $quote. '/'.\n; $xml .= 'dragregion src=' . $quote. ../images/drag.gif . $quote. '/'.\n; $xml .= '/skin'; header('Content-Type: video/quicktime'); //took out a space header (Content-Length: .strlen($xml)); // added a space echo $xml; ? On Sep 21, 2005, at 7:25 PM, Chris Shiflett wrote: Graham Anderson wrote: Even though I am defining Content-type as 'video/quicktime', the output is still text/html Also, Content-Length is not outputting properly either :( [snip] header('Content-Type: video/quicktime'); header (Content-Length:.strlen($xml)); You have a superfluous space in your Content-Type header, and you're missing a space in your Content-Length header. Those two need to share. :-) Your other error is due to output being generated prior to the header() calls. Hope that helps. Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http://brainbulb.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] Re: Using DOM object, how?
On Monday 19 September 2005 05:27 am, Jasper Bryant-Greene wrote: Ken Tozier wrote: I don't see any obvious DOM method for including scripts or css links like script language='text/javascript' src='bobo.js'. Do you have to put them in some other type of node like a processing instruction or a comment? ?php $dom = new DOMDocument('1.0', 'UTF-8'); $script = $dom-createElement('script'); $script-setAttribute('type', 'text/javascript'); $script-setAttribute('src', 'bobo.js'); $dom-appendChild($script); ? I would be extremely careful with this.. because sadly PHP's XML generator uses the short form whenever possible. script / will *NOT* work in most browsers such as FireFox. script/script Will work. I personally would love to see a function where I could set it to use the long form. and when importing if it's in long form.. set that long from flag on automatically .. this would have saved me _hours_ of debugging work. are you trying to just generate the entire html page using only the XML DOM? .. or are you doing this in conjunction with another language such as XSL? Similarly for a link or style element for CSS... -- Jasper Bryant-Greene Freelance web developer http://jasper.bryant-greene.name/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] REGEX Help Please
On Monday 19 September 2005 09:03 am, Shaun wrote: Hi, I am trying to implement a regular expression so that I have a number between 0.00 and 1.00. the following works except I can go up to 1.99 $regexp = /^[0-1]{1}.[0-9]{2}/; Can anyone help here please? Thanks $regexp = /^(0\.[0-9]{2}|1\.00)/; that should work :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Using DOM object, how?
On Monday 19 September 2005 12:25 pm, Ken Tozier wrote: I would be extremely careful with this.. because sadly PHP's XML generator uses the short form whenever possible. script / will *NOT* work in most browsers such as FireFox. script/script Will work. Thanks for the heads up. Looks like if you define the tag like $script= $dom-createElement('script',''); -- empty string It tacks on an end tag. The way that I've been doing this thus far is using XSL. If you use the DOMDocument::loadXML() function and it has anything like that. it will convert it to short form. I design the back XML using Dom calls then throw a xsl at it to spit out my page. very nice clean code that's separated from style. So far, just playing. But ultimately I'd like to generate the whole page using dom calls. It seems much cleaner for what I'm doing than creating a whole bunch of large functions that do nothing more than echo prestyled html. Is this clean enough? :) minimum for one of my pages that uses SQL: ?php include(Document.php); // a DOM Object is auto generated along with an XPath object to go with it. // $Document-gDom() and $Document-gXPath() to gain access to them. $Document = new Document(rootNode); try { $Document-gDb()-connect(Database::SQLITE,../database.db); } catch (DBConnectFailed $dbCF) { die(Failed to connect to the Database.); } $Document-setTitle(This is the title); // Use $Document-setStylesheet(); to set a stylesheet, // defaults to index.xsl. // Here is where you put the page specific code. // XML data nodes used in the XSL template. // This outputs the header(); and the DocType. $Document-outputHeader(); echo $Document; // This will load the XSL document, apply it, and return // The page to be echo'd ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Using DOM object, how?
On Monday 19 September 2005 06:04 pm, Ken Tozier wrote: Not a bad Idea. You might like this function I made then ;) function createElement($parentNode, $name, $elements=array()) { $node = $this-Dom-createElement($name); for ($x=0; $x count($elements); $x++) { if ($elements[$x][0] == .) { $node-nodeValue = $elements[$x][1]; } else { $node-setAttribute($elements[$x][0], $elements[$x][1]); } } $parentNode-appendChild($node); } general all purpose element creator for those of us that hate to call setAttribute a hundred times ;) Even better, you can just extend the DOMDocument class, which is perfect, since I'm basically just adding convenience methods. Thanks all for your help Ken ?php $x = new MyDom(); $x-createScriptElement('howdy.js'); $x-createCSSLinkElement('howdy.css'); $x-createStyledDivElement('bugColumnTitle', I'm a styled piece of text!); print($x-saveXML()); class MyDom extends DOMDocument { function createScriptElement($inPath) { $new_elem = $this-createElementAndAppend('script', null); $new_elem-setAttribute('type', 'text/javascript'); $new_elem-setAttribute('src', $inPath); } function createCSSLinkElement($inPath) { $new_elem = $this-createElementAndAppend('link', null); $new_elem-setAttribute('href', $inPath); $new_elem-setAttribute('rel', 'stylesheet'); $new_elem-setAttribute('media', 'screen'); } function createStyledDivElement($inStyle, $inData) { $new_elem = $this-createElementAndAppend('div', $inData); $new_elem-setAttribute('class', $inStyle); } function createElementAndAppend($inType, $inData) { // setting null inData to an empty string forces a close tag which is what we want $elem_data= ($inData == null) ? '' : $inData ; $new_elem= $this-createElement($inType, $elem_data); $this-appendChild($new_elem); return $new_elem; } } ? On Sep 19, 2005, at 6:13 PM, Ken Tozier wrote: Thanks Jasper Works perfectly on my Mac now as well. Ken On Sep 19, 2005, at 4:58 PM, Jasper Bryant-Greene wrote: ?php $x = new MyDom(); $x-createScriptElement('howdy.js'); print($x-saveXML()); class MyDom { private $dom; /* __construct() = PHP5 constructor */ function __construct() { $this-dom = new DOMDocument('1.0', 'iso-8859-1'); /* No need to return $this from a constructor */ } function createScriptElement($scriptPath) { $script = $this-dom-createElement('script', ''); $script-setAttribute('type', 'text/javascript'); $script-setAttribute('src', $scriptPath); $this-dom-appendChild($script); /* Doesn't make sense for a createScriptElement() method to also print out the XML, so I made a separate method and called that from the mainline code. */ } function saveXML() { return $this-dom-saveXML(); } } ? -- 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] Quick Poll: PHP 4 / 5
Can't expect everything to be done right on the first try. But it sure was a big annoyance. Great to hear that work is being done to improve on this. I personally would rather it just be silently ignored as to me an error line at the top is the same as it not working at all. Would love to find a tool that could go over code and output errors like this tho. Provide a better solution or whatever along with all the dumb mistakes that PHP is ignoring for you. With my experiences I have never used pointers or references in PHP. I'm sure they are powerful and all. but I just don't want to mess with them or have worry about them. That's just 1 thing in programming I don't have much experience with. I give a function a variable and I think I'm passing the value. if the function takes the reference and modifies that.. oh well.. I got my result back that's all I care about :) as for the sort thought. If the programmer does that and can't figure out what's going on.. they obviously didn't read the manual or just don't know basic programming ;) bool sort ( array array [, int sort_flags] ) Returns bool.. that's not an array ;) If it takes an array but doesn't return an array.. it must operate on the passed in array if it didn't what a useless function. Lets sort the array and say yah we sorted it but you can't have it :) So yes a bug. But for those that want to be able to grab only what we need. in my case array_pop's returned element. I don't wanna be hassled with the are you sure you wanted to ignore part of what we did? It's almost like every program asking are you sure you wanted to close me? everytime I get asked that I always think... I did just click the X.. so Yah... Just my 2 cents. I'm sure you guys will come up with something.. either way PHP is the only language I'll use for a website. Thank you very much for the detailed reason behind this. On Friday 16 September 2005 09:28 am, Rasmus Lerdorf wrote: Stephen Leaf wrote: $this-urlArr[0] = array_pop($arr = explode(,$this-urlArr[0])); I still have to scratch my head as to why I *need* that $arr = prior to 5.0.5 this was not needed. $this-urlArr[0] = array_pop(explode(,$this-urlArr[0])); This is a much misunderstood issue. And we are still contemplating the best way to handle this. Let's take a step back to a really simple example: function foo() { return 3; } function bar($arg) { $arg = banana; } bar(foo()); What do we do with code like this? If you follow it through it is essentially doing: 3 = banana; which makes very little sense and is probably something the developer would want to know about. PHP 4.3.x happily let you do this, and in some circumstances this could even corrupt memory. PHP 4.4 and higher have fixed this memory corruption problem, and at the same time since we are now able to detect this we can throw an error to let you know that your code is probably not doing what you intended. Now, in your example you are doing: $a = array_pop(explode(,ab)); to get the last element from the explode. The issue with array_pop() and other similar functions is that they do 2 things. They modify the array (by removing the last element) and they return something (the removed element in this case). When you pass in the result of explode() you are passing in something that doesn't have any permanent storage associated with it. Internally in PHP this is known as a temp var. You can't make a reference to a temp var. In our simpler example it is like trying to do 3 which doesn't make any sense. So in this case array_pop() has no place to store the modification. Your code happens to not care about that and only cares about the returned value. The real question here is whether we should silently ignore cases where such an argument modification is thrown away. In the case of array_pop() it may make sense. But how about this: sort(explode(,ab)); sort() has just one purpose. That is to sort the passed array in place. The above line of code is a really slow line of code that does absolutely nothing because we are passing in something that goes out of scope as soon as the call is done. This line of code in a PHP program is an obvious bug. Now, if we change this to: sort($a=explode(,ab)); then it suddenly makes sense. This is equivalent to writing: $a = explode(,ab)); sort($a); and the result is that we have a sorted array in $a after this. So the idea here is that PHP should be able to detect these sorts of obvious errors. In the array_pop() case it is not as black and white as the sort() case because of the dual-purpose nature of array_pop(). You could make a case for silently ignoring the array modification in array_pop(). My personal feeling on this is that we should throw an E_NOTICE on these and let the code continue on. Often there is a more efficient way to do some of these things simply because
Re: [PHP] php/mysql object id question..
On Wednesday 14 September 2005 03:42 pm, bruce wrote: hi... i have the following psuedo code... i'm showing the pertinent parts, and eliminating the rest... -- class sql { function sql(...) { return false mysql_ mysql_ } } $db = new sql(...) The new sql() is returning an object because that is what your asking for. now if you did a $db-sql() that'd return false. yes you did put a return false in the constructor but an object is what is being created and thus what is being returned. In my opinion a return anything within the constructor shouldn't be allowed. This might be the behavior in newer versions but I don't know. newer syntax is: class sql { function __construct (...) { ... } } truthfully when you do the $db = new sql(...); you are not running that function.. you are instantiating a new instance of sql which is invoking the object's constructor. echo db = .$db; $db comes back as an object id.. even when i force a 'return false'. it appears that no matter what i do, the class constructor returns an object id!!! the weird thing is that it gets to the 'return false' and then still seems to return the 'object id' i've also replaced 'false' with other values to see if it made a diff.. it didn't which is good... i would have really hit the roof then!! so.. why is this behavior occuring. any ideas as to why? or, am i just too tired right now! thanks bruce ps.. i could use the $db, object ID, and try to see if it actually access the db, in order to determine if it actually exists. but i shouldn't have to do that... the class should return false!!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql query
On Wednesday 14 September 2005 07:36 pm, Jesús Alain Rodríguez Santos wrote: I have a table colum in mysql with two fields: day and month. I would like to know if it's possible to make a query where I can determine if exist days before to a selected day, for example: if I have in my table: day 19 - month 05, I wish to know if there are previous days inserted at the 19, the days they are not inserted in the table, they are inserted according your selection, what I want to get is that every time that you insert a day, I want to check if there are days previous to the one already inserted in the table in the same month, in case that there are not them then they owe you to insert together with the one selected, I wait they understand me what I want: I work php/mysql. create table tableA ( day int, month int ); select * from tableA where month=5 and day 19; This will select everything from the 5th month and before the 19th day of the 5th month. Is that what you were going for? sorry for my english i'm cuban Thank you and excuse the nuisances -- Este mensaje ha sido analizado por MailScanner en busca de virus y otros contenidos peligrosos, y se considera que está limpio. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Quick Poll: PHP 4 / 5
On Tuesday 13 September 2005 05:52 pm, Ryan A wrote: [x] I never work with PHP 4 anymore, all my work is with PHP 5 so far I've not found any hosts that do PHP5, however I do all my own hosting anyway. I've switched to use PHP5 because I was interested in doing XSL, and the concept of doing objects intrigues me. XSL support in 5 is far superior. It's a walk in the park now, where as before it was quite confusing. I'm currently doing a project where the client doesn't know what she wants... because of this I'm constantly having to redo sections to add what she wants. So taking this approach for this client has saved me from 10 times more work. I personally can't wait for PDO. I do lots of projects that all use SQL (SQLite, PostgreSQL and MySQL) Right now I have to recode everything to use the right DB. with my newest project I'm using SQLite with a custom Object to handle the DB Object. It's actually design with PDO in mind. After they get PDO in and working well It'll save me hours of work. From that Website about the 6 dumbest ideas. I guess you could say I'm an early adopter I like ideas that'll save me time in the long run, even if I'm the one that has to do tons of testing to make it usable. The long run is what matters to me. If I can spend time learning, testing.. and then later be able to do something in 5 mins that'd take 15 the old way.. I'm up for it. Has to be someone to do the testing to bring projects forward isn't there ? ;) From the opposite side of the spectrum I have had my share of upgrade issues. One was from 5.0.4 to 5.0.5 $this-urlArr[0] = array_pop($arr = explode(,$this-urlArr[0])); I still have to scratch my head as to why I *need* that $arr = prior to 5.0.5 this was not needed. $this-urlArr[0] = array_pop(explode(,$this-urlArr[0])); Perhaps someone here could tell me what was change to make this happen.. and how does that change make the engine better? It seemed to work perfectly fine before. I've also had to upgrade a few classes written for PHP4 specifically ones that like to use: var $variable; Overall, If you can upgrade to 5 .. do so. the advantages in my cases have been so nice. If you can't upgrade, Don't. Use what works. I personally would urge you to upgrade to 5 if you wanna get in deep with objects. I'm sure that 3 and 4 can do them just fine. but whats the use of learning how to do OOP in something that has been updated? Or worded differently, Why learn old ways when you can benefit from newer ideas/implementations ? It'd be like putting logs under a platform and repositioning the log that came out the back in the front again as a way to move something instead of wagon just because it's always worked before. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DOM XML compatible PHP4 PHP5
On Monday 12 September 2005 02:08 pm, Florent Monnier wrote: Hi, Is there a way to make dom xml applications compatible PHP4 and PHP5? Thanks You can use the PHP_VERSION predefined constant or the function_exists(string) http://us2.php.net/manual/en/function.function-exists.php What I did was created a Document Object. right now it only works with PHP5 I might add PHP4 support to it later tho when I have more time using this approach unless anyone can think of a better idea. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php