php-general Digest 20 Jul 2003 05:06:33 -0000 Issue 2186

Topics (messages 155900 through 155941):

else needed?
        155900 by: Larry Brown
        155901 by: Curt Zirzow
        155929 by: Juan Nin

Question about Include_once
        155902 by: Al
        155904 by: David Nicholson

MySQL datetime extraction
        155903 by: Yasir Malik
        155905 by: David Nicholson
        155906 by: Yasir Malik
        155907 by: John W. Holmes
        155912 by: Yasir Malik

Re: classes v. functions
        155908 by: olinux
        155934 by: Justin French

TESTERS Needed!
        155909 by: Mark Clarkstone
        155911 by: Andu
        155913 by: Andu
        155914 by: John W. Holmes
        155915 by: Mark Clarkstone
        155916 by: John W. Holmes
        155918 by: John Manko

Re: osCommerce and modifications
        155910 by: olinux

MYSQL Client Flags
        155917 by: John Manko

PHP / mcrypt compile
        155919 by: Tom Ray [Lists]

nedit - previw html/php in browser
        155920 by: Andu

Setting total db size to a variable.
        155921 by: Jason Martyn
        155924 by: Curt Zirzow
        155926 by: David Nicholson
        155930 by: Juan Nin
        155937 by: Jason Martyn

Sending email with the windows version of php
        155922 by: Ivan Carey
        155923 by: Curt Zirzow

Passing value back to SWF
        155925 by: Dan J. Rychlik

Segfault on 4.1.2 on RH 7.2
        155927 by: Roger B.A. Klorese
        155931 by: Curt Zirzow
        155932 by: Roger B.A. Klorese
        155933 by: Curt Zirzow

Re: The stupidest question of the month.
        155928 by: Juan Nin

Re: URL correctimizer ... how to make one?
        155935 by: Justin French

Re: locking to domain
        155936 by: Justin French

