Re: [PHP] accessing data from classes

2002-03-12 Thread Samuel Ottenhoff

It is good that you are looking into classes and functions. The concept
you are missing is that of returning a result.

At the end of your function mysql_query, add a line:

return $result;

Then, when you call that function, make it like this:

$resultArray = $TemplateTable-mysql_query(select );

Now you can pass $resultArray on to a different function.

Sam


On 3/12/02 3:48 PM, caspar kennerdale [EMAIL PROTECTED] wrote:

 I am just getting my head around classes, so forgive me if this is a
 schoolboy error!
 
 In order to learn I am re-writing my content management system and am in the
 process of writing an HTML.class and a MYSQL.class.
 
 so far so good. I spawn new instances of a table for example, sending
 parameter,and a table is output.
 
 now in my MYSQL.class- I want to send a query to my class which then returns
 an array- my database row or rows.
 
 the problem is that whilst my array is created- I only seem to be able to
 manipulate it within my MYSQL class. This is not satisfactory as I really
 want to be able to send it on to my HTML.class for formatting etc.
 
 I obvioulsy do not want to format any 'echoed' output from within my
 databasee class.
 
 Here is a bit of sample code-
 
 Once my database is open I call my query like this-
 
 $TemplateTable = new DB;
 $TemplateTable-mysql_query('SELECT * FROM template ORDER BY name ASC LIMIT
 10');
 
 This is the function within my MYSQL.class
 
 function mysql_query($query){
 $a= 0;
 while($row=mysql_fetch_row($SQL)) {
 $new_row =  join('***',$row);
 $result[] = $new_row;
 echo $result[$a].br;
 $a++;
 }
 }
 
 
 So here I am creating a string with each row in my database which is
 delimted by *** - $new_row.and am placing each row in anew array called
 $result.
 
 I can evaluate and format either $new_row or $result from within
 mysql_query() but I really want to do is to send it on to another funtion or
 even better another class- or access the values glabbally as variables.
 
 Any ideas or am I missing something really obvious?
 
 Thanks in advance
 


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




Re: [PHP] attachment through mail

2002-03-11 Thread Samuel Ottenhoff

There is a very good article (with some well written OO classes) available
at PHPBuilder.  

http://www.phpbuilder.com/columns/kartic2807.php3

I think the classes are at:

http://www.phpbuilder.com/columns/kartic2807.zip

This will make file attachments very easy.

BTW, the PHPBuilder columns section should be bookmarked by most  people.
It answers a lot of questions on this list about session management, gd
image creation, file uploads, etc.

http://www.phpbuilder.com/columns/

Sam



On 3/12/02 2:03 AM, Swati Patil [EMAIL PROTECTED] wrote:

 i m using php4.1.1
 in the mail function, i want to provide the facility to the end user to
 attach his/her  word document.
 how can i do this?
 
 swati.


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




Re: [PHP] connection speed?

2002-03-11 Thread Samuel Ottenhoff

There aren't too many elegant ways to do this, that I know of.

You can create a flash movie with a big chunk of nothing in it... With a
couple of calls, you can find how long it took to load So if it took 4
secs to load 200k You can sort of figure out their connection speed.

But unfortunately, there is not going to be any:

$speed = get_connection_speed();

Sam
 

On 3/11/02 2:29 AM, Kunal Jhunjhunwala [EMAIL PROTECTED] wrote:

 Hey,
 How can I detect the users connection speed? I dont want to ask them.. :)
 Regards,
 Kunal Jhunjhunwala
 
 Minds think with ideas, not information. No amount of data, bandwidth, or
 processing power can substitute for inspired thought. - Clifford Stoll
 


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




Re: [PHP] Update database via email

2002-03-11 Thread Samuel Ottenhoff

If I were you, I would start looking into procmail.

http://www.procmail.org

You would set up an alias on your server... Something like
[EMAIL PROTECTED]  Procmail would filter the email for the important
stuff and pass that on to a PHP script.  The php script would then update
your database.

Try a google search on procmail php.

Sam


