Re: [PHP] remote file existance when protected by a .htaccess

2004-10-21 Thread Mag
> try this function, I lifted almost all of this stuff
> off of the manual
> and the zend site...

Hey!
Thanks Matt, it works like a charm!

Exactly what I was looking for, its giving me either a
200status header or a 404 and I can easily work from
there.

I have been going through the code (the curl part),
some of it seems a bit complicated and other parts
dont need an explanation... will go through the manual
when I get time, I'm trying to learn about classes and
regular expressions for now plus work on a project.

I did find some classes,code and links via google that
actually fetches the remote file but for some reason
people left out the part if you want to just verify a
file's existance...

Thanks again,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



[PHP] ImageMagik

2004-10-21 Thread Mag
Hi,
I have a requirment to dynamically brighten, darken or
add/remove contrast from a thumbnail image, since I
cannot do this in GD I was thinking of doing this in
ImageMagik, but searching google I cannot find many
tutorials and even visiting the image magik site i
only see that it can be used with php but no examples
were given.

Any idea of any classes that use imagemagik to do the
above or you have any code taht does the above or can
recommend some tutorials that do that above, please
reply.

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



Re: [PHP] remote file existance when protected by a .htaccess

2004-10-21 Thread Mag

--- "Matt M." <[EMAIL PROTECTED]> wrote:

> > Nope, no PEAR allowedany other options?
> 
> curl, Is that available to you?
> 
> http://us2.php.net/curl
> 

Hi Matt,
Yep, cURL is available but I was going through the
manual for curl (and google too suggests that might be
my best option)...but it does not look very easy to
learn :-(

so I was hopeing for something else..

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



Re: [PHP] remote file existance when protected by a .htaccess

2004-10-20 Thread Mag

> > which works great except I have been getting some
> 403
> > access denied errors for some sites, checking I
> see
> > that they are protected by a htaccess file (that
> > checks the referrer) so i tried putting
> > 
> > header('referer: domain')
> > 
> > where domain is the parse_url['host'] of
> $remote_file
> > but that too has failed...
> > 
> > Any ideas?
> 
> 
> might want to try
> http://pear.php.net/package/HTTP_Client

Nope, no PEAR allowedany other options?

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



[PHP] remote file existance when protected by a .htaccess

2004-10-20 Thread Mag
Hi,
I have a form where the user specifies a remote image
so it can be made into a thumb, before that I am
trying to make sure the image exists using this code:

$chk_gallery = @fopen ($remote_image, "r");
if (!$chk_gallery) 
{echo "ERROR:Unable
to fetch the remote image";exit;}
fclose($chk_gallery);

which works great except I have been getting some 403
access denied errors for some sites, checking I see
that they are protected by a htaccess file (that
checks the referrer) so i tried putting 

header('referer: domain')

where domain is the parse_url['host'] of $remote_file
but that too has failed...


Any ideas?

Thanks,
Mag



=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



[PHP] Add to regex help

2004-10-18 Thread Mag
Hi,
Quite some time back I modified a regex (to the one
below) to work with my script:

if (preg_match_all('/]*)[\"\']?[^>]*>.*?<\/a>/i', $url, $matches))
{
   foreach($matches as $match){$links[] = $match;}
}

Problem is, I dont really know REGEXs properly and
dont remember how I modified it and it completly
ignores the below: 



because its a map and I guess it does not start with


but I need to make sure it catches even the above...

Can someone help me add to the above regex please?

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



Re: [PHP] dirty words

2004-10-18 Thread Mag
Hi,

> > I am useing file_get_contents on a remote page
> then
> > using stristr() to make sure there are no "bad
> words"
> > and its a family site.
> 
> May I point out this is a lost battle from the
> start? If someone really
> wants to enter "bad words" they will, by masking
> them in various ways;
> humans will interpret the bad words correctly in far
> more cases than you
> can filter with software. Additionally, you will end
> up filtering parts of
> legit words that look like bad words.

True, but only sites that pass the above test get
added to the database on an "unconfirmed" state, then
I personally look at the site and "confirm" itthe
aboev is just something of a "pre-screen"

I got it working though so this is an old problem :-)

Cheers,
Mag


=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



Re: [PHP] cacheing problem

2004-10-17 Thread Mag
Hi,
I dont really have a problem in converting from POST
to GET but the html FILE box does not post its
variables if it is not in POST

eg:


if you do a submit with $_GET the $_FILES array will
be "" or not existant

How to pass that?

Thanks,
Mag


--- Greg Donald <[EMAIL PROTECTED]> wrote:

> On Sun, 17 Oct 2004 17:16:09 -0700 (PDT), Mag
> <[EMAIL PROTECTED]> wrote:
> > Warning: Page has Expired
> 
> You can use the GET method instead of POST in your
> form if that's appropriate.
> 
> 
> -- 
> Greg Donald
> Zend Certified Engineer
> http://gdconsultants.com/
> http://destiney.com/
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



[PHP] cacheing problem

2004-10-17 Thread Mag
Hi,
Heres my problem:
I am offering a form for the client to upload his
picture, then his pic is shown and he can pick some
text to write on the image, then I am using GD to
write the text.
If the client does not like the position of the text
he can press the back button and change the position,
but this seems to be working only in Operain IE it
is displaying this horrorable text:

Warning: Page has Expired 

The page you requested was created using information
blah balh blah blah

What headers or whatever do I have to set so that it
shows the cached page?
please show me where and how to set the headers or
whatever :-)

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



RE: [PHP] dirty words

2004-10-16 Thread Mag
Hey!
Thanks, I think in_array() is what I was looking for,
but by a quick glance I think its case sensitive (?),
I didnt want to use a class for this coz it kind of
seemed like using a gun instead of a flyswatter
:-)

