RE: [PHP] Silly table and php question.

2001-07-12 Thread Navid A. Yar

Well, I guess what you can do is embed the PHP within the table cell and
call an if statement. Like this...


table
   tr
  td

// if the user is online, then display the online image
?php
If ($user = online) {
?

img src=online.gif

// else if the user is offline, display the offline image
?php
}
elseif ($user = offline) {
?

img src=offline.gif

// This is just some error checking
?php
} else {
echo $some_error;
?

?php
}
?

/td
   /tr
/table


Try that, it's simple and short, and it works within the table cell you
would specify. Of course, you may have to alter the code and the code
structure a bit to fit your scheme. If you're new to PHP then stripping away
the comments I placed for you might help to make the code look more clear to
you. Good luck...

Navid Yar


-Original Message-
From: Johan Vikerskog (ECS) [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 12, 2001 2:30 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Silly table and php question.


Hi all.
I know this is a silly question but i dont know how to do it so thats why i
am asking.
Be gentle towards me. Im just a stupid swede! ;-)

statement:
I have a table cell in my upper right corner.

I have a small php script which checks wheter my user is online or not. If
the user is i want to update that cell
with an gif that i made that says online.
How do i update just that cell? Is there a special function in PHP to do
that?

I know the question is silly but bare with me.

//Johan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] building a search engine ??

2001-07-12 Thread Navid A. Yar

This sounds interesting. Where can I find htdig?

-Original Message-
From: scott [gts] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 12, 2001 12:20 PM
To: php
Subject: RE: [PHP] building a search engine ??


and to answer one of the previous questions, 

yes... it is *very* resource intensive to scan an entire
directory tree full of files every single time a user
wants to search

as far as i know, htdig indexes the information into one
big file, and just reads thru that... which will save you
loads of disk accesses and generally speed up search
queries mucho...

not to mention that allowing any users to submit data on
a web form and then use that data in a command line tool
is asking for trouble... :)

best of luck.

 -Original Message-
 From: Miles Thompson [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, July 12, 2001 8:46 AM
 To: void; [EMAIL PROTECTED]
 Subject: Re: [PHP] building a search engine ??
 
 
 
 Why reinvent the wheel? Use htdig or one of the other open source search 
 engines. There's a memo on the htdgi site on integrating PHP and htdig.
 
 Miles Thompson
 
 At 02:26 PM 7/12/01 +0200, void wrote:
 I am thinking of building a search engine with the grep command for our
 site.
 i have my information in a mysql db,
 but i am putting it back into text files.
 reoson being is that maybe the mysql db goes down under hevy load,
 and then our site would look like a tree with out branches.
 So i put all the info in the text files.
 
 now for the search engine i have a form that posts of the pattern.
 on the page receiving this pattern as say $searchpattern
 i do the command
 grep --binary-files=without-match -lri $searchpattern $path
 
 is this too resource intensive ?
 
 How does this idea sound ?
 
 please let me know.
 thanx in advance for any replies.
 
 Cape Town South Africa
 
 
 
 
 
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] stripping white space?

2001-07-10 Thread Navid A. Yar

I guess this is just one of those things where everyone's opinions runs in
different directions, yet everyone is entitled to their own. I myself try to
respect the standard because of the browser war years which made everyone
uncomfortable. Now most browsers are trying to merge into a single standard
(thank god). I believe the future to be XML, and I also don't think HTML
will ever go away. However, I do believe that HTML will be treated more
strict (hence the emergence of XHTML which is based on HTML 4.0 and XML). My
suggestion to everyone is to continue using standards and try not to go
astray from them, else we know the headaches us developers can face in the
future.

Sincerely,
Navid Yar


