php-general Digest 5 Jan 2008 16:20:37 -0000 Issue 5218
Topics (messages 266757 through 266785):
Re: Posting Summary for Week Ending 4 January, 2008: [EMAIL PROTECTED]
266757 by: TG
266758 by: TG
266761 by: tedd
266767 by: chris smith
266778 by: Daniel Brown
Re: can't figure out proper format for c:\ path for curl upload
266759 by: Manuel Lemos
Re: image* Functions' Memory Usage
266760 by: Ólafur Waage
Re: How to secure Flash Video? [Solved?]
266762 by: tedd
266763 by: Casey
Re: First stupid post of the year. [SOLVED]
266764 by: tedd
need opinions regarding php.ini
266765 by: Afan Pasalic
266784 by: Daniel Brown
266785 by: Afan Pasalic
how to use php from mysql to xml
266766 by: Yang Yang
266768 by: chris smith
menu andfolder question
266769 by: Alain Roger
266770 by: chris smith
266771 by: Alain Roger
266772 by: chris smith
266773 by: John Gunther
Re: problem sending emamil across one postfix server
266774 by: Miren Urkixo
Delete rows from database
266775 by: Balasubramanyam A
266777 by: Per Jessen
266779 by: Daniel Brown
http_request
266776 by: peeyush gulati
266780 by: Daniel Brown
266781 by: Dave Goodchild
266782 by: Daniel Brown
266783 by: Dave Goodchild
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
It's not being sent from Dan's email, it appears. I didn't look at the
headers yet, but the "From:" is showing this:
"PostTrack [Dan Brown]" <[EMAIL PROTECTED]>
So don't everyone jump on Dan just yet.
Besides, *I* want to win and I'm holding a close second!
-TG
----- Original Message -----
From: "Daniel Brown" <[EMAIL PROTECTED]>
To: "PostTrack [Dan Brown]" <[EMAIL PROTECTED]>
Cc: [EMAIL PROTECTED]
Date: Fri, 4 Jan 2008 19:24:02 -0500
Subject: Re: [PHP] Posting Summary for Week Ending 4 January, 2008:
[EMAIL PROTECTED]
> It must be something on the mailing list side of things, because
> I'm getting them, too, but there's nothing at all in my outgoing
> queue.
>
> On Jan 4, 2008 5:48 PM, PostTrack [Dan Brown]
> <[EMAIL PROTECTED]> wrote:
> >
> >
> > Posting Summary for PHP-General List
> > Week Ending: Friday, 4 January, 2008
> >
> > Messages | Bytes | Sender
> > ----------------+-----------------+------------------
> > 4 (100%) 4305 (100%) EVERYONE
> > 2 (0.5%) 1100 (0.26%) "Daniel Brown"
> <[EMAIL PROTECTED]>
> > 1 (0.25%) 1532 (0.36%) "TG"
> <[EMAIL PROTECTED]>
> > 1 (0.25%) 1673 (0.39%) "Miren Urkixo"
> <[EMAIL PROTECTED]>
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
>
> --
> 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
>
>
--- End Message ---
--- Begin Message ---
Ah.. nevermind.. I didn't see this amidst the debris. Bad Dan! :)
-TG
(Am I winning yet?)
----- Original Message -----
From: "Daniel Brown" <[EMAIL PROTECTED]>
To: "PostTrack [Dan Brown]" <[EMAIL PROTECTED]>
Cc: [EMAIL PROTECTED]
Date: Fri, 4 Jan 2008 18:31:00 -0500
Subject: Re: [PHP] Posting Summary for Week Ending 4 January, 2008:
[EMAIL PROTECTED]
> On Jan 4, 2008 6:22 PM, PostTrack [Dan Brown]
> <[EMAIL PROTECTED]> wrote:
> >
> > Posting Summary for PHP-General List
> > Week Ending: Friday, 4 January, 2008
> >
> > Messages | Bytes | Sender
> > ----------------+-----------------+------------------
> > 6 (100%) 8880 (100%) EVERYONE
> > 2 (0.33%) 1100 (0.12%) "Daniel Brown"
> <[EMAIL PROTECTED]>
> > 2 (0.33%) 4204 (0.47%) "Miren Urkixo"
> <[EMAIL PROTECTED]>
> > 1 (0.17%) 1532 (0.17%) "TG"
> <[EMAIL PROTECTED]>
> > 1 (0.17%) 2044 (0.23%) Jim Lucas <[EMAIL PROTECTED]>
> >
>
> Ignore that. It's a new script that is going to start running as
> of 4:00p EST on 11 January, 2008. It will summarize the number of
> messages to the list, then tell who posted how many, what size, et
> cetera.
>
> There may be one or two more messages that will wind up getting
> sent because I accidentally manually ran the live script while testing
> it for the cron.
>
> 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.
>
>
> --
> 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
>
>
--- End Message ---
--- Begin Message ---
At 11:33 PM -0500 1/4/08, TG wrote:
Ah.. nevermind.. I didn't see this amidst the debris. Bad Dan! :)
-TG
(Am I winning yet?)
I think we're going to have to change his name to:
PostTrack Dan
if this keeps up.
In all seriousness, I am sure he doesn't realize that this is
happening -- it's a mistake. He wouldn't intentionally do this to
this list.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
> 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/
--- End Message ---
--- Begin Message ---
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.
--- End Message ---
--- Begin Message ---
Hello,
on 01/05/2008 02:18 AM John Gunther said the following:
> I can't figure out how to pass a c:\... filepath via curl for an RFC1867
> multipart form upload in PHP 5.2.1.
>
> I'm using the following code to perform a programmatic file upload to
> the PHP server:
>
> $filepath='/home/user/testfile.txt';
> $ch=curl_init('http://bucksvsbytes.com/upload.php');
> curl_setopt($ch,CURLOPT_POST,true);
> curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
> curl_setopt($ch,CURLOPT_POSTFIELDS,array('peru'=>'@'.$filepath));
> curl_exec($ch);
> curl_close($ch);
>
> Works great if the file I want to upload is on the web server but it
> never is. The files I want are on the client computer, of course, e.g.
> c:\home\user\testfile.txt
>
> I've tried passing every variation of that path I can think of, e.g.:
>
> C:\home\user\testfile.txt
> C:\\home\\user\\testfile.txt
> C:/home/user/testfile.txt
> urlencode(...)
> utf8_encode(...)
>
> and nothing works. I either get the dreaded "failed creating formpost
> data" or the filepath shows up in $_POST and $_FILES is empty. The
> listed formats don't work with fopen() either.
>
> I've searched dozens of web examples but I can't get it. Help!
>
> For that matter, is there a better approach than curl for programmed
> uploads of client computer files to the PHP server?
When I use Curl I prefer composing a RAW HTTP request because I am sure
it will work as intended. Whenever possible I prefer using fsockopen
connections. In any case I use this HTTP client request class that wraps
everything and supports form submission with file upload as you need:
http://www.phpclasses.org/httpclient
--
Regards,
Manuel Lemos
Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--- End Message ---
--- Begin Message ---
I recently made two commercial sites that used both GD and Imagick and
i can share some wisdom i got from those projects.
(both projects were "card" generators where users made their custom
cards and but one had a fixed picture and users could add text and the
other one allowed users to add their own picture with text)
# Some functions of the GD library are VERY memory intensive.
For example the image resizing. The resizing process is calling three
functions to work and two of them are holding very large amounts of
data within them. (the original image and the new image area you are
going to put the resized image into, and then the 3rd functions
resizes the image)
# Basic GD library functions can be quite fast (and most if not all
Imagick functions are fast if the image isn't too big)
# Speed of both options are always affected by the size of the image
being used. (Size in bytes, a 10x15 print quality card generated with
a user selected image + text can take up to 30 seconds to generate)
And yes thats an annoying generator to debug.
# If you are going beyond simple things like adding text onto an image
i recommend going with Imagick.
# Imagick is a great system to use if you learn all the command lines
and combinations, far superior to GD in many ways.
# Complex Imagick functions (that works with all possible outcomes)
can be VERY slow.
# If you have the choice of running Imagick from the command line
(installed onto the linux system) or running the Imagick PHPlib, go
with the PHP library one (even though it looks like more overhead in
code) since error reporting with the command line is close to none.
# If you have the choice of the images being generated later (ie. by
an admin of the system), go with that path always. (one of my systems
does that and the other doesn't) and the problems with the end users
on the image generating step are very hard to debug, since they
usually describe the problems very badly.
Hope this helps some.
- Ólafur Waage
[EMAIL PROTECTED]
2008/1/4, Casey <[EMAIL PROTECTED]>:
> Greetings, list.
>
> I have a web application that generates PNG images that are thousands
> of pixels high by thousands of pixels wide (using imagepng, etc.).
>
> The problem is this takes way too much memory, and the rest of the
> site becomes too slow.
>
> I'm working on something to cache the images, but some suggestions in
> the meantime would be great.
>
> Maybe ImageMagick is faster? Flash?Any suggestions? Thank you very much.
>
> - Casey
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
Hi gang:
Here's my logic, so what's wrong with it?
My sole concern here is to protect a Video from being stolen and/or
being viewed remotely while allowing "approved" users to view it.
It is a fact that anything you present to a user is theirs. There's
no stopping them from downloading a Video if they have permission to
do so. In fact, that's exactly what they do when they view a Video --
they can't view it in their browser unless their browser has it.
Now, I have investigated several ways to protect videos and prevent
caching. Some methods are very complex -- but complexity does not
always guarantee security. Complexity is more likely to present
problems in its application. Sometimes the simplest method is best.
The simplest protection method I can think of can be done by using
Flash Video Actionscript in concert with php/mysql.
It's a simple matter to have the Video run the following prior to displaying:
theXML.load(http://example.com/security.php)
That's similar to a javascript onload function.
Upon loading the Video, the Video will run the script "security.php"
which in-turn will check to see if an approved user is attempting to
view the Video. This done by simply checking a user-id session
variable in the script that delivers the Video.
If that session variable (user-id ) is empty, then the security.php
returns nothing.
If that session session is not empty, then the script will check the
user-id against the database to see if the user has permission to
view the Video. If the user does not have permission, then the
security.php script returns nothing.
If everything checks, then the security.php script will return a key
and the Video will check that key against an internal key -- if a
match is made, then the video plays.
Now, please note that this will also prohibit the user, even after
paying for the Video, from downloading the Video for future plays
because the Video will always check for a key.
Even if the user downloads the Video and takes the Video to a remote
player, the Video will still try to run the security script seeking a
key. If the security script is not there, then it fails. Even if the
user figures out that the Video requires a key, the still user has no
way to determine what that internal key is.
So, I think this will work. What say all of you? Where have I screwed up?
And, please no one liners that solve the entire mess and make me look
like a fool.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
On Jan 4, 2008 9:16 PM, tedd <[EMAIL PROTECTED]> wrote:
> Hi gang:
>
> Here's my logic, so what's wrong with it?
>
> My sole concern here is to protect a Video from being stolen and/or
> being viewed remotely while allowing "approved" users to view it.
>
> It is a fact that anything you present to a user is theirs. There's
> no stopping them from downloading a Video if they have permission to
> do so. In fact, that's exactly what they do when they view a Video --
> they can't view it in their browser unless their browser has it.
>
> Now, I have investigated several ways to protect videos and prevent
> caching. Some methods are very complex -- but complexity does not
> always guarantee security. Complexity is more likely to present
> problems in its application. Sometimes the simplest method is best.
>
> The simplest protection method I can think of can be done by using
> Flash Video Actionscript in concert with php/mysql.
>
> It's a simple matter to have the Video run the following prior to displaying:
>
> theXML.load(http://example.com/security.php)
>
> That's similar to a javascript onload function.
>
> Upon loading the Video, the Video will run the script "security.php"
> which in-turn will check to see if an approved user is attempting to
> view the Video. This done by simply checking a user-id session
> variable in the script that delivers the Video.
>
> If that session variable (user-id ) is empty, then the security.php
> returns nothing.
>
> If that session session is not empty, then the script will check the
> user-id against the database to see if the user has permission to
> view the Video. If the user does not have permission, then the
> security.php script returns nothing.
>
> If everything checks, then the security.php script will return a key
> and the Video will check that key against an internal key -- if a
> match is made, then the video plays.
>
> Now, please note that this will also prohibit the user, even after
> paying for the Video, from downloading the Video for future plays
> because the Video will always check for a key.
>
> Even if the user downloads the Video and takes the Video to a remote
> player, the Video will still try to run the security script seeking a
> key. If the security script is not there, then it fails. Even if the
> user figures out that the Video requires a key, the still user has no
> way to determine what that internal key is.
>
> So, I think this will work. What say all of you? Where have I screwed up?
>
> And, please no one liners that solve the entire mess and make me look
> like a fool.
>
> Cheers,
>
> tedd
>
I'm not sure if you mean FLV's or SWF's.
If you mean FLV's loaded from SWF's, the browser can cache the FLV,
and the user can later retrieve it.
If you mean SWF's, there are "extractors" out there.
In other words, it's not really possible to completely secure these
videos, but this is a fairly good solution, as I see it.
--
-Casey
--- End Message ---
--- Begin Message ---
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.
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">
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.
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?
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.
"This entire encoding process is more involved
than it looks"
That sounds familiar.
I read a book on Unicode and the book provided
considerable evidence of the complexities of
encoding. Now throw into the mix PUNYCODE for
IDNS and you have quite an assortment of problems
with rendering different code-points in different
char-sets. A very interesting topic.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
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?
xxxx [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?
xxxx [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?
xxxx [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.
Thanks.
-afan
--- End Message ---
--- Begin Message ---
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?
> xxxx [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?
> xxxx [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?
> xxxx [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.
--- End Message ---
--- Begin Message ---
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?
xxxx [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?
xxxx [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?
xxxx [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).
--- End Message ---
--- Begin Message ---
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 author content date
a1 a2 a3 a4
b1 b2 b3 b4
..........................
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 .= "\t<entry>\n";
$xml_output .= "\t\t<date>" . $row['date'] . "</date>\n";
// Escaping illegal characters
$row['text'] = str_replace("&", "&", $row['text']);
$row['text'] = str_replace("<", "<", $row['text']);
$row['text'] = str_replace(">", ">", $row['text']);
$row['text'] = str_replace("\"", """, $row['text']);
$xml_output .= "\t\t<text>" . $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>
<Title>a1</Title>
<Author>a2</Author>
<Content>a3</Content>
<date>2003-06-29</date>
</Record>
<Record>
<Title>b1</Title>
<Author>b2</Author>
<Content>b3</Content>
<date>2003-06-30</date>
</Record>
........
----many record
</Table>
how can i improve this script?
Thanks all
--- End Message ---
--- Begin Message ---
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 author content date
> a1 a2 a3 a4
> b1 b2 b3 b4
> ..........................
>
>
> 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>
> <Title>a1</Title>
> <Author>a2</Author>
> <Content>a3</Content>
> <date>2003-06-29</date>
> </Record>
> <Record>
> <Title>b1</Title>
> <Author>b2</Author>
> <Content>b3</Content>
> <date>2003-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/
--- End Message ---
--- Begin Message ---
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
--- End Message ---
--- Begin Message ---
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/
--- End Message ---
--- Begin Message ---
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
--- End Message ---
--- Begin Message ---
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/
--- End Message ---
--- Begin Message ---
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,
--- End Message ---
--- Begin Message ---
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: <[EMAIL PROTECTED]>
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>
<p>Has 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
--- End Message ---
--- Begin Message ---
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 "\t<tr>\n";
echo "<td><input type=checkbox name=index /></ td>";
foreach ($line as $col_value) {
echo "\t\t<td> $col_value</td>\n";
}
//echo "<td><input type=button name=vcancel value=Cancel /></td>";
echo "\t</tr>\n";
}
--- End Message ---
--- Begin Message ---
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
--- End Message ---
--- Begin Message ---
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.
--- End Message ---
--- Begin Message ---
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
--- End Message ---
--- Begin Message ---
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.
--- End Message ---
--- Begin Message ---
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
>
>
--- End Message ---
--- Begin Message ---
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.
--- End Message ---
--- Begin Message ---
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.
>
--- End Message ---