php echo and inserting variables in a iframe.....

  • oskillzzo
  • Beginner
  • Beginner
  • oskillzzo
  • Posts: 50

Post 3+ Months Ago

im basically doing a iframe inside of a iframe for the most part.



heres the code im using for my pages
Code: [ Select ]
<p><IFRAME vspace="0" hspace="0" allowtransparency="true" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" style="border:0px;" width="482" height="414" SRC="http://www.onlygoodanimes.com/mv.php?id=MNVJFML2"></IFRAME></p>



Heres my MV.php file

Code: [ Select ]
<html>
<head>
<META NAME='ROBOTS' CONTENT='NOINDEX, NOFOLLOW'>
</head>





<body>

<iframe style='margin-top: 420px' onLoad='window.scrollTo(6,532)' src ='http://www.megavideo.com/?v=<?php echo $fieldsObjects['field_id']->data; ?>' width='1000' height='1000' vspace='0' hspace='0' allowtransparency='true' scrolling='no' marginwidth='0' marginheight='0' frameborder='0' style='border:0px;'></iframe>


</body>

</html>
  1. <html>
  2. <head>
  3. <META NAME='ROBOTS' CONTENT='NOINDEX, NOFOLLOW'>
  4. </head>
  5. <body>
  6. <iframe style='margin-top: 420px' onLoad='window.scrollTo(6,532)' src ='http://www.megavideo.com/?v=<?php echo $fieldsObjects['field_id']->data; ?>' width='1000' height='1000' vspace='0' hspace='0' allowtransparency='true' scrolling='no' marginwidth='0' marginheight='0' frameborder='0' style='border:0px;'></iframe>
  7. </body>
  8. </html>




what im trying to do is pull the 'id' from the code and insert it into a certain part of the mv.php file specifically after 'http://www.megavideo.com/?v='. i used that php echo code you see there but it doesnt pull the 'id' and insert it? did i do something wrong? can anyone help me out at all on this>?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • PolishHurricane
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1585

Post 3+ Months Ago

PHP Code: [ Select ]
<iframe style='margin-top: 420px' onLoad='window.scrollTo(6,532)' src ='http://www.megavideo.com/?v=<?php echo $_REQUEST['id']; ?>' width='1000' height='1000' vspace='0' hspace='0' allowtransparency='true' scrolling='no' marginwidth='0' marginheight='0' frameborder='0' style='border:0px;'></iframe>


But you might want to validate input first so there is no injection. I used preg_match() in this example, but you can use w/e you want, like: ctype_alnum() or anything you can think off, kind of tired atm.

PHP Code: [ Select ]
<?php
function ValidateID($ID='')
{
return preg_match('#^[0-9a-z]{1,10}$#i',$ID);
}
 
$MovieID = $_REQUEST['id'];
if(ValidateID($MovieID))
{ //Only show if the ID is valid to prevent injection
?>
<iframe style='margin-top: 420px' onLoad='window.scrollTo(6,532)' src ='http://www.megavideo.com/?v=<?php echo $MovieID; ?>' width='1000' height='1000' vspace='0' hspace='0' allowtransparency='true' scrolling='no' marginwidth='0' marginheight='0' frameborder='0' style='border:0px;'></iframe>
<?php
}
?>
  1. <?php
  2. function ValidateID($ID='')
  3. {
  4. return preg_match('#^[0-9a-z]{1,10}$#i',$ID);
  5. }
  6.  
  7. $MovieID = $_REQUEST['id'];
  8. if(ValidateID($MovieID))
  9. { //Only show if the ID is valid to prevent injection
  10. ?>
  11. <iframe style='margin-top: 420px' onLoad='window.scrollTo(6,532)' src ='http://www.megavideo.com/?v=<?php echo $MovieID; ?>' width='1000' height='1000' vspace='0' hspace='0' allowtransparency='true' scrolling='no' marginwidth='0' marginheight='0' frameborder='0' style='border:0px;'></iframe>
  12. <?php
  13. }
  14. ?>



That's a lot of iframes btw, 2 is too many for me. :)
  • oskillzzo
  • Beginner
  • Beginner
  • oskillzzo
  • Posts: 50

Post 3+ Months Ago

worked perfectly! thanks oh so much, most appreciated
  • oskillzzo
  • Beginner
  • Beginner
  • oskillzzo
  • Posts: 50

Post 3+ Months Ago

is there a way i can get something else to show up like a link to my site saying this content was stolen or something if someone tries to use this iframe code?



Code: [ Select ]
<p><IFRAME vspace="0" hspace="0" allowtransparency="true" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" style="border:0px;" width="482" height="414" SRC="http://www.onlygoodanimes.com/mv.php?id=MNVJFML2"></IFRAME></p>




heres what my mv.php looks like so far
Code: [ Select ]
<?php
function ValidateID($ID='')
{
return preg_match('#^[0-9a-z]{1,10}$#i',$ID);
}

