Computer Webmaster Gaming Console Graphics Forum

Welcome to the Computer Webmaster Gaming Console Graphics Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

MK PitStop Main Earn $25 Earn Money Posting Extras Members Blogs Image Hosting User Pages
Go Back   Computer Webmaster Gaming Console Graphics Forum > Webmaster Forum > Website Coding > PHP
Register FAQ/Rules Become A V.I.P. Member Search Today's Posts Mark Forums Read

PHP PHP for some can be one of the hardest website programming codes, so do you need help on your PHP script, if it is php4, php5 or lower this is the place for you for any PHP help.

Google
Reply
 
LinkBack Thread Tools Display Modes
Old 07-01-2007, 3:19 PM   #1
Ian.H [dS]
 
Ian.H [dS]'s Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default Interfering with html using php

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Whilst lounging around on Sat, 05 Jul 2003 10:32:20 +0100, tiago
borges da silva <tiago.borges-da-silva@rca.ac.uk> amazingly managed
to produce the following with their Etch-A-Sketch:

> Hi I'm trying to develop a php web page that allows you to type in
> the name of a web site and it will pop up with a different
> background color to the original one.
>
> I'm looking for something like:
> Type in url of site ($url)
> $url is read and bgcolor is found and changed (instead of yellow it
> becomes white)
> And window pops up with site $url having a white background.
>
>
> I'm trying a few things such as:
>
> <?
> $filename="http://www.panda-man.info/index.htm";
> $fd = fopen($filename,"r");
> $content=fread($fd, 300000);
> fclose($fd);
> $color='BGCOLOR="#FF0000/"';
> $newcolor='BGCOLOR="#FF0033/"';
> preg_replace('/$color/', $newcolor, $content);

^^^^^^^^^^^^


Waaaaaay overkill =)

RegEx takes up a fair bit more processing than an alternative. I also
think that the ' ' should be " " as it's looking for literally
'$color' rather than the value of $color.

Personally, I'd try:


$content = str_replace('#FF0000', '#FF0033', $content);


str_replace() is less processing intensive than RegEx functions so
should be more efficient too (not that you may physically notice it
here, more of a pointer in general =) ).

Again, just for efficiency, no need to store the colour values in
vars.


>
> echo($content);
>
> ?>
>
> But I'm a bit new to php and it's taking too long.
>
> Can any one give me a bit of help?
>
> Thanx very much
>
> Regards
>
>
> Tiago, ze panda-man
>
>




HTH.



Regards,

Ian

-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0

iQA/AwUBPwah/mfqtj251CDhEQKwlACggqOiHaCpVz0ARIxF54F77Ca8cDsAoJ0 /
JuLxCLG/RdeLgZfrXXO6raPC
=ukTJ
-----END PGP SIGNATURE-----

--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Programming, Web design, development & hosting.
 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Reply With Quote
Advertisements
Old 07-01-2007, 3:19 PM   #2
tiago borges da silva
 
tiago borges da silva's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default Interfering with html using php

Fantastic Ian! you're right, it worked.
I'm using variables cos it is part of a bigger script.

Is str_replace() case sensitive? I mean, would it work for BGCOLOR and
bgcolor the same way?
Or would I need to create a condition?










Thanx

tiago








-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Whilst lounging around on Sat, 05 Jul 2003 10:32:20 +0100, tiago
borges da silva <tiago.borges-da-silva@rca.ac.uk> amazingly managed
to produce the following with their Etch-A-Sketch:

> Hi I'm trying to develop a php web page that allows you to type in
> the name of a web site and it will pop up with a different
> background color to the original one.
>
> I'm looking for something like:
> Type in url of site ($url)
> $url is read and bgcolor is found and changed (instead of yellow it
> becomes white)
> And window pops up with site $url having a white background.
>
>
> I'm trying a few things such as:
>
> <?
> $filename="http://www.panda-man.info/index.htm";
> $fd = fopen($filename,"r");
> $content=fread($fd, 300000);
> fclose($fd);
> $color='BGCOLOR="#FF0000/"';
> $newcolor='BGCOLOR="#FF0033/"';
> preg_replace('/$color/', $newcolor, $content);