Forms and PHP
        155938 by: Jason Giangrande
        155939 by: Chris Hubbard
        155940 by: Justin French
        155941 by: Curt Zirzow

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 if statements, I periodically don't want anything to happen if the
requisite is not met.  In most cases just writing the statement in the
format if (this) { do that; } and nothing more will work.  However, I
periodically get weird results with this and found the only fix was to do
a... if (this) {do that;}else{"echo "";}

I try using continue in the else but get errors about using continue on
level 1 or something to that affect.  I'm assuming that continue is only
used in loops.

It's amazing how far I can code things without these little "foundation
level" bits of information ;-)

Larry S. Brown
Dimension Networks, Inc.
(727) 723-8388




--- End Message ---
--- Begin Message ---
Larry Brown <[EMAIL PROTECTED]> wrote:
> On if statements, I periodically don't want anything to happen if the
> requisite is not met.  In most cases just writing the statement in the
> format if (this) { do that; } and nothing more will work.  However, I
> periodically get weird results with this and found the only fix was to do
> a... if (this) {do that;}else{"echo "";}

Never have i had a problem with the 
        if (condition) { code; } 

It has to be some sort of error on your part.

> 
> I try using continue in the else but get errors about using continue on
> level 1 or something to that affect.  I'm assuming that continue is only
> used in loops.

correct

 
Curt
-- 


--- End Message ---
--- Begin Message ---
From: "Larry Brown" <[EMAIL PROTECTED]>

> On if statements, I periodically don't want anything to happen if the
> requisite is not met.  In most cases just writing the statement in the
> format if (this) { do that; } and nothing more will work.  However, I
> periodically get weird results with this and found the only fix was to do
> a... if (this) {do that;}else{"echo "";}

I experienced the same problem once...
It really amazed me...

I had some conditions like:

if ( some_thing ){ do_something }
if ( some_other_thing ){ do_something_else }
if ( yet_another_thing ){ do_another_more_thing }

they were stupid conditions, with no possibility of error...
I checked them many times to see if I was not having some stupid error, but
there was no error

The results were weird, and not as expected unless I added an else
statement..
It was on a Red Hat 7.1 system, but I can't remember the exact PHP version
maybe it was a bug, but I had the same problem, and it was definitively not
an error of my code..

Regards,

Juan


--- End Message ---
--- Begin Message --- Does file called by "Include_once" stay with the client's session or just for operations in the page where it is stated?

For example, assume I have one file that contains several functions, then if use "include_once('functions.php')" on several pages, does the server reload the file for every page, or does it know to save it for all pages used in the session?


--- End Message ---
--- Begin Message ---
Hello,

This is a reply to an e-mail that you wrote on Sat, 19 Jul 2003 at
19:15, lines prefixed by '>' were originally written by you.
> Does file called by "Include_once"  stay with the client's
session or
> just for operations in the page where it is stated?

just for operations in the page where it is stated

David.

--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: http://www.phpmachine.com/

          Professional Web Development by David Nicholson
                    http://www.djnicholson.com/

    QuizSender.com - How well do your friends actually know you?
                     http://www.quizsender.com/
                    (developed entirely in PHP)

--- End Message ---
--- Begin Message ---
Given a date in MySQL datetime format, how do I extract the elements?
That is get the month, day, year, hour, ...
Thanks,
Yasir

--- End Message ---
--- Begin Message ---
Hello,

This is a reply to an e-mail that you wrote on Sat, 19 Jul 2003 at
19:16, lines prefixed by '>' were originally written by you.

> Given a date in MySQL datetime format, how do I extract the
elements?
> That is get the month, day, year, hour, ...
> Thanks,
> Yasir

Bit off topic for this list, but see the DATE_FORMAT() function at
http://www.mysql.com/doc/en/Date_and_time_functions.html

David.

--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: http://www.phpmachine.com/

          Professional Web Development by David Nicholson
                    http://www.djnicholson.com/

    QuizSender.com - How well do your friends actually know you?
                     http://www.quizsender.com/
                    (developed entirely in PHP)

--- End Message ---
--- Begin Message ---
What list do I go to?  I just want store the elements into some variables
in PHP.
Yasir
On Sat, 19 Jul 2003, David Nicholson wrote:

> Date: Sat, 19 Jul 2003 19:22:25 +0100
> From: David Nicholson <[EMAIL PROTECTED]>
> To: Yasir Malik <[EMAIL PROTECTED]>
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] MySQL datetime extraction
>
> Hello,
>
> This is a reply to an e-mail that you wrote on Sat, 19 Jul 2003 at
> 19:16, lines prefixed by '>' were originally written by you.
>
> > Given a date in MySQL datetime format, how do I extract the
> elements?
> > That is get the month, day, year, hour, ...
> > Thanks,
> > Yasir
>
> Bit off topic for this list, but see the DATE_FORMAT() function at
> http://www.mysql.com/doc/en/Date_and_time_functions.html
>
> David.
>
> --
> phpmachine :: The quick and easy to use service providing you with
> professionally developed PHP scripts :: http://www.phpmachine.com/
>
>           Professional Web Development by David Nicholson
>                     http://www.djnicholson.com/
>
>     QuizSender.com - How well do your friends actually know you?
>                      http://www.quizsender.com/
>                     (developed entirely in PHP)
>

--- End Message ---
--- Begin Message --- Yasir Malik wrote:
Given a date in MySQL datetime format, how do I extract the elements?
That is get the month, day, year, hour, ...

You could do it in the query using DATE_FORMAT(), MONTH(), YEAR(), etc.


You can do it in PHP by sending the MySQL timestamp through strtotime() and then using date() to extract each component.

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals – www.phparch.com





--- End Message ---
--- Begin Message ---
Thanks.  Here's how I did it:
$str = "2003-12-13 12:23:34"
$b = localtime(strtotime($str), 1);
printf("seconds: ".$a["tm_sec"]."\n");

On Sat, 19 Jul 2003, John W. Holmes wrote:

> Date: Sat, 19 Jul 2003 14:28:00 -0400
> From: John W. Holmes <[EMAIL PROTECTED]>
> To: Yasir Malik <[EMAIL PROTECTED]>
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] MySQL datetime extraction
>
> Yasir Malik wrote:
> > Given a date in MySQL datetime format, how do I extract the elements?
> > That is get the month, day, year, hour, ...
>
> You could do it in the query using DATE_FORMAT(), MONTH(), YEAR(), etc.
>
> You can do it in PHP by sending the MySQL timestamp through strtotime()
> and then using date() to extract each component.
>
> --
> ---John Holmes...
>
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>
> PHP|Architect: A magazine for PHP Professionals – www.phparch.com
>
>
>
>

--- End Message ---
--- Begin Message ---
I'm quite new to OOP myself, but these two articles
helped my understanding a lot

See the sidebar - Classes and Object Oriented
Programming
http://webreference.com/perl/xhoo/php1/5.html

Taking PHP the OO way
http://phpmag.net/itr/online_artikel/psecom,id,284,nodeid,114.html


olinux


--- Sam Baum <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> am Friday 18 July 2003 23:08 schrieb Andu:
> 
> > This may show my ignorance or my refusal to take
> for granted something I
> > don't fully understand but I have a hard time
> figuring out the advantage
> > of using classes as opposed to just functions. I
> am certainly new to php
> > and at first sight classes seemed to cut a lot of
> corners but so do
> > functions (with which I have more experience). The
> more I read about
> > classes the deeper the confusion. Anyone can
> enlighten me?
> 
> Im programming for a few years now in PHP. After
> trying to use classes i
> dont see their point either. In most cases if i need
> a class-like structure
> i do something like this:
> 
> function thing_new() {
>         return ++$GLOBALS['thing_resource'];
> }
> 
> function thing_put($stuff, $res=NULL) {
>         if (is_null($res)) $res =
> $GLOBALS['thing_resource'];
>         $GLOBALS['thing_stuff'][$res] = $stuff;
> }
> 
> function thing_get($stuff, $res=NULL) {
>         if (is_null($res)) $res =
> $GLOBALS['thing_resource'];
>         return $GLOBALS['thing_stuff'][$res];
> }
> 
> Because there is no constraint to be more OO like in
> Java it doesnt makes
> sense. And this way you are more flexible.
> 
> 
> bg
> 
> Sam
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

--- End Message ---
--- Begin Message --- Whether it's the right move or not, I've put off my learning of PHP classes and OOP methods until PHP5.x, so I guess the time in near :)

