[PHP] how to use php from mysql to xml
hi,everyone,i am a newbuy for php world and i have a problem when i study php i want to make a script,it works for: a mysql table,like title authorcontentdate a1a2 a3 a4 b1b2 b3b4 .. and i want to use php ,select it and make a xml to save it ,now i use this script ?php header(Content-type: text/xml); $host = localhost; $user = root; $pass = ; $database = test; $linkID = mysql_connect($host, $user, $pass) or die(Could not connect to host.); mysql_select_db($database, $linkID) or die(Could not find database.); $query = SELECT * FROM blog ORDER BY date DESC; $resultID = mysql_query($query, $linkID) or die(Data not found.); $xml_output = ?xml version=\1.0\?\n; $xml_output .= entries\n; for($x = 0 ; $x mysql_num_rows($resultID) ; $x++){ $row = mysql_fetch_assoc($resultID); $xml_output .= \tentry\n; $xml_output .= \t\tdate . $row['date'] . /date\n; // Escaping illegal characters $row['text'] = str_replace(, , $row['text']); $row['text'] = str_replace(, , $row['text']); $row['text'] = str_replace(, gt;, $row['text']); $row['text'] = str_replace(\, quot;, $row['text']); $xml_output .= \t\ttext . $row['text'] . /text\n; $xml_output .= \t/entry\n; } $xml_output .= /entries; echo $xml_output; ? it has no problem,but i want to save a xml file ,like this format ?xml version=1.0 encoding=GB2312? Table Record Titlea1/Title Authora2/Author Contenta3/Content date2003-06-29/date /Record Record Titleb1/Title Authorb2/Author Contentb3/Content date2003-06-30/date /Record many record /Table how can i improve this script? Thanks all
Re: [PHP] Posting Summary for Week Ending 4 January, 2008: php-general@lists.php.net
Once it settles down, it will run every Friday at 4:00p to summarize the week. For bragging rights, to keep track of how much time you've spent doing community service or whatever else. Why? Does anybody really care how many emails they send to the list? While I don't doubt your good intentions, apart from the maybe 30-40 regular posters, there are probably hundreds or thousands more on the list (I have no idea how big the list is) who don't care about this and then there are the ones who get the digest version too. Can't you just put it on your website and have a link to it in your sig or something? After all the crap of dealing with off-topic threads about html and javascript and database questions, is this any better? -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to use php from mysql to xml
On Jan 5, 2008 9:14 PM, Yang Yang [EMAIL PROTECTED] wrote: hi,everyone,i am a newbuy for php world and i have a problem when i study php i want to make a script,it works for: a mysql table,like title authorcontentdate a1a2 a3 a4 b1b2 b3b4 .. and i want to use php ,select it and make a xml to save it ,now i use this script $resultID = mysql_query($query, $linkID) or die(Data not found.); for($x = 0 ; $x mysql_num_rows($resultID) ; $x++){ $row = mysql_fetch_assoc($resultID); Change that to while ($row = mysql_fetch_assoc($resultID)) { .. } You don't need to know the number of rows the query returns (unless you actually want to use that number, but you don't need it for this loop). it has no problem,but i want to save a xml file ,like this format See http://www.php.net/fopen http://www.php.net/fwrite for details on how to write to a file. ?xml version=1.0 encoding=GB2312? Table Record Titlea1/Title Authora2/Author Contenta3/Content date2003-06-29/date /Record Record Titleb1/Title Authorb2/Author Contentb3/Content date2003-06-30/date /Record many record /Table Something like this should work: while ($row = mysql_fetch_assoc($resultID)) { $xml_entry .= record; foreach ($row as $fieldname = $data) { $xml_entry .= . $fieldname . ; $xml_entry .= htmlentities($data); $xml_entry .= / . $fieldname . ; } $xml_entry .= /record; } -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] menu andfolder question
Hi, Serveral web sites have a menu and when you pass your mouse over a link, the browser statusbar only shows the folder where is located the file link, not the complete address including the file link. i mean if you take web site : http://www.zend.com/en/ when you pass your mouse cursor over Company link, it displays only : http://www.zend.com/en/company; in the statusbar of your browser. how is it possible whereas the link points to company/index.htm ? thanks a lot, -- Alain Windows XP SP2 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008
Re: [PHP] menu andfolder question
On Jan 5, 2008 10:23 PM, Alain Roger [EMAIL PROTECTED] wrote: Hi, Serveral web sites have a menu and when you pass your mouse over a link, the browser statusbar only shows the folder where is located the file link, not the complete address including the file link. i mean if you take web site : http://www.zend.com/en/ when you pass your mouse cursor over Company link, it displays only : http://www.zend.com/en/company; in the statusbar of your browser. how is it possible whereas the link points to company/index.htm ? In that example the link takes you to http://www.zend.com/en/company/ - not http://www.zend.com/en/company/index.htm index.htm is the default file it looks for based on apache config. See http://httpd.apache.org/docs/2.2/mod/mod_dir.html for more info. You can set it to whatever you like, but as a rule apache uses index.html or index.htm or index.php and asp/asp.net uses default.asp or default.aspx. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] menu andfolder question
ok, maybe i did not write my question well. i already used it because i setup the DirectoryIndex to index.php, index.html my concern for now, how to have the same behavior on my local computer (development computer) ? my computer has IP 200.170.1.2 (for example) so in my brower i type : 200.170.1.2/myWebSite this load my firt index.php webpage to browser... if i pass my mouse cursor over menu link Company, it displays http://200.170.1.2/myWebSite/200.170.1.2/company which is not great :-( here is the code i use : print div class='MenuItem4'a href='.$_SERVER['SERVER_NAME']./company'Company/a/div; thanks for help. A. On Jan 5, 2008 12:29 PM, chris smith [EMAIL PROTECTED] wrote: On Jan 5, 2008 10:23 PM, Alain Roger [EMAIL PROTECTED] wrote: Hi, Serveral web sites have a menu and when you pass your mouse over a link, the browser statusbar only shows the folder where is located the file link, not the complete address including the file link. i mean if you take web site : http://www.zend.com/en/ when you pass your mouse cursor over Company link, it displays only : http://www.zend.com/en/company; in the statusbar of your browser. how is it possible whereas the link points to company/index.htm ? In that example the link takes you to http://www.zend.com/en/company/ - not http://www.zend.com/en/company/index.htm index.htm is the default file it looks for based on apache config. See http://httpd.apache.org/docs/2.2/mod/mod_dir.html for more info. You can set it to whatever you like, but as a rule apache uses index.html or index.htm or index.php and asp/asp.net uses default.asp or default.aspx. -- Postgresql php tutorials http://www.designmagick.com/ -- Alain Windows XP SP2 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008
Re: [PHP] menu andfolder question
On Jan 5, 2008 10:36 PM, Alain Roger [EMAIL PROTECTED] wrote: ok, maybe i did not write my question well. i already used it because i setup the DirectoryIndex to index.php, index.html my concern for now, how to have the same behavior on my local computer (development computer) ? my computer has IP 200.170.1.2 (for example) so in my brower i type : 200.170.1.2/myWebSite this load my firt index.php webpage to browser... if i pass my mouse cursor over menu link Company, it displays http://200.170.1.2/myWebSite/200.170.1.2/company which is not great :-( here is the code i use : print div class='MenuItem4'a href='.$_SERVER['SERVER_NAME']./company'Company/a/div; In your case it's taking the existing url and tacking the rest on which is not what you want. If you print out $_SERVER['SERVER_NAME'] - it doesn't include the http[s]:// at the start to make it a complete absolute url. It also doesn't include your current directory (myWebSite) so even with http:// at the start you'd end up with http://ip.address/company - not what you want either. You should probably have a variable or define for your application url in your config file so you can: print a href=' . APPLICATION_URL . /company'Company/a; It's much safer this way than relying on any $_SERVER variables (which believe it or not are suspect to XSS attacks/vulnerabilities). -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: menu andfolder question
Unless I misunderstand your question, this is normal behavior. The page designer purposely enters the link in the simpler form: http://www.zend.com/en/company because the web server is configured to assume that index.htm is the default page in that folder and correctly displays it. Alain Roger wrote: Hi, Serveral web sites have a menu and when you pass your mouse over a link, the browser statusbar only shows the folder where is located the file link, not the complete address including the file link. i mean if you take web site : http://www.zend.com/en/ when you pass your mouse cursor over Company link, it displays only : http://www.zend.com/en/company; in the statusbar of your browser. how is it possible whereas the link points to company/index.htm ? thanks a lot, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem sending emamil across one postfix server
Now i have chage the php scripts with the bellow script but appears the bellow error. Can anybody helps me please. I don't know how can i solve mi proble for sending emails using php againts one postfix into one SuSE linux. Thnaks //script ?php $para = '[EMAIL PROTECTED]'; $asunto= 'el asunto'; $mensaje = 'hola carabola'; $cabeceras = 'From: miname [EMAIL PROTECTED]' . \n . 'Reply-To: [EMAIL PROTECTED]' . \n . 'X-Mailer: PHP/' . phpversion().\n; mail($para, $asunto, $mensaje, $cabeceras, '[EMAIL PROTECTED]'); ? //log Jan 5 13:52:02 server postfix/pickup[16768]: 20EB589B68: uid=30 from=[EMAIL PROTECTED] Jan 5 13:52:02 server postfix/cleanup[17322]: 20EB589B68: message-id=[EMAIL PROTECTED] Jan 5 13:52:02 server postfix/qmgr[7450]: 20EB589B68: from=[EMAIL PROTECTED], size=394, nrcpt=1 (queue active) Jan 5 13:52:02 server postfix/qmgr[7450]: 20EB589B68: to=[EMAIL PROTECTED], orig_to=[EMAIL PROTECTED], relay=none, delay=0, status=deferred (delivery temporarily suspended: transport is unavailable) - Original Message - From: Jim Lucas [EMAIL PROTECTED] To: Miren Urkixo [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Saturday, January 05, 2008 12:08 AM Subject: Re: [PHP] problem sending emamil across one postfix server Miren Urkixo wrote: Hello i want from one php page to send emails but i have one great problem. The server is one postfix into one suse and the php pages are into the same server with apache 2 and php 5. it doesn't sent the messages and into the email server logs appears this: Jan 3 16:28:55 server postfix/pickup[18946]: 7F6C978557: uid=30 from=wwwrun Jan 3 16:28:55 server postfix/cleanup[18976]: 7F6C978557: message-id=[EMAIL PROTECTED] Jan 3 16:28:55 server postfix/qmgr[18947]: 7F6C978557: from=[EMAIL PROTECTED], size=722, nrcpt=1 (queue active) Jan 3 16:28:55 server postfix/qmgr[18947]: 7F6C978557: to=[EMAIL PROTECTED], orig_to=[EMAIL PROTECTED], relay=none, delay=0, status=deferred (delivery temporarily suspended: transport is unavailable) My emamils from the php page i send using this: /* recipients */ $to = [EMAIL PROTECTED]; //$nombre . . $email. ; /* subject */ $subject = Email desde la pagina web; /* message */ $message = html head /head body pHas recibido este correo desde el formulario de la pagina web./p p Nombre: $nombre br Email: $email br Asunto del mensaje: $asunto /p /body /html ; /* To send HTML mail, you can set the Content-type header. */ $headers = MIME-Version: 1.0\r\n; $headers .= Content-type: text/html; charset=iso-8859-1\r\n; /* additional headers */ $headers .= From: . $nombre . . $email. ; /* and now mail it */ mail($to, $subject, $message, $headers); ? but it doesn't send Can you help me? thanks You probably need to set a custom From header entry -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- 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] Delete rows from database
Hi all, I'm searching names from MySQL and printing it on a browser. Also, I've provided checkbox for all the rows and a delete button for a page. I want to delete the selected rows from MySQL when I click on the Delete button. How do I do that? Here is the code which I used to print the rows after fetching the same from MySQL while ($line = mysql_fetch_array($resultset, MYSQL_ASSOC)) { echo \ttr\n; echo tdinput type=checkbox name=index // td; foreach ($line as $col_value) { echo \t\ttdnbsp;$col_value/td\n; } //echo tdinput type=button name=vcancel value=Cancel //td; echo \t/tr\n; }
[PHP] http_request
Greetings on New Year :) We have a script, say layer.php, which uses HTTP_REQUEST package to authenticate a user to an existing application (viz., wordpress, mediawiki etc.) I would like help on the following two fronts: 1. How do I return the cookies, headers etc. from the layer (which are being sent from the application) to the browser? 2. How do I redirect browser from the layer.php to a page of the application. I was thinking that if I could find a way to send the headers and cookies to the browser, I could also send a 302 status code, along with the cookies, to redirect the user to a page of the app. -- Thanks and Regards Peeyush Gulati +91-9916304135 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Delete rows from database
Balasubramanyam A wrote: Hi all, I'm searching names from MySQL and printing it on a browser. Also, I've provided checkbox for all the rows and a delete button for a page. I want to delete the selected rows from MySQL when I click on the Delete button. How do I do that? You process the form that is (presumably) submitted when the user hits Delete. In your processing you collect the row-ids or something else you can use in the whereclause : DELETE FROM table WHERE whereclause. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Delete rows from database
On Jan 5, 2008 9:03 AM, Balasubramanyam A [EMAIL PROTECTED] wrote: Hi all, Hi! [snip] while ($line = mysql_fetch_array($resultset, MYSQL_ASSOC)) { [snip] Just a side note: wouldn't it be easier to just use mysql_fetch_assoc() ? It does the exact same thing, with less typing. -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Posting Summary for Week Ending 4 January, 2008: php-general@lists.php.net
Had everything gone as it was supposed to, I think it would've been welcomed with open arms. Unfortunately, my stupid ass flipped the wrong flag while testing for approximately an hour, which sent posts to the list every minute for one hour. However, they weren't coming through at the time, and I didn't realize that they were even being sent, because the address was not subscribed at the time. Once the address was subscribed, all of the messages must've been held in a queue on the mailing list side, and were then distributed. This leads me to ask, why? Isn't this a really Bad Idea[tm] to hold posts in queue, pending confirmation of the sender's address? I can understand one message, but any more than that shouldn't be necessary. My intentions were just to add something neat to the list for the regulars (which will work as expected now), but what if someone had truly malicious intentions? What if hundreds or thousands of emails were sent and held in queue, and then the sender's address confirmed? Would the mailing list software even be able to handle that much of a queue? -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] http_request
Also, supply an absolute URL when using header redirects. On Jan 5, 2008 3:44 PM, Daniel Brown [EMAIL PROTECTED] wrote: On Jan 5, 2008 9:06 AM, peeyush gulati [EMAIL PROTECTED] wrote: Greetings on New Year :) To you, as well! We have a script, say layer.php, which uses HTTP_REQUEST package to authenticate a user to an existing application (viz., wordpress, mediawiki etc.) I would like help on the following two fronts: 1. How do I return the cookies, headers etc. from the layer (which are being sent from the application) to the browser? 2. How do I redirect browser from the layer.php to a page of the application. I was thinking that if I could find a way to send the headers and cookies to the browser, I could also send a 302 status code, along with the cookies, to redirect the user to a page of the app. When you create a cookie in your script, it is automatically sent via the HTTP server to the client (browser). The same occurs with $_SESSION information, as the PHPSESSID cookie is sent to the browser to track the session name. With regard to redirection, there are a lot of ways to do that, but the easiest is as follows: ? header(Location: somefile.php); exit; ? Just be sure to always exit; after using the header(Location: xxx); to stop the current script from running, unless you have explicit reasons not to do so. -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] http_request
On Jan 5, 2008 9:06 AM, peeyush gulati [EMAIL PROTECTED] wrote: Greetings on New Year :) To you, as well! We have a script, say layer.php, which uses HTTP_REQUEST package to authenticate a user to an existing application (viz., wordpress, mediawiki etc.) I would like help on the following two fronts: 1. How do I return the cookies, headers etc. from the layer (which are being sent from the application) to the browser? 2. How do I redirect browser from the layer.php to a page of the application. I was thinking that if I could find a way to send the headers and cookies to the browser, I could also send a 302 status code, along with the cookies, to redirect the user to a page of the app. When you create a cookie in your script, it is automatically sent via the HTTP server to the client (browser). The same occurs with $_SESSION information, as the PHPSESSID cookie is sent to the browser to track the session name. With regard to redirection, there are a lot of ways to do that, but the easiest is as follows: ? header(Location: somefile.php); exit; ? Just be sure to always exit; after using the header(Location: xxx); to stop the current script from running, unless you have explicit reasons not to do so. -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] need opinions regarding php.ini
That was my thought too, but, when I create new folder - it will automatically create php.ini inside and there is no point of deleting them. HOW insecure it is? Because, since you know there is php.ini you can easy open every of them (http://mydomain.com/gallery/images/php.ini) and look. Isn't is vulnerable point? -afan Daniel Brown wrote: On Jan 5, 2008 2:35 AM, Afan Pasalic [EMAIL PROTECTED] wrote: hi, after my host moved my account from old server (shared hosting) with php 4.4.7, mysql 4.x to new one with php 5.x and mysql 5.x. nice. they did it fast and without problems. but then I realized that every folder has it's own php.ini file?!? I talked to them (live chat) about this and they told me that is how our system is setup: ... afan [20:25]: why is now different then before? [20:25]: That is not different. That has always been the case. You may not have had a php.ini in every folder, but every folder still needed its own php.ini if you wanted to change the php settings. afan [20:27]: I don't understand why I should have php.ini in every folder? it's like having admin area for each folder? [20:28]: You don't have to if you don't want to, but that is how our system is setup, so unless you don't want to change settings for all of your folders, you'll want to leave those there. afan [20:29]: ok. in case I want to change something in php.ini, how to do it on all php.ini files? [20:29]: You would change one php.ini file, then visit the link I provided, and that will show you how to copy that to all folders. ... and I got the link with script how to change EVERY php.ini on my account (with over 10 addon domain). I still think that's not correct. I need your opinion. I'm not entirely sure why your host found it necessary to provide a php.ini file in every directory, but the fact is, it's safe to delete all of them if you want. They're just there to allow you to override certain settings (INI_PERDIR settings, for example). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] need opinions regarding php.ini
On Jan 5, 2008 2:35 AM, Afan Pasalic [EMAIL PROTECTED] wrote: hi, after my host moved my account from old server (shared hosting) with php 4.4.7, mysql 4.x to new one with php 5.x and mysql 5.x. nice. they did it fast and without problems. but then I realized that every folder has it's own php.ini file?!? I talked to them (live chat) about this and they told me that is how our system is setup: ... afan [20:25]: why is now different then before? [20:25]: That is not different. That has always been the case. You may not have had a php.ini in every folder, but every folder still needed its own php.ini if you wanted to change the php settings. afan [20:27]: I don't understand why I should have php.ini in every folder? it's like having admin area for each folder? [20:28]: You don't have to if you don't want to, but that is how our system is setup, so unless you don't want to change settings for all of your folders, you'll want to leave those there. afan [20:29]: ok. in case I want to change something in php.ini, how to do it on all php.ini files? [20:29]: You would change one php.ini file, then visit the link I provided, and that will show you how to copy that to all folders. ... and I got the link with script how to change EVERY php.ini on my account (with over 10 addon domain). I still think that's not correct. I need your opinion. I'm not entirely sure why your host found it necessary to provide a php.ini file in every directory, but the fact is, it's safe to delete all of them if you want. They're just there to allow you to override certain settings (INI_PERDIR settings, for example). -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] http_request
It's advisable as the page you will be redirected to will be relative to the one the browser actually requested, so it's a good habit to get into. On Jan 5, 2008 4:05 PM, Daniel Brown [EMAIL PROTECTED] wrote: On Jan 5, 2008 10:59 AM, Dave Goodchild [EMAIL PROTECTED] wrote: Also, supply an absolute URL when using header redirects. That's not necessary, as far as I know. Relative redirections have always worked just fine. -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you.
Re: [PHP] http_request
On Jan 5, 2008 10:59 AM, Dave Goodchild [EMAIL PROTECTED] wrote: Also, supply an absolute URL when using header redirects. That's not necessary, as far as I know. Relative redirections have always worked just fine. -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] menu andfolder question
this is how i solved my issue :-) On Jan 5, 2008 4:28 PM, jeffry s [EMAIL PROTECTED] wrote: On Jan 5, 2008 7:36 PM, Alain Roger [EMAIL PROTECTED] wrote: ok, maybe i did not write my question well. i already used it because i setup the DirectoryIndex to index.php, index.html my concern for now, how to have the same behavior on my local computer (development computer) ? my computer has IP 200.170.1.2 (for example) so in my brower i type : 200.170.1.2/myWebSite this load my firt index.php webpage to browser... if i pass my mouse cursor over menu link Company, it displays http://200.170.1.2/myWebSite/200.170.1.2/company which is not great :-( here is the code i use : print div class='MenuItem4'a href='.$_SERVER['SERVER_NAME']./company'Company/a/div; thanks for help. A. On Jan 5, 2008 12:29 PM, chris smith [EMAIL PROTECTED] wrote: On Jan 5, 2008 10:23 PM, Alain Roger [EMAIL PROTECTED] wrote: Hi, Serveral web sites have a menu and when you pass your mouse over a link, the browser statusbar only shows the folder where is located the file link, not the complete address including the file link. i mean if you take web site : http://www.zend.com/en/ when you pass your mouse cursor over Company link, it displays only : http://www.zend.com/en/company; in the statusbar of your browser. how is it possible whereas the link points to company/index.htm ? In that example the link takes you to http://www.zend.com/en/company/ - not http://www.zend.com/en/company/index.htm index.htm is the default file it looks for based on apache config. See http://httpd.apache.org/docs/2.2/mod/mod_dir.html for more info. You can set it to whatever you like, but as a rule apache uses index.html or index.htm or index.php and asp/asp.net uses default.asp or default.aspx. -- Postgresql php tutorials http://www.designmagick.com/ -- Alain Windows XP SP2 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008 omg.. i don't know someone will care enough to ask something like this.. if you want the status bar to display the index.htm or index.php simply write the index.php or index.html in the link for example instead of this print div class='MenuItem4'a href='.$_SERVER['SERVER_NAME' ]./company'Company/a/div; do it like this print div class='MenuItem4'a href='.$_SERVER['SERVER_NAME']./company/index.htm'Company/a/div; the taskbar will display the whole link in href when you point the mouse over that link,. -- Alain Windows XP SP2 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008
Re: [PHP] http_request
Thank you will do that Ok can i redirect the response to the browser from the layer after my layer has recieved the response from the application. On Jan 5, 2008 10:05 PM, Daniel Brown [EMAIL PROTECTED] wrote: On Jan 5, 2008 11:14 AM, peeyush gulati [EMAIL PROTECTED] wrote: Thank you for the reply But i am not asking for simple rediredtion. I am aware of the (header:Location:url); From a layer i am sending a http_request to an existing application, now the application will response back to the layer. My concern is how do i make the application response back to the browser instead of the layer without changing the code of the application although the request was sent from layer. This is what i am looking for. Is there some PECL package. Please keep your replies on-list for others to benefit. What you're asking to do is send a third-party response to the browser which never instantiates the call to the remote script in the first place. To my knowledge, it's not possible, which is a good thing. Otherwise anyone would be able to inject arbitrary responses (like a man-in-the-middle attack). -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- Thanks and Regards Peeyush Gulati +91-9916304135
Re: [PHP] need opinions regarding php.ini
On Jan 5, 2008 11:20 AM, Afan Pasalic [EMAIL PROTECTED] wrote: That was my thought too, but, when I create new folder - it will automatically create php.ini inside and there is no point of deleting them. HOW insecure it is? Because, since you know there is php.ini you can easy open every of them (http://mydomain.com/gallery/images/php.ini) and look. Isn't is vulnerable point? Using .htaccess you can disallow viewing of the file. If you use phpinfo(); anywhere in your site, that actually divulges more information, because that will disclose the availability and configuration of external modules, users on the server, path information, and more. -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] http_request
On Jan 5, 2008 11:14 AM, peeyush gulati [EMAIL PROTECTED] wrote: Thank you for the reply But i am not asking for simple rediredtion. I am aware of the (header:Location:url); From a layer i am sending a http_request to an existing application, now the application will response back to the layer. My concern is how do i make the application response back to the browser instead of the layer without changing the code of the application although the request was sent from layer. This is what i am looking for. Is there some PECL package. Please keep your replies on-list for others to benefit. What you're asking to do is send a third-party response to the browser which never instantiates the call to the remote script in the first place. To my knowledge, it's not possible, which is a good thing. Otherwise anyone would be able to inject arbitrary responses (like a man-in-the-middle attack). -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: website tree
Get the various parts from the $_SERVER superglobal variable: 1) scheme (e.g. http://) from $_SERVER['HTTPS'] (https if on) 2) host:port (e.g. bucksvsbytes.com) from $_SERVER['HTTP_HOST'] 3) /path/page?query part (e.g. /catalog/index.php?pid=444) from $_SERVER['REQUEST_URI'] John Gunther Alain Roger wrote: Hi, let's imaging we have the following thing : www.mywebsite.com/company/index.php www.mywebsite.com/company/profile.php www.mywebsite.com/services/index.php how can i detect in which address am i ? for example how to retrieve www.mywebsite.com/services or www.mywebsite.com/company -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] website tree
On Jan 5, 2008 12:06 PM, Alain Roger [EMAIL PROTECTED] wrote: Hi, let's imaging we have the following thing : www.mywebsite.com/company/index.php www.mywebsite.com/company/profile.php www.mywebsite.com/services/index.php how can i detect in which address am i ? for example how to retrieve www.mywebsite.com/services or www.mywebsite.com/company ? preg_match('/\/(.*)\//',$_SERVER['REQUEST_URI'],$match); echo $match[1]; ? -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Posting Summary for Week Ending 4 January, 2008: php-general@lists.php.net
On Jan 5, 2008 12:05 PM, Børge Holen [EMAIL PROTECTED] wrote: On Saturday 05 January 2008 16:31:49 Daniel Brown wrote: Had everything gone as it was supposed to, I think it would've been welcomed with open arms. Unfortunately, my stupid ass flipped the wrong flag while testing for approximately an hour, which sent posts to the list every minute for one hour. However, they weren't coming through at the time, and I didn't realize that they were even being sent, because the address was not subscribed at the time. Once the address was subscribed, all of the messages must've been held in a queue on the mailing list side, and were then distributed. This leads me to ask, why? Isn't this a really Bad Idea[tm] to hold posts in queue, pending confirmation of the sender's address? I can understand one message, but any more than that shouldn't be necessary. My intentions were just to add something neat to the list for the regulars (which will work as expected now), but what if someone had truly malicious intentions? What if hundreds or thousands of emails were sent and held in queue, and then the sender's address confirmed? Would the mailing list software even be able to handle that much of a queue? I wonder... what you try to do seems like a trivial task, or just task, where did you go wrong to make it send all those mails? just some personal interrest... -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. While I was testing things, I commented out the wrong to line and the cron was running. It was a simple mistake. -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] http_request
On Jan 5, 2008 11:41 AM, peeyush gulati [EMAIL PROTECTED] wrote: Thank you will do that Ok can i redirect the response to the browser from the layer after my layer has recieved the response from the application. Absolutely. That's the same premise under which the PayPal IPN works. The script (layer) sends a request to the application, and receives a response, parses it if necessary, and feeds that data back to the client. -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] website tree
Hi, let's imaging we have the following thing : www.mywebsite.com/company/index.php www.mywebsite.com/company/profile.php www.mywebsite.com/services/index.php how can i detect in which address am i ? for example how to retrieve www.mywebsite.com/services or www.mywebsite.com/company -- Alain Windows XP SP2 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008
Re: [PHP] Posting Summary for Week Ending 4 January, 2008: php-general@lists.php.net
On Saturday 05 January 2008 16:31:49 Daniel Brown wrote: Had everything gone as it was supposed to, I think it would've been welcomed with open arms. Unfortunately, my stupid ass flipped the wrong flag while testing for approximately an hour, which sent posts to the list every minute for one hour. However, they weren't coming through at the time, and I didn't realize that they were even being sent, because the address was not subscribed at the time. Once the address was subscribed, all of the messages must've been held in a queue on the mailing list side, and were then distributed. This leads me to ask, why? Isn't this a really Bad Idea[tm] to hold posts in queue, pending confirmation of the sender's address? I can understand one message, but any more than that shouldn't be necessary. My intentions were just to add something neat to the list for the regulars (which will work as expected now), but what if someone had truly malicious intentions? What if hundreds or thousands of emails were sent and held in queue, and then the sender's address confirmed? Would the mailing list software even be able to handle that much of a queue? I wonder... what you try to do seems like a trivial task, or just task, where did you go wrong to make it send all those mails? just some personal interrest... -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- --- Børge Holen http://www.arivene.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Login script problem
On Jan 5, 2008 11:50 AM, Reese [EMAIL PROTECTED] wrote: Daniel Brown wrote: Do you expect the value of $key in this condition to be a literal zero? $twoyears = array('alphanumeric_code1', 'alphanumeric_code2', 'alphanumeric_code3', 'alphanumeric_code4', 'alphanumeric_code5', 'alphanumeric_code6', 'alphanumeric_code7'); $key = in_array($sPromocode,$twoyears); if($key=='0') I changed if($key=='0') to if(!isset($key=='1')) to see what effect that change might make, the server threw an error so I set it back to its original state: Parse error: parse error, unexpected T_IS_EQUAL, expecting ',' or ')' in /[PATH]/login.php on line 16 That's because isset() isn't able to eval() an expression. Remove the !isset() part, or the =='1' part and that will remove the parse error. -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHTML files showing as blank pages
Hi, I'm having a problem getting .phtml files to display in a web browser. I can successfully display a test.php page as per PHP install instructions but the phtml files show up blank (in firefox or IE). I have added these entries to my apache httpd.conf: LoadModule php5_modulemodules/libphp5.so AddHandler php5-script .php .phtml AddType text/html .php .phtml #AddType application/x-httpd-php .php .php3 .php4 .phtml (I tried with this uncommented too and without the previous entry) AddType application/x-httpd-php-source .phps My system is: Apache/2.2.6 (Unix) PHP/5.2.5 The phtml files I am having the problem with are from an opensource project called CDRTool I believe other people can run this app fine so I believe my issue is a prob with apache/php (also because I've never configured apache/php before so its a fair shout Ive done something wrong! :P) The one thing that looks odd to me as someone who hasnt done this before is that all the phtml files start with a line: ? Anyway, hopefully its an easy one to fix if ur an expert! Any help appreciated! thanks in advance, Andy. Message sent using UK Grid Webmail 2.7.9 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHTML files showing as blank pages
On Jan 5, 2008 9:39 AM, A.smith [EMAIL PROTECTED] wrote: Hi, I'm having a problem getting .phtml files to display in a web browser. I can successfully display a test.php page as per PHP install instructions but the phtml files show up blank (in firefox or IE). I have added these entries to my apache httpd.conf: LoadModule php5_modulemodules/libphp5.so AddHandler php5-script .php .phtml AddType text/html .php .phtml #AddType application/x-httpd-php .php .php3 .php4 .phtml (I tried with this uncommented too and without the previous entry) AddType application/x-httpd-php-source .phps My system is: Apache/2.2.6 (Unix) PHP/5.2.5 The phtml files I am having the problem with are from an opensource project called CDRTool I believe other people can run this app fine so I believe my issue is a prob with apache/php (also because I've never configured apache/php before so its a fair shout Ive done something wrong! :P) The one thing that looks odd to me as someone who hasnt done this before is that all the phtml files start with a line: ? Anyway, hopefully its an easy one to fix if ur an expert! Any help appreciated! thanks in advance, Andy. A decent HOWTO to setup Apache2 and PHP5 on *nix systems: http://dan.drydog.com/apache2php.html Also, those ? lines are to be expected. That indicates where PHP code begins. If you want to get involved with PHP programming, I suggest learning the basics before trying to set up a whole system yourself. -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem viewing phtml files
Hi, I'm having a problem getting .phtml files to display in a web browser. I can successfully display a test.php page as per PHP install instructions but the phtml files show up blank (in firefox or IE). I have added these entries to my apache httpd.conf: LoadModule php5_module modules/libphp5.so AddHandler php5-script .php .phtml AddType text/html .php .phtml #AddType application/x-httpd-php .php .php3 .php4 .phtml (I tried with this uncommented too and without the previous entry) AddType application/x-httpd-php-source .phps I have the default recommended php.ini installed under both: /usr/local/apache2/conf /usr/local/apache2/php as I wasnt certain where it should go... My system is: Apache/2.2.6 (Unix) PHP/5.2.5 The phtml files are from an opensource product called CDRTool which other people are using successfully so I think the most likely problem I have is I have something badly configured on my apache/php side (particularly as this isnt something Ive attemtped to configure before). One thing I noticed regarding all of the CDRTool .phtml files is that they all have a first line like: ? Is that normal? I suppose someone who knows php will know what it means :S Thanks in advance for any advice, Andy. Message sent using UK Grid Webmail 2.7.9 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] which window?
this would be an html / js issue... why have a popup login in this case? just show the logon in the main window and then do the redirect... bastien To: php-general@lists.php.net From: [EMAIL PROTECTED] Date: Sat, 5 Jan 2008 10:17:55 -0800 Subject: [PHP] which window? Hello; I have a login panel that is opened as a javascript window. In the processing script, a successful login uses the header function to send the user to the restricted content index page. But this page is loading into the javascript window instead of the opener window of the browser. Is it possible to supply a target property to the header() function to display content in a specific window? Or is that strictly an html/javascript issue? I have looked into the header() function but it is unclear to me what all can be done with headers. Thanks in advance for suggestions, info; Jeff K -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Use fowl language with Chicktionary. Click here to start playing! http://puzzles.sympatico.msn.ca/chicktionary/index.html?icid=htmlsig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHTML files showing as blank pages
Andy, try this AddHandler php5-script .php .phtml #AddType text/html .php .phtml AddType application/x-httpd-php .php .phtml .html .htm bastien Date: Sat, 5 Jan 2008 14:39:49 + To: php-general@lists.php.net From: [EMAIL PROTECTED] Subject: [PHP] PHTML files showing as blank pages Hi, I'm having a problem getting .phtml files to display in a web browser. I can successfully display a test.php page as per PHP install instructions but the phtml files show up blank (in firefox or IE). I have added these entries to my apache httpd.conf: LoadModule php5_modulemodules/libphp5.so AddHandler php5-script .php .phtml AddType text/html .php .phtml #AddType application/x-httpd-php .php .php3 .php4 .phtml (I tried with this uncommented too and without the previous entry) AddType application/x-httpd-php-source .phps My system is: Apache/2.2.6 (Unix) PHP/5.2.5 The phtml files I am having the problem with are from an opensource project called CDRTool I believe other people can run this app fine so I believe my issue is a prob with apache/php (also because I've never configured apache/php before so its a fair shout Ive done something wrong! :P) The one thing that looks odd to me as someone who hasnt done this before is that all the phtml files start with a line: Anyway, hopefully its an easy one to fix if ur an expert! Any help appreciated! thanks in advance, Andy. Message sent using UK Grid Webmail 2.7.9 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Read what Santa`s been up to! For all the latest, visit asksantaclaus.spaces.live.com! http://asksantaclaus.spaces.live.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] which window?
Hello; I have a login panel that is opened as a javascript window. In the processing script, a successful login uses the header function to send the user to the restricted content index page. But this page is loading into the javascript window instead of the opener window of the browser. Is it possible to supply a target property to the header() function to display content in a specific window? Or is that strictly an html/javascript issue? I have looked into the header() function but it is unclear to me what all can be done with headers. Thanks in advance for suggestions, info; Jeff K -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHTML files showing as blank pages
- Original Message From: Daniel Brown [EMAIL PROTECTED] To: A.smith [EMAIL PROTECTED] Cc: php-general@lists.php.net Subject: Re: [PHP] PHTML files showing as blank pages Date: 05/01/08 17:48 A decent HOWTO to setup Apache2 and PHP5 on *nix systems: http://dan.drydog.com/apache2php.html Also, those lt;? lines are to be expected. That indicates where PHP code begins. If you want to get involved with PHP programming, I suggest learning the basics before trying to set up a whole system yourself. -- Hi Dan/all, thanks, however I've already followed the how to for setup and as I mentioned in my first post I can successfully see the test.php page. Actually my aim is just to host an opensource product (CDRTool) that happens to be in PHP, currently I dont have any desire to write or modify the app. I just want to host it successfully, which currently I am not :( As I said its a mature product which works for other people so I guess I have something configured badly but Im not sure how to go about diagnosing the problem thanks Andy. Message sent using UK Grid Webmail 2.7.9 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHTML files showing as blank pages
Hi Bastien, thanks for the suggestion, unfortunately I still have no page displayed... thanks Andy. - Original Message From: Bastien Koert [EMAIL PROTECTED] To: A.smith [EMAIL PROTECTED], php-general@lists.php.net php-general@lists.php.net Subject: RE: [PHP] PHTML files showing as blank pages Date: 05/01/08 18:20 Andy, try this AddHandler php5-script .php .phtml #AddType text/html .php .phtml AddType application/x-httpd-php .php .phtml .html .htm bastien Message sent using UK Grid Webmail 2.7.9 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHTML files showing as blank pages
On Jan 5, 2008 1:50 PM, A.smith [EMAIL PROTECTED] wrote: Hi Bastien, thanks for the suggestion, unfortunately I still have no page displayed... thanks Andy. Are you restarting Apache after you've made the changes? Every time you modify php.ini or httpd.conf, you have to restart Apache. -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Login script problem
Daniel Brown wrote: if(!isset($key=='1')) //caused parse error That's because isset() isn't able to eval() an expression. Got it, I see the mistake now. Remove the !isset() part, or the =='1' part and that will remove the parse error. I changed it to if(!isset($key)) and you were right, the parse error went away. This change seems to have no effect on access code logins (I'm able to log in, as expected) or IP-authenticated logins (I still cannot log in, even though my IP is in the MySQL db). Reese -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] login and read ad email
HI! I try to login and read ad email in server. Does any one know how to do this? Below does not run correctly. Regards, Yui p.s I try to see pop3 email. I can not find the example! ?php $host = abc.com; $port = 110; $user ='[EMAIL PROTECTED]'; $pwd ='password'; $fp = fsockopen($host, $port); // ログイン fputs($fp,USER $user\r\n); // USE $line = fgets($fp, 512); fputs($fp,PASS $pwd\r\n); // pwd $line = fgets($fp, 512); echo $line; if( !eregi(OK, $line) ) // login faile?if( !eregi(OK, $line) ) //ogin faile? { echo fail; fclose($fp); return false; } echo sucess; ? 2008/1/1, Richard Lynch [EMAIL PROTECTED]: PHP's IMAP module will cheerfully use POP if you insist on it. You don't have to READ the email with IMAP. You can just re-arrange all your folders or do whatever it is you want it to do... You keep asking the same questions, and I keep telling you IMAP will do it. maybe you should try it? On Mon, December 31, 2007 1:17 am, Yui Hiroaki wrote: Thank you! But I would like to use pop. Because I do not want display the email. I just access and get email. Please teach me some advise. Yui 2007/12/31, Richard Lynch [EMAIL PROTECTED]: On Sun, December 30, 2007 2:19 pm, Yui Hiroaki wrote: HI! I am trying to access qmail with php. Why! Because I would like to read mail who someone send an email me to qmail. If anyone knows the code, please send me the code. http://php.net/imap Sample Code: http://l-i-e.com/imap/index.phps Some spam filtering I set up to catch what slips through spam assasin and get the email sorted server-side rather than have my desktop client CHOKES trying to sort out thousands of emails upon login... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So?
Re: [PHP] First stupid post of the year. [SOLVED]
On Sat, 5 Jan 2008 01:08:13 -0500, tedd wrote: At 1:41 AM +0100 1/5/08, Nisse Engström wrote: On Fri, 4 Jan 2008 09:16:54 -0500, tedd wrote: At 10:33 AM +0100 1/4/08, Nisse Engström wrote: On Thu, 3 Jan 2008 12:39:36 -0500, tedd wrote: Nisse: Thanks again for your time and guidance. If that's what you want to call my incoherent ramblings... :-) As you said, it's my understanding that a web page encoding can be designated via a meta statement meta http-equiv=content-type content=text/html;charset=UTF-8 The page encoding is determined by the HTTP `Content-Type:´ header. Period. A meta element may provide hints to a browser if the HTTP header is missing (eg. when saving a page to disc). In the presence of a `Content-Type:´ header, the meta element should be completely ignored. There have been reports about russian servers that transcode document from one encoding to another (and modifies the HTTP headers accordingly) on the fly, which means that the meta element is incorrect when it reaches the browser. NOTE: Richard Lynch tells us that (some versions of) Internet Explorer, under certain circumstances, ignore the `Content-Type:´ header and that a meta element is necessary to make it guess the encoding correctly. I don't know about this, but I tend to believe him. You should probably do what Richard says. However, that might be different than how the page was actually saved. I have heard of instances where a disconnect like that has caused problems with browsers and made them kick into quirks mode, which also has affected other things like javascript. I had one javascript guru that kept hitting me over the head with complaints that I was deliberately doing it just to piss him off, but the truth was I just didn't realize the problem -- still don't. Things like that can probably happen. So, to cover all bases -- what's the best way to set encoding in web page, to save correctly and use a meta tag? And, what do you recommend to be the best encoding to shoot for, UTF-8? UTF-8. The only character encodings that seem to be universally supported (if I recall correctly) are most ISO-8859 (eg `ISO-8859-1´) and Windows (eg. `cp1252´) encodings, and UTF-8. The advantage of UTF-8 is, of course, that it covers *a lot* more characters than any of the legacy 8-bit encodings. I think that support for UTF-16 (and UTF-32) is lacking, especially when it comes to form submission. UTF-8 also has some very nice properties: * Compatibility with ASCII. Even though it is a variable- length encoding, all ASCII characters (U+00 - U+7f) have identical encodings in ASCII and UTF-8. * Compatibility with 8-bit string functions. All multi- octet sequences (U+80 and up) contain only octets in the range 80 - ff, so there are no NULL or control characters embedded that can cause problems. Even string comparison works (unless you want to go whole hog with combining characters, character collation and what-not). * (And some more stuff that I'm too tired to remember.) And lastly, what's the best encoding to set your browser? I have clients who are all over the place with special windoze characters that appear like garbage in my browser. Set it to detect automatically, with a preference for cp1252 (or windows-1252) which covers a lot of western characters. cp1252 also has the nice property of being compatible with ISO-8859-1, except that it has some extra real characters where 8859-1 has control characters. I seems to me that when a page is served with an incorrect encoding or none at all, cp1252 is often the correct encoding. Of course, that may depend on which pages I tend to visit... This doesn't always work of course; Regardless of what you choose, you can probably find plenty of pages where that choice is wrong. Both Opera and FireFox will let you choose encoding on the fly through the menu bar. - - - And sometimes you can stumble upon a page where *every* choice is wrong: http://www.w3.org/International/ Look at the various languages under Links to Translation in the yellowish column. Under ar (Arabic) you'll find the following characters (in UTF-8): c3 98c2 a7c3 99c2 84c3 98c2 b9c3 98 c2 b1c3 98c2 a8c3 99c2 8ac3 98c2 a9 Run this through a `UTF-8 to UTF-16´ converter (to make the Unicode code points easier to read) and you'll find: 00 d800 a700 d900 8400 d800 b900 d8 00 b100 d800 a800 d900 8a00 d800 a9 Now, lose the zeroes... d8 a7d9 84d8 b9d8 b1d8 a8d9 8ad8 a9 ...and run it *again* through the `UTF-8 to UTF-16´ converter... 06 2706 4406 3906 3106 2806 4a06 29 ...and you end up with some actual arabic characters! (The range U+0600 - U+06ff contain arabic characters.) It's the same for the other languages. And this on a page about internationalization no less. :-) I read a book on Unicode and the book provided considerable evidence of the complexities of encoding. Now
Re: [PHP] login and read ad email
On Saturday 05 January 2008 22:06:47 Yui Hiroaki wrote: HI! I try to login and read ad email in server. Does any one know how to do this? Below does not run correctly. right, the line: if( !eregi(OK, $line) ) // login faile?if( !eregi(OK, $line) ) //ogin faile? it looks just like this? without reading the code it strikes me as odd if it does. Regards, Yui p.s I try to see pop3 email. I can not find the example! ?php $host = abc.com; $port = 110; $user ='[EMAIL PROTECTED]'; $pwd ='password'; $fp = fsockopen($host, $port); // ログイン fputs($fp,USER $user\r\n); // USE $line = fgets($fp, 512); fputs($fp,PASS $pwd\r\n); // pwd $line = fgets($fp, 512); echo $line; if( !eregi(OK, $line) ) // login faile?if( !eregi(OK, $line) ) //ogin faile? { echo fail; fclose($fp); return false; } echo sucess; ? 2008/1/1, Richard Lynch [EMAIL PROTECTED]: PHP's IMAP module will cheerfully use POP if you insist on it. You don't have to READ the email with IMAP. You can just re-arrange all your folders or do whatever it is you want it to do... You keep asking the same questions, and I keep telling you IMAP will do it. maybe you should try it? On Mon, December 31, 2007 1:17 am, Yui Hiroaki wrote: Thank you! But I would like to use pop. Because I do not want display the email. I just access and get email. Please teach me some advise. Yui 2007/12/31, Richard Lynch [EMAIL PROTECTED]: On Sun, December 30, 2007 2:19 pm, Yui Hiroaki wrote: HI! I am trying to access qmail with php. Why! Because I would like to read mail who someone send an email me to qmail. If anyone knows the code, please send me the code. http://php.net/imap Sample Code: http://l-i-e.com/imap/index.phps Some spam filtering I set up to catch what slips through spam assasin and get the email sorted server-side rather than have my desktop client CHOKES trying to sort out thousands of emails upon login... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- --- Børge Holen http://www.arivene.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHTML files showing as blank pages
On Jan 5, 2008, at 10:50 AM, A.smith [EMAIL PROTECTED] wrote: Hi Bastien, thanks for the suggestion, unfortunately I still have no page displayed... thanks Andy. - Original Message From: Bastien Koert [EMAIL PROTECTED] To: A.smith [EMAIL PROTECTED], php-general@lists.php.net php-general@lists.php.net Subject: RE: [PHP] PHTML files showing as blank pages Date: 05/01/08 18:20 Andy, try this AddHandler php5-script .php .phtml #AddType text/html .php .phtml AddType application/x-httpd-php .php .phtml .html .htm bastien Message sent using UK Grid Webmail 2.7.9 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php In the actual page, try replacing ? with ?php. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] which window?
Try adding target=_top or target=_parent to the form element in HTML. On 1/5/08, Bastien Koert [EMAIL PROTECTED] wrote: this would be an html / js issue... why have a popup login in this case? just show the logon in the main window and then do the redirect... bastien To: php-general@lists.php.net From: [EMAIL PROTECTED] Date: Sat, 5 Jan 2008 10:17:55 -0800 Subject: [PHP] which window? Hello; I have a login panel that is opened as a javascript window. In the processing script, a successful login uses the header function to send the user to the restricted content index page. But this page is loading into the javascript window instead of the opener window of the browser. Is it possible to supply a target property to the header() function to display content in a specific window? Or is that strictly an html/javascript issue? I have looked into the header() function but it is unclear to me what all can be done with headers. Thanks in advance for suggestions, info; Jeff K -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Use fowl language with Chicktionary. Click here to start playing! http://puzzles.sympatico.msn.ca/chicktionary/index.html?icid=htmlsig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- -Casey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year. [SOLVED]
On Jan 5, 2008 5:04 PM, Nisse Engström [EMAIL PROTECTED] wrote: [snip!] The page encoding is determined by the HTTP `Content-Type:´ header. Period. [snip=again] Negative. If that were the case, what would be the sense in providing browser encoding translation? Have you noticed, for example, that Opera and Firefox (read: any browser other than Internet Exploder) provide the opportunity for viewing in alternate UTFs, et cetera? I'm not saying you're entirely wrong, but it's not an all-encapsulating answer to say that all page encoding (which I'll read as data served) will be determined by the HTTP (which is actually only a protocol, by the way) 'Content-type' header. Regardless, interpretation will be done by the client. Versioning, for example, proves that the Content-type header is not the end-all, be-all. Grabbing a file via wget 1.3 may give (again, *may give*, this is unchecked ;-P ) a different result than Netscape Navigator 2.4. From there, the filters (where necessary) argue over how the format is handled. -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHTML files showing as blank pages
On Jan 5, 2008, at 639AM, A.smith wrote: I'm having a problem getting .phtml files to display in a web browser. I can successfully display a test.php page as per PHP install instructions but the phtml files show up blank (in firefox or IE). A blank page often means that there's an error of some kind, but error reporting is turned off. Put the following code in the file that's giving you problems to turn on errors, then reload the file in your browser to see what you get: ini_set('display_errors',1); Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HTML form upload works, CURL fails when uploading file from c:
PHP 5.2.1 on Apache/Linux. Client is Firefox and IE7 on Windows XP. Uploading C:\boot.ini works great from an HTML type=file form element but fails using what should be the equivalent: curl_setopt($ch,CURLOPT_POSTFIELDS,array('peru'='@C:/boot.ini')); CURL error is failed creating formpost data. Same CURL works when the test file resides on the PHP server: curl_setopt($ch,CURLOPT_POSTFIELDS,array('peru'='@/home/user/boot.ini')); so problem seems to be in the '@C:/boot.ini' filespec. Substituting '@C:\boot.ini' or '@C:\\boot.ini' doesn't help. What am I doing wrong? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: HTML form upload works, CURL fails when uploading file from c:
Well, dope slap I think I understand the problem now: CURL is operating from the server so it knows nothing about C: on the client! So how do I solve my problem? I want to upload multiple files from C: to the server based on a single wildcard spec typed into an HTML form by the user. John Gunther wrote: PHP 5.2.1 on Apache/Linux. Client is Firefox and IE7 on Windows XP. Uploading C:\boot.ini works great from an HTML type=file form element but fails using what should be the equivalent: curl_setopt($ch,CURLOPT_POSTFIELDS,array('peru'='@C:/boot.ini')); CURL error is failed creating formpost data. Same CURL works when the test file resides on the PHP server: curl_setopt($ch,CURLOPT_POSTFIELDS,array('peru'='@/home/user/boot.ini')); so problem seems to be in the '@C:/boot.ini' filespec. Substituting '@C:\boot.ini' or '@C:\\boot.ini' doesn't help. What am I doing wrong? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: HTML form upload works, CURL fails when uploading file from c:
-Original Message- From: John Gunther [mailto:[EMAIL PROTECTED] Sent: Saturday, January 05, 2008 8:57 PM To: php-general@lists.php.net Subject: [PHP] Re: HTML form upload works, CURL fails when uploading file from c: Well, dope slap I think I understand the problem now: CURL is operating from the server so it knows nothing about C: on the client! So how do I solve my problem? I want to upload multiple files from C: to the server based on a single wildcard spec typed into an HTML form by the user. John Gunther wrote: PHP 5.2.1 on Apache/Linux. Client is Firefox and IE7 on Windows XP. Uploading C:\boot.ini works great from an HTML type=file form element but fails using what should be the equivalent: curl_setopt($ch,CURLOPT_POSTFIELDS,array('peru'='@C:/boot.ini')); CURL error is failed creating formpost data. Same CURL works when the test file resides on the PHP server: curl_setopt($ch,CURLOPT_POSTFIELDS,array('peru'='@/home/user/boot.ini' )); so problem seems to be in the '@C:/boot.ini' filespec. Substituting '@C:\boot.ini' or '@C:\\boot.ini' doesn't help. What am I doing wrong? You can't solve this issue with HTML+javascript+PHP alone. You will need plugin support (a Java applet, an ActiveX control, Flash). Google for swfupload, though there are similar projects, it seems to be one of the easiest solutions as it only requires you to know javascript (no guarantees anyway). Rob Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 | TEL 954-607-4207 | FAX 954-337-2695 Email: [EMAIL PROTECTED] | MSN Chat: [EMAIL PROTECTED] | SKYPE: bestplace | Web: http://www.bestplace.biz | Web: http://www.seo-diy.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Execute a script from command line on a Linux system with Plesk (safe mode)
Hello, I am trying to execute this script (from command line): function getMailboxSize($domain, $mailbox){ // Maildirectories are stored under /var/qmail(mailnames/domain/mailuser $path = /var/qmail/mailnames/ . $domain . / . $mailbox; $size = shell_exec(cd . $path . ;du -bc * | grep total | cut -d\\t -f 0,1); return trim($size); } I get the warning: shell_exec(): Cannot execute using backquotes in Safe Mode. Ok, I don't want to modify to suphp or so... what other alternatives do I have? Shall I put this code in a shell script, sudo it and let it execute by my php script? Or how can I get around? I have also tried to connect via mysql in order to get the usage/limitation with the imap_get_quotaroot function... I used this code: function getMailboxSize($domain, $mailbox, $passwd){ $mbox = imap_open({my_server_ip:993/imap/ssl/novalidate-cert}, $mailbox.@.$domain, $passwd, OP_HALFOPEN) or die(can't connect: . imap_last_error()); $size = 0; $quota = imap_get_quotaroot($mbox, INBOX); if( $quota != FALSE is_array($quota) ){ print_r($quota); }else{ echo no quota?\n; } imap_close($mbox); return $size; } imap_get_quotaroot returns false. I don't know really what else I could try... The goal is to get the usage of each imap mailbox on the machine (used/quota) to know if it is full or not (if not, how full?). Would be nice if someone could help :) LS -- Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] client time zone?
Hello; I am running a server that is using UTC and I want to be able to convert to clients local time in some display presentations. Is this indicated by $_SERVER[REQUEST_TIME]? If not, is there a way to get the requesting host's time zone so I can offset the servers clock value correctly? Thank you for info: Jeff K -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Execute a script from command line on a Linux system with Plesk (safe mode) [solved]
Hello, I found it myself... I just start php in command line with --php-ini other_php.ini where I set safe_mode Off. Bye :) -- GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS. Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] which window?
On Jan 5, 2008, at 3:09 PM, Casey wrote: Try adding target=_top or target=_parent to the form element in HTML. On 1/5/08, Bastien Koert [EMAIL PROTECTED] wrote: this would be an html / js issue... why have a popup login in this case? just show the logon in the main window and then do the redirect... bastien Thank you, the idea of a target property in the form opening tag is new to me, but it is worth a try. However, I redid the script to process itself instead of doing a header redirect. Then once the login form reloads, there is a link that has javascript do the redirect as document.referrer.window.location = (target file); (for anyone who could use a little useful info on javascript). That is one of the things I love about php. The login script can write javascript that is not present in the pre form submission version. So someone trying by trial and error to log in cannot look at the javascript and figure anything out from it. Someone who can log in could see it in the added script, but there's no point because it is visible in the location field of the browser, then. I have other tricks to screen access. But no one is going to get the keys to Fort Knox on this site either. It is effectively the same type of security that a forum would use, and the same type of content value. Thank you for the suggestion; Jeff K To: php-general@lists.php.net From: [EMAIL PROTECTED] Date: Sat, 5 Jan 2008 10:17:55 -0800 Subject: [PHP] which window? Hello; I have a login panel that is opened as a javascript window. In the processing script, a successful login uses the header function to send the user to the restricted content index page. But this page is loading into the javascript window instead of the opener window of the browser. Is it possible to supply a target property to the header() function to display content in a specific window? Or is that strictly an html/javascript issue? I have looked into the header() function but it is unclear to me what all can be done with headers. Thanks in advance for suggestions, info; Jeff K -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Use fowl language with Chicktionary. Click here to start playing! http://puzzles.sympatico.msn.ca/chicktionary/index.html?icid=htmlsig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- -Casey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to use php from mysql to xml
On Jan 5, 2008 5:14 AM, Yang Yang [EMAIL PROTECTED] wrote: hi,everyone,i am a newbuy for php world and i have a problem when i study php i want to make a script,it works for: a mysql table,like title authorcontentdate a1a2 a3 a4 b1b2 b3b4 .. and i want to use php ,select it and make a xml to save it ,now i use this script ?php header(Content-type: text/xml); $host = localhost; $user = root; $pass = ; $database = test; $linkID = mysql_connect($host, $user, $pass) or die(Could not connect to host.); mysql_select_db($database, $linkID) or die(Could not find database.); $query = SELECT * FROM blog ORDER BY date DESC; $resultID = mysql_query($query, $linkID) or die(Data not found.); $xml_output = ?xml version=\1.0\?\n; $xml_output .= entries\n; for($x = 0 ; $x mysql_num_rows($resultID) ; $x++){ $row = mysql_fetch_assoc($resultID); $xml_output .= \tentry\n; $xml_output .= \t\tdate . $row['date'] . /date\n; // Escaping illegal characters $row['text'] = str_replace(, , $row['text']); $row['text'] = str_replace(, , $row['text']); $row['text'] = str_replace(, gt;, $row['text']); $row['text'] = str_replace(\, quot;, $row['text']); $xml_output .= \t\ttext . $row['text'] . /text\n; $xml_output .= \t/entry\n; } $xml_output .= /entries; echo $xml_output; ? it has no problem,but i want to save a xml file ,like this format ?xml version=1.0 encoding=GB2312? Table Record Titlea1/Title Authora2/Author Contenta3/Content date2003-06-29/date /Record Record Titleb1/Title Authorb2/Author Contentb3/Content date2003-06-30/date /Record many record /Table how can i improve this script? php has tools to help you work with xml, the best one for most purposes in php5 is SimpleXML. http://www.php.net/manual/en/ref.simplexml.php heres the way i would do it (you may have debug a tiny bit, all ive done is verified the syntax parses without errors). ?php header(Content-type: text/xml); $host = localhost; $user = root; $pass = ; $database = test; $linkID = mysql_connect($host, $user, $pass) or die(Could not connect to host.); mysql_select_db($database, $linkID) or die(Could not find database.); $query = SELECT * FROM blog ORDER BY date DESC; if(!($resultSet = mysql_query($query, $linkID))) { die('data not found!'); } /// create the table container $table = new SimpleXMLElement('table/table'); while($resultRow = mysql_fetch_object($resultSet)) { $record = new SimpleXMLElement('record/record'); // create a container for the record foreach($resultRow as $curColName = $curColValue) {// add the columns from this record $record-addChild($curColName, $curColValue); } $table-addChild($record); } echo $table-asXML(); -nathan