On 3/11/02 11:52 AM, Jackson Miller [EMAIL PROTECTED] wrote:

 I am working on a site that I
 would like to be able to
 update content (basically news
 stories) on via email.  I am
 sitting with the problem
 trying to figure out the best
 way to do this before I start
 coding.
 
 I am curious if anyone else
 has done this and has a list
 of lessons learned that they
 would be willing to share.
 Also is there any code
 available that does this kind
 of thing.
 
 Thanks in advance,
 
 -Jaxn
 


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




Re: [PHP] index.php question

2002-03-11 Thread Samuel Ottenhoff

# 
# DirectoryIndex: Name of the file or files to use as a pre-written HTML
# directory index.  Separate multiple entries with spaces.
#
IfModule mod_dir.c
DirectoryIndex index.php index.php3 index.html
/IfModule

Sam

On 3/11/02 1:36 PM, Omland Christopher m [EMAIL PROTECTED]
wrote:

 Hi all, I'm new to the mailing list, I hope I'm in the right spot.
 I have installed php, and .php files work fine, unless they are my index
 file. For example http://whatever.com/~jondoe/info.php will work. But if I
 make a index.php file and go to http://whatever.com/~jondoe it wont work.
 I can view the source and see my php code, which I know means the server
 isn't translating it. I'm running RH LINUX, and running apache webserver.
 I have checked the httpd.conf file and the load modules lines are in
 there, and they are correct??(I THINK)
 Any help would be appreciated.
 Thank You.
 -Chris
 


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




Re: [PHP] Image upload and scaling

2002-03-11 Thread Samuel Ottenhoff

Someone just mentioned ImageMagick... Check it out:

http://www.imagemagick.org/

ImageMagickTM is a robust collection of tools and libraries to read, write,
and manipulate an image in many image formats (over 68 major formats)
including popular formats like TIFF, JPEG, PNG, PDF, PhotoCD, and GIF. With
ImageMagick you can create images dynamically, making it suitable for Web
applications. You can also resize, rotate, sharpen, color reduce, or add
special effects to an image and save your completed work in the same or
differing image format. Image processing operations are available from the
command line, as well as through C, C++, Perl, or Java programming
interfaces.

Or you can check out the built in gd functions.

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

Sam


On 3/11/02 12:21 PM, P.Agenbag [EMAIL PROTECTED] wrote:

 Hi, I am trying to make a util whereby ppl can upload their own images to my
 server for me to automatically display them.
 The below code works fine, but I have the following problem.
 It only works fne if everyone complies to a standard of a set width and height
 for the image. This is not always possible, so I'm looking for a way to accept
 the image in any form they have and then to scale it
 to fit within an acceptable height/width range.
 This I need help with, so if someone could hep me ( at the hand of my current
 code) I would be very pleased.
 
 Thanks
 
 Petre
 
 below my code snippet


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




Re: [PHP] limiting the livetime of a session possible?

2002-03-11 Thread Samuel Ottenhoff

The last person gave you a way to do it without using php.ini Re-read
the reply.

1) you can create a timestamp column last_access in your USERS table
2) every time that user hits a page, you need to update that column
3) every time the user asks for a new page, see if the last access is less
than 60 minutes.  If not Session_destroy() Send them to the home
page.

Sam


On 3/11/02 1:14 PM, Andy [EMAIL PROTECTED] wrote:

 Hi Andrey,
 
 is there no way to control the lifetime without modifiying the php.ini? I am
 not on my own server. The ISP controles this file.
 
 Would you suggest to go for a self made session?
 
 Andy
 
 Andrey Hristov [EMAIL PROTECTED] schrieb im Newsbeitrag
 027901c1c91d$cce57970$0b01a8c0@ANDreY">news:027901c1c91d$cce57970$0b01a8c0@ANDreY...
 PHP4 sessions or self made sessions. If PHP4 there is an option in php.ini
 to set about how frequently the GC(garbage collector)
 will be started. Otherwise if self made and using a DB for backend - add
 new field last_time , and on every page request do Delete
 from session_table where last_timenow() interval 60 min; not sure for
 the query but that is the idea.
 
 
 Best regards,
 Andrey Hristov
 


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