^^^^^^^^^^^^


Waaaaaay overkill =)

RegEx takes up a fair bit more processing than an alternative. I also
think that the ' ' should be " " as it's looking for literally
'$color' rather than the value of $color.

Personally, I'd try:


$content = str_replace('#FF0000', '#FF0033', $content);


str_replace() is less processing intensive than RegEx functions so
should be more efficient too (not that you may physically notice it
here, more of a pointer in general =) ).

Again, just for efficiency, no need to store the colour values in
vars.


>
> echo($content);
>
> ?>
>
> But I'm a bit new to php and it's taking too long.
>
> Can any one give me a bit of help?
>
> Thanx very much
>
> Regards
>
>
> Tiago, ze panda-man
>
>




HTH.



Regards,

Ian

-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0

iQA/AwUBPwah/mfqtj251CDhEQKwlACggqOiHaCpVz0ARIxF54F77Ca8cDsAoJ0 /
JuLxCLG/RdeLgZfrXXO6raPC
=ukTJ
-----END PGP SIGNATURE-----

--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Programming, Web design, development & hosting.

 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Reply With Quote
Old 07-01-2007, 3:19 PM   #3
Ian.H [dS]
 
Ian.H [dS]'s Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default Interfering with html using php

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Whilst lounging around on Sat, 05 Jul 2003 11:29:45 +0100, tiago
borges da silva <tiago.borges-da-silva@rca.ac.uk> amazingly managed
to produce the following with their Etch-A-Sketch:

> Fantastic Ian! you're right, it worked.



Glad it worked =)


> I'm using variables cos it is part of a bigger script.



Ahh, fair enough and understood.


>
> Is str_replace() case sensitive?



Nope.


> I mean, would it work for BGCOLOR and
> bgcolor the same way?



Nope.


> Or would I need to create a condition?



Nope =P


str_ireplace() is what you're after for that =)


http://uk.php.net/manual/en/function.str-ireplace.php



Regards,

Ian

-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0

iQA/AwUBPwawN2fqtj251CDhEQKsbQCdGyktDLTRPcrSMiTgHhw1rE XrJMgAoLoT
meEK4nxWSPttjWaaa50RTRS6
=n8M5
-----END PGP SIGNATURE-----

--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Programming, Web design, development & hosting.
 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Reply With Quote
Old 07-01-2007, 3:19 PM   #4
Ian.H [dS]
 
Ian.H [dS]'s Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default Interfering with html using php

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Whilst lounging around on Sat, 05 Jul 2003 11:02:20 GMT, "Ian.H [dS]"
<ian@WINDOZEdigiserv.net> amazingly managed to produce the following
with their Etch-A-Sketch:

> >
> > Is str_replace() case sensitive?

>
>
> Nope.



Oops, that should have been: yup =)



Regards,

Ian

-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0

iQA/AwUBPwawcmfqtj251CDhEQLaYgCgm+5o78zPmstcPN9APTLTpA N5b54AoNiB
gN46G0XRuPtGOt8Np9Wwnaqk
=He+j
-----END PGP SIGNATURE-----

--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Programming, Web design, development & hosting.
 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Reply With Quote
Old 07-01-2007, 3:19 PM   #5
tiago borges da silva
 
tiago borges da silva's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default Interfering with html using php

Thanx very much for your help Ian.
Have a good day


Cheerio

tiago



On 5/7/03 12:02, in article lubdgv4qur12nvnn2cciv5nb0mfeupigca@4ax.com,
"Ian.H [dS]" <ian@WINDOZEdigiserv.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Whilst lounging around on Sat, 05 Jul 2003 11:29:45 +0100, tiago
> borges da silva <tiago.borges-da-silva@rca.ac.uk> amazingly managed
> to produce the following with their Etch-A-Sketch:
>
>> Fantastic Ian! you're right, it worked.