$MovieID = $_REQUEST['id'];
if(ValidateID($MovieID))
{ //Only show if the ID is valid to prevent injection
?>
<iframe style='margin-top: 420px' onLoad='window.scrollTo(6,532)' src ='http://www.megavideo.com/?v=<?php echo $MovieID; ?>' width='1000' height='1000' vspace='0' hspace='0' allowtransparency='true' scrolling='no' marginwidth='0' marginheight='0' frameborder='0' style='border:0px;'></iframe>
<?php
}
?>
  1. <?php
  2. function ValidateID($ID='')
  3. {
  4. return preg_match('#^[0-9a-z]{1,10}$#i',$ID);
  5. }
  6. $MovieID = $_REQUEST['id'];
  7. if(ValidateID($MovieID))
  8. { //Only show if the ID is valid to prevent injection
  9. ?>
  10. <iframe style='margin-top: 420px' onLoad='window.scrollTo(6,532)' src ='http://www.megavideo.com/?v=<?php echo $MovieID; ?>' width='1000' height='1000' vspace='0' hspace='0' allowtransparency='true' scrolling='no' marginwidth='0' marginheight='0' frameborder='0' style='border:0px;'></iframe>
  11. <?php
  12. }
  13. ?>
  • PolishHurricane
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1585

Post 3+ Months Ago

I seldom use frames, but you can put a javascript on the actual page of your website that will break out of the frames if the page is in frames. So put this in the HTML head of the page that you don't want to be in frames:

Code: [ Select ]
 
<script type="text/javascript">
if(window != top){ top.location.href = location.href; }
</script>
 
  1.  
  2. <script type="text/javascript">
  3. if(window != top){ top.location.href = location.href; }
  4. </script>
  5.  


Basically "If (This page isn't the main frame), tell the browser to go to it", so if someone tries to put your website in a frame the user will automatically be redirected to your website, IF the browser supports javascript, usually most browsers do or the user will have to allow it.
  • romel19
  • Born
  • Born
  • romel19
  • Posts: 1

Post 3+ Months Ago

Hi i m using wordpress n using a specific theme which is used to add videos

what i m tryin to add a iframe tag in "videoembed" custom field which looks like this:
Code: [ Select ]
 
    <iframe height="385" frameborder="0" width="476" scrolling="no" border="0" src="http://rock3r.zzl.org/movie/flv/mv.php?id=25JPJGD3">
  1.  
  2.     <iframe height="385" frameborder="0" width="476" scrolling="no" border="0" src="http://rock3r.zzl.org/movie/flv/mv.php?id=25JPJGD3">


and in that mv.php file i used these:

Code: [ Select ]
 <body>
 
    <?php
    function ValidateID($ID='')
    {
    return preg_match('#^[0-9a-z]{1,10}$#i',$ID);
    }
 
    $MovieID = $_REQUEST['id'];
    if(ValidateID($MovieID))
    { //Only show if the ID is valid to prevent injection
    ?>
    <iframe width="476" scrolling="no" height="523" frameborder="0" src ='http://www.megavideo.com/?v=<?php echo $MovieID; ?>' border="0" style="float: left; margin-left: -26px; margin-top: -148px; Margin-Bottom: -148px;"></iframe>
    <?php
    }
    ?>
    </body>
  1.  <body>
  2.  
  3.     <?php
  4.     function ValidateID($ID='')
  5.     {
  6.     return preg_match('#^[0-9a-z]{1,10}$#i',$ID);
  7.     }
  8.  
  9.     $MovieID = $_REQUEST['id'];
  10.     if(ValidateID($MovieID))
  11.     { //Only show if the ID is valid to prevent injection
  12.     ?>
  13.     <iframe width="476" scrolling="no" height="523" frameborder="0" src ='http://www.megavideo.com/?v=<?php echo $MovieID; ?>' border="0" style="float: left; margin-left: -26px; margin-top: -148px; Margin-Bottom: -148px;"></iframe>
  14.     <?php
  15.     }
  16.     ?>
  17.     </body>


the problem is when i use the iframe tag in the "videoembed" field it doesnt show the whole page or anthing, besides the iframed video and the page dont scroll anymore. is there something wrong with code that i m using in "mv.php"? or ifame tag which is causing this? or do i have to do something in the theme files to fix this

any help will be very much appriciated

thx in advance

p.s. here is the link to the page where i used the iframe...
Code: [ Select ]
 
http://rock3r.zzl.org/movie/?p=22
  1.  
  2. http://rock3r.zzl.org/movie/?p=22


and the usual page looks like this:

http://rock3r.zzl.org/movie/?p=7

oh and thx very much once again for all of you guys here i found so many stuff here which helped a lot

Post Information

  • Total Posts in this topic: 6 posts
  • Users browsing this forum: ScottG and 93 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.