TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 01-30-2009, 11:47 PM   #1 (permalink)
The Wanderer
 
Edwin's Avatar
 
Join Date: Jan 2008
Posts: 10
Thanks: 1
Edwin is on a distinguished road
Default need help fixing PHP code

can someone please help me edit this php snip for me =]

PHP Code:
'<textarea cols="'.$t_cols.'" rows="'.$t_rows.'" onclick="this.focus(); this.select();">'."\n".

'<img src="'.$imgURL.'" alt ="'.$alt.'">'."\n".

'<p><a href="'.$site_url.'">Spaceskillz Myspace Comments</a></p>'."\n".

'</textarea>'."\n"
can someone delete the img tag and the site url tag and add this part instead

HTML Code:
<style type="text/css">
body {background-image: url(.$imgURL.); 
background-repeat: repeat; 
background-attachment: fixed;}
</style>
<div style="position:absolute; top:0; right:0"><a href=".$site_url." target="_blank"><img src="http://i309.photobucket.com/albums/kk366/spaceskillz/spaceskillz.gif" border="0"></a></div>
Thank You =]
Edwin is offline  
Reply With Quote
Old 01-30-2009, 11:54 PM   #2 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

PHP Code:
$html = <<<TALKPHP_SAVES_MY_BACON
<textarea cols="$t_cols" rows="$t_rows" onclick="this.focus(); this.select();">
<style type="text/css">
body { background-image: url(
$imgURL);
background-repeat: repeat;
background-attachment: fixed; }
</style>
<div style="position:absolute; top:0; right:0;"><a href="
$site_url" target="_blank"><img src="http://i309.photobucket.com/albums/kk366/spaceskillz/spaceskillz.gif" border="0"></a></div>
</textarea>
TALKPHP_SAVES_MY_BACON; 
Salathe is offline  
Reply With Quote
The Following User Says Thank You to Salathe For This Useful Post:
Edwin (01-31-2009)
Old 01-31-2009, 12:07 AM   #3 (permalink)
The Wanderer
 
Edwin's Avatar
 
Join Date: Jan 2008
Posts: 10
Thanks: 1
Edwin is on a distinguished road
Default

Quote:
Originally Posted by Salathe View Post
PHP Code:
$html = <<<TALKPHP_SAVES_MY_BACON
<textarea cols="$t_cols" rows="$t_rows" onclick="this.focus(); this.select();">
<style type="text/css">
body { background-image: url(
$imgURL);
background-repeat: repeat;
background-attachment: fixed; }
</style>
<div style="position:absolute; top:0; right:0;"><a href="
$site_url" target="_blank"><img src="http://i309.photobucket.com/albums/kk366/spaceskillz/spaceskillz.gif" border="0"></a></div>
</textarea>
TALKPHP_SAVES_MY_BACON; 
thanx dude ! =D
Edwin is offline  
Reply With Quote
Old 01-31-2009, 12:20 AM   #4 (permalink)
The Wanderer
 
Edwin's Avatar
 
Join Date: Jan 2008
Posts: 10
Thanks: 1
Edwin is on a distinguished road
Unhappy

im sorry for the double post but that code you supplied didnt work i get alot of areas so i thought about pasting the whole PHP file on here so here u go =]

PHP Code:
<?

include("config.php");

$cat $_GET['id'];
$img $_GET['img'];
$alt trim(preg_replace('/[^a-z]|((gif|jpg|jpeg|png|bmp)$)/i'' '$_GET['img']));

define("title"$alt." Myspace Graphic Comment");
define("keywords"$alt." myspace comment");
define("description""Viewing Comments ".$alt);

if(
$PBloc == '1')
$imgURL $PBURL.'cat/'.$cat.'/'.$img;
else
$imgURL $site_url.'cat/'.$cat.'/'.$img;

$uniqueID md5('graphic/cat/'.$cat.'/'.$img);

echo 
"\n".'<div align="center">'."\n".

'<div class="header">'.$alt.'</div>'."\n".

'<img src="'.$imgURL.'" alt ="'.$alt.'">'."\n";

if(
$rate == 1){
echo 
'<div align="center">'."\n".
'<script type="text/javascript">'."\n".
'<!-- //'."\n".
'document.write(\'<div\'+\' class="js-kit-rating" starColor="Blue" view="combo" path="/'.$uniqueID.'"><\/di\'+\'v>\')'."\n".
'//-->'."\n".
'</script>'."\n".
'</div>'."\n";
}

echo 
'<br />'."\n".

'<textarea cols="'.$t_cols.'" rows="'.$t_rows.'" onclick="this.focus(); this.select();">'."\n"