>
>
> Glad it worked =)
>
>
>> I'm using variables cos it is part of a bigger script.

>
>
> Ahh, fair enough and understood.
>
>
>>
>> Is str_replace() case sensitive?

>
>
> Nope.
>
>
>> I mean, would it work for BGCOLOR and
>> bgcolor the same way?

>
>
> Nope.
>
>
>> Or would I need to create a condition?

>
>
> Nope =P
>
>
> str_ireplace() is what you're after for that =)
>
>
> http://uk.php.net/manual/en/function.str-ireplace.php
>
>
>
> Regards,
>
> Ian
>
> -----BEGIN PGP SIGNATURE-----
> Version: PGP 8.0
>
> iQA/AwUBPwawN2fqtj251CDhEQKsbQCdGyktDLTRPcrSMiTgHhw1rE XrJMgAoLoT
> meEK4nxWSPttjWaaa50RTRS6
> =n8M5
> -----END PGP SIGNATURE-----


 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Reply With Quote
Old 07-01-2007, 3:20 PM   #6
tiago borges da silva
 
tiago borges da silva's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default Interfering with html using php

You're a star Ian!!!!


I'll send you a postcard with a special thank you.
Have a look at www.panda-man.info, that's me.


* and regards


Tiago



On 5/7/03 13:19, in article r8gdgvs5675n9dgqgbuigi8nla915u0ud2@4ax.com,
"Ian.H [dS]" <ian@WINDOZEdigiserv.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Whilst lounging around on Sat, 05 Jul 2003 12:23:52 +0100, tiago
> borges da silva <tiago.borges-da-silva@rca.ac.uk> amazingly managed
> to produce the following with their Etch-A-Sketch:
>
>> Ian, and what about if I want to change the font. The php script
>> reading the contents of a url and the body doesn't have any color
>> defined in it, so body would be <body this and that but no
>> bgcolor>, which would make the page to be white by default, but If
>> I want to include 'bgcolor="black"' inside the <body> what would be
>> the best way of doing it? With include? But what would be the best
>> way to search for '<body' and include stuff straight after it?

>
>
> The font part could be changed in a similar method:
>
>
> $content = str_replace('font="name"', 'font="new_name"', $content);
>
>
> If I understand the rest correctly, you could use RegEx for that:
>
>
> if (!preg_match("#\<body.*bgcolor.*\>#i", $content)) {
> // If bgcolor not found
> $content = str_replace('<body ', '<body bgcolor="#FF0033" ',
> $content);
> }
>
>
> This would then "insert" your bgcolor choice within the body tag if
> it's not found =)
>
>
>>
>>
>> <sorry to keep you busy with these questions>
>> tiago

>
>
> No probs =)
>
>
>
> HTH.
>
>
>
> Regards,
>
> Ian
>
> -----BEGIN PGP SIGNATURE-----
> Version: PGP 8.0
>
> iQA/AwUBPwbCYmfqtj251CDhEQL/RgCfdha65X0k9s2wcVTiP+S81//cpp0AoO60
> stexFE3RAmXNjmRtAMwEpI4k
> =pt96
> -----END PGP SIGNATURE-----


 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Reply With Quote
Featured Websites
Free Space
Free Space
Free Space Free Space
Reply
Tags: , , ,




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
php/html Leandra PHP 3 07-01-2007 3:18 PM
embedded php in html file, how to tell calling html file? MeNotHome PHP 1 07-01-2007 3:17 PM
xls to html a.der Kinderen HTML 2 07-01-2007 1:49 PM
sorry for HTML Guy Melan Car audio 0 06-17-2007 3:02 PM
HTML help Stivey HTML 8 03-27-2006 3:30 AM


Featured Websites




All times are GMT +1. The time now is 3:02 PM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.0.0
Cheap Computers
MK PitStop Copyright 2005 - 2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98