Also, any way to check if a remote file exists?
I am presently using this:
$url='http://www.blah.net/movie.mpg'; 
$addy=parse_url($url); 
$addy['port']=isset($addy['port'])?$addy['port']:80; 
$sh=fsockopen($addy['host'],$addy['port']) or
die('cant open socket'); 
fputs($sh,"HEAD {$addy['path']} HTTP/1.1\r\nHost:
{$addy['host']}\r\n\r\n"); 
while($line=fgets($sh)) 
if(preg_match('/^Content-Length: (d+)/',$line,$m)) 
$size=$m[1]; 
echo isset($size)?"size of $url file is $size": 'no
such file: '.$url; 

Thanks,
Mag


> in_array() can check your $string against a array
> and return if a bad word
> is in string
> 
> Is this what you are after?
> 
> Chris Kay (CK)
> [EMAIL PROTECTED]
> 
> 
> -Original Message-
> From: Mag [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, 17 October 2004 12:41 AM
> To: php php
> Subject: [PHP] dirty words
> 
> Hi,
> I am useing file_get_contents on a remote page then
> using stristr() to make
> sure there are no "bad words"
> and its a family site.
> Right now I am checking for just 3 bad words which
> means 3 stristr()
> function calls, but if the bad words increase then
> that would mean more
> calls
> 
> I have seen some forum software before that used to
> take an array of bad
> words and check it against the post, anybody have an
> idea what that function
> would be like coz I am pretty sure I am going about
> this the wrong way...php
> has a simple solution to most of these problems...
> 
> Thanks,
> Mag
> 
> =
> --
> - The faulty interface lies between the chair and
> the keyboard.
> - Creativity is great, but plagiarism is faster!
> - Smile, everyone loves a moron. :-)
> 
> 
>   
> __
> Do you Yahoo!?
> Yahoo! Mail Address AutoComplete - You start. We
> finish.
> http://promotions.yahoo.com/new_mail 
> 
> --
> 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
> 
> 


=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



[PHP] dirty words

2004-10-16 Thread Mag
Hi,
I am useing file_get_contents on a remote page then
using stristr() to make sure there are no "bad words"
and its a family site.
Right now I am checking for just 3 bad words which
means 3 stristr() function calls, but if the bad words
increase then that would mean more calls

I have seen some forum software before that used to
take an array of bad words and check it against the
post, anybody have an idea what that function would be
like coz I am pretty sure I am going about this the
wrong way...php has a simple solution to most of these
problems...

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

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



Re: [PHP] Advanced maths help (part 2)

2004-10-15 Thread Mag
Hey Chris,
Thanks for replying.

Dont worry about it, I got so p*ssed that I just
striped the whole thing down to pretty much just the 
imagecopyresized() function, fiddled around with it to
see how it works and got the sh*t working. The good
thing now is I understand a bit better how the
function works and thanks to you and Trever I learnt
how the first problem works too, not a bad day at all
if I say so myself.

Working on other parts of the scripts now so have not
uploaded the working parts but if you would like to
see it working, just reply.

Cheers,
Mag

> I think you've a couple of problems with your second
> problem (problem 
> problem problem).
> 
> First of all, you're setting $dst_h to 0, which
> gives you a height of 0 
> - IIRC that's not what you wanted :)
> 
> You should be setting that $dst_h = 120 as you
> always want it to be 120px
> 
> I reckon that your code should look more like this:
> 
>  
> // assuming that we're creating two thumbnails, one
> has h=120, w=?, the 
> second has h=120, w=90
> // we'll also assume that the original has h=600,
> w=800
> 
> $src_img =  imagecreatefromjpeg("tgp1.jpg");
> 
> $src_h = imagesy($src_img); // 600
> $src_w = imagesx($src_img); // 800
> 
> $dst_h = 120;
> $dst_w =  $src_w * ($dst_h / $src_h);
> 
> $dst_img = imagecreatetruecolor($dst_w,$dst_h);
> 
> imagecopyresampled ($dst_img, $srcImage, 0, 0, 0, 0,
> $dst_w, $dst_h, $src_w, $src_h);
> 
> // so far so good, now, lets save the file
> imagejpeg($dst_img, 'test.jpg');
> 
> unset($dst_img);
> 
> // time for problem 2
> 
> // first we need a h=120, w=90 image
> 
> // image size for h=120, w=90 thumbnail
> $dst_h = 120;
> $dst_w = 90;
> 
> $dst_img = imagecreatetruecolor($dst_w, $dst_h);
> 
> // we will be copying to the top left corner of the
> new thumbnail
> $dst_x = 0;
> $dst_y = 0;
> 
> // now, let's find the top-left offset from the
> larger original image
> $src_x = ($src_h - $dst_h) / 2;
> $src_y = ($src_w - $dst_w) / 2;
> 
> // no need for imagecopyresampled as we'll be doing
> 1-1 pixel copying here
> 
> imagecopy ($dst_img, $src_img, $dst_x, $dst_y,
> $src_x, $src_y, $src_w, 
> $src_h);
> 
> // so far so good, now, lets save the file
> imagejpeg($dst_img, 'test2.jpg');
> 
> unset($dst_img);
> 
> ?>
> 
> 
> 
> 
> Hope this helps (although I haven't tested it)
> 
> Cheers
> 
> Chris
> 
> 
> 
> Mag wrote:
> 
> >Hi again guys, :-)
> >Thanks to the educated (and excellient) help of
> Chris
> >and trevor I am now getting proportionate thumbs
> >(which was "problem 1", remember? )
> >
> >Heres the code that i am using, if it may help
> anyone
> >else:
> >
> >** code start **
> >$src_img =  imagecreatefromjpeg("tgp1.jpg");
> >$img_dim = getimagesize("tgp1.jpg");
> >
> >$h_1 = $img_dim[1];
> >$w_1 = $img_dim[0];
> >
> >$dst_h = 120;
> >$dst_w = $w_1 * ($dst_h / $h_1);
> >
> >$dst_img = imagecreatetruecolor($dst_w,$dst_h);
> >$src_w = imagesx($src_img);
> >$src_h = imagesy($src_img);
>
>imagecopyresampled($dst_img,$src_img,0,0,0,0,$dst_w,$dst_h,$src_w,$src_h);
> >// problem 1 solved till here
> >** code end **
> >
> >
> >Then i am trying to work with problem 2, instead of
> >starting all over again from the beginning of
> getting
> >the images dimensions etc I am continueing and
> trying
> >to get it straight from the above like so:
> >
> >** code start problem 2**
> >$dst_w = ($dst_w - 90) / 2;
> >$dst_h = 0;  // because the image is only 120px
> high
> >
>
>imagecopyresampled($dst_img,$src_img,0,0,0,0,$dst_w,$dst_h,$src_w,$src_h);
> >
> >ImageJPEG($dst_img,'test.jpg');
> >echo "The bitch works!";
> >** code end problem 2 **
> >
> >When i check the output I am only getting the first
> >parts output... is what i am doing even possible?
> or
> >do I have to do everything from the start for
> problem
> >2 (eg: read from disk, calculate dimensions etc)
> >
> >Thanks,
> >Mag
> >
> >
> >
> >=
> >--
> >- The faulty interface lies between the chair and
> the keyboard.
> >- Creativity is great, but plagiarism is faster!
> >- Smile, everyone loves a moron. :-)
> >
> >
> > 
> >__
> >Do you Yahoo!?
> >Yahoo! Mail Address AutoComplete - You start. We
> finish.
> >http://promotions.yahoo.com/new_mail 
> >
> >
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



RE: [PHP] Advanced maths help (part 2)

2004-10-15 Thread Mag
Hi Trevor,

Sorry, am just a bit confused myself mostly because I
am using a third party script to clip the 120x90 part
out of the image...understanding the way the script is
written is a little frustrating as it was written for
something else and I am trying to adopt it.

if you want to try your hand at it tell me and i'll
zip up the script and send it to you.

Thanks,
Mag

--- "Gryffyn, Trevor" <[EMAIL PROTECTED]>
wrote:

> My interpretation of Problem 2 before was that you
> wanted to get a 120w
> x 90h (?) section of the original image, not of the
> thumbnail you
> generated by resizing the original.
> 
> You seem to be working off of the adjusted height.
> 
> Sorry, I didn't noodle all the way through this one,
> what I am missing?
> 
> -TG
> 
> > -Original Message-
> > From: Mag [mailto:[EMAIL PROTECTED] 
> > Sent: Friday, October 15, 2004 12:45 PM
> > To: php php
> > Subject: [PHP] Advanced maths help (part 2)
> > 
> > 
> > Hi again guys, :-)
> > Thanks to the educated (and excellient) help of
> Chris
> > and trevor I am now getting proportionate thumbs
> > (which was "problem 1", remember? )
> > 
> > Heres the code that i am using, if it may help
> anyone
> > else:
> > 
> > ** code start **
> > $src_img =  imagecreatefromjpeg("tgp1.jpg");
> > $img_dim = getimagesize("tgp1.jpg");
> > 
> > $h_1 = $img_dim[1];
> > $w_1 = $img_dim[0];
> > 
> > $dst_h = 120;
> > $dst_w = $w_1 * ($dst_h / $h_1);
> > 
> > $dst_img = imagecreatetruecolor($dst_w,$dst_h);
> > $src_w = imagesx($src_img);
> > $src_h = imagesy($src_img);
> >
>
imagecopyresampled($dst_img,$src_img,0,0,0,0,$dst_w,$dst_h,$sr
> > c_w,$src_h);
> > // problem 1 solved till here
> > ** code end **
> > 
> > 
> > Then i am trying to work with problem 2, instead
> of
> > starting all over again from the beginning of
> getting
> > the images dimensions etc I am continueing and
> trying
> > to get it straight from the above like so:
> > 
> > ** code start problem 2**
> > $dst_w = ($dst_w - 90) / 2;
> > $dst_h = 0;  // because the image is only 120px
> high
> > 
> >
>
imagecopyresampled($dst_img,$src_img,0,0,0,0,$dst_w,$dst_h,$sr
> > c_w,$src_h);
> > 
> > ImageJPEG($dst_img,'test.jpg');
> > echo "The bitch works!";
> > ** code end problem 2 **
> > 
> > When i check the output I am only getting the
> first
> > parts output... is what i am doing even possible?
> or
> > do I have to do everything from the start for
> problem
> > 2 (eg: read from disk, calculate dimensions etc)
> > 
> > Thanks,
> > Mag
> > 
> > 
> > 
> > =
> > --
> > - The faulty interface lies between the chair and
> the keyboard.
> > - Creativity is great, but plagiarism is faster!
> > - Smile, everyone loves a moron. :-)
> > 
> > 
> > 
> > __
> > Do you Yahoo!?
> > Yahoo! Mail Address AutoComplete - You start. We
> finish.
> > http://promotions.yahoo.com/new_mail 
> > 
> > -- 
> > 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
> 
> 


