Re: [PHP] Getting The Document Root

2006-02-02 Thread Silvio Porcellana [tradeOver]

Jeremy Privett wrote:
I'm looking for a method that would be able to extract the user's true 
document root (e.g. /home/jeremy/public_html/) so that I can use it for 
some filesystem scanning functions. I'm trying to avoid hard-coding 
supported document roots in favor of being able to dynamically detect 
it, but nothing is coming to mind. I thought I would consult some of the 
minds of the mailing list for advice. Any ideas or code would be greatly 
appreciated.




You can try with __FILE__

quote from=http://php.net/manual/en/language.constants.predefined.php;
 The full path and filename of the file. If used inside an include, the 
name of the included file is returned. Since PHP 4.0.2, __FILE__ always 
contains an absolute path whereas in older versions it contained 
relative path under some circumstances.

/quote

and then use 'dirname()'
http://php.net/manual/en/function.dirname.php

Ciao!
Silvio

--
tradeOver | http://www.tradeover.net
...ready to become the King of the World?

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



Re: [PHP] PHP 5 Backwards Compatability

2006-01-30 Thread Silvio Porcellana [tradeOver]

Tod Thomas wrote:
Is their a list of portability problems to be aware of when switching 
from v4 to v5?  Maybe a table that compares the two?


Thanks.



You can start here:
http://www.zend.com/php5/migration.php

Silvio

--
tradeOver | http://www.tradeover.net
...ready to become the King of the World?

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



Re: [PHP] Regular expression

2006-01-30 Thread Silvio Porcellana [tradeOver]

Barry wrote:

Simple reg help please

i want to match the last , in a,b,c,d and replace it with  and 



Without using a regexp, you could do:

code
  $string = 'a,b,c,d';
  $letters = explode(',', $string);
  $last_letter = array_pop($letters);
  $final_string = implode(',', $letters) . ' and ' . $last_letter;
/code

Not very efficient - but should work...

Silvio

--
tradeOver | http://www.tradeover.net
...ready to become the King of the World?

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



Re: [PHP] PHP hosting with multiple domains?

2006-01-30 Thread Silvio Porcellana [tradeOver]

[EMAIL PROTECTED] wrote:

snip /



hah.. I'll stop now.  Think you get the idea.  The convenient management of 
multiple domains with a hosting provider is my ultimate goal.



Go with http://www.hub.org
I've got a couple of domains with them - and I think they are great.

Silvio

--
tradeOver | http://www.tradeover.net
...ready to become the King of the World?

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



Re: [PHP] How can I get ENUM values from column info?

2006-01-29 Thread Silvio Porcellana [tradeOver]

[EMAIL PROTECTED] wrote:


If I have columns type ENUM('live', 'hidden', 'pending'), $flags will show
ONLY 'enum'.
How can I get all ENUM values?

Thanks for any help or direction.

-afan



This doesn't really seem a PHP question... BUT... give a look here:
http://dev.mysql.com/doc/refman/5.0/en/enum.html

