PHP - Iframe Displaying External Content
Hello!
Looking for some advice regarding displaying content from my databases on my members websites via an iframe. Here's what I want to do; Members on my site are rated and reviewed, what I wanted to do was create a piece of code that they could embed on their website to show their reviews. My first instincts where to create an iframe and use the source to pass get variables to my server to identify the member and then use these in a query to select member reviews. Here is the code; For their site; Code: [Select] <iframe frameborder="0" height="250px" width="700px" scrolling="auto" src="http://www.mysite.co.uk/reviews.php?ID=9999&aKey=123456"></iframe> Passes the member ID and a unique access key for that member. The page on my site; (reviews.php) include_once $_SERVER['DOCUMENT_ROOT'] . // path to script files $ID=mysql_real_escape_string($_GET['ID']); $aKey=mysql_real_escape_string($_GET['aKey']); if(empty($aKey) || empty($ID)){ die("Key or ID not set,Selection Error"); exit;} $reviewresult = mysql_query("SELECT Name,Review,Date FROM Reviews WHERE ID='$ID' AND aKey='$aKey' Order by RAND() Limit 10"); //if there is at least one review if($reviewresult && mysql_num_rows($reviewresult) > 0) { while($review = mysql_fetch_array($reviewresult)) { // output reviews } } Are there any security risks with this script? Do you think it is the best method to accomplish what I want? Are there better alternatives? Any suggestions or room for improvement? Thanks! Similar TutorialsDear, I have page1.php where there is a iframe with source page2.php. How can I read page2.php? Both the pages are in external website, and if I directly point www.thatsite.com/page2.php, it shows blank page (no error). But if I load www.thatsite.com/page1.php in FIREFOX and use SAVE FRAME AS function, it does save page2.php successfully. Thanks, Hi guys Do you guys know if possible to open an external URL without actually displaying this to the user? We have a service where we wish to open an external URL which triggers sending out an SMS to the user. However..we cannot display the url opened to the user as it shows our username etc with the sms provider. basically the url looks like this: https://www.smsprovider.com/username=OurUsername&password=******&smsMsg_to_send=blablablablabla Is it possible to "trigger" this URL without letting our users see it? Thanks in advance for any help you may provide (Posted this in the MySQL section, but i think the php section might be the proper place)
I have a webshop db where i want to export some things linke order information to another external db on another server etc.
Example of things to move:
Table1 - orderid - orderdate Table2 - adress - shippingmethodI ONLY want it to export and import things that is not currently there. How can this be done in a php script? Ok, my php skills are such that I can customize an existing script to some extend, but I can't write one. My problem is the following: I'm using a php-based forum script in a friends website. I load the 'forum.php' script in an iframe of a static page. When a user gets a response to a post that he wrote on the forum, he receives a mail with a link which - if clicked - gets him to the response he got ie. http://someurl.com/forum.php?todo=viewtopic&tid=6#t2 The problem is now that if he clicks the link, the file of course doesn't open in the iframe of the static page (http://someurl.com/forum.html) where normally this forum.php file opens. I guess I will have to make the static page also into a php-file and then use parts of the clicked url (forum.php?todo=viewtopic&tid=6#t2) and insert it into the iframe as the file to load ... would appreciate a lot if anyone can advice me how to do that! Thanks in advance, K. hello and good day... I'm trying to refresh by press the F5 button to refresh my iframe.. for your information, there is other tool in that iframe. the problem is 1. when i press the F5 key(refresh) while it's running, the whole page refreshing and i need to login to the tool. 2. i want to refresh the iframe without logout the tool... can you give me some guide how to solve this problem.. sorry my english not so good... thank you... regards, hyuuga Hi! I'm a total stupid newbie. Please humor me. So, I'm trying to make a guestbook, just as practice. So far I have a form that writes entries to a file, each entry on a new line. Entries look like this: Code: [Select] 11:11 am, Oct 12th, 2010|name|website|message My dividing character between parts of the entries is the vertical bar. I don't know if that's a bad idea. As I said, I'm a newb. I should probably find out how to make a code that makes it so people can't use that character in the form. Anyway, this is my code so far trying to display the entries. So far, I just want to show the date of the first entry. $file = fopen("posts.txt", 'rb'); while(!feof($file) && fgetc($file) != "|"){ $date = $date.fgetc($file); } echo $date; fclose($file); I already have a problem. The code does stop at the vertical bar, but instead of showing the date as "11:11 am, Oct 12th, 2010" it shows "11 m c 2h 00". I'm just super confused, and I don't know what to do. Thanks. (: Hi all, I'm not sure if this is a PHP question or javascript, so if it needs to be moved can an admin please do so... Anyway, basically I have the following code: Code: [Select] <a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'">View Availability</a> This pops up a divs with a black alpha background, so that it appears the new content is displaying over the top of the current content. This all works fine, however the content I am displaying in the top level div is (or should be) dynamic. In order for the content to be useful I need to grab the id. Normally I would simply do this: Code: [Select] <a href = "[b]url.php?uniqueidentifier=<?php echo $row['id'];?>[/b]" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'">View Availability</a> However what happens in this instance is that the page loads with the javascript and the id in the url but it then disappears... Has anyone got any ideas on how I might be able to get around this? Many thanks, Greens85 Hi Guys what I need to do is display data from two different tables that equal the same value in a specific field Table one has ID Title Course content table two has ID Title Start date End date I need a query that says if title from table one matches title from table 2 then will display the start and end date from table two sorry if this is really simple I am a newbie thanks inadvance Hi! So I have got some code that looks like this: Code: [Select] if (isset($_GET['view_log'])) { // show content (text from db) } When I click the button named "view_log" everything displays just fine, however I would like to be able to click the button again and make the content disappear. Is this possible using only PHP?? Thanks for the help!:) It is greatly appreciated! Hi, When i am getting the part of the text using the function substr, am getting this kind of problem , (text in the end not printing properly) how to solve this. تسر مؤسسة مهارات التقنية ومؤسسة اشبكة الثنائية ان تطلع جميع عملاءها بإصدار نظام تاتش لإدارة الموقع الالكترونية من يوم السبت ا� This is the code am using $sub_string_content = substr(strip_tags($temp['News_Content'],'<p></a><ul><li><div><span>'),0,300); Thanks, Hello - I'm opening my website up to visitors for free, and trying to bypass a login screen to go straight into the data content that was appearing after a user logged in. I have an index.php file that included the following code at the beginning: <?php session_start(); include("database.php"); include("login.php"); include("/vservers/skyranks/db_connect.php"); ?> <?header("Cache-control: private"); ?> <html> I deleted the "include("login.php"); line, and was successful at bypassing the username and login screen. However, the page that is supposed to display the data content is incomplete. In fact, it only displays my company's logo. Any ideas as to why the data content is not showing up? Thank you for any help with this, as my php is quite novice at this point. Regards - Joe I am wanting HTML to render within a table and sourcing the data from another file. In an attempt to do this, I tried: Code: [Select] <TABLE class="main"> <TR> <TD> <?php readfile('./1/index.html'); ?> </TD> </TR> </TABLE> This does not work and I am wondering if anyone knows how it can be done - or even if it can be done? I'm currently running a classified ads site and planning to display my own content from database combined with and external site rss. So here is what i got right now after the db query for the jobs ads (procedural php),
while ($row = mysqli_fetch_array($results, MYSQLI_ASSOC)){ echo '<div class="media margin-none"> <a class="pull-left bg-inverse innerAll text-center" href="#"><img src="'.$foto.'" share_alt="" width="100" height="100"></a> <div class="media-body innerAll"> <h4 class="media-heading innerT"> <a href="' . $row['title'] .'-da' . $row['id_ad'] . '" class="text-inverse">'. $remuneracion .' ' . substr(ucfirst(strtolower($row['title'])), 0, 53) . '</a> <small class="pull-right label label-default"><i class="fa fa-fw fa-calendar-o"></i> ' . $row['date_created'] . '</small></h4> <p>' . substr(ucfirst(strtolower($row['description'])), 0, 80) . ' ...</p>'; echo '</div> </div> <div class="col-separator-h"></div>'; } echo pagination($statement,$per_page,$page, $url_filtros, $filtros); ?>it is the while loop that i use to display ads from my database, what could be the best way to display (in this same loop?) other site's rss feed so i can show my content combined with the external rss? Thanks Hello,
I recently posted here about an issue I was having with my database orientated products page.
I have now run into another problem where say if, /db.php was typed or /db.php?p=IDoNotExist was typed, it returns blank.
I have in my code the desired content to be displayed, but it just doesn't seem to want to make a show.
I was also wondering if it is possible to show different content for whatever the URL is, so for no parameter, the content about the products, and a non existent one, maybe "Product not found"?
Here is my code:
<?php $db=mysql_connect ("localhost", "webwibco_charlie", "Hello123") or die ('I cannot connect to the database because: ' . mysql_error()); $mydb=mysql_select_db("webwibco_products"); include("header.php"); $status = htmlspecialchars( @$_GET ['p'] ); if ($status == "floorpuzzles") { echo "<h1>Our Floor Puzzles</h1>"; $sql="SELECT ID, Name, Tags, Description, Category FROM products WHERE Category LIKE '%" . FloorPuzzles . "%'"; $result=mysql_query($sql); while($row=mysql_fetch_array($result)){ $Name =$row['Name']; $ID =$row['ID']; $Description =$row['Description']; echo "<div class=\"box\">"; echo "<h1>$Name</h1>"; echo "<div class=\"floorbox\"><a href=\"?p=$ID\"><img src=\"images/products/catalogue/big/floorpuzzles/$ID.jpg\" class=\"small\"></a></div>"; echo "<h2>$Description</h2>"; echo "</div>"; } ?> <? }else{ if ($status == $_GET["p"]) { $sql="SELECT ID, Name, Tags, Description, Pieces, Size, Barcode, Category FROM products WHERE ID = '" . $_GET['p'] . "'"; $result=mysql_query($sql); while($row=mysql_fetch_array($result)){ $Name =$row['Name']; $ID =$row['ID']; $Description =$row['Description']; $Pieces =$row['Pieces']; $Size =$row['Size']; $Barcode =$row['Barcode']; echo "<div class=\"1\">"; echo "<h1>$Name</h1>"; echo "<div class=\"bigbox\">"; echo "<div class=\"floorbox\"><img src=\"images/products/catalogue/big/floorpuzzles/$ID.jpg\" class=\"big\"></div>"; echo "</div>"; echo "</div>"; echo "<div class=\"2\">"; echo "<p>Puzzle Pieces: $Pieces</p> <p>Puzzle Size: $Size</p> <p>Barcode: $Barcode</p>"; echo "</div>"; } }else{ ?> <? echo"<h1>Our Products</h1> <p>Our jigsaw puzzles are hand cut by skilled craftsmen and therefore each one is unique with self-correcting pieces. There is a strict quality control process at all stages by our highly experienced staff. The puzzles are durable and provide fun and excitement, enhancing learning and a child’s development.<p> <p>All of our jigsaws are made using materials from sustainable resources grown in managed forests. Where possible we support companies in the UK and source our components locally, most of our suppliers are in the East Midlands, many in Derbyshire and Nottinghamshire. We keep packaging to a minimum and take our environmental and ethical responsibilities very seriously.</p> <p>Reducing waste and recycling was a way of life for us before it became fashionable. We are constantly searching for new ideas and consult teachers when developing our jigsaws, which are often used within the national curriculum.</p> <p>As well as making our own range, we manufacture for leading suppliers to the education market. Check for \"Made in Britain\" and it is probably made by us.</p> <p>We have a wide variety of products available for viewing, from classic floor puzzles to innovative inset trays. You can take a look at all our products on this page, simply use the navigation buttons to your left.</p>"; }} include("footer.php"); ?>The final echo is what I wish to be displayed on the URL without or with an invalid parameter. Here is my site URL: http://www.webwib.co...saws/search.php (note that only the "Floor Puzzles" category has content within it). Thank you in advance for assistance. Hi, I will start off trying to explain what I am trying to make the best I can. What I want to create is a script that gets the gold value from this website: http://www.lbma.org.uk/pages/index.cfm?page_id=46&title=current_statistics and then save it to a variable which I will use to calculate values of different gold karats. Here is the content in bold I need on the website I linked: Quote LONDON GOLD FIXING USD GBP EUR AM 1588.00 1005.127 1251.083 PM 1589.50 1004.741 1249.803 So what help do I need? Well, I don't expect you to figure out the calculating part for me but some help how to get that content pointed out above and save it to a variable is what I would appreciate getting some help with. I don't know much PHP, only some and I have been trying to figure this out for a day now without any success. I suppose php get contents and/or curl should be used here but I don't know how really. I would very much appreciate the help I can get on this. Thank you! I would like a part of my script to link to an external sites script It doesn't seem to be doing it though Othersite.com - index.php?name=hello&status=1 I would like my post.php to run that above. Can it be done? I'm building a program in php that will be able to view YouTube videos from the URL. So if I type: http://www.youtube.com/watch?v=(Video ID) Then my program works and it will return the Video ID! But then some idiot clicks on a related video and this URL is generated: http://www.youtube.com/watch?v=(Video ID)&feature=related And my program strips the first bit by replacing "http://www.youtube.com/watch?v=" with an empty string "" but then I'm still left with the "&feature=related" I thought about just replacing that with an empty string as well but sometimes there can be a URL like this: &feature=g-vrec&context=G28d9eecRVAAAAAAAABA Which has a different unique code each time. So I thought it'd be much simpler if I could use $_GET[] with an external URL, so the user types in: http://www.youtube.com/watch?v=(Video ID)&feature=related It just gets the "v" value rather than my buggy replace thing. Thanks. I was just wondering if it was possible to have an external php file that can be included in the head of a web page, like a .js file. If this isn't possible maybe have a .js file containing php code that can be executed regarding the JavaScript around it... Hi, I have a peice of code which publishes an image with a link from my database. However I cant get it to use external links. My code is: echo "<a href=\"" .$link . "\"> <img src=\"" .$image ."\" /> </a><BR />"; I have tried all the options I can think of but I cant get it work. Can anyone advise please? |