Re: [PHP] Date Stuff...

2002-08-02 Thread Stas Maximov

(YearsDifference*12)+FullMonthsDifference :)

Regards, Stas.

- Original Message - 
From: "Brian McGarvie" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 02, 2002 1:50 PM
Subject: [PHP] Date Stuff...


> Given a date how would you work out number of months elapsed between
> DateInPast and DateNow?
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


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




Re: [PHP] Embeding images in HTML emails

2002-08-20 Thread Stas Maximov

www.phpclasses.org

Stas

- Original Message - 
From: "Andrew Perevodchik" <[EMAIL PROTECTED]>
To: "Michael Sims" <[EMAIL PROTECTED]>
Sent: Tuesday, August 20, 2002 3:06 PM
Subject: Re: [PHP] Embeding images in HTML emails


> Hello, Michael Sims!
> 
> MS> I imagine that
> MS> Manuel Lemos' PHP Classes site has a class that would take care of
> MS> this for you...
> 
> url, plz :)
> 
> -- 
> Andrew Perevodchik
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


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




Re: [PHP] Simple Security Clarification

2002-08-21 Thread Stas Maximov

"Outside" would be in '/var/www/secure' in your case. Or any other place
your scripts have access to, save under '/var/www/html/'.

HTH, Stas

- Original Message -
From: "Andre Dubuc" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, August 21, 2002 1:11 PM
Subject: [PHP] Simple Security Clarification


> In another thread [How do you protect individual files], Justin French
stated:
>
> "In real short, you want to store the files outside your htdocs root (so
they
> can't be served by http) . . ."
>
> My PHP setup serves files from DOCUMENT_ROOT=/var/www/html. If I place
files
> in '/var/www/html/secure' would this provide any isolation for file
access?
> Am I correct in thinking that 'below' is not the same as 'outside'
doc_root,
> and that i this case, no protection would be afforded?
>
> Tia,
> Andre
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


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




Re: [PHP] check unread messages in a forum

2002-08-26 Thread Stas Maximov

Hi,

Just store the user's last log-in date/time either in the database or in
cookie. On the next log-in "select * messages where creationDate >
$userLastLoginDate" and highlight those selected. It won't work for every
particular unread message, but I doubt if one needs to be that much
specific.

HTH, Stas

- Original Message -
From: "Charlotte" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 26, 2002 1:04 PM
Subject: [PHP] check unread messages in a forum


> I have made a forum in PHP, and the users are logged in using cookies. I
> want all new threads (and if there are new replies in an old thread) to be
> highlight or something like that.
>
> How do I check if a user has read a message or not?
>
>
>
> /Charlotte
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


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




Re: [PHP] problem with using include files

2002-08-27 Thread Stas Maximov


This should help you. This way the browser will look for images directory in
the root of your webserver.

Regards, Stas

- Original Message -
From: "Ivan Carey" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, August 27, 2002 1:50 PM
Subject: [PHP] problem with using include files


Hello
The problem I have when using include files is the path to different parts
of the web site.

To Explain:

I have a header.inc file in an inc directory:

root
 |___inc
 |   |___header.inc
 |
 |___images
 |   |___topbar_01.gif
 |
 |___faq
|___faq.php

In the header.inc file there is:


now when I include this into the faq.php file I do not display the
topbar_01.gif as the path to topbar_01.gif is now
/root/faq/images/topbar_01.gif

I would like to be able to use a header.inc file so that I can update the
entire site simply.

Is there a way I can specify the correct path when using an include file in
this way?
I have tried to use some of the Environment Variables.

I find that I am having this problem when I am using a structured site. I
would rather not place all files into the same directory

Thankyou for your reply,
Ivan



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




Re: [PHP] Compiling PHP with Sablot support

2002-08-27 Thread Stas Maximov

Hi,
There should be a new entry like "XSLT enabled" under "XML enabled" in your
PHPinfo in case of successful set-up.
I'm not very familiar with the Unix build, but just to be sure can you check
if you uncommented the xslt extension in your php.ini file (if any)?

HTH, Stas

- Original Message -
From: "Dan Hardiker" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, August 27, 2002 2:52 PM
Subject: [PHP] Compiling PHP with Sablot support


> Hi All,
>
> I have PHP-4.3.0(dev) [php cvs version] and have the following
> configure:
>
> ../configure --with-mysql=/usr/local/ --with-gd=/usr/local/
> --with-openssl --with-curl --enable-ftp --with-dom --with-xml
> --enable-trans-sid
> --enable-sockets --enable-wddx --with-zlib --with-mcrypt=/usr/local/
> --with-mhash=/usr/local/ --with-freetype --with-t1lib --with-ttf
> --with-freetype-dir=/usr/local/ --with-gettext --enable-track-vars
> --with-apxs --with-expat --with-enable-xslt --with-xslt-sablot
> --with-sablot
>
> Configure runs fine... Make runs beautifully... Make Install runs
> perfectly... Apache restarts great, but:
>
> Fatal error: Call to undefined function: xslt_create_processor() in
> /usr/home/dhardiker/public_html/cvs/flash_api_4.03/xslTransformer.inc.php
> on line 24
>
> Ideas?
>
> PS: Im running FreeBSD 4.6-Stable and a copy of my
> phpinfo() output can be found at http://dipsy.dapond.net/phpinfo.html.
>
>
> --
> Dan Hardiker [[EMAIL PROTECTED]]
> ADAM Software & Systems Engineer
> First Creative Ltd
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


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