=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



[PHP] Advanced maths help (part 2)

2004-10-15 Thread Mag
Hi again guys, :-)
Thanks to the educated (and excellient) help of Chris
and trevor I am now getting proportionate thumbs
(which was "problem 1", remember? )

Heres the code that i am using, if it may help anyone
else:

** code start **
$src_img =  imagecreatefromjpeg("tgp1.jpg");
$img_dim = getimagesize("tgp1.jpg");

$h_1 = $img_dim[1];
$w_1 = $img_dim[0];

$dst_h = 120;
$dst_w = $w_1 * ($dst_h / $h_1);

$dst_img = imagecreatetruecolor($dst_w,$dst_h);
$src_w = imagesx($src_img);
$src_h = imagesy($src_img);
imagecopyresampled($dst_img,$src_img,0,0,0,0,$dst_w,$dst_h,$src_w,$src_h);
// problem 1 solved till here
** code end **


Then i am trying to work with problem 2, instead of
starting all over again from the beginning of getting
the images dimensions etc I am continueing and trying
to get it straight from the above like so:

** code start problem 2**
$dst_w = ($dst_w - 90) / 2;
$dst_h = 0;  // because the image is only 120px high

imagecopyresampled($dst_img,$src_img,0,0,0,0,$dst_w,$dst_h,$src_w,$src_h);

ImageJPEG($dst_img,'test.jpg');
echo "The bitch works!";
** code end problem 2 **

When i check the output I am only getting the first
parts output... is what i am doing even possible? or
do I have to do everything from the start for problem
2 (eg: read from disk, calculate dimensions etc)

Thanks,
Mag



=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

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



RE: [PHP] Advanced maths help (for GD image functionality)

2004-10-15 Thread Mag
DAMN!
2 minutes after posting to the list I get some pretty
good mails from two people with answers on how to
solve this,while i had a restless night trying to
figure this out in my head! I LOVE THIS LIST!

Thanks guys, will tell you how this goes and if i have
any problems.

Cheers,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



[PHP] Advanced maths help (for GD image functionality)

2004-10-15 Thread Mag
Hi!
I need someone who is very good with maths to help me
with this, unfortunatly I suck at maths so that
someone can not be me. Ironically before I started my
first computer course years back I asked the
instructer if "learning computers needed a lot of
maths...she said 'no, just basics'"..that aint really
true is it? :-D

Anyway, I have 2 scripts, one that resizes an image
according to the height and width i specify and
another that cuts a w=90 h=120 thumb from *within* an
image according to the x and y parameters I send it.
This functionality is distributed in 2 scripts.

Heres my maths problems in 2 parts:

Problem 1)
I need to scale down an image (eg: example.jpg) to
height of 120 pixels while maintaining the images
proportions.

eg:
if i have an image of (height and width) 800x600 what
would the dimensions be if the height was 120?

usually for resizeing I just do something like this:

if($image_height > 400)
{$image_height=$image_height / 2;
 $image_width=$image_width / 2;}

which gets me a pretty decent imagebut now I need
an image no more than 120px in height with a
proportionate width.


Problem 2) 
After getting the above image now I need the x and y
parameters to cut a h120 x w90 thumb *from the center
of the image*

eg: if from problem 1 the result is an image of 120 x
160 then x=35 and y=125 (I think, i told you i suck at
maths.. :-D )


Anyone up to the challenge? or just want to help a
poor person with some maths?

Thanks in advance,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)




__
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
http://promotions.yahoo.com/new_mail

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



Re: [PHP] include()ing into a variable

2004-10-14 Thread Mag
Hi Curt,
Thanks for replying.


> class SaveToFile {
>   function open($file)  {
> //open file...
>   }
>   function write($buf) {
> //write to file...
>   }
>   function close() {
> //close file
>   }
> }
> $obSaveFile = new SaveToFile();
> $obSaveFile->open('/path/to/file.html');
> ob_start(array(&$obSaveFile, 'save'), 1024);
> 
> /* do your stuff  here */
> 
> ob_end_flush();
> $obSaveFile->close();


Problem is, I have not really learnt classes as yet, I
know how to use them but I really have no idea as to
how to make them. Looking at your above code I see you
are calling open() and close() of the class but not
write() is that a mistake or just my lack of
understanding of classes? (No idea what this:
&$obSaveFile 
means either)
Also I have heard that outbuffering can be quite
complicated, would you mind filling in your example a
bit more and I can make add to it and work from there?

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



[PHP] include()ing into a variable

2004-10-14 Thread Mag
Hi,
I have never done this before (but in my first test it
seems to work), I am include()ing a file into a
variable like this:

$a=include("th-file.php");

Will this give me any extra problems later on? or is
this resource intensive?

The reason I am doing this is because I want to put
whole pages into a variable then write the contents of
the variable to a static html file...

eg:
$a=include("header.php");
$a .= "";
$a .= include "footer.php";
->fopen and write $a to newfile: something.html


Thats the idea anyway this is the first time I am
experimenting with this approach, so I want to know is
this "legal" in php and if I should be expecting any
problems. The final pages to output can be around 100k
I guess and I will be outputting every 3-60 mins.

Thanks,
Mag


=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



Re: [PHP] Working out the image path...partly solved, please have a look at my code

2004-10-13 Thread Mag
Hey Matt,


> > /../imgs/blah.jpg should return
> > http://www.textx.com/t1/t2/imgs/blah.jpg
> > 
> > but its returning:
> > http://www.textx.com/t1/t2/t3/imgs/blah.jpg
> > 
> > and this: /../../imgs/blah.jpg
> > should return:
> http://www.textx.com/t1/imgs/blah.jpg
> > 
> > but its returning:
> > http://www.textx.com/t1/t2/imgs/blah.jpg
> > 
> > in both cases one extra level directory :-(
> > 
> > Any ideas?



> ok, I gave it a try and honestly this is probably
> over my head :) but
> here is something to try


Nope, no go...but dont worry about it, most of the PHP
gurus on the list have not replied so I guess it was
beyond them tooso where do we mere mortals have a
chance :-D

Will leave it as as for now and come back to it at a
later date i guess.

Thanks for trying.
Mag


 
>  
> $url='http://www.textx.com/t1/t2/t3/blah.html';
> 
> function ret_url($rel_path, $base = '')
> {
>   $base_path = substr($base, 0, strpos($base,
> '/',7));
> 
>   if(substr($rel_path,0,1)=='/' &&
> strpos($rel_path,'/../') === false)
>   {  
>   return $base_path.$rel_path; 
>   }
> 
> elseif(strpos($rel_path,'://') > 0)
> {  return $rel_path; }
> 
> else {  
>   return collapse(dirname($base),$rel_path); 
>   }
> 
> return $rel_path;
> }
> 
> /* this function removes the /../ parts */
> function collapse($path,$rel_path)
> {
>   
>   $parsed = parse_url($path);
>   preg_match_all('/\/\.\./',$rel_path, $matches); 
>   if(($count = count($matches[0])) > 0) {
>   $parts = preg_split('/\//', $parsed['path'], -1,
> PREG_SPLIT_NO_EMPTY);
>   for ($i = 1;$i <= $count; $i++) {
>   array_pop($parts);
>   }
>   $path = str_replace($parsed['path'],
> '/'.implode($parts,'/'), $path);
>   }
> 
>   $rel_path = (preg_match('/^\//',$rel_path)) ?
> $rel_path :'/'.$rel_path;
>   $path = preg_replace('/\/\.\./', '',
> $path.$rel_path);
>   
>   return $path;
> }
> 
> 
> $uris = array();
> $uris[] = '/blah.jpg';
> $uris[] ='/imgs/blah.jpg';
> $uris[] ='imgs/blah.jpg';
> $uris[] ='../imgs/blah.jpg';
> $uris[] ='/../imgs/blah.jpg';  // ## not working ##
> $uris[] ='/../../imgs/test.jpg'; // ## not working
> ##
> $uris[] ='http://some-site-blah.com/imgs/blah.jpg';
> 
> echo '';
> foreach($uris as $uri)
> {
> echo ''.htmlspecialchars($uri).'
td>'.htmlspecialchars(ret_url($uri,$url)).'';
> }
> echo '';
> ?>
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail 

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