However, *especially* if you're the only programmer on a project, you can take the ideas & benefits behind OOP (for me, having clear, clean code that can be reused over and over again with minimal changes is my primary goal) and apply it to your own code.

It takes strict naming conventions and some careful planning, but I don't see that as a limitation at all -- more like a benefit :)


Justin



On Saturday, July 19, 2003, at 07:08 AM, Andu wrote:


This may show my ignorance or my refusal to take for granted something I don't fully understand but I have a hard time figuring out the advantage of using classes as opposed to just functions. I am certainly new to php and at first sight classes seemed to cut a lot of corners but so do functions (with which I have more experience). The more I read about classes the deeper the confusion. Anyone can enlighten me?

Regards, Andu Novac

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

---
[This E-mail scanned for viruses]




--- End Message ---
--- Begin Message ---
Hey Guys I need People to test out My Program, Mini serve  to find out more
go to www.mini-networks.uni.cc

Thanks



--- End Message ---
--- Begin Message ---

--On Saturday, July 19, 2003 20:02:52 +0100 Mark Clarkstone <[EMAIL PROTECTED]> wrote:

Hey Guys I need People to test out My Program, Mini serve  to find out
more go to www.mini-networks.uni.cc


The black text on dark-blue background is really inviting, did you try black on black??


Thanks



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php







Regards, Andu Novac



--- End Message ---
--- Begin Message ---

--On Saturday, July 19, 2003 15:23:31 -0400 Andu <[EMAIL PROTECTED]> wrote:



--On Saturday, July 19, 2003 20:02:52 +0100 Mark Clarkstone
<[EMAIL PROTECTED]> wrote:

Hey Guys I need People to test out My Program, Mini serve  to find out
more go to www.mini-networks.uni.cc


The black text on dark-blue background is really inviting, did you try black on black??

Never mind, for windows programs is good enough.



Thanks



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php







Regards, Andu Novac



-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php







Regards, Andu Novac



--- End Message ---
--- Begin Message --- Andu wrote:
--On Saturday, July 19, 2003 20:02:52 +0100 Mark Clarkstone <[EMAIL PROTECTED]> wrote:

Hey Guys I need People to test out My Program, Mini serve  to find out
more go to www.mini-networks.uni.cc


The black text on dark-blue background is really inviting, did you try black on black??