Re: [PHP] Window/Page/Browser/Screen width

2002-08-28 Thread Stas Maximov

Hi Rick,

The important thing to remember is that PHP (as any other similar language)
is a server-side scripting language. It won't help you getting your client
details apart of those sent in HTTP headers.
You should rather consider looking into JavaScript capabilities to
accomplish your task.

HTH, Stas

- Original Message -
From: "Rick Selby" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, August 28, 2002 12:02 PM
Subject: [PHP] Window/Page/Browser/Screen width


> Hi,
>
> I've seen similar questions in archives so sorry if I'm asking the same
thing
> again!
>
> Is it possible, using php, to get the screen, page, or window width?
>
> My aim would be to have a set of picture thumbnails, and give the html the
best
> number of columns depending on the size of the display.
>
> I'd rather not use java, because many people have it turned off (even
though I
> wouldn't be exploiting it!)
>
> Cheers,
> --Rick
>
> __
> Do You Yahoo!?
> Everything you'll ever need on one web page
> from News and Sport to Email and Music Charts
> http://uk.my.yahoo.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


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




Re: [PHP] using variable ..help

2002-08-28 Thread Stas Maximov

Remon,

Your code works correct, cause you coded it this way as it should go through
the array and output every element in the array into one line.
If I got your idea correctly - you probably want you rows to be of two
different colors. You may do it simplier way:
 
 

 blablabbaba

 


The "$index&1" construct will return either 0 or 1 for even and odd rows, so
the proper color will be selected.

HTH, Stas

- Original Message -
From: "Remon Redika" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, August 28, 2002 2:46 PM
Subject: [PHP] using variable ..help


> I wanna do with my  bgcolor trough my array
>
> 
> 
> 
>  }
> ?>">
> blablabbaba
> 
>  }
> ?>
> 
>
>
> I have look my view source output my TR bgcolor , and i found this below
> 
>
> I want my  bgcolor display with one by one like this below
> 
> 
> 
> 
> 
> 
>
> etc
>
> help please.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


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




Re: [PHP] Fun with Binary Numbers

2002-08-28 Thread Stas Maximov

Hey Dave,

It is much easier to use hex numbers when working with bits. Thus, the mask
for the first (left) "quartet" would be 0xF000,
second 0x0F00, third 0x00F0 and fourth 0x000F. To apply the mask use binary
AND operator, which is "&" in case of PHP.
After applying the mask you need to "shift-right" (another binary operator)
your number to the certain number of bits you want to omit:
$result = ($yourNumber & 0x0F00) >> 8; // for the third "quartet"

Hope this helps,
Stas

- Original Message -
From: "David Buerer" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, August 28, 2002 3:11 PM
Subject: [PHP] Fun with Binary Numbers


> Here's a question,
>
> Say I have a binary number like this
>
> 1101 0100 0110 0110
>
> And I want to pull out of the binary number the third quartet (is that the
> right word)
>
> I want to know how to apply the mask
>
>    
>
> to the number above so that the result would be
> 0100
>
> Likewise, given
> the number: 1101 0100 0110 0110
> and the mask    
> the result 0110
>
> I suppose this is the same algorithm used to separate the host from the
node
> address given an IP address and a subnet mask.  I just need to know what
the
> algorithm is.
>
> Thanks
> David
>
>


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




Re: [PHP] Re: Mail()....

2002-08-30 Thread Stas Maximov

If you need plaintext newsletter, you can not use HTML at all, even
pretending that it is a plain-text.
It will be screwed badly on the plaintext-only e-mail clients anyway.

Stas

- Original Message -
From: "Brian McGarvie" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 30, 2002 10:27 AM
Subject: [PHP] Re: Mail()


> It's a text-based newsletter...
>
> I have a solution i think... so it'll look the same... just need to verify
> that it *should* be the same...
>
> inserting the contents in html, but within a ?
>
> 2'nd, using the following headers, sends it as an attachment it seems...
>
>   $headers = "MIME-Version: 1.0\r\n";
>   $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
>
> TIA..
>
> "Brian McGarvie" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Is there a way to set the font on a plaintext email?
> >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


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




Re: [PHP] PHP_AUTH_USER

2002-08-30 Thread Stas Maximov

> You can't log out of http authentication.  Close the browser is it.  Not
very secure, eh.  Use a session based login method > if you need logout
function.

Why not? Sending this to the client should do the job:

header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');

HTH, Stas





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




Re: [PHP] PHP_AUTH_USER

2002-08-30 Thread Stas Maximov

Yes, Matt, you were right about tracking the authorized state with a
session. I actually thought about same thing: keeping a variable somewhere
which will help to decide whether to send those "Authenticate" headers or
not - just didn't realize you meant the same thing. :)