Re: [PHP] Quick imageSize question

2004-10-13 Thread Mag
Hey,

Dont worry about talking crap, I took that risk when I
started this thread :-) I was hopeing that maybe the
image would have the info incoded in it which php
could read before going through the uploador
something like that.

I too am not really sure if its possible, but am
hopeing the "big boys" on the list who have worked on
stuff like this for a long time will confirm it.

Thanks,
Mag

> Hello,
> that's usually not possible because your webserver
> can't access the image
> on your computer; a possible solution might be to
> determine the image size
> via javascript and submit it with the form, so you
> can accept or deny the
> image upload in your php script - problem: with
> javascript running on client
> side, this is not foolproof. Anyways i don't know
> exactly how to solve it with
> javascript even, so please correct me, if i'm
> talking crap here.
> 
> Best regards,
> 
> -sd
> 
> On Wed, Oct 13, 2004 at 07:37:29AM -0700, Mag wrote:
> > The problem with the above is I can only get the
> > dimensions AFTER the file has been uploaded and is
> on
> > disk,which is quite a pain in the ... coz I want
> to
> > accept only images that are smaller than x pixels
> > width and then i have to tell the client that
> their
> > upload failed coz their image is too big...is
> there
> > any way to get the dimensions before the upload is
> > done?
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.
http://mobile.yahoo.com/maildemo 

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



Re: [PHP] Remote grabbed images are blank

2004-10-12 Thread Mag
Hi Rick,
Thanks for replying.


> Mag wrote:
> > Hi,
> > I got a pretty good code snippet from Zend to grap
> a
> > remote image and save it to disk, the problem is,
> when
> > it saves to my disk i am unable to open the
> > images...they are blank and the file matches the
> > remote images filesize...
> 
> [snip]
> 
> >   ob_start(); 
> >   readfile($url); 
> >   $img = ob_get_contents(); 
> >   ob_end_clean(); 
> >   $size = strlen($img); 
> > 
> >   [EMAIL PROTECTED]($filename, "a"); 
> >   fwrite($fp2,$img); 
> >   fclose($fp2); 


> I'm not sure what the problem is, but simplifying
> the code will help you 
> track it down.  Rather than messing with output
> buffering and 
> fopen/fwrite/fclose, I'd suggest using the copy()
> function.
> 
> This line replaces the 8 lines above:
> 
> copy( $url, $filename );
> 
> --Rick


One of the problems is that my host has a 
anti-leaching .htaccess file setup (which is good
really) so people cant "hot-link"...problem is with
copy() I am getting this error:

HTTP/1.0 403 Forbidden

Is there any way to forge the headers or something to
get through?

Thanks,
Mag 


=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

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



[PHP] Remote grabbed images are blank

2004-10-12 Thread Mag
Hi,
I got a pretty good code snippet from Zend to grap a
remote image and save it to disk, the problem is, when
it saves to my disk i am unable to open the
images...they are blank and the file matches the
remote images filesize...


Heres the code I got from Zend:
 Start code ##
';else:echo "No image
there.";endif;   


?> 

### End image code ###

Any idea whats wrong?

Thanks,
Mag


=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

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



Re: [PHP] Working out the image path...partly solved, please have a look at my code

2004-10-11 Thread Mag
Hey Matt,
Thanks for replying.


> >  > 
> > $url='http://www.textx.com/t1/t2/t3/blah.html';
> > 
> > function ret_url($rel_path, $base = '')
> > {
> >  $base_path = substr($base, 0, strpos($base,
> '/',7));
> > 
> > if(substr($rel_path,0,1)=='/' &&
> > !strpos($rel_path,'/../'))
> >  {  return $base_path.$rel_path; }
> > 
> >  elseif(strpos($rel_path,'://') > 0)
> >  {  return $rel_path; }
> > 
> >  else {  return
> > collapse(dirname($base).'/'.$rel_path); }
> > 
> >  return $rel_path;
> > }
> > 
> > /* this function removes the /../ parts */
> > function collapse($path)
> > {
> > 
> >  while(strpos($path,'/../') !== false)
> >  {$p2 = ereg_replace('/([^/]*)/\.\./','/',$path);
> >   if($p2==$path)
> >break;
> >   $path = $p2;
> >  }
> > 
> >  return $path;
> > }
> > 
> > $uris = array();
> > $uris[] = '/blah.jpg';
> > $uris[] ='/imgs/blah.jpg';
> > $uris[] ='imgs/blah.jpg';
> > $uris[] ='../imgs/blah.jpg';
> > $uris[] ='/../imgs/blah.jpg';  // ## not working
> ##
> > $uris[] ='/../../imgs/blah.jpg'; // ## not working
> ##
> > $uris[]
> ='http://some-site-blah.com/imgs/blah.jpg';
> > 
> > echo '';
> > foreach($uris as $uri)
> > {
> > echo ''.htmlspecialchars($uri).' >
>
td>'.htmlspecialchars(ret_url($uri,$url)).'';
> > }
> > echo '';
> > ?>



> try this:
> 
> function ret_url($rel_path, $base = '')
> {
> $base_path = substr($base, 0, strpos($base, '/',7));
> 
> if(substr($rel_path,0,1)=='/' &&
> strpos($rel_path,'/../') === false)
> {  return $base_path.$rel_path; }
> 
> elseif(strpos($rel_path,'://') > 0)
> {  return $rel_path; }
> 
> else {  return
> collapse(dirname($base).'/'.$rel_path); }
> 
> return $rel_path;
> }

Close, but its not giving the correct paths.
eg:
/../imgs/blah.jpg should return
http://www.textx.com/t1/t2/imgs/blah.jpg

but its returning:
http://www.textx.com/t1/t2/t3/imgs/blah.jpg

and this: /../../imgs/blah.jpg
should return: http://www.textx.com/t1/imgs/blah.jpg

but its returning:
http://www.textx.com/t1/t2/imgs/blah.jpg