Also, did you know that you can use a period to end a sentence? Like this. Or this. You should try it. (Look, there's another!)


--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals – www.phparch.com





--- End Message ---
--- Begin Message ---
If any one finds any bugs or anything please let me know!



--- End Message ---
--- Begin Message --- Mark Clarkstone wrote:

If any one finds any bugs or anything please let me know!

Got this:


Warning: readfile(content/subcats/Products.html): failed to open stream: No such file or directory in /home/britspy/public_html/mnet/index.php on line 76

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals – www.phparch.com





--- End Message ---
--- Begin Message --- the the following table, when you onmouseover the MSN addy, the enlargement of the font size changes the table width, and it does restore on onmouseout:

_*Stats*_

Style: Devil's Bloom
Host: www.BritneySpy.com <http://www.BritneySpy.com>
Projects: 3
Hits 321
MSN [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>





Mark Clarkstone wrote:

If any one finds any bugs or anything please let me know!








--- End Message ---
--- Begin Message ---
you should check out http://www.x-cart.com
Their pro cart looks like it will handle what you
want. Not free, but you do get the source code. 

Plus it uses smarty (smarty.php.net). Right now I am
working on an osCommerce project and while it is a
great project I cannot believe it has come so far
without any template system.

olinux


--- Edward Peloke <[EMAIL PROTECTED]> wrote:
> thanks Richard, I will take a look.  osCommerce does
> a create job of
> creating an online marketplace.  The problem is to
> add items, you need to go
> through the admin pages.  We need to be able to
> allow users to add items,
> sort of like ebay without the auction.
> 

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

--- End Message ---
--- Begin Message --- I was interested in how to determine the number of rows matched on an update, even if they weren't updated. The reason for this was mysql_affected_rows() returns the number of rows affected, which my not be the number of rows matched by the query (see the manual). So, I came accross a post in the comment section of the online documentation that says the following:

---------------------------------------------------------------------------
from mysql_affected_rows()
"As of PHP 4.3.0 (I assume, I only tried with 4.3.2), you can make mysql_affected_rows() return the number of rows matched, even if none are updated. You do this by setting the CLIENT_FOUND_ROWS flag in mysql_connect(). For some reason, not all the flags are defined in PHP, but you can use the decimal equivalent, which for CLIENT_FOUND_ROWS is 2."


$db= mysql_connect("localhost", "user", "pass", false, 2);
mysql_select_db("mydb", $db);"
-----------------------------------------------------------------------
from mysql_connect()
|"I presume that mysql_connect() just passes through to the C MySQL API, which provides these constants:


#define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */
#define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */
#define CLIENT_LONG_FLAG 4 /* Get all column flags */
#define CLIENT_CONNECT_WITH_DB 8 /* One can specify db on connect */
#define CLIENT_NO_SCHEMA 16 /* Don't allow database.table.column */
#define CLIENT_COMPRESS 32 /* Can use compression protocol */
#define CLIENT_ODBC 64 /* Odbc client */
#define CLIENT_LOCAL_FILES 128 /* Can use LOAD DATA LOCAL */
#define CLIENT_IGNORE_SPACE 256 /* Ignore spaces before '(' */
#define CLIENT_CHANGE_USER 512 /* Support the mysql_change_user() */
#define CLIENT_INTERACTIVE 1024 /* This is an interactive client */
#define CLIENT_SSL              2048     /* Switch to SSL after handshake */
#define CLIENT_IGNORE_SIGPIPE   4096     /* IGNORE sigpipes */
#define CLIENT_TRANSACTIONS 8192 /* Client knows about transactions */"|
------------------------------------------------------------------------------

So, I started searching, an I found a few other flags(below). My question: Is this list complete, does php have defined flags for these (or do I have to define descriptive variables for the corrasponding numbers), and is this pretty much the extent of the information I will find on the php end of things?

CLIENT_MULTI_QUERIES
Tell the server that the client may send multi-row-queries (separated with `;'). If this flag is not set, multi-row-queries are disabled. New in 4.1.


CLIENT_MULTI_RESULTS
Tell the server that the client can handle multiple-result sets from multi-queries or stored procedures. This is automatically set if CLIENT_MULTI_QUERIES is set. New in 4.1.






--- End Message ---
--- Begin Message --- Ok, I've never done this before so I want to double check before I do it.

I'm running RH 7.3 and PHP was installed as a RPM. Now I've just installed libmcrypt. My question is when I go to recompile PHP can I just run the PHP configure file as "configure --with-mcrypt[=DIR] --disable-posix-threads or do I need to run the enter configre command listed in phpinfo? OR can I just activate it in php.ini since it was an RPM install?(and if I can how do I do that command?)

TIA


--- End Message ---
--- Begin Message --- For those using Nedit with php/html here's a macro which will open a browser window and previw your script (Linux):

file = $file_path $file_name
file = replace_in_string(file, "/path_to_your_server_root/htdocs/", "")
in_browser="mozilla -remote 'openURL(localhost/" file " ,new-window)'" " >& /dev/null &"
shell_command(in_browser ,"")


It implies you run Apache/php locally, obviously and you may need to adjust the server root path and/or mozilla location if not standard.


Regards, Andu Novac



--- End Message ---
--- Begin Message ---
I have a question in regards to finding the total db size and setting it to a variable.

How would I go about this?

--- End Message ---
--- Begin Message ---
Jason Martyn <[EMAIL PROTECTED]> wrote:
> I have a question in regards to finding the total db size and setting it to a 
> variable.

This is rather vague in several aspects. Please expand on your question
with more details, otherwise it makes it hard to help with with your
question.

> 
> How would I go about this?

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

--- End Message ---
--- Begin Message ---
Hello,

This is a reply to an e-mail that you wrote on Sun, 20 Jul 2003 at
00:42, lines prefixed by '>' were originally written by you.
> I have a question in regards to finding the total db size and
setting
> it to a variable.
> How would I go about this?

For mysql this will do the trick...

$info = mysql_fetch_array(mysql_query("show table status from
$databasename  = '$tablename'"));
$sizeinMB = $info["Data_length"]/1024/1024;

--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: http://www.phpmachine.com/

          Professional Web Development by David Nicholson
                    http://www.djnicholson.com/

    QuizSender.com - How well do your friends actually know you?
                     http://www.quizsender.com/
                    (developed entirely in PHP)

--- End Message ---
--- Begin Message ---
From: "Curt Zirzow" <[EMAIL PROTECTED]>

> > I have a question in regards to finding the total db size and setting it
to a variable.
>
> This is rather vague in several aspects. Please expand on your question
> with more details, otherwise it makes it hard to help with with your
> question.

I think he wants to get the size of a database, and setting that value to a
variable...
Probably the question is not regarding on how to set the value to a
variable, but on how to get the database size, which surelly depends on the
RDBMs you are using

(if it can be done, no idea..)  :oP

regards,

Juan


--- End Message ---
--- Begin Message ---
 Theres a problem with the SQL query. It fails? I tried removing the " =
 '$tablename' " however, then the mysql_fetch_array cannot save the result
 set.

 I guess my basic question is how do I query the SHOW TABLE STATUS for a
 specific table in a specific database.

 <-- Forgot to post this earlier -->
 My apologies.

 There are 2 databases. The admin database and the registrant info database.
 I would like to be able to be able to calculate the size of the combined
 databases and use them as a statistic. In the first database there is 5
 tables, and in the other database there are 2 tables. I'm using MySQL V.
4.0
 and PHP V. 4.3.
 <-->

 Jay


> ----- Original Message -----
> From: "David Nicholson" <[EMAIL PROTECTED]>
> To: "Jason Martyn" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Saturday, July 19, 2003 5:51 PM
> Subject: Re: [PHP] Setting total db size to a variable.
>
>
> Hello,
>
> This is a reply to an e-mail that you wrote on Sun, 20 Jul 2003 at
> 00:42, lines prefixed by '>' were originally written by you.
> > I have a question in regards to finding the total db size and
> setting
> > it to a variable.
> > How would I go about this?
>
> For mysql this will do the trick...
>
> $info = mysql_fetch_array(mysql_query("show table status from
> $databasename  = '$tablename'"));
> $sizeinMB = $info["Data_length"]/1024/1024;
>
> --
> phpmachine :: The quick and easy to use service providing you with
> professionally developed PHP scripts :: http://www.phpmachine.com/
>
>           Professional Web Development by David Nicholson
>                     http://www.djnicholson.com/
>
>     QuizSender.com - How well do your friends actually know you?
>                      http://www.quizsender.com/
>                     (developed entirely in PHP)
>


--- End Message ---
--- Begin Message ---
hello,

My client is wanting to transfer their web site from a system that uses: freebsd, 
apache, mysql and php, to a windows based hosting service.

So I was wondering if the Windows version of PHP sends e-mail with the same commands 
as Sendmail or do I have to re-write the scripts. Or can you tell me what form of 
email sending windows would use.

Thanks,

Ivan





--- End Message ---
--- Begin Message ---
Ivan Carey <[EMAIL PROTECTED]> wrote:
> hello,
> 
> My client is wanting to transfer their web site from a system that uses: freebsd, 
> apache, mysql and php, to a windows based hosting service.
> 
Did you tell them this is a bad idea.


> So I was wondering if the Windows version of PHP sends e-mail with the same commands 
> as Sendmail or do I have to re-write the scripts. Or can you tell me what form of 
> email sending windows would use.
> 
if you use the php mail command, you shouldn't have any problems.  In
the unix version the mail command uses sendmail where the windows
version connects to a smtp server and sends the message its self.


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

--- End Message ---
--- Begin Message ---
I have a swf file that I have created with a appropriate loadvarnum() function.  I 
have created a $statusmsg dynamic text field.  When I execute my script with a button 
action I am able to 

This works fine.
print "&statusmsg="."Passing value";

But when I 
print "&statusmsg=". $testvariable;

Returns null, or no value...  Im not sure why this wont work, Ive read some documents 
on how to make flash and php talk.  Any ideas or suggestions?

--- End Message ---
--- Begin Message --- Yes, yes, I know it's ancient -- but it's also what's out there for RPMs, and if I need to go to source I will, but for now...

One single installation of gallery on our site -- a HUGE one -- consistently kills PHP.

Here's a trace -- any useful info here?

#0 chunk_realloc (ar_ptr=0x40349300, oldp=0x8343c78, oldsize=137641080, nb=344) at malloc.c:3563
#1 0x402959e2 in __libc_realloc (oldmem=0x8343c80, bytes=340) at malloc.c:3390
#2 0x08123a1b in _erealloc ()
#3 0x0810d232 in url_adapt_ext_ex ()
#4 0x080c6130 in session_adapt_uris ()
#5 0x08074dee in php_ub_body_write_no_header ()
#6 0x080744a2 in php_body_write ()
#7 0x0806cd78 in php_printf ()
#8 0x0806d00f in php_error_cb ()
#9 0x081333ac in zend_error ()
#10 0x08123b51 in _erealloc ()
#11 0x0810d232 in url_adapt_ext_ex ()
#12 0x080c6130 in session_adapt_uris ()
#13 0x08074dee in php_ub_body_write_no_header ()
#14 0x080744a2 in php_body_write ()
#15 0x0806cd78 in php_printf ()
#16 0x0806d00f in php_error_cb ()
#17 0x081333ac in zend_error ()
#18 0x08123b51 in _erealloc ()
#19 0x0810d232 in url_adapt_ext_ex ()
#20 0x080c6130 in session_adapt_uris ()
#21 0x08074dee in php_ub_body_write_no_header ()
#22 0x080744a2 in php_body_write ()
#23 0x0806cd78 in php_printf ()
#24 0x0806d00f in php_error_cb ()
#25 0x081333ac in zend_error ()
#26 0x0812378e in _emalloc ()
#27 0x08137c9b in zend_hash_index_update_or_next_insert ()
#28 0x08109d6d in php_var_unserialize ()
#29 0x0810a46c in php_var_unserialize ()
#30 0x0810a46c in php_var_unserialize ()
#31 0x0810a46c in php_var_unserialize ()
#32 0x0810a46c in php_var_unserialize ()
#33 0x0810a741 in zif_unserialize ()
#34 0x0815ab3a in execute ()
#35 0x0815ad33 in execute ()
#36 0x0815ad33 in execute ()
#37 0x0815ad33 in execute ()
#38 0x0815fe67 in execute ()
#39 0x08133798 in zend_execute_scripts ()
#40 0x0806ebf6 in php_execute_script ()
#41 0x0806c53c in main ()
#42 0x40230657 in __libc_start_main (main=0x806ba50 <main>, argc=2, ubp_av=0xbfffeca4,
init=0x80689d4 <_init>, fini=0x81653e0 <_fini>, rtld_fini=0x4000dcd4 <_dl_fini>,
stack_end=0xbfffec9c) at ../sysdeps/generic/libc-start.c:129



--- End Message ---
--- Begin Message ---
Roger B.A. Klorese <[EMAIL PROTECTED]> wrote:
> Yes, yes, I know it's ancient -- but it's also what's out there for 
> RPMs, and if I need to go to source I will, but for now...

hmm.. yeah you might want to upgrade to a newer version. 

> #1  0x402959e2 in __libc_realloc (oldmem=0x8343c80, bytes=340) at 
> malloc.c:3390
> #2  0x08123a1b in _erealloc ()
> #3  0x0810d232 in url_adapt_ext_ex ()
> #4  0x080c6130 in session_adapt_uris ()
> #5  0x08074dee in php_ub_body_write_no_header ()
> #6  0x080744a2 in php_body_write ()
> #7  0x0806cd78 in php_printf ()
> #8  0x0806d00f in php_error_cb ()
> #9  0x081333ac in zend_error ()
> #10 0x08123b51 in _erealloc ()
> #11 0x0810d232 in url_adapt_ext_ex ()
> #12 0x080c6130 in session_adapt_uris ()
> #13 0x08074dee in php_ub_body_write_no_header ()
> #14 0x080744a2 in php_body_write ()
> #15 0x0806cd78 in php_printf ()
> #16 0x0806d00f in php_error_cb ()
> #17 0x081333ac in zend_error ()
> #18 0x08123b51 in _erealloc ()
> #19 0x0810d232 in url_adapt_ext_ex ()
> #20 0x080c6130 in session_adapt_uris ()
> #21 0x08074dee in php_ub_body_write_no_header ()
> #22 0x080744a2 in php_body_write ()
> #23 0x0806cd78 in php_printf ()
> #24 0x0806d00f in php_error_cb ()
> #25 0x081333ac in zend_error ()
> #26 0x0812378e in _emalloc ()

Whats weird though is it looks like your in an infinite loop in, appears
you have a on error handler set that is causing an error, this
definitely needs to be fixed if it occurs in current release.
  

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

--- End Message ---
--- Begin Message --- Curt Zirzow wrote:

Roger B.A. Klorese <[EMAIL PROTECTED]> wrote:


Yes, yes, I know it's ancient -- but it's also what's out there for RPMs, and if I need to go to source I will, but for now...



hmm.. yeah you might want to upgrade to a newer version.



Well, yes. But I'm afraid of the upgrade cascade -- it's not an easy thing to shift from RPMs to trying to keep lots of source in sync.



--- End Message ---
--- Begin Message ---
* Thus wrote Roger B.A. Klorese ([EMAIL PROTECTED]):
> Curt Zirzow wrote:
> 
> >Roger B.A. Klorese <[EMAIL PROTECTED]> wrote:
> > 
> >
> >>Yes, yes, I know it's ancient -- but it's also what's out there for 
> >>RPMs, and if I need to go to source I will, but for now...
> >>   
> >>
> >
> >hmm.. yeah you might want to upgrade to a newer version. 
> > 
> >
> 
> Well, yes.  But I'm afraid of the upgrade cascade -- it's not an easy 
> thing to shift from RPMs to trying to keep lots of source in sync.

True, but in order to report this you'll need to get it tested on a
recent copy. Here are a couple options you can do:

  - force RH to be more up to date :)
        - compile a new version and just to test it. 
        - find someone to test it for you.


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

--- End Message ---
--- Begin Message ---
From: "René Fournier" <[EMAIL PROTECTED]>

> I need to write a little program that opens and maintains a TCP socket
> connection to a server across the Internet. This little program would
> wait for messages from the server it's connected to, then record those
> messages and send a kinda of acknowledgment "Got it".

I would a daemon programmed in C or maybe Perl

Regards,

Juan


--- End Message ---
--- Begin Message --- I think you should attempt to detect a VALID url, rather than attempting to correct human errors. You're guaranteed not to think of every possible mistake, so IMHO, you're approaching it the wrong way.

Put the responsibility back on the user to write a valid URL, and alert them to invalid URLs.

Having said that, you could use parse_url() or some complex regular expressions to determine if the URL is valid, or you could just test the URL.

I found a version of this on codewalkers.com:

<?  

// the supplied URL
$url = 'http://www.yourURL.com';

// strip 'http://' from the start
$url = eregi_replace("^http://";,'',trim($url));


// test the URL // it's important that you dont put http:// or it will not work // the 2nd paramater is how long to test the URL b4 timing out $found = fsockopen($url, 10);


// act on it
if($found)
{  
    echo "URL http://{$url} could not be found, thus is considered invalid";
}
?>



There's also plenty more here: http://www.google.com/search?q=PHP+URL+validation&ie=UTF-8&oe=UTF-8


Seriously, I know it's great to learn everything from scratch, but the wheel has already been invented... you just need to make sure it's the right kind of wheel for your needs :)


Try out a few different approaches, test, test, test, test, and see what works for you.


Justin










On Saturday, July 19, 2003, at 07:54 AM, -{ Rene Brehmer }- wrote:

Hi gang

Finally I've got the time to finish up my guestbook script ... so little left that I can actually see the light at the end of the tunnel now..

The guestbook data is stored in a text file. When opening the guestbook, this file is parsed and the named fields are used to construct different HTML structures according to which optional information signers have entered.

One of the optional fields is an URL, and rather than enforcing a specific format, I'd like to have the script, in as much as possible, to automagically correctify the URL as far as possible without reaching too far into guessing and assumption...

I mean, I want the script to automagically add http:// when needed, turn slashes the right way, and remove excess double slashes ... but I'm uncertain as to what else I can/should make it do automatically, and what I shouldn't ...

Also, I'm not sure which characters and structures are actually permitted/required in a "legal" URL, so I'm not sure what I should make it look for to detect an impossible URL ...

Anyone able to offer some help here?

I know I could've probably just picked up someone's script out there ... but I'm trying to do it on my own, as I figure I'd learn more that way ...

Rene
--
Rene Brehmer
aka Metalbunny

http://metalbunny.net/
References, tools, and other useful stuff...


-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

---
[This E-mail scanned for viruses]




--- End Message ---
--- Begin Message --- Start with:

<pre>
<? print_r($_SERVER) ?>
</pre>

have a look through the array, to find the values you need to test on... something like

$_SERVER['HTTP_HOST'] => mydomain.com is what I would use, but your srver may do different things.

So, then we can test/compare that value to the one you're allowing:

<?
$allowedDomain = 'mydomain.com';
if($_SERVER['HTTP_HOST'] != $allowedDomain)
        {
        echo "wrong domain";
        exit;
        }
else
        {
        // the rest of the page goes here
        }
?>


Of course, what's stopping someone from changing the value of $allowedDomain??
It depends on why you want to restrict, and how important it is.


My other thought is that you could take $_SERVER['HTTP_HOST'], submit it to a script on another domain, and check for validity that way.

But again, what's stopping the owner of the script from modifying/removing those lines? Nothing -- unless you encode your entire script with something like zend encoder.


It depends what you're trying to achieve.



Justin French



On Saturday, July 19, 2003, at 02:00 AM, Ryan A wrote:


Hi,
I want to make sure my scripts can be executed on only one domain (or
localhost/ 127.0.0.1)...it should not matter if its
http://somesite.com/myscript.php
 or http://somesite.com/~blah/myscript.php
 or http://blah.somesite.commyscript.php
 or http://somesite.com/1/2/asdf/234/myscript.php

It should only work on "somsite.com"

Any ideas on how i can do this? I've seen this done on some old perl scripts
but how in php?


Kindly help.

Thanks,
-Ryan



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

---
[This E-mail scanned for viruses]




--- End Message ---
--- Begin Message ---
I have a question about forms and PHP.  Here's what I'm looking to do. 
I'm trying to set up a spell checker that checks text entered in a form,
but I want the check results to show up in a different window so that
the user can change the misspelled words if they'd like.  In other
words, I want to be able to click a link and have another page open that
checks the spelling.  My question is how can I send the text from the
form to this other page (which, right now, is a separate php script) so
it can be spell checked without actually submitting the actual form
first?  In other words, I would like the user to be able to check the
spelling without actually submitting the form.

Thanks,
Jason Giangrande


--- End Message ---
--- Begin Message ---
Not sure why you don't want to submit the form.  But if you really really
don't want to "submit the form" then you have to use javascript.
If you're willing to submit the form, then this is relatively simple,
depending on how you want to display the data.
if you're willing to submit, then step through the field that has the data,
one word at a time (maybe explode the string on " " (space)) and compare the
word to your dictionary.  if the word is misspelled, then add it to an
array, or do some action


-----Original Message-----
From: Jason Giangrande [mailto:[EMAIL PROTECTED]
Sent: Saturday, July 19, 2003 8:37 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Forms and PHP


I have a question about forms and PHP.  Here's what I'm looking to do.
I'm trying to set up a spell checker that checks text entered in a form,
but I want the check results to show up in a different window so that
the user can change the misspelled words if they'd like.  In other
words, I want to be able to click a link and have another page open that
checks the spelling.  My question is how can I send the text from the
form to this other page (which, right now, is a separate php script) so
it can be spell checked without actually submitting the actual form
first?  In other words, I would like the user to be able to check the
spelling without actually submitting the form.

Thanks,
Jason Giangrande


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message --- This is done with javascript... without getting too off topic... JS can get the contents of the textarea, and submit it via get (maybe post as well) to another (pop-up) window. the pop-up window can highlght misspelled words, and even make dynamic changes to the content in the first window.

it's pretty complex stuff though... and definitely NOT for the JS newbie...

look around the JS lists and sites for something that might give you a head start.


justin




On Sunday, July 20, 2003, at 02:37 PM, Jason Giangrande wrote:

I have a question about forms and PHP. Here's what I'm looking to do.
I'm trying to set up a spell checker that checks text entered in a form,
but I want the check results to show up in a different window so that
the user can change the misspelled words if they'd like. In other
words, I want to be able to click a link and have another page open that
checks the spelling. My question is how can I send the text from the
form to this other page (which, right now, is a separate php script) so
it can be spell checked without actually submitting the actual form
first? In other words, I would like the user to be able to check the
spelling without actually submitting the form.


Thanks,
Jason Giangrande


-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

---
[This E-mail scanned for viruses]




--- End Message ---
--- Begin Message ---
* Thus wrote Justin French ([EMAIL PROTECTED]):
> This is done with javascript... without getting too off topic... JS can 
> get the contents of the textarea, and submit it via get (maybe post as 
> well) to another (pop-up) window.  the pop-up window can highlght 
> misspelled words, and even make dynamic changes to the content in the 
> first window.

Yes you can do a POST with javascript :)


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

--- End Message ---

Reply via email to