php-general Digest 12 Jun 2004 18:58:18 -0000 Issue 2817
Topics (messages 188141 through 188159):
Re: testing array_search
188141 by: Bob Lockie
Header target?
188142 by: Bob Lockie
188144 by: Steve Douville
export from mysql to csv file
188143 by: Dustin Krysak
188145 by: Larry E. Ullman
188146 by: John Hicks
Re: gethostbyaddr
188147 by: John Hicks
Installation Question
188148 by: Marlene Thoms
188149 by: Marlene Thoms
188150 by: Steve Douville
188153 by: Pham Cong Dinh
PHP 5/OOP, Functionality similar to an Abstract method?
188151 by: Chris
188159 by: Justin Patrin
Re: PHP pros and cons
188152 by: Pham Cong Dinh
Best Lossless Hi-Res Photo Storage with PHP
188154 by: Galen
return string size in bytes
188155 by: PHP4web
188156 by: Dascalu Marius
Re: Limit the number of characters in a string
188157 by: Richard Harb
finding text strings in html code
188158 by: Kathleen Ballard
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 ---
On 06/11/04 17:17 Curt Zirzow spoke:
* Thus wrote Bob Lockie ([EMAIL PROTECTED]):
I'm having a very hard time testing array_search.
$j = array_search( $i, $errList );
echo "j=" . $j;
if (($j != false) && ($j >= 0)) {
<snip>
mixed array_search ( mixed needle, array haystack [, bool strict])
Searches haystack for needle and returns the key if it is found in
the array, FALSE otherwise.
</snip>
When ever you see that a function that returns mixed with a possible
FALSE Boolean value. You must always test your result as follows:
if ($j !== FALSE) {
// found an item
} else {
// no item found
}
Ok, I supected it was a boolean thing. :-(
--- End Message ---
--- Begin Message ---
Is it possible to specify the target frame in a "Header" call?
I have a form that submits in one frame and I want it to redirect to
another frame in some cases.
--- End Message ---
--- Begin Message ---
You could use javascript to determine whether or not to send it to the frame
and if so, the target attribute in the form tag can be used to direct the
form values to the frame for processing, if you're intending for the other
frame to process the form data.
If you're intending that the frame that submitted the form to process it and
then manipulate another frame, you could load javascript values based on
whatever results you had from processing the form and then use javascript to
manipulate the other frames location or values.
Geeze, that even confused me just reading it. Hope it makes sense.
Steve
----- Original Message -----
From: "Bob Lockie" <[EMAIL PROTECTED]>
To: "php-general Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, June 11, 2004 9:07 PM
Subject: [PHP] Header target?
> Is it possible to specify the target frame in a "Header" call?
> I have a form that submits in one frame and I want it to redirect to
> another frame in some cases.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
>
--- End Message ---
--- Begin Message ---
Can anyone point me to an existing script or tutorial to learn this?
Thanks in advance!
d
--- End Message ---
--- Begin Message ---
Can anyone point me to an existing script or tutorial to learn this?
I'm fairly sure there's a tutorial at PHPBuilder.com or Zend.com. Or
you can check the PEAR modules for code (I know there are database to
Excel classes).
If all else fails, Google's always helpful.
Larry
--- End Message ---
--- Begin Message ---
On Friday 11 June 2004 10:16 pm, Dustin Krysak wrote:
> Can anyone point me to an existing script or
> tutorial to learn this?
>
> Thanks in advance!
>
> d
There is a mysql utility that does this:
mysqldump -p mypassword -T mytargetdirectory
mydatabasename [mytablenames]
(The "-T" tells it to dump the data in tab-limited
format. Otherwise it generates a series of insert
statements.)
See:
http://dev.mysql.com/doc/mysql/en/mysqldump.html
One pointer: the mysql daemon does the writing so the
mysql user must have write permission on the target
directory.
Hope this helps.
John
---------------------------------------
John Hicks
Gulfbridge, Inc.
"Putting the Web to work for your business."
http://gulfbridge.com
561-586-8116
--- End Message ---
--- Begin Message ---
Hi Alicia.
Welcome to the list.
On Friday 11 June 2004 12:58 pm, Alicia Riggs wrote:
> Hi guys, I am new to this list, and signed up
> specifically for this problem. If any one has any
> ideas it would be greatly appreciated.
>
> I am writing a function to allow users from a
> specific intranet permission to view a directory. I
> am getting very different results from IE and
> Netscape. I have written this in JavaScript as well
> as PHP, and I am getting the same error in both
> languages.
Are you talking about regular old (browser-based)
Javascript? Javascript and (server-based) PHP are like
apples and oranges. You can't really get the same
error from each because they are doing completely
different things in completely different places.
> When I use the gethostbyaddr call, in IE I get a
> domain name the majority of the time, with a few
> exceptions. When I use the gethostbyaddr call in
> Netscape I only receive a domain name if there is a
> DNS entry. If there is no DNS entry, Netscape
> returns an IP address.
PHP functions are executed by the server. The browser
(Netscape and IE) have nothing to do with them.
gethostbyaddr is a simple reverse-DNS lookup (of the
REMOTE_ADDR ip address) requested by your server to
its nameserver. This never goes near the user's IE or
Netscape browser.
The IP address used is the one your webserver is using
in its HTTP (TCP) connection with the browser (or its
agent -- a firewall or proxy, for example).
If there is no DNS entry for the ip address, there
should be no hostname returned because by definition
there is no host name to be returned.
> I am not sure what IE is using to get the domain
> names when there is no DNS entry.
>
> How do I get the correct info to be returned from
> Netscape?
>
>
> Here is the code I am using
> ***********************************
>
> <?php
> //echo "<pre>";
> //print_r($_SERVER);
> //echo "</pre>";
> $hn = gethostbyaddr($_SERVER['REMOTE_ADDR']);
> echo "host by addr = " . $hn . "\n<br>";
> $darr = explode(".", $hn);
> $cnt = count($darr);
> $host = $darr[$cnt - 2] . "." . $darr[$cnt - 1];
> echo "host = " . $host . "\n<br>";
> /*
> if($host == "xyz.com")
> header("Location: xyz.html");
> else
> if($host == "abc.com")
> header("Location: abc.html");
> else
> header("Location: error.html");
> */
> ?>
For debugging purposes, I would add more verbose echos:
particularly for IP address and full host name
returned ($hn).
How are you deducing that you are getting different
results based on the user's browser?
Are there firewalls or web proxies involved? This could
account for getting conflicting IP addresses for the
same user reported by the browser (via Javascript) and
server.
> Thanks in advance for any ideas!
>
> Alicia Riggs
> PSG - Web Development Engineer
> 214-550-7452
Hope this helps.
Regards,
John
---------------------------------------
John Hicks
Gulfbridge, Inc.
"Putting the Web to work for your business."
http://gulfbridge.com
561-586-8116
--- End Message ---
--- Begin Message ---
I am running Windows XP and have installed Apache2, MyODBC, mySQL and php on
my workstation. Apache and MySQL are running, however when I try to access
phpinfo.php from my browser, php is not being accessed. Instead I see the
source code. I have gone through the installation instructions several times
on php.net and cannot find the problem. I am hoping you can help me out.
Thanks so much.
- Marlene Thoms
--- End Message ---
--- Begin Message ---
I am running Windows XP and have installed Apache2, MyODBC, mySQL and php on
my workstation. Apache and MySQL are running, however when I try to access
phpinfo.php from my browser, php is not being accessed. Instead I see the
source code. I have gone through the installation instructions several times
on php.net and cannot find the problem. I am hoping you can help me out.
Thanks so much.
- Marlene Thoms
--- End Message ---
--- Begin Message ---
did you set up the mime types in apache? did you restart apache?
----- Original Message -----
From: "Marlene Thoms" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, June 12, 2004 12:37 AM
Subject: [PHP] Installation Question
I am running Windows XP and have installed Apache2, MyODBC, mySQL and php on
my workstation. Apache and MySQL are running, however when I try to access
phpinfo.php from my browser, php is not being accessed. Instead I see the
source code. I have gone through the installation instructions several times
on php.net and cannot find the problem. I am hoping you can help me out.
Thanks so much.
- Marlene Thoms
--- End Message ---
--- Begin Message ---
Hi,
I also have an installation guide on PHP4/5, Apache2, Windows XP but it
is written in Vietnamese (
http://www.opensourcevn.org/javavietnam/php/caiphp.htm ). Could you give
me some details on your installation process ?
Regards,
Dinh
Marlene Thoms wrote:
I am running Windows XP and have installed Apache2, MyODBC, mySQL and php on
my workstation. Apache and MySQL are running, however when I try to access
phpinfo.php from my browser, php is not being accessed. Instead I see the
source code. I have gone through the installation instructions several times
on php.net and cannot find the problem. I am hoping you can help me out.
Thanks so much.
- Marlene Thoms
--- End Message ---
--- Begin Message ---
I have an abstract class with quite a few 'children'. Essentially I want
to be able to interchange calls between children (Take a script, written
with ClassA and redefine the variable as ClassB etc.)
Though there is a large subset of methods all of these children declare,
there are a few which only *some* declare. What I think I'm looking for
is a variation on an abstract method that, if not defined in a child,
will do nothing. Using an abstract method forces me to declare the
method in the child with an empty body.
Are you understanding me?
Any thoughts on the matter would be appreciated.
Thanks,
Chris
--- End Message ---
--- Begin Message ---
Chris wrote:
I have an abstract class with quite a few 'children'. Essentially I want
to be able to interchange calls between children (Take a script, written
with ClassA and redefine the variable as ClassB etc.)
Though there is a large subset of methods all of these children declare,
there are a few which only *some* declare. What I think I'm looking for
is a variation on an abstract method that, if not defined in a child,
will do nothing. Using an abstract method forces me to declare the
method in the child with an empty body.
AFAIK, there is no support for this explicitly in PHP5. You would have
to implement something yourself, like putting a die() or exit in the
abstract method in the parent class.
If you just want an empty funciton anyway, why don't you just put an
empty function in the parent? I don't see why you would need PHP to yell
at you when you don't want to do antyhing with it anyway.
--
paperCrane <Justin Patrin>
--- End Message ---
--- Begin Message ---
Hi,
Yes, namespaces has been removed from CVS for PHP5 but Object Model for
PHP5, based on Java, has been improved. I would like to say: plz forget
PHP4 and rush into PHP5.
Dinh
PHPVietnam
Chris Shiflett wrote:
--- Amanda Hemmerich <[EMAIL PROTECTED]> wrote:
what do you guys think are some limitations of PHP?
It's not persistent like ColdFusion.
It doesn't have namespaces.
The object model in PHP 4 is poor.
I'm sure others can pitch in here. :-)
Chris
=====
Chris Shiflett - http://shiflett.org/
PHP Security - O'Reilly
Coming Fall 2004
HTTP Developer's Handbook - Sams
http://httphandbook.org/
PHP Community Site
http://phpcommunity.org/
--- End Message ---
--- Begin Message ---
I'm working on a photo site and most of it is working. The intent is to
store original high-resolution photos that will only be accessed when
purchased, and then a variety of thumbnails that will be accessed when
viewing. Because they're high-resolution, I need maximal image
compression but I can't sacrifice image quality. With hundreds (or
more) of many megapixel images, space requirements quickly soar.
I am currently using PNG, but that's not all that great for lossless
photo compression. JPEG 2000 is significantly better in terms of file
size, but I haven't ever used that with PHP (and it seems I'll have to
use it via ImageMagick or something). Are there any other (free)
formats for high image compression out there that I can use (maybe even
just via the shell) with PHP?
--- End Message ---
--- Begin Message ---
I now there are function to calc file size but I want function to get string size in
bytes
--- End Message ---
--- Begin Message ---
php4web wrote:
>I now there are function to calc file size but I want function to get
string size in bytes
Maybe what you want is strlen()?
http://www.php.net/strlen <http://www.php.net/strlen>
HTH
Marius
--- End Message ---
--- Begin Message ---
actually it is:
substr($string, 0, 100);
http://www.php.net/substr
-----Original Message-----
From: php-general
Sent: Friday, June 11, 2004, 3:17:15 PM
> substr( xxx, 1, 100)
>>>
>>>Hi
>>>
>>>Anyone know how to clip the number of characters in a string? For instance,
>>>I have a string carrying a long piece of text, say, of 200 characters, but I
>>>want to reduce this to just the first 100 characters.
>>>
>>>
>>>Thanks in advance.
>>>
>>>Russell
--- End Message ---
--- Begin Message ---
I am beginning a project that will involve moving data
from an mssql table to xml files.
In addition to fixing non-xml compliant html in the
text fields and outputting the data to a new xml
format, I need to find certain chunks of text marked
by standard html comments at the start and end,
comment out everything between the comments, and
insert the found text into its own xml element (which
will in some cases be inline).
I have played with code using substr/str_pos, running
html tidy with exec() and it works. But searching the
archives, it seems like the new html tidy tags in php5
will be more useful. In most cases the target text is
in a one row, one cell table.
Any advice on how to attack this would be appreciated.
I can handle the coding, I just have a feeling I am
approaching this from the hard way.
Kathleen
--- End Message ---