in both cases one extra level directory :-(

Any ideas?

Thanks,
Mag


=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



[PHP] Working out the image path...partly solved, please have a look at my code

2004-10-11 Thread Mag
Hi,
I wrote this to the list a little while back and have
been working on it...i have come 95% of the way but
for some reason cant work the other 5% out...can
somebody help please?

Basically I need to figure out the URL or a image from
a relitive path...something like this:


/blah.jpg // should return http://x.com/blah.jpg

/imgs/blah.jpg // return http://x.com/imgs/ blah.jpg

imgs/blah.jpg //return
http://x.com/t1/t2/t3/imgs/blah.jpg

../imgs/blah.jpg // etc

/../imgs/blah.jpg //etc

http://some-site-blah.com/imgs/blah.jpg // return the
same url



running the below code will show you how far i have
come and how only 2 examples are not working for some
damn reason.


* code start **

http://www.textx.com/t1/t2/t3/blah.html';

function ret_url($rel_path, $base = '')
{
 $base_path = substr($base, 0, strpos($base, '/',7));

if(substr($rel_path,0,1)=='/' &&
!strpos($rel_path,'/../'))
 {  return $base_path.$rel_path; }

 elseif(strpos($rel_path,'://') > 0)
 {  return $rel_path; }

 else {  return
collapse(dirname($base).'/'.$rel_path); }

 return $rel_path;
}

/* this function removes the /../ parts */
function collapse($path)
{
 
 while(strpos($path,'/../') !== false)
 {$p2 = ereg_replace('/([^/]*)/\.\./','/',$path);
  if($p2==$path)
   break;
  $path = $p2;
 }
 
 return $path;
}

$uris = array();
$uris[] = '/blah.jpg';
$uris[] ='/imgs/blah.jpg';
$uris[] ='imgs/blah.jpg';
$uris[] ='../imgs/blah.jpg';
$uris[] ='/../imgs/blah.jpg';  // ## not working ##
$uris[] ='/../../imgs/blah.jpg'; // ## not working ##
$uris[] ='http://some-site-blah.com/imgs/blah.jpg';

echo '';
foreach($uris as $uri)
{
echo ''.htmlspecialchars($uri).''.htmlspecialchars(ret_url($uri,$url)).'';
}
echo '';
?>

*** code end ***

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Express yourself with Y! Messenger! Free. Download now. 
http://messenger.yahoo.com

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



[PHP] Working out the image path...

2004-10-11 Thread Mag
Hey!
Am having a little problem working out the logic in
this, basically I pass a graphics path to a function
and it should give/retrun me the URL path.

http://x.com/t1/t2/t3/blah.html';

function ret_url($rel_path)
{ }

?>

so I pass a relitive url like this
$a=ret_url('/blah.jpg';)

and (using the above sample url) it should return me:
http:// www.x.com/blah.jpg, which seems easy enough
except that there are some other combinations...

So far these are the combinations I could think of
that will be used...correct me if I am wrong by adding
or subtracting:

/blah.jpg // should return http://x.com/blah.jpg

/imgs/blah.jpg // return http://x.com/imgs/ blah.jpg

imgs/blah.jpg //return
http://x.com/t1/t2/t3/imgs/blah.jpg

../imgs/blah.jpg // etc

/../imgs/blah.jpg //etc

http://some-site-blah.com/imgs/blah.jpg // return the
same url

To try and do the above I was fooling around with
parse_url() and explode() but cant work out the logic,
if it helps, heres what i did so far in my
"experiments"


$parsed_url = parse_url($url);
$thissite = $parsed_url['host'];
$thispath = $parsed_url['path'];

echo "$thissite  $thispath";

$pieces= explode("/",$thispath);
print_r($pieces);




ANY help appreciated.

Thanks!
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

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



Re: [PHP] Quick file_get_contents() questions...your opinion needed

2004-10-11 Thread Mag
I did look at the fopen option...but it just seemed a
little longer and more complicated to do that plus
according to this benchmark
(http://force-elite.com/~chip/projects/php/benchmarks/file-vs-fgets/)
using file_get_contents is upto 6 times faster (?) in
some cases..

I think I'll stick with this, and specify that anybody
running this code should have php 4.3.x or higher 

Most webhosts too I think will have a 4.3 or above
version...if they are a good host anyway, ornot?
I mean I have been running php on my desktop for
months and have 4.3.1..

Feel free to correct me :-)

Cheers,
Mag


--- Greg Donald <[EMAIL PROTECTED]> wrote:

> On Mon, 11 Oct 2004 08:40:09 -0700 (PDT), Mag
> <[EMAIL PROTECTED]> wrote:
> > Interesting, so what is more backwards compatable?
> or
> > to put it in another way, what did you change on
> your
> > servers so that your app worked without
> > file_get_contents?
> 
> I used the usual fopen(), fgets(), fclose()
> combination which has been
> available since PHP3.
> 
> 
> -- 
> Greg Donald
> Zend Certified Engineer
> http://gdconsultants.com/
> http://destiney.com/
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



Re: [PHP] Quick file_get_contents() questions...your opinion needed

2004-10-11 Thread Mag
Oops, sorry to hear that.

Some scumbag always spoils it for everyone :-(

Looks like you can enable it if you really need it
though..

Mag

--- lists <[EMAIL PROTECTED]> wrote:

> I"m kinda bummed, I tried to us it last night and
> discovered I could 
> not use it because Pair Networks disables the
> ability, can't include 
> either.
> 
> from their newsletter:
> 
> "Lately, the most common method of exploit has been
> to pass a variable 
> to a PHP script which does not sufficiently check
> the variable's value. 
> The variable is then used in a "require" or
> "include" statement, and 
> the variable contents cause malicious code to be
> fetched from a remote 
> location instead of from a local file, as the author
> intended. This 
> type of exploit is easily blocked by setting the
> allow_fopen_url 
> configuration value to "Off." We have recently
> adopted this change 
> globally; if you have a script that requires the
> ability to open remote 
> URLs, you can re-enable this functionality. Before
> doing so, please 
> make sure you are checking all user-supplied data
> carefully."
> 
> 
> 
> 
> On Oct 11, 2004, at 8:17 AM, Greg Donald wrote:
> 
> > On Mon, 11 Oct 2004 07:24:03 -0700 (PDT), Mag
> <[EMAIL PROTECTED]> wrote:
> >> $url=file_get_contents("http://www.yahoo.com/";);
> >>
> >> The thing is, it takes quite some time (2-5 secs)
> >> before the contents are in my program (I am using
> my
> >> local webserver on my desktop for testing...not a
> >> webserver)
> >>
> >> My questions are for you more experienced guys...
> >> is there anyway to 'quicken' the process or is
> this
> >> normal?
> >> do you recommend anything other than
> >> file_get_contents() ?
> >> and lastly, is this a resource intensive hog?
> >
> > The 2-5 seconds is most likely a DNS lookup.  You
> can speed it up by
> > using a local caching DNS server or the IP
> address, or possibly a DNS
> > server under less load.
> >
> > file_get_contents() is fairly new and and
> therefore not very backwards
> > compatible with older PHP installs as a result. 
> It's handy and all,
> > but I found our production servers were running a
> PHP too old to use
> > it one day last week when I tried.
> >
> >
> > -- 
> > Greg Donald
> > Zend Certified Engineer
> > http://gdconsultants.com/
> > http://destiney.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
> 
> 


=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



Re: [PHP] Quick file_get_contents() questions...your opinion needed

2004-10-11 Thread Mag

Hey,

> On Mon, 11 Oct 2004 07:24:03 -0700 (PDT), Mag
> <[EMAIL PROTECTED]> wrote:
> > $url=file_get_contents("http://www.yahoo.com/";);
> > 
> > The thing is, it takes quite some time (2-5 secs)
> > before the contents are in my program (I am using
> my
> > local webserver on my desktop for testing...not a
> > webserver)
> > 
> > My questions are for you more experienced guys...
> > is there anyway to 'quicken' the process or is
> this
> > normal?
> > do you recommend anything other than
> > file_get_contents() ?
> > and lastly, is this a resource intensive hog?


 
> The 2-5 seconds is most likely a DNS lookup.  You
> can speed it up by
> using a local caching DNS server or the IP address,
> or possibly a DNS
> server under less load.


Thats kind of what I thought, but wanted to confirm.

 
> file_get_contents() is fairly new and and therefore
> not very backwards
> compatible with older PHP installs as a result. 
> It's handy and all,
> but I found our production servers were running a
> PHP too old to use
> it one day last week when I tried.

Interesting, so what is more backwards compatable? or
to put it in another way, what did you change on your
servers so that your app worked without
file_get_contents?

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

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



[PHP] Quick file_get_contents() questions...your opinion needed

2004-10-11 Thread Mag
Hi,
I am using a statement like this

$url=file_get_contents("http://www.yahoo.com/";);

The thing is, it takes quite some time (2-5 secs)
before the contents are in my program (I am using my
local webserver on my desktop for testing...not a
webserver)

My questions are for you more experienced guys...
is there anyway to 'quicken' the process or is this
normal?
do you recommend anything other than
file_get_contents() ? 
and lastly, is this a resource intensive hog?

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



Re: [PHP] PHP gurus...how are they doing this?

2004-10-11 Thread Mag
Hi John,
Thank you for replying.

>> once a person submits a site, they are doing 2
things
>> that totally puzzle me, 
>> 1.showing the number of "outgoing links"
 
> Middle man. You have them click on a link containing
> an ID, increment 
> the counter for that ID, then forward them to the
> requested link.

I'm not sure I understand what you mean here.

This is how far I have come trying to imitate the
above: (Its not working of course :-)   )

http://www.jumac.com/');
$html = implode('', file("$url")); //put the page
source in a string

//find the links and put them in an array
$links = array();
if (preg_match_all('/]*)[\"\']?[^>]*>.*?<\/a>/i', $html, $matches))
{
foreach($mathes as $match){$links[] = $match;}
}

//check for offsite links
$parsed_url = parse_url($url); //parse the url
$thissite = $parsed_url['host'];
$ii=0;
foreach($links as $link){
  if (strstr($link, 'http://') AND !strstr($link,
"$thissite")){   //the link is not relative, and not
on this host
  $ii++;
  }
}
print "There were $ii offsite links";

?>





>> 2. counting the number of linked to pictures (eg:
>> href='blah.jpg') and movies (eg: href='blah,mpg')
and
>> also giving the size of each movie (this i figured
>> out) and the resulation!!
> 
> Can be as easy as a regex match for ".jpg" or
".mpg".

I thought so too, but then its not picking up the
normal image links
eg:


its only takeing the href image links
eg:


Another problem is I am not too good with REGEX (still
learning from php walkers)

I know this is solveable as its working on someone
elses program...but just not able to work out the
logic for myself.

Ideas?

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



[PHP] PHP gurus...how are they doing this?

2004-10-10 Thread Mag
Hi,
Am totally puzzled as to how they are doing this.
The site is at
http://www.teeniesxxx.com/madtgp/submit.php (please
note its an adult site so you might not want to go
there, also note I am in NO way connected with that
site...AT ALL)