Re: [PHP] Broadcasting

2002-03-10 Thread Samuel Ottenhoff

This is sort of a weird question as it seemingly involves both physical
theft and virtual theft.  But here goes:

1) How do script kiddies find you?
If you have a public IP address, and you are not protected behind a
firewall, you will be probed by scripts.  How do they find you?  By port
scanning large ranges of IP addresses.  They often scan all the RoadRunner
ips... So they start in 24.x.x.1 range and work through all of them testing
out common ports (http, ftp, ssh, etc).  Then, if the script finds an open
port, it will test out an exploit (or a series of known exploits).  For
example, FTP usually runs on port 21 If the script finds an open port
21, on a RedHat 6.0 box, it may try the remote root exploit of the ftp
daemon (wuftpd).  If that doesn't work, it just moves onto the next one.

If you are running a private apache server, and you don't want the public to
see it, then it is time to learn about firewalls.

2) broadcasting your ip
Your questions are odd here But yes, you can often learn a fair bit
about an IP.  Do a reverse dns lookup on a university campus and you can
often find a lot Maybe seat13.mathlab.university.edu.

Also, you can find out a lot from what Apache sends in the headers...
Example: Apache/1.3.0 (Unix) PHP/3.0 MyMod/1.2

So, if I check out your server, and see that you are running PHP 4.06 on
linux or solaris, a hacker could try the multipart/form-data exploit with a
broken boundary check (http://security.e-matters.de/advisories/012002.html).

There is a setting in Apache to limit this information in the headers so
that you do not reveal what kind of OS you are running and what version of
PHP and Apache you are running... I suppose this could help in limiting
exploits. Although, keeping up-to-date with versions, patches, and
security alerts is a better solution.

http://httpd.apache.org/docs/mod/core.html#servertokens


Sam

On 3/10/02 9:45 PM, jtjohnston [EMAIL PROTECTED] wrote:

 Not really a php thing, more a loss of php :) !
 
 My PHP-MySQL server has been stolen from my office (last night).
 Security has not been doing their job!
 
 I noticed in the logs once where people were trying to get in by FTP on
 occasion, or adding weird things to a url, when it was running just as
 an IP. My question is: does my Apache server broadcast itself or its IP
 for when script kiddies come check out my machine to see if they can
 crash it? What does it broadcast? How did the script kiddies find me?
 Can I reverse process this and see if my stolen machine still exists
 anywhere? What would I look for?
 
 I have a ghost backup going back around four week ago, but ...
 
 Sigh :(
 John
 


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




Re: [PHP] PHP based search engine

2002-03-10 Thread Samuel Ottenhoff

Check out phpdig: http://phpdig.toiletoine.net/

My guess is that one of these packages on the web can serve as a foundation
for you... You might just need to build a custom layer on top of it.

Check out the site freshmeat.net.  It tracks software packages and new
updates and is quite focused on open-source/GPL stuff.

A search on php search engine could get you started.

Sam

On 3/10/02 11:41 PM, Underbrush [EMAIL PROTECTED] wrote:

 I don't see why not, but you have to write the search engine.  i.e. create a
 form, take user input, search your database, search your static files, and
 return some formatted output with links to the content.  It's a project.
 Someone else might be able to point you to some pre-written code.  I too would
 like that, but as of right now I am planning on writing my own.
 
 Good Luck,  Chad
 - Original Message -
 From: Tim Thorburn
 To: [EMAIL PROTECTED]
 Sent: Monday, March 11, 2002 12:25 PM
 Subject: [PHP] PHP based search engine
 
 
 Hi,
 
 Does anyone know of a PHP based search engine for a website?  I was using
 Fluid Dynamics on my site - as I've got some sections of the site in a
 MySQL database, and some sections are just static pages.  However, it seems
 to get stuck in a loop while trying to index portions of my database that
 are DATE formatted.
 
 Is it even possible to have a PHP search engine search a site that is mixed
 with MySQL and static pages?
 
 Thanks
 -Tim


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