RE: [PHP] OOP methodology{O|T} kinda'

2004-01-30 Thread Ajai Khattri
On Fri, 30 Jan 2004, Kelly Hallman wrote:

> Other languages dispense with a lot of the formalities found in C++ (a
> good or bad thing, depending on your perspective). I found Python to be a
> great language to learn OOP, since it forces good habits on you.

C++ is a very large unwieldly language - it has too many constructs and
too much syntax. Experience has chown that smaller simpler languages are
easier to learn and apply than larger ones. This is why C is still the
language of choice for a lot of systems coding (among other reasons).

While purists will no doubt damn me to hell, I know a lot of people would
put C++ at the bottom of their list of OOP coding languages of choice.

-- 
Aj.
Sys. Admin / Developer

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



php-general@lists.php.net

2004-01-30 Thread Ajai Khattri
On Fri, 30 Jan 2004, Maciek Hofstede wrote:

> i'm writing a host monitor.
> image it's diagram generate from mysql,
> if i use imagestring or imagettftext web is too big, there is about 150
> - 170 hosts, and i have generate image and put html descriptions:
> 
> host alive: ble ble ble
> ble ble ble (statistic)
>
> ps.sorry for my english ;(

You can easily test for and adjust the size of the text.
You can use various functions to get the font metrics and see if they fit
in your image - if not, you can decrease the size and try again. If you
write it as a loop with a flag, you can have it automatically size the
text to the bounding box.

Its not as hard as it sounds...

--
Aj.
Sys. Admin / Developer

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



php-general@lists.php.net

2004-01-30 Thread Ajai Khattri
On Fri, 30 Jan 2004, Maciek Hofstede wrote:

> I have one problem,
>
> i can't use 'text mode' exp:
>
> echo "blah";
>
> end 'image function'?
> exp: imagepng($rys);

You have to use the font rendering functions to put text into an
image. I have used imagettftext() to do this.

See: http://www.php.net/manual/en/ref.image.php

-- 
Aj.
Sys. Admin / Developer

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



Re: [PHP] MySQL Dump using PHP

2003-12-06 Thread Ajai Khattri
On Sat, Dec 06, 2003 at 06:02:40PM -0300, Cesar Aracena wrote:

> The thing is that I don't have phisical access to the server and it doesn't
> have telnet access either. What I want to achieve is to make a password
> protected page inside my site were a button is kept to start a full backup
> of my MySQL DB and after clicking on it, be able to select the Internet
> Explorer's option to store the file xxx.sql in my HDD. Is this possible?
> I use the built'in function of phpbb that does exactly that and it's just
> beautifull.

Of course it is possible to do it that way (in which case, you can probably
look at how phpBB does it).

The only problem with this is if the script takes too long to execute (rare,
but possible) in which case your browser could timeout.

-- 
Aj.
Sys. Admin / Developer

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



Re: [PHP] Apache Installation Query

2003-12-06 Thread Ajai Khattri
On Sat, Dec 06, 2003 at 03:56:49PM -, Shaun wrote:

> I have just installed Apache on my local machine. However, when browsing a
> directory I get the listing of it's contents rather than it defaulting to
> the index.php file, is there a way to make this happen?

Yes, you need to add index.php to the DirectoryIndex configuration directive
in Apche's httpd.conf file.

-- 
Aj.
Sys. Admin / Developer

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



Re: [PHP] MySQL Dump using PHP

2003-12-06 Thread Ajai Khattri
On Sat, Dec 06, 2003 at 04:39:22PM -0300, Cesar Aracena wrote:

> I am wondering if someone could point me to the right functions to use to
> make a script to dump all the tables in a specific MySQL DB. I need this to
> keep a daily backup from my site as the hackers are screwing up my site very
> often these days.

Much easier to use mysqldump in a shell script to do this.

man mysqldump

-- 
Aj.
Sys. Admin / Developer

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



Re: [PHP] Problem With Apache / PHP Installation

2003-12-06 Thread Ajai Khattri
On Sat, Dec 06, 2003 at 07:46:07PM -, Shaun wrote:

> I have installed PHP and Apache but when i try to view a PHP file i.e.
> http://127.0.0.1/hello.php i get a dialog box asking me if i want to open or
> save the file?
> 
> Any ideas why this is happening?

Assuming, your Apache is configured to load the php module:

Your Apache is not configured to handle .php files. You need
to add directives in httpd.conf for PHP files.

See PHP installation docs.

-- 
Aj.
Sys. Admin / Developer

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



Re: [PHP] Spamming bastardly problem, please help

2003-12-05 Thread Ajai Khattri
On Fri, Dec 05, 2003 at 11:03:56PM +0100, Ryan A wrote:

> Problem is we have a catch all address as the site is large and we have been
> using differient email ids all around the place which basically goes into
> one, so turning of the catch all can/would result in us missing some
> important stuff...

Your basic problem is there - you have a catchall. This is like having a
"bury-me-spam-free-n-easy" card.

I say grab the bull by the horns: make a list of all possible email addresses
and set them up, then remove the catchall. Worst-case is that you miss a few
here and there and have to re-create them as aliases.

-- 
Aj.
Sys. Admin / Developer

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



Re: [PHP] PHP RSS sites and SlashDot

2003-12-05 Thread Ajai Khattri
On Fri, Dec 05, 2003 at 08:34:15PM +0100, Ryan A wrote:

> I downloaded a few good classes to use RSS but dont know where to get the
> feeds from...

Basically RSS is just an XML file that you can retrieve from a site using
HTTP. Sites that make feeds available generally have a link to them somewhere
on the site.

In the case of Slashdot, the link is at the bottom of their home page and is
labelled "rss".

Im assuming you have some code to parse the XML...?

-- 
Aj.
Sys. Admin / Developer

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



Re: [PHP] related products, how to's best practices

2003-12-04 Thread Ajai Khattri
On Thu, Dec 04, 2003 at 03:43:53PM +, Jon Bennett wrote:

> Would I be right in thinking that php alone can't change the content of
> a dropdown once the browser has loaded the file without a page refresh
> ??? In which case I need to source out some javascript, anyone got
> anything that might help me (code, tute, urls etc) as I'm not having
> much luck with google ??

I have done this in JavaScript - but I dont have any code handy.

Basically you will need to pre-generate a series of JavaScript arrays for each
category of product at the top of the web page. Then you have a JavaScript
event handler in the category pulldown that changes the product pulldown to a
different array whenever the category changes (use something like onClick or
onChange or a similar relevant event).

Works pretty well - I once worked on a project which pulled data from Access
via ODBC (I was coding in ASP - bleh! Never again... ;-) and generated the web
page with the arrays and JavaScript functions at the top to handle the
switching of the pulldowns.

-- 
Aj.
Sys. Admin / Developer

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



Re: [PHP] What do you say to someone who says...

2003-12-04 Thread Ajai Khattri
On Thu, Dec 04, 2003 at 12:25:25PM -0500, Cesar Cordovez wrote:

> So there you go!  We are all greek!!!

Beware of Greeks bearing GIFs


(Sorry, couldn't resist ;-)

-- 
Aj.
Sys. Admin / Developer

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



Re: [PHP] International Addresses and Telephones

2003-12-04 Thread Ajai Khattri
On Thu, Dec 04, 2003 at 09:53:16AM -0600, Rankin, Randy wrote:

> I have a form which captures US addresses ( address, city, state ) and
> telephone numbers ( 10 digit ) and am writing this data to a MySQL table. I
> need to expand this to capture non-US info, so I was hoping for some
> guidance on forms and table structures. I have googled this to death and
> still haven't come up with anything. 

I tend to use an internationalized format for all phone numbers, such as:

+CCC (NP)AAAXXX

where:
CCC = country code (i.e. 44 for UK, 39 for Italy, etc)
NP = optional national prefix (e.g. in the US this is 1)
AAA = area code (212 for New York, 6 for Rome, etc)
XXX = actual phone number

-- 
Aj.
Sys. Admin / Developer

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



Re: [PHP] copy_file() files

2003-12-04 Thread Ajai Khattri
On Thu, Dec 04, 2003 at 06:21:05AM -0600, Jay Blanchard wrote:

> You had already stated the owner/group...I want to know what the
> read/write permissions are. For 'nobody' to be able to write to a
> directory that directory must be owned by 'nobody'
> 
> drw--- (chmod 600)
> 
> If the group is 'nobody' it must also have permission
> 
> drw-rw--- (chmod 660)

Of course, user nobody had read/write permission and the group too.

> These are called absolute permissions and are oft misunderstood. The
> first digit is the owner's permission, the second is the group's, and
> the third is everyone else. Numbers range from 0 (no permissions) to 7
> (read write and execute permissions).
> 
> In order to copy a file to a directory the 'person' must have write
> permissions.

As an administrator with 15 years experience of Unix, I think I understand
this! ;-)

Anyway, I solved my problem - I just needed to tweak open_base_dir in php.ini.

-- 
Aj.
Sys. Admin / Developer

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



Re: [PHP] Remote Server Info

2003-12-03 Thread Ajai Khattri
On Wed, Dec 03, 2003 at 02:35:16PM -0800, Jason Williard wrote:

> Is there a function that can get remote server information such as what
> server software the remote host is running?

http://www.php.net/manual/en/ref.info.php

-- 
Aj.
Sys. Admin / Developer

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



Re: [PHP] copy_file() files

2003-12-03 Thread Ajai Khattri
On Wed, Dec 03, 2003 at 11:19:46PM +0100, Bronislav Klucka wrote:

> are you working with uploaded files?? because move_uploaded _files() woks
> only with them,

I switched to this function and had the same problem.

> and what is $image variable??? is that file on disk or uploaded file?? do u

It is a variable in the form (register globals is off).

> know that they are stored i $_FILES global variable?

Yes I know - I didn't write this code and dont really want to mess with it.

However, I managed to get this working now - I realized that open_base_dir needs
to have /tmp added to the list of permissable directories. Now image uploads
appear to be working.

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



Re: [PHP] copy_file() files

2003-12-03 Thread Ajai Khattri
On Wed, Dec 03, 2003 at 03:06:50PM -0600, Jay Blanchard wrote:

> What is the chmod of those files/directories. Also, there is no

Well, the destination folder (as I stated) is owned by user nobody and group
nobody. Apache is running as user nobody and group nobody. And Im assuming that
any files written in /tmp by Apache are owned by user nobody and group nobody.

> copy_file() function listed at php.net...could this be a user built
> function? Or are you talking about http://www.php.net/copy ?

You're right - I changed the function to move_uploaded_file() which still
doesn't work either.

Here's a snippet of code (I have commented out passwords and database stuff
with X's:


01: http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] copy_file() files

2003-12-03 Thread Ajai Khattri
I recently upgraded PHP and now have two sites that use copy_file() that no
longer work. I have safe_mode=Off in my php.ini. Also, the files and directories
Furthermore, the file and directories Im trying to copy files to are owned by
user nobody and group nobody (My Apache server runs as user nobody in group
nobody).

Im assuming its some permissions problem. If I continuously list files in /tmp,
I see the uploaded file appear but then the copy_file() fails and the temp file
disappears.

Any ideas?

-- 
Aj.
Sys. Admin / Developer

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