once a person submits a site, they are doing 2 things
that totally puzzle me, 
1.showing the number of "outgoing links"
2. counting the number of linked to pictures (eg:
href='blah.jpg') and movies (eg: href='blah,mpg') and
also giving the size of each movie (this i figured
out) and the resulation!!

I would like to do the same thing for a cartoon site,
can anybody tell me where to begin or some sample
code?

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
Y! Messenger - Communicate in real time. Download now. 
http://messenger.yahoo.com

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



[PHP] finding links to jpg,mpg,avi

2004-10-08 Thread Mag
Hi,
I have seen this functionality in a PERL
program/script and would like to do the same
thing...but in php.

The way the script worked was, you give it a url:
http://somesite.com/pics-and-movies.html

pics-and-movies.html (the above example page) would
contain something like:



 pic 1
 pic 2
...
 mpg 1
 mpg 2



the scipt would find ONLY the links pointing to either
a .jpg or a .mpg and then display the size of each.

This is how far I have come:
1: via fopen download the entire page (done)

2: scan the page for all where href ends with .jpg or
mpg (cant work out logic for this)

3: send the names and url to a function to get the
sizes of each (did this with help from the php manual!
yeahhh!!)

biggest problem I have come accross is that the link
can be written like this
 or
 or
 or

etc

HOW are these guys doing it? anybody? (I think I need
regex here...but dont know regex :-((  )

Thanks,
Mag




=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

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



Re: [PHP] READ BEFORE REPLYING TO : Re: [PHP] UNSUBSCRIBE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

2004-10-01 Thread Mag

--- Curt Zirzow <[EMAIL PROTECTED]> wrote:

> * Thus wrote GH:
> > Dear EVERYONE WHO HAS POSTED OR WANTS TO POST IN
> THIS THREAD...
> > 
> > If Ms. Holland managed to get herself off of this
> list she is not
> > seeing any of this... however you seem to be
> FLAMING the rest of the
> > board with information that is NOT PHP related NOR
> is it relevant to
> > ANY DISCUSSION that pertains to a PHP related
> topic... i.e.
> > PEAR/DataBase/Servers etc...
> 
> Um.. i have no clue why you are complaining, You
> contributed to the
> posts. By replying to the thread and requesting not
> to post any
> more messages, you simply open the topic back up and
> now you have
> to read Yet Another Thread
 

True :-)

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



[PHP] stand alone php

2004-10-01 Thread Mag
Hi,
Is there any app that converts php to a stand alone
version?

like a windows .exe program.


Just curious.

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



RE: [PHP] UNSUBSCRIBE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

2004-10-01 Thread Mag
Prick.

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail 

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



Re: [PHP] simple date/now() question

2004-09-28 Thread Mag
Hi,
Thanks for replying.

> Just select out records that are NOW() - (24 * 60 *
> 60)

I just need this for 1 record, when the user logs in I
want to know if he has joined more than 1 day back or
not...


I am looking into php.net/date and php.net/time, but
if  have an example for me...:-)

Thanks,
Ryan

>or if you use
> datetime field instead of timestamp, which is prolly
> better off ofr many
> reasons, use DATE_SUB(NOW(), INTERVAL 1 DAY) or
> something similar.  you
> can get timestamps from datetime fields, if that is
> an issue for you...
> 
> Jason
> 
> Mag <[EMAIL PROTECTED]> wrote: 
> > 
> > Hi,
> > I have a field in the db called 
> > 
> > join_date_time(timestamp 14) 
> > 
> > which has data like:
> > 
> > 20040928170708
> > 20040916163619
> > etc
> > 
> > This keeps track of the customer join date, I need
> to
> > know if the client has joined in the last 24hrs or
> > more than 24hrs back...
> > 
> > Anybody have a function for this? or can help? am
> a
> > bit confused because reading on google I see that
> > there are 2 possible problems as MySql has its own
> > time and PHP its own time (most of the time!)
> > 
> > Thanks,
> > Mag
> > 
> > =
> > --
> > - The faulty interface lies between the chair and
> the keyboard.
> > - Creativity is great, but plagiarism is faster!
> > - Smile, everyone loves a moron. :-)
> > 
> > 
> > 
> > ___
> > Do you Yahoo!?
> > Declare Yourself - Register online to vote today!
> > http://vote.yahoo.com
> > 
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit:
> http://www.php.net/unsub.php
> > 
> > 
> 


=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



[PHP] simple date/now() question

2004-09-28 Thread Mag
Hi,
I have a field in the db called 

join_date_time(timestamp 14) 

which has data like:

20040928170708
20040916163619
etc

This keeps track of the customer join date, I need to
know if the client has joined in the last 24hrs or
more than 24hrs back...

Anybody have a function for this? or can help? am a
bit confused because reading on google I see that
there are 2 possible problems as MySql has its own
time and PHP its own time (most of the time!)

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



[PHP] 9 line function logic problem

2004-09-26 Thread Mag
Hi,
I am going crazy with this function please have a look
at it and tell me what i am doing wrong.

This is my setup:
I have a file called one.html.cache in the directory
/cache/

in one.html.cache I have a time()+ 3600 number (eg:
1096224755)

I need to know if the number in that file is still
bigger  than the present time() or not

the problem is, it is always returning zero...


heres the function:




echo "b".is_cache("one.html");


function is_cache($get_file)
{
$th_file = $include_path.$get_file . '.cache';
$fp = fopen($th_file, 'a+');
fseek($fp, 0);
$rd = fread($fp, filesize($th_file));
fclose($fp);

if (time() - $rd > 5)
return 0;
else
return 1;
}









What am i doing wrong? or is there a better way of
doing this?

Thanks,
Mag


=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.
http://mobile.yahoo.com/maildemo 

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



[PHP] simple templateing

2004-09-24 Thread Mag
Hi,
I am searching for a REAL simple templateing
class/package

I have googled for this and basically SMARTY and PAT
is too bulky, the people who will be using this script
will be pretty dumb and all I can trust them to do
would be something like this:


  


and the template should have a cacheing feature...

Looking via google i think I can make such a "template
engine" or another option would be to "get the
contents of a file and eval() them" as was written on
devshed, but if someone knows of something like this
thats already written

Thanks,
Mag



=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)




__
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 

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



Re: [PHP] Any idea how this is done?

2004-09-23 Thread Mag

--- Marek Kilimajer <[EMAIL PROTECTED]> wrote:

> Mag wrote:
> > Hi,
> > I was just looking at the demo of Comus Thumbs at 
> > 
> > http://nibbi.net/scripts/comus_thumbs.php
> > 
> > and I see he has an option there to
> > lighted/darken/sharpen/resize/thumb images
> dynamically
> > on the page (the image gets lightened etc without
> > reloading the page) any idea how? its listed
> that
> > he is using imagemagik.
> 
> Without reloading? It must be IE's filter extension
> to css.
> 
> > 
> > He also has an option to thumb an image, where you
> > click on the image and a rectangle appears, then
> when
> > you accept it, it cuts the image exactly according
> to
> > the rectangleI am not too familier with
> > imagemagik..is this easy to do?
> 
> DHTML should be able to do this.
> 
Hey,
You are right, sucks badly in Mozalla.