-Original Message-
From: Maxim Maletsky [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 10, 2001 1:06 AM
To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
Subject: RE: [PHP] stripping white space?


Yeah, I know that XML requires it. And I also know that it is not a good
code practice, but it perfectly works for HTML pages. Browsers compatible
with the style sheets have no problems with this code (there's no
connection), and if there's any XML to work on the HTML will be rewritten
anyway, so there's really no reason to worry about it. Just the size gets
lower and typing (escaping in PHP) is easier. I think it IS a good practice
if you only practicing HTML to be outputted by PHP.


Sincerely,

 Maxim Maletsky
 Founder, Chief Developer
 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com




-Original Message-
From: Navid A. Yar [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 10, 2001 2:40 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] stripping white space?


If you do this then those who will want to eventually convert their projects
over to XML or XHTML format will have a hard time doing so, because the
double quotes around the values of the attributes are required. Also, it's
not good code practice. Just something for future reference...

-Original Message-
From: Maxim Maletsky [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 10, 2001 12:16 AM
To: '[EMAIL PROTECTED]'; Kurt Lieber; [EMAIL PROTECTED]
Subject: RE: [PHP] stripping white space?


I would not be stripping white spaces, but double white spaces into single '
';

for example:

$html = ereg_replace([[:space:]]+, ' ', $page);

I never tested this, but what I am trying to do is to get all and any blank
characters and replace them with one single space. Why? Because I don't want
all the words in text to merge together.

This should reduce the size.

Also here's a tip: remove any double or single quotes in tags surrounding
integers. This is compatible enough, but is a bunch of bytes.

i.e.:

change every
IMG SRC=/img/arrow.gif WIDTH=12 HEIGHT=11 BORDER=0 ALT=arrow
align=left

to

IMG SRC=/img/arrow.gif WIDTH=12 HEIGHT=11 BORDER=0 ALT=arrow
align=left

this example is reduced by 6 bytes.



Sincerely,

 Maxim Maletsky
 Founder, Chief Developer
 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com




-Original Message-
From: Mukul Sabharwal [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 10, 2001 2:05 PM
To: Kurt Lieber; [EMAIL PROTECTED]
Subject: Re: [PHP] stripping white space?


Hi,

I take that you simply want to remove ALL whitespaces
from a data block (variable).

you could simply use str_replace( , , $var);



--- Kurt Lieber [EMAIL PROTECTED] wrote:
 Is there a way using PHP to easily strip white space
 out of an html page as
 it's being sent to the client.  That is to say, the
 page that we as
 developers work on is nicely formatted, indented,
 etc. but when it's sent
 out to the client, PHP will remove all the extra
 white space both to
 obfuscate the code and reduce the size a bit.

 For anyone who knows Cold Fusion, I'm looking for
 the PHP equivalent of the
 Suppress whitespace by default option in the Cold
 Fusion Server
 Administrator.

 (NOTE: I'm not looking for a discussion on the
 merits of stripping vs. not
 stripping white space characters or whether or not
 it really does any
 good -- I just want to know if it can be done easily
 using PHP)

 Thanks.

 --kurt


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 To contact the list administrators, e-mail:
 [EMAIL PROTECTED]



=
*
http://www.geocities.com/mimodit
*

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED

RE: [PHP] Removing quotes (was stripping white space?)

2001-07-10 Thread Navid A. Yar

My thoughts exactly Comrade

--Navid Yar

-Original Message-
From: Kurt Lieber [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 10, 2001 9:27 AM
To: Maxim Maletsky; [EMAIL PROTECTED]
Subject: [PHP] Removing quotes (was stripping white space?)


Will IE 6 support this non-standard coding style?  What about mozilla 1.0?
Opera?  Konqueror?

I think the point is that standards give you a pre-defined style guide that
everyone can code to and know that their applications will (or at least
should) work across multiple platforms.  While removing quotes will work
today, it may not tomorrow or the next day.  However, by adhering to
standards, you have a much better chance of your code not breaking as new
browsers get released.

An ancillary point is the size savings that you likely get on a single page
is 30-40 *bytes*.  So you're saving a whopping.01 second of download
time.  (ok, maybe a bit more, but you get the point)

As someone else pointed out, this is a holy war type of thing, so not
everyone will agree.  However, the points above are why I adhere to coding
standards as much as possible.

--kurt



- Original Message -
From: Maxim Maletsky [EMAIL PROTECTED]
To: 'Mark Charette' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, July 09, 2001 11:18 PM
Subject: RE: [PHP] stripping white space?


 Here we are talking about our coding styles:

 When the PHP output is going to be an HTML page, why not getting rid of
 double quotes with an integer? Even a string is fine, but I just don't
feel
 as confident.

 I know it makes some very few difference doing so, but I just don't see
why
 not if it is easier for me to develop this way.


 Give me a valid reason and I'll stop.

 (I am talking about simple plain HTML, no XML or anything else, just HTML)


 -maxim maletsky



 -Original Message-
 From: Mark Charette [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, July 10, 2001 3:09 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] stripping white space?


 From: Maxim Maletsky [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Tuesday, July 10, 2001 1:05 AM
 Subject: RE: [PHP] stripping white space?


  I think it IS a good practice
  if you only practicing HTML to be outputted by PHP.

 Why, if you know that it's illegal XHTML and XML, would you ever conclude
 that it's _good_ practice to break the rules? Saving 20 or 30 bytes/page?
If
 you really want some space saving on many browsers and you're running
Apache
 why not just install the zlib package? Effective throughtput on my (over
 100,000) pages on my site jumped 8-fold for those people able to receive
and
 decode zlib-compressed pages, and I didn't have to change anything ...

 Mark C.


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] how to hide dbconnect file if its in publisheddirectory?

2001-07-09 Thread Navid A. Yar

Hmmm, I was wondering about security of PHP also. Does anyone know the
general issues of security within PHP documents? My thought is that PHP
cannot be seen when you view a source anyway, so isn't it secure enough
(besides the basic firewall and system security)?

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 09, 1979 11:40 PM
To: [EMAIL PROTECTED]; Rasmus Lerdorf
Cc: Noah Spitzer-Williams; [EMAIL PROTECTED]
Subject: Re: [PHP] how to hide dbconnect file if its in
publisheddirectory?


on 7/10/01 12:30 AM, John Weaver at [EMAIL PROTECTED] wrote:


 Sorry, I should have been more clear.  If you write modular code, your
 included file will be nothing but a group of functions.  Call a file with
 nothing but functions in it and you get; HTMLHEAD/HEAD/HTML.  I
can't
 see the security problem you refer to.


Ahhh!

I have this problem now ... do you put the ?php ? tags on an inc file?

If not how do you keep people from reading it?


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] stripping white space?

2001-07-09 Thread Navid A. Yar

If you do this then those who will want to eventually convert their projects
over to XML or XHTML format will have a hard time doing so, because the
double quotes around the values of the attributes are required. Also, it's
not good code practice. Just something for future reference...

-Original Message-
From: Maxim Maletsky [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 10, 2001 12:16 AM
To: '[EMAIL PROTECTED]'; Kurt Lieber; [EMAIL PROTECTED]
Subject: RE: [PHP] stripping white space?


I would not be stripping white spaces, but double white spaces into single '
';

for example:

$html = ereg_replace([[:space:]]+, ' ', $page);

I never tested this, but what I am trying to do is to get all and any blank
characters and replace them with one single space. Why? Because I don't want
all the words in text to merge together.

This should reduce the size.

Also here's a tip: remove any double or single quotes in tags surrounding
integers. This is compatible enough, but is a bunch of bytes.

i.e.:

change every
IMG SRC=/img/arrow.gif WIDTH=12 HEIGHT=11 BORDER=0 ALT=arrow
align=left

to

IMG SRC=/img/arrow.gif WIDTH=12 HEIGHT=11 BORDER=0 ALT=arrow
align=left

this example is reduced by 6 bytes.



Sincerely,

 Maxim Maletsky
 Founder, Chief Developer
 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com




-Original Message-
From: Mukul Sabharwal [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 10, 2001 2:05 PM
To: Kurt Lieber; [EMAIL PROTECTED]
Subject: Re: [PHP] stripping white space?


Hi,

I take that you simply want to remove ALL whitespaces
from a data block (variable).

you could simply use str_replace( , , $var);



--- Kurt Lieber [EMAIL PROTECTED] wrote:
 Is there a way using PHP to easily strip white space
 out of an html page as
 it's being sent to the client.  That is to say, the
 page that we as
 developers work on is nicely formatted, indented,
 etc. but when it's sent
 out to the client, PHP will remove all the extra
 white space both to
 obfuscate the code and reduce the size a bit.

 For anyone who knows Cold Fusion, I'm looking for
 the PHP equivalent of the
 Suppress whitespace by default option in the Cold
 Fusion Server
 Administrator.

 (NOTE: I'm not looking for a discussion on the
 merits of stripping vs. not
 stripping white space characters or whether or not
 it really does any
 good -- I just want to know if it can be done easily
 using PHP)

 Thanks.

 --kurt


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 To contact the list administrators, e-mail:
 [EMAIL PROTECTED]



=
*
http://www.geocities.com/mimodit
*

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]