And a little excerpt from w3.org proving the point:
"HTTP Authentication has the addition problem that there is no mechanism
available to the server to cause the browser to 'logout'; that is, to
discard its stored credentials for the user. This presents a problem for any
web application that may be used from a shared user agent. Requests for how
to force 'logout' appear almost daily in the netnews html and cgi authoring
groups, and are one of the most common support questions received by Agranat
Systems from their customers developing embedded systems web interfaces."

Cheers, Stas




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




Re: [PHP] News Feeds....

2002-09-04 Thread Stas Maximov

Try www.moreover.com

HTH Stas

- Original Message -
From: "Brian McGarvie" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 04, 2002 1:52 PM
Subject: [PHP] News Feeds


> Hi
>
> I'd like to get some news from any reputable news site, bbc.co.uk...
> yahoo.co.uk etc etc
>
> UK news would be best, if not then some hints to how to go about it would
be
> much appreciated!
>
> TIA...
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


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




Re: [PHP] Umm... Uh-oh

2002-10-04 Thread Stas Maximov

The easiest and safest way to get around this problem is to place all your
include files outside of your webroot directory (say one level up), so they
will be accessible locally via includes, but NOT accessible via http.

HTH, Stas

- Original Message -
From: "John Wards" <[EMAIL PROTECTED]>
To: "PHP" <[EMAIL PROTECTED]>
Sent: Friday, October 04, 2002 10:58 AM
Subject: Re: [PHP] Umm... Uh-oh


erm..would that alow hackers access? Say I have a database include file
would hackers be able to get access to my database like this?

(include('http://mysite.com/datainc.php');)

I hope bloody not!!! if so how on earth do i get round that!

John

On Friday 04 Oct 2002 10:52 am, Marek Kilimajer wrote:
> Use realpath() to check the path. I also suspect your script is
> vulnarable to cross-site includes
> (include('http://hacker.com/script.inc');)
>
> Rick Beckman wrote:
> >Okay, I was mistaken... There is a gaping security hole in my simple li'l
> >script... How do I modify it to only accept files from a certain path? I
> >want the url format to be script.php?call=1 where "1" is the called file
> > in the /includes/ directory. Just when I get optimistic I leave the
> > entire system exposed. Yeah, that fits with my luck. :-)


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




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




Re: [PHP] Re: PHP & XML

2002-10-16 Thread Stas Maximov

The benefit would be in dividing business logic from presentation layer.

Stas.

- Original Message -
From: "Simon Taylor" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, October 16, 2002 7:35 AM
Subject: RE: [PHP] Re: PHP & XML


> To me this is a lot of work and processing for limited benefits, a simple
db
> abstraction layer provides you with a divide between you db queries and
the
> presentation of your site, what benefits do you see in doing this?
> Cheers
> Simon
>
> -Original Message-
> From: Alexandru COSTIN [mailto:[EMAIL PROTECTED]]
> Sent: 15 October 2002 18:50
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: PHP & XML
>
>
> Hello,
>
> Most of what you are looking for is already implemented and fully working
in
>
> our Krysalis Professional platform.
>
> We help you create dynamic XML files, we provide you reusable taglibs  to
> avoid rewriting similar code multiple times, wr provide various levels of
> caching and many more.
>
> Please se more details at : http://www.interakt.ro/products/
>
> Alexandru
>
> > Let me preface this by saying that I know the benefits of using XML
> > with regards to portability and extensibility. Here is the issue I
> > face.  I have all of my data stored in a MySQL database.  I'm
> > considering reworking my website so that it uses XML (after being
> > converted from resultant records in my DB) to transmit & XSLT to
> > transform and display the data to my end user. There are a few
> > benifits I can see in sending XML messages as part of the back end
> > processing.  However, that seems to be out- weighed by the amount of
> > processing that's going to need to take place in actually serving the
> > data to the user. First I have to query and pull the records from the
> > database.  Then, I need to send those records to a function (or
> > functions) to convert it to XML.  Then, I need to take that XML data
> > and have PHP use an XSL stylesheet to transform it to HTML before it,
> > finally, gets sent on to the browser.  So that's basically 2
> > conversions that take place on the back end.
> > How much experience have any of you had with doing that?  Does
> > it take significantly longer to serve the pages; is there a noticible
> > performance hit?  Do you realize more benifit for the back end
> > processes when using XML that makes any additional time it takes
> > to display a page to the user worth it?
> > I'd love to hear about people's experience with this kind of thing so I
> > can better make a decision wrt whether or not I should even go down
> > this route.
> >
> > thnx,
> > Chris
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


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




Re: [PHP] Show indexes

2002-10-16 Thread Stas Maximov

First get all the table names in your db:
mysql_query("show tables from [your_db_name]");

Then crawl thru the table list and get index information for each of them:
mysql_query("show index from [your_table_name]");

HTH Stas
- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, October 16, 2002 1:45 PM
Subject: [PHP] Show indexes


> Is there a way in PHP to list all of the indexes in an SQL database? Or is
> it only through SQL that this can be done? (Or can it?)
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


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