Also, can you tell me which IE filter to css you are
talking about? googleing tells me there are quite a
few of them :-(

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



[PHP] Any idea how this is done?

2004-09-23 Thread Mag
Hi,
I was just looking at the demo of Comus Thumbs at 

http://nibbi.net/scripts/comus_thumbs.php

and I see he has an option there to
lighted/darken/sharpen/resize/thumb images dynamically
on the page (the image gets lightened etc without
reloading the page) any idea how? its listed that
he is using imagemagik.

He also has an option to thumb an image, where you
click on the image and a rectangle appears, then when
you accept it, it cuts the image exactly according to
the rectangleI am not too familier with
imagemagik..is this easy to do?

Thanks,
Mag



=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail

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



Re: [PHP] Get remote servers ip [part 2]

2004-09-22 Thread Mag
> 
> It's all in the manual...
> 
> http://us4.php.net/manual/en/function.parse-url.php

Hey John,
Thanks, got it!
-Mag 


=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



RE: [PHP] Get remote servers ip [part 2]

2004-09-22 Thread Mag
Hey,
Thanks Jay, I needed a starting point and after
reading  at the url you posted I think I need
parse_url...

Thanks,
Mag

--- Jay Blanchard
<[EMAIL PROTECTED]> wrote:

> [snip]
> and gethostbyname is only displaying the ip if I
> pass
> it something like 
> www.google.com
> 
> Any idea how i can "strip" the first 2 examples to
> get
> the format i can pass to gethostbyname() ?
> [/snip]
> 
> 
> Start here ... http://www.php.net/url
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

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



[PHP] Get remote servers ip [part 2]

2004-09-22 Thread Mag
Hi again,
Am having a bit of a problem here, basically I have a
text box on my site where the visitor enters a url and
I display that url's ip address...which as Eugeni
kindly pointed out can be easily done with
gethostbyname()...but the problem is the url entered
at my site would be something like:

http://google.com/index.html
or
http://www.google.com/something/more/index.html

and gethostbyname is only displaying the ip if I pass
it something like 
www.google.com

Any idea how i can "strip" the first 2 examples to get
the format i can pass to gethostbyname() ?

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

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



Re: [PHP] Get remote servers ip

2004-09-22 Thread Mag
gethostbyname() of course!!!

Got it, I just forgot the function name.

Thanks,
Mag


--- Eugeni Doljenko <[EMAIL PROTECTED]> wrote:

> That's very simple. Use gethostbyname() function.
> Look "LXVIII. Network 
> Functions" for more details.
> 
> ----- Original Message - 
> From: "Mag" <[EMAIL PROTECTED]>
> To: "php php" <[EMAIL PROTECTED]>
> Sent: Wednesday, September 22, 2004 3:47 PM
> Subject: [PHP] Get remote servers ip
> 
> 
> > Hi,
> > I have a textbox where a visitor can enter a site
> > name/url (eg: http://google.com) and i need to
> display
> > that ip on the screen.
> >
> > how do i get the ipaddress of google.com using
> PHP?
> >
> > Thanks,
> > Mag
> >
> > =
> > --
> > - The faulty interface lies between the chair and
> the keyboard.
> > - Creativity is great, but plagiarism is faster!
> > - Smile, everyone loves a moron. :-)
> >
> >
> >
> >
> > __
> > Do you Yahoo!?
> > New and Improved Yahoo! Mail - 100MB free storage!
> > http://promotions.yahoo.com/new_mail
> >
> > -- 
> > 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
> 
> 


=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

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



[PHP] Get remote servers ip

2004-09-22 Thread Mag
Hi,
I have a textbox where a visitor can enter a site
name/url (eg: http://google.com) and i need to display
that ip on the screen.

how do i get the ipaddress of google.com using PHP? 

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)




__
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 

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



Re: [PHP] List Etiquette

2004-09-19 Thread Mag
"Top posting"
Whats that?

hehehe


--- -{ Rene Brehmer }- <[EMAIL PROTECTED]>
wrote:

> Most mail programs have their default settings set
> for top posting ... 
> while most news clients are set for bottom posting
>  which way is the 
> most preferable depends on what's most useful for
> your reply ... but those 
> that enjoy mixing top and bottom posting are the
> daft ones ... once a 
> thread goes into top posting, it's easier to simply
> continue that way ... 
> otherwise it gets utterly confusing 
> 
> But some kinds of replies, especially to long windy
> posts, are better made 
> at the bottom or inline ... or a mix  especially
> lists like this one 
> where it's alot of programming code, are usually
> easier to read when 
> bottom/inline posted  while regular commentary
> lists benefit more from 
> the top posting ...
> 
> There's advantages and disadvantages to both
> principles, and some people 
> prefer one over the other ... but it's really
> depending on the actual 
> content and nature of the discussion whether the one
> is preferable to each 
> other...
> 
> In either method, learn to trim, and everyone will
> be much happier nomatter 
> how you reply ... any properly configured signature
> will be removed 
> automatically by a properly written client program
> ... but the rest of the 
> crud you really need to peel out with manual labour
> ...
> 
> 
> Rene
> 
> At 00:33 19-09-2004, Robert Cummings wrote:
> >*RUH ROH* Better watch out, top posting is an
> extremely unpopular
> >discussion. Some members of the list will attempt
> to lambaste you and
> >tell you that because the rules are written, then
> they must be the final
> >word. Feel free to post however you please, while
> the dogs might bark
> >loudly, they are at a safe distance. You'll notice
> that many, many
> >people top post. Some people top post, some bottom
> post, and almost
> >everyone at some point interlace posts. Don't
> forget that at one time
> >people thought the world was flat because people
> said it was so, of
> >course we know better now, but change usually comes
> at the price of old
> >customs, and some old dogs hate new tricks.
> >
> >Happy top posting,
> >Rob.
> 
> -- 
> Rene Brehmer
> aka Metalbunny
> 
> If your life was a dream, would you wake up from a
> nightmare, dripping of 
> sweat, hoping it was over? Or would you wake up
> happy and pleased, ready to 
> take on the day with a smile?
> 
> http://metalbunny.net/
> References, tools, and other useful stuff...
> Check out the new Metalbunny forums at
> http://forums.metalbunny.net/
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



Re: [PHP] fopen problem, 5 line script [SOLVED!]

2004-09-15 Thread Mag
Got it,
'case anybody else needs this:

$page =
file_get_contents('http://www.google.se/index.html');
if(strstr($page,
'href="/imghp?hl=sv&tab=wi&ie=UTF-8"'))
{
  $resultt = 1;
}
else
{
  $resultt = 2;
}

echo $resultt;

Cheers,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



Re: [PHP] fopen problem, 5 line script

2004-09-15 Thread Mag

--- Curt Zirzow <[EMAIL PROTECTED]> wrote:

> * Thus wrote Mag:
> > Hi,
> > Can someone tell me what I am doing wrong here
> please?
> > 
> >  > $fileptr =
> > fopen("http://www.google.com/index.html","r";);
> > 
> > $contents = fread($fileptr, filesize($fileptr));
> >...
> > 
> > This is the error I get:
> > Warning: filesize(): Stat failed for Resource id
> #1
> > (errno=2 - No such file or directory) in
> > /home/quickxxx/public_html/tpg/ check- remote.php
> on
> > line 4
> > 
> > Warning: fread(): Length parameter must be greater
> > than 0. in /
> > home/quickxxx/public_html/tpg/check-remote.php on
> line
> 
> filesize() relies on the fact that the file you
> opened has support
> for stat(). the http wrapper does not have such a
> thing.
> 
> see:
>   http://php.net/filesize
>   http://php.net/wrappers.http
> 
> 


Thanks for your replies guys but you have left me even
more confused...can someone correct my 5 line script
and tell me what was wrong THEN give me the php.net
manual urls? like this am just getting more
confused...

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)