There is one user comment ('Posted by J. Santiago Scarfo on March 31 
2005 7:16pm') that I think can help you.


Silvio

--
tradeOver | http://www.tradeover.net
...ready to become the King of the World?

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



Re: [PHP] query problem.

2006-01-24 Thread Silvio Porcellana [tradeOver]

Angelo Zanetti wrote:

(...)
Why does the   cause that not to be displayed? or is it retrieving it 
correctly but not showing it because of the   (which might be 
conflicting with HTML tags?




When showing things in an HTML page it's always a good idea to use 
'htmlspecialchars' (or htmlentities) first


http://php.net/manual/en/function.htmlspecialchars.php
http://php.net/manual/en/function.htmlentities.php

HTH, ciao!
Silvio

--
tradeOver | http://www.tradeover.net
...ready to become the King of the World?

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



Re: [PHP] Re: hiding the index.php page.

2006-01-23 Thread Silvio Porcellana [tradeOver]

Barry wrote:

Gregory Machin wrote:

Hi
I would like to know how i would hide my index page so that it is not 
shown

at the end of the url like how gmail does it and many cms do it ..
And what is it called when one does this ..

Thank you



If you use Apache, what you are looking for is probably the 
'DirectoryIndex' directive:

http://httpd.apache.org/docs/2.0/mod/mod_dir.html#directoryindex

But it could also be that you mean something that needs 'mod_rewrite', 
in this case I guess it's better if you search the archives:

http://marc.theaimsgroup.com/?l=php-generalw=2r=1s=mod_rewriteq=b

HTH!
Ciao, Silvio

--
tradeOver | http://www.tradeover.net
...ready to become the King of the World?

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



Re: [PHP] date(H, $datevalue) always adds an hour?

2006-01-20 Thread Silvio Porcellana [tradeOver]

David Grant wrote:

Murray,

I can't think what else it might be.  Sorry!

David


What does

date(I, $datevalue)

return? (it's a capital 'i')

I guess you already checked out this page...
http://php.net/date

--
tradeOver | http://www.tradeover.net
...ready to become the King of the World?

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



Re: [PHP] adding script

2006-01-20 Thread Silvio Porcellana [tradeOver]

Ross wrote:

This was a page I did ages ago

http://www.ecurry.net/menu2.php

The problem with it is when you add or subtact an item is it always button 
press behind.



This must be because of the way the page self submits or something?

The script is here

http://www.ecurry.net/calculate.phps

This is ok when I put it in an iframe it updates on every click.

http://www.ecurry.net/menu.php



This is the ideal situation for an AJAX solution:
http://en.wikipedia.org/wiki/AJAX
http://marc.theaimsgroup.com/?l=php-generalm=112198633625636w=2

Ciao
Silvio

--
tradeOver | http://www.tradeover.net
...ready to become the King of the World?

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



Re: [PHP] getting list of files included

2006-01-20 Thread Silvio Porcellana [tradeOver]

Diana Castillo wrote:
does anyone know of a command in php that will give you a list of the files 
already included .  Something that would tell you whether a file is already 
included before you do the require_once  ?




Try this:
http://php.net/manual/en/function.get-included-files.php

Oh, and maybe next time try to RTFM... :-)

Cheers!
Silvio

--
tradeOver | http://www.tradeover.net
...ready to become the King of the World?

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



Re: [PHP] fopen/fwrite and owner/group settings

2006-01-05 Thread Silvio Porcellana [tradeOver]
Mathijs wrote:
 Hello there,
 
 I Have a problem with some file writeing.
 
 I Use fopen to create a new file, but that file gets the owner and group
 the same as the apache owner and group.
 
 How can i change it so that the file gets the same owner/group as the
 files i upload with FTP?
 
 Thx in advanced
 

You can use FTP functions to create the file (for example 'ftp_put')
http://php.net/ftp

HTH, cheers
Silvio

-- 
tradeOver | http://www.tradeover.net
...ready to become the King of the World?

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



Re: [PHP] Access Client IP address

2006-01-04 Thread Silvio Porcellana [tradeOver]
Nilanjan Dasgupta wrote:
 Hi,
 Is there any way to client's IP address inside a php document. I am
 trying to generate a code that depends on the IP address of the client.
 
 thanks a lot,
 Nilanjan
 

Give a look at $_SERVER, and more specifically $_SERVER[REMOTE_ADDR]
http://php.net/manual/en/reserved.variables.php#reserved.variables.server

HTH, cheers.
Silvio

-- 
tradeOver | http://www.tradeover.net
...ready to become the King of the World?

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



Re: [PHP] forms

2006-01-03 Thread Silvio Porcellana [tradeOver]
Mark wrote:
 Hi can any one show me how make another form appear below another once the
 1st form has been submitted.
 

[not really a PHP solution...]

You can do like this: the 'SUBMIT' button of the first form only makes
visible the (hidden) DIV where the second form is, and only *that*
'SUBMIT' button actually submits the form.

CSS reference: http://www.w3schools.com/css/css_reference.asp

HTH, cheers
Silvio

-- 
tradeOver | http://www.tradeover.net
...ready to become the King of the World?

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



Re: [PHP] Earlier versions hurt PHP 5

2005-12-29 Thread Silvio Porcellana [tradeOver]
Anas Mughal wrote:
 Here is a PHP5 hosting company:
 http://www.a2hosting.com/
 

Aaargh! I wouldn't suggest that one, I've had a really really bad
experience with them (they shut down my site *w/o any notice* because
they said I was using too much of their resources - while this was not
true).

I am now using hub.org (http://www.hub.org) and I find they have a
really good service (and PHP5)

-- 
tradeOver | http://www.tradeover.net
...ready to become the King of the World?

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



Re: [PHP] XML Reader

2005-12-29 Thread Silvio Porcellana [tradeOver]
[EMAIL PROTECTED] wrote:
 Is there any easy php script to run to view an xml file such as new
 headlines like so:  http://news.google.com/?output=rss or can anyone point
 me in the right direction for good online tutorials or books.
 

You can start here:
http://magpierss.sourceforge.net/

Magpie RSS is a good RSS parser for PHP.

HTH, cheers
Silvio

-- 
tradeOver | http://www.tradeover.net
...ready to become the King of the World?

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



Re: [PHP] Location ....

2005-12-28 Thread Silvio Porcellana [tradeOver]
Christian Ista wrote:
 Hello,
 
 Could you tell me a efficient solution for change page (new location) in
 PHP? I tried this code : header(Location: mypage.php);
 
note:  HTTP/1.1 requires an absolute URI
http://php.net/header

 But in some case, I have error message heade already send. Then I use a
 javascript solution : window.location.href=mypage.php;
 
 Is there a good solution in php ?
 

Check out 'headers_sent', you can choose how to redirect ('header' or
JavaScript) depending on whether you have sent the headers or not.

http://php.net/headers_sent

HTH, cheers
Silvio

-- 
tradeOver | http://www.tradeover.net
...ready to become the King of the World?

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



Re: [PHP] gdf fonts

2005-12-21 Thread Silvio Porcellana [tradeOver]
Adrian Bruce wrote:
 Hi
 
 Does anyone know where i can get some decent gdf fonts for using in the
 imageloadfont() function, i have found some on the net but they are all
 a bit naf so far.  I'm really just looking for something like Arial or
 verdana.  Im creating pie charts on the fly but at the moment they look
 like something that would be produced by a spectrum or commodore 64!
 
 Thanks
 Adrian
 

Try here:
http://www.widgnet.com/gdf_fonts/

HTH, cheers

Silvio
-- 
tradeOver | http://www.tradeover.net
...ready to become the King of the World?

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



Re: [PHP] mutiple file upload

2005-12-21 Thread Silvio Porcellana [tradeOver]
Ross wrote:
 Hi,
 
 I am trying create a multiple file upload to a mysql server.
 

Google is your friend...
http://www.google.com/search?hl=enq=multiple+upload+phpbtnG=Google+Search

And, by the way, if you are uploading and storing images in your MySQL
DB, you might want to consider that there is a much better database for
storing files. It's called 'filesystem'.

HTH, cheers

Silvio
-- 
tradeOver | http://www.tradeover.net
...ready to become the King of the World?

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



Re: [PHP] Problem with fopen and sending POST vars

2005-12-20 Thread Silvio Porcellana [tradeOver]
Barry wrote:
 Hello everyone!
 
 I have a problem sending POST vars via fopen.
 It was possible for me to send some xml data but that's all.
 
 Anyone know how to send POST vars?
 Big probleme here is also that i have to connect via SSL.
 

cURL can be your friend...

http://php.net/curl
http://www.zend.com/pecl/tutorials/curl.php

HTH, cheers
Silvio

-- 
tradeOver | http://www.tradeover.net
...ready to become the King of the World?

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



Re: [PHP] Filtering URLs problem..

2005-12-20 Thread Silvio Porcellana [tradeOver]
Anders Norrbring wrote:
 
 I'm writing a filter/parsing function for texts entered by users, and
 I've run into a problem...
 What I'm trying to do is to parse URLs of different sorts, ftp, http,
 mms, irc etc and format them as links, that part was real easy..
 

You might want to consider using vbCode, there is a nice class for PHP here:
http://www.phpclasses.org/browse/package/1379.html

HTH, cheers.
Silvio

-- 
tradeOver | http://www.tradeover.net
...ready to become the King of the World?

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



Re: [PHP] Re: [Bulk] Re: [PHP] PHP errors in Apache error logs

2005-12-19 Thread Silvio Porcellana [tradeOver]
Jose Borquez wrote:
 I installed PHP from the ports and did not do any configuration.  I set
 up the phpinfo page and the configuration line did not set disable session.
 
 Thanks in advance,
 Jose
 

Maybe you have this:
'--disable-all'
(not sure, thou, this should enable sessions anyway, IIRC...)

Maybe you could point us to your phpinfo(), it sure would help.

Cheers
Silvio

-- 
tradeOver | http://www.tradeover.net
...ready to become the King of the World?

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



Re: [PHP] Passing $_POST values to a php script

2005-12-19 Thread Silvio Porcellana [tradeOver]
Jay Blanchard wrote:
 [snip]
 I am trying to develop a testing framework for a bunch of php scripts. These
 
 files expect various kinds of data from the $_POST array. They work fine 
 when invoked from the browser.
 
 But I am wondering if I can programmatically pass these values so that I can
 
 stress test them in a systematic manner.
 [/snip]
 
 You will probably want to use http://www.php.net/curl
 
You can also try the Apache benchmarking tool - ab
[http://httpd.apache.org/docs/2.0/programs/ab.html]

It can also do POST request (check the -p option)
quote from=http://httpd.apache.org/docs/1.3/programs/ab.html
-p POST file
A file containing data  that  the  program  will send  to  the
Apache  server  in  any HTTP POST requests. The contents of the
file  should  look like  name=valuesomething=other,  with
special characters URL encoded.
/quote

HTH, cheers

Silvio

-- 
tradeOver | http://www.tradeover.net
...ready to become the King of the World?

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



Re: [PHP] Random Images with no duplicates?

2005-12-18 Thread Silvio Porcellana [tradeOver]
Jared Williams wrote:
 Hi,
   Just unset the ones you've picked
  
 ?php
 #random images example
 #this is your file
 $file = images.txt;
 #open the file
 $openFile = file($file);
 #generate a random number
 srand((double)microtime()*100);
 #get one of the entries in the file
 for ($i = 0; $i  10; ++$i)
 {
$r = array_rand($openFile);
$random_image = $openFile[$r]; 
echo img src='$random_image' height='170'  width='100'/img;
unset($openFile[$r]);
 }
 ?
 
 Jared
 

Sorry if I jump in late in this thread, but wouldn't this work?

code
$file = images.txt;
$openFile = file($file);
$num_images = 10;
# don't need this is PHP  4.2.0
srand((float) microtime() * 1000);
$random_keys = array_rand($openFile, $num_images);
foreach ($random_keys as $random_key) {
echo img src='$random_image' height='170'  
width='100'/img;
}
/code

array_rand: http://php.net/array_rand

Maybe I'm missing something... Anyway, cheers everybody!

Silvio

-- 
tradeOver | http://www.tradeover.net
...ready to become the King of the World?

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



Re: [PHP] Random Images with no duplicates?

2005-12-18 Thread Silvio Porcellana [tradeOver]
Silvio Porcellana [tradeOver] wrote:
 
 code
   $file = images.txt;
   $openFile = file($file);
   $num_images = 10;
   # don't need this is PHP  4.2.0
   srand((float) microtime() * 1000);
   $random_keys = array_rand($openFile, $num_images);
   foreach ($random_keys as $random_key) {
   echo img src='$random_image' height='170'  
 width='100'/img;

ops, sorry, that obviously should be:
echo img src=' . $openFile[$random_key] . ' height='170'
width='100'/img;

   }
 /code

Sorry about this!

Silvio

-- 
tradeOver | http://www.tradeover.net
...ready to become the King of the World?

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



Re: [PHP] XSS via curl

2005-11-30 Thread Silvio Porcellana [tradeOver]
Sandy Keathley wrote:
 
 Is there a way to detect that a script is being accessed by curl, and 
 not by a browser?  ENV ($_SERVER) variables won't work, as 
 those can be forged.
 

Use a CAPTCHA test:
http://en.wikipedia.org/wiki/Captcha

HTH, cheers!
Silvio

-- 
tradeOver | http://www.tradeover.net
ready to become the King of the World?

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