'<img src="'.$imgURL.'" alt ="'.$alt.'">'."\n"

'<p><a href="'.$site_url.'">Spaceskillz Myspace Comments</a></p>'."\n"

'</textarea>'."\n".

'<br />'."\n".

'<br />'."\n";

include(
"./ad.php");

echo 
"\n".'</div>'."\n";

if(
$rate == 1)
echo
'<script src="http://js-kit.com/ratings.js"></script>';

?>
Edwin is offline  
Reply With Quote
Old 02-02-2009, 09:00 PM   #5 (permalink)
The Wanderer
 
Edwin's Avatar
 
Join Date: Jan 2008
Posts: 10
Thanks: 1
Edwin is on a distinguished road
Default

anyone? =[
Edwin is offline  
Reply With Quote
Old 02-02-2009, 09:30 PM   #6 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

Hehe. That is a lot code to look through. What is it you want doing exactly in this follow-up?
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 02-02-2009, 10:40 PM   #7 (permalink)
The Contributor
 
Join Date: Feb 2009
Posts: 65
Thanks: 0
Krik is on a distinguished road
Default

Well I can guess why it didn't working. Trying to change the body style after the body tag has been loaded will do nothing.

Put
HTML Code:
<style type="text/css">
body {background-image: url('<?php echo $imgURL; ?>'); 
background-repeat: repeat; 
background-attachment: fixed;}
</style>
In the <head> .. </head> of the page or at least before the <body> loads

And the "$imgURL" will need to be defined before that

PHP Code:
<?php
include("config.php");

$cat $_GET['id'];
$img $_GET['img'];

$imgURL = ($PBloc == '1') ? $PBURL.'cat/'.$cat.'/'.$img $site_url.'cat/'.$cat.'/'.$img;
?>
<style type="text/css">
body {background-image: url('<?php echo $imgURL?>'); 
background-repeat: repeat; 
background-attachment: fixed;}
</style>
I do hope that the config.php defines $PBURL and/or $site_url otherwise that will cause you issues as well

Next, this
PHP Code:
'<script type="text/javascript">'."\n".
'<!-- //'."\n".
'document.write(\'<div\'+\' class="js-kit-rating" starColor="Blue" view="combo" path="/'.$uniqueID.'"><\/di\'+\'v>\')'."\n".
'//-->'."\n".
'</script>'."\n"
First, path="/'.$uniqueID.'" should be path="\'.$uniqueID. \'"

Second, <\/di\'+\'v>\' should be <\/div>\'

But worse yet you are going to have javascript write that second <div> in stead of PHP, that is a lot of unneeded code I would say
PHP Code:
if($rate == 1){
echo 
'<div align="center">
<div class="js-kit-rating" starColor="Blue" view="combo" path="\'.$uniqueID. \'"></div>
</div>
<script src="http://js-kit.com/ratings.js"></script>'
;

And as that last line, was called at the end in another "if", identical to the one above so I moved in to clean up your code

Lastly get rid of all the ."\n" they serve no purpose.
Krik is offline  
Reply With Quote
Old 02-02-2009, 11:35 PM   #8 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

Edwin, why are you just asking us to do particular tasks? I would be more than glad to help you with questions, but do your own basic work. What good are we actually doing for you by making simple edits? I'd suggest learning HTML so you can do these little tasks.
__________________

Village Idiot is offline  
Reply With Quote
Old 02-03-2009, 12:07 AM   #9 (permalink)
The Addict
 
CoryMathews's Avatar
 
Join Date: Nov 2007
Location: USA
Posts: 256
Thanks: 7
CoryMathews is on a distinguished road
Default

Quote:
Originally Posted by Village Idiot View Post
Edwin, why are you just asking us to do particular tasks? I would be more than glad to help you with questions, but do your own basic work. What good are we actually doing for you by making simple edits? I'd suggest learning HTML so you can do these little tasks.
Agreed.

PHP Code:
<?php
$Freelabor 
"bad";

if(
$problemExists true) { //yes only 1
  
echo "Try it then ask specific help questions";
} else while(
$Freelabor == "bad") { //good luck changing that
  
echo "Go learn it yourself! try google.com";
  if(
2) break; //prove me wrong
}
?>
go run that if you need to see what it does.
CoryMathews is offline  
Reply With Quote
Old 02-03-2009, 01:10 AM   #10 (permalink)
The Wanderer
 
Edwin's Avatar
 
Join Date: Jan 2008
Posts: 10
Thanks: 1
Edwin is on a distinguished road
Default

Quote:
Originally Posted by Wildhoney View Post
Hehe. That is a lot code to look through. What is it you want doing exactly in this follow-up?
I only need this part edited i tried a couple of times =/ but dont get nothing

PHP Code:
'<textarea cols="'.$t_cols.'" rows="'.$t_rows.'" onclick="this.focus(); this.select();">'."\n".

'<img src="'.$imgURL.'" alt ="'.$alt.'">'."\n".

'<p><a href="'.$site_url.'">Spaceskillz Myspace Comments</a></p>'."\n".

'</textarea>'."\n"
with

HTML Code:
<style type="text/css">
body {background-image: url(.$imgURL.); 
background-repeat: repeat; 
background-attachment: fixed;}
</style>
<div style="position:absolute; top:0; right:0"><a href=".$site_url." target="_blank"><img src="http://i309.photobucket.com/albums/kk366/spaceskillz/spaceskillz.gif" border="0"></a></div>
Quote:
Originally Posted by Krik View Post
Well I can guess why it didn't working. Trying to change the body style after the body tag has been loaded will do nothing.

Put
HTML Code:
<style type="text/css">
body {background-image: url('<?php echo $imgURL; ?>'); 
background-repeat: repeat; 
background-attachment: fixed;}
</style>
In the <head> .. </head> of the page or at least before the <body> loads

And the "$imgURL" will need to be defined before that

PHP Code:
<?php
include("config.php");

$cat $_GET['id'];
$img $_GET['img'];

$imgURL = ($PBloc == '1') ? $PBURL.'cat/'.$cat.'/'.$img $site_url.'cat/'.$cat.'/'.$img;
?>
<style type="text/css">
body {background-image: url('<?php echo $imgURL?>'); 
background-repeat: repeat; 
background-attachment: fixed;}
</style>
I do hope that the config.php defines $PBURL and/or $site_url otherwise that will cause you issues as well

Next, this
PHP Code:
'<script type="text/javascript">'."\n".
'<!-- //'."\n".
'document.write(\'<div\'+\' class="js-kit-rating" starColor="Blue" view="combo" path="/'.$uniqueID.'"><\/di\'+\'v>\')'."\n".
'//-->'."\n".
'</script>'."\n"
First, path="/'.$uniqueID.'" should be path="\'.$uniqueID. \'"

Second, <\/di\'+\'v>\' should be <\/div>\'

But worse yet you are going to have javascript write that second <div> in stead of PHP, that is a lot of unneeded code I would say
PHP Code:
if($rate == 1){
echo 
'<div align="center">
<div class="js-kit-rating" starColor="Blue" view="combo" path="\'.$uniqueID. \'"></div>
</div>
<script src="http://js-kit.com/ratings.js"></script>'
;

And as that last line, was called at the end in another "if", identical to the one above so I moved in to clean up your code

Lastly get rid of all the ."\n" they serve no purpose.
the script all works fine i just need a certain part edited as i listed below =] but thanx for helping me fix up the script =D

Quote:
Originally Posted by Village Idiot View Post
Edwin, why are you just asking us to do particular tasks? I would be more than glad to help you with questions, but do your own basic work. What good are we actually doing for you by making simple edits? I'd suggest learning HTML so you can do these little tasks.
I know some php but not alot thats why i came here for the help


Quote:
Originally Posted by CoryMathews View Post
Agreed.

PHP Code:
<?php
$Freelabor 
"bad";

if(
$problemExists true) { //yes only 1
  
echo "Try it then ask specific help questions";
} else while(
$Freelabor == "bad") { //good luck changing that
  
echo "Go learn it yourself! try google.com";
  if(
2) break; //prove me wrong
}
?>
go run that if you need to see what it does.
just thought i let you know your code wont work your gonna receive an syntax error -_-
Edwin is offline  
Reply With Quote
Old 02-03-2009, 01:56 AM   #11 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

php Code:
$szData = '<style type="text/css">
body {background-image: url(%s);
background-repeat: repeat;
background-attachment: fixed;}
</style>
<div style="position:absolute; top:0; right:0"><a href="%s" target="_blank"><img src="http://i309.photobucket.com/albums/kk366/spaceskillz/spaceskillz.gif" border="0"></a></div>'
;

echo sprintf($szData, $imgURL, $site_url);
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Writing Clean Code Village Idiot Tips & Tricks 10 06-25-2012 12:35 PM
10 PHP Myths Dispelled Wildhoney General 9 06-15-2009 06:55 AM
PHP Compressor Kalle Script Giveaway 8 05-28-2008 12:14 AM
Display pages php code? Aaron General 16 01-31-2008 11:29 AM
Optimizing PHP Code webosb General 12 11-15-2007 06:20 PM


All times are GMT. The time now is 05:59 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design