__
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 

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



[PHP] fopen problem, 5 line script

2004-09-15 Thread Mag
Hi,
Can someone tell me what I am doing wrong here please?

http://www.google.com/index.html","r";);

$contents = fread($fileptr, filesize($fileptr));

if(strstr($contents,
"href=\"/froogle?hl=en&tab=wf\""))
{ $result = 1;}else{ $result = 2;}

echo $result;
?>

This is the error I get:
Warning: filesize(): Stat failed for Resource id #1
(errno=2 - No such file or directory) in
/home/quickxxx/public_html/tpg/ check- remote.php on
line 4

Warning: fread(): Length parameter must be greater
than 0. in /
home/quickxxx/public_html/tpg/check-remote.php on line
4
2



Any ideas?

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail

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



Re: [PHP] Reminder or answer to check if remote page is linking to you

2004-09-14 Thread Mag
> > I have been searching the archives for the past 2
> > hours without luck, I am looking for an older
> thread
> > which was discussed on how to connect to a remote
> page
> > and check if that page was linking back to
> blah.com, I
> > think it was done via fopen.
> >
> > If you can tell me either,
> > 1. the name of that thread or its url
> > 2. how to do the above check
> > I would really appreciate it.
> 
> $page =
> file_get_contents('http://example.org/page.html');
> 
> Now use the string functions to search $page for a
> "href" back to your site. 
> Not foolproof, but then nothing is.
> 
> ---John Holmes... 

Hello John,
Thanx for replying.

I figured the part that you sent me by myself, but I
dont know the regex/string functions used to "read"
the href...any ideas?

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



[PHP] Reminder or answer to check if remote page is linking to you

2004-09-14 Thread Mag
Hi,
I have been searching the archives for the past 2
hours without luck, I am looking for an older thread
which was discussed on how to connect to a remote page
and check if that page was linking back to blah.com, I
think it was done via fopen.

If you can tell me either, 
1. the name of that thread or its url
2. how to do the above check
I would really appreciate it.

Thanks in advance,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail

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



Re: [PHP] Perplexing problem, suggestions or answer needed

2004-09-11 Thread Mag

> > Hello John,
> > The reason is I am trying to "chain" some
> programs,
> > the idea is to take the first part (in the
> original
> > example "ninty", then redirect to the second
> script
> > passing that value...after the second script
> finishes
> > it redirects back to the first script which will
> pass
> > the second value (which would be "four") which
> would
> > be be passed to the second script etc
> > 
> > I think the main part which is confusing me is how
> I
> > can take out just certain "used" parts of the
> array in
> > the $_SESSION array...ideas?
> > 
> > Thanx,
> > Mag
> > 
> 
> I guess you're looking for array_pop(), it pops the
> last element off
> the end of the array. Look it up in the manual to
> convince yourself.
 
Thanks for the tip, will do.

Cheers,
-Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail 

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



Re: [PHP] Perplexing problem, suggestions or answer needed

2004-09-11 Thread Mag

--- John Holmes <[EMAIL PROTECTED]> wrote:

> Mag wrote:
> 
> > Hi,
> > I will be getting input from a textarea and then I
> am
> > using "explode" to break the text into an array
> when
> > it encounters a space.
> > 
> > eg:
> > one two three four ninty
> > would be broken into 5 parts of an array.
> > 
> > ** The array would then be put into a session ** 
> > now I need to display the last part (which would
> be
> > "ninty" using the above example) then take out the
> > last part from the array then echo the next last
> part
> > (which would be "four") then take out the last
> part
> > (using unset? ) etc etc so I have something like:
> > 
> > Displaying Array : 
> > ninty
> > (deleteing ninty)
> > four
> > (deleteing four)
> > three
> > (deleteing three)
> > etc
> > 
> > I have been reading the manual and have come this
> far,
> > then I think I have to use the array splice
> function..
> > Am totally confused, any help, links, tutorials,
> > pointers, tips or code would be appreciated.
> 
> Why not just use array_reverse() and then print them
> out in order using 
> foreach?
> 
> -- 
> 
> ---John Holmes...

Hello John,
The reason is I am trying to "chain" some programs,
the idea is to take the first part (in the original
example "ninty", then redirect to the second script
passing that value...after the second script finishes
it redirects back to the first script which will pass
the second value (which would be "four") which would
be be passed to the second script etc

I think the main part which is confusing me is how I
can take out just certain "used" parts of the array in
the $_SESSION array...ideas?

Thanx,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail

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



[PHP] Perplexing problem, suggestions or answer needed

2004-09-10 Thread Mag
Hi,
I will be getting input from a textarea and then I am
using "explode" to break the text into an array when
it encounters a space.

eg:
one two three four ninty
would be broken into 5 parts of an array.

** The array would then be put into a session ** 
now I need to display the last part (which would be
"ninty" using the above example) then take out the
last part from the array then echo the next last part
(which would be "four") then take out the last part
(using unset? ) etc etc so I have something like:

Displaying Array : 
ninty
(deleteing ninty)
four
(deleteing four)
three
(deleteing three)
etc

I have been reading the manual and have come this far,
then I think I have to use the array splice function..
Am totally confused, any help, links, tutorials,
pointers, tips or code would be appreciated.

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Shop for Back-to-School deals on Yahoo! Shopping.
http://shopping.yahoo.com/backtoschool

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



[PHP] unzipping

2004-09-07 Thread Mag
Hi,
Anybody know of a good class, tutorial or something
easy to let me unzip a file on my server?

E.g:
I have 3 uploaded zip files named a,b,c
I want to unzip them into 3 diff folders while
preserving their file structure.

Thanks in advance.
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

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



[PHP] Slightly 0T - Smarty problem

2004-09-03 Thread Mag
Hello,

I have been asked to add a "pagination" to one page as
the data gets updated to one extra row around every
10-35 seconds.

Thats no problem for me as I am used to the pagination
concept and have done it before...but never in smarty.
I usually did it using classes from phpclasses, I have
the classes ready but no ideo how to "intergrate" them
into the page/script/template.

Problem is, I am working on a project that another
developer left, this is my first hurdle, I am learning
the basics of Smarty via the crash course at
http://smarty.php.net/crashcourse.php but any
advise/examples would be appreciated.

Please tell me if you want me to send you the page
code/template or anything else.

Thanks in advance.
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail

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



[PHP] Please have a look at my function

2004-08-18 Thread Mag
Hello,
I dont know regex very well but I am using one below
that I modified from the web:

** Start code**

function RStripHeader($string) {
  return eregi_replace('', '', $string);
}

$the_file = "something.html";
$content = RStripHeader(file_get_contents($the_file));
$fhandle = fopen($the_file, "w");
fwrite($fhandle,$content);
fclose($fhandle);
echo "Done ".$the_file."";

** End code***

Basically what I am trying to do above is:
open a file
delete everything that starts with
 
and ends with 

eg: 
it will delete everything below including 
"" and ""

 all this will be deleted! 



Its working great for 1 file, but when I put it into a
for loop to handle multiple files....it takes ages for
10 files and sometimes just "hangs".

please help.

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Express yourself with Y! Messenger! Free. Download now. 
http://messenger.yahoo.com

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



[PHP] membership via folders

2004-08-18 Thread Mag
Hi,
I have searched for this kind of an app on hotscritps
and also at phpclsases, I have found a couple that
come close and am confused which one to download, this
is my requirment:

1.Visitor joins (and becomes a member), a folder is
created just for him (i have done this)

2.He is allowed to upload upto x.xx mb of files

3.He can download his files and should have a kind of
file manager to see what he has there

I can write the above myself, but the above is quite
"normal" and I am sure many people must have had a
requirement close to this so if possible I would like
to avoid writing this from scratch...maybe modifying
some existing apps?

Any recommendations? resources? links?

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

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



[PHP] PEAR

2004-08-16 Thread Mag
Hi,
some newbie questions about PEAR:

1. How do I know if its already installed? (via
phpinfo() ? )

2. Can I install it myself if its not already
installed or do I have to contact my host?

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail

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