Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6567543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:20:59+00:00 2026-05-25T14:20:59+00:00

I am creating a very basic iPhone simulator and what I want to do

  • 0

I am creating a very basic iPhone simulator and what I want to do is just have it in one location, and then any site that we have and want to put it on, we would just call it using: http://www.example.com/iphone-test.php?url=http://www.example.com/mobile/

Is there anything I need to look out for that could be un-safe? There is no database involved or anything, but just in case someone wanted to mess around and put some stuff in the URL, what are some things I can do to help make this a little more safe?

Here is my code:

<?php
    if(isset($_GET['url'])) {
        $url = $_GET['url'];
        ?>

        <!doctype html>
        <html lang="en">
            <head>
                <meta charset="utf-8">
                <title>iPhone Test</title>
                <style type="text/css">
                #iphone { 
                    background:url(iPhone.png) no-repeat; 
                    width:368px; height:706px; 
                    position:relative; 
                    overflow:hidden;  
                }
                #iphone iframe {
                    position:absolute; 
                    left:30px; 
                    top:143px; 
                    border:0;overflow:hidden; 
                }
                </style>
            </head>
            <body>
                <div id="iphone">
                <iframe src="<?=$url;?>" width="307" height="443"><p>Your Browser does not support iFrames.</p></iframe>
                </div>
            </body>
        </html>
        <?php
    }
?>

Edit: Thanks for all of your help. I did some research and here is what I have so far:

<?php
include_once 'filter.php';
$filter = new InputFilter();   

if(isset($_GET['url'])) {
if (filter_var($_GET['url'], FILTER_VALIDATE_URL)) {
    $url = $filter->process($_GET['url']);
?>

Source: http://oozman.com/php-tutorials/avoid-cross-site-scripting-attacks-in-php/

Class: http://www.phpclasses.org/browse/file/8941.html

What do you think?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T14:21:00+00:00Added an answer on May 25, 2026 at 2:21 pm

    If this page is accessible for anyone to access then you are opening yourself up to XSS and Phishing redirects. For example, try adding this to your URL params:

    ?url="></iframe><script>alert(123)</script>
    

    In Firefox 6.02 that fires off the alert. Which means that any JS could be fired and used to redirect users who think they are visiting your site. Or it could be used to steal cookies that are not marked HTTPOnly.

    This can be mitigated by encoding for HTML attributes. Which is described here from OWASP:

    Except for alphanumeric characters, escape all characters with ASCII values less than 256 with the &#xHH; format (or a named entity if available) to prevent switching out of the attribute. The reason this rule is so broad is that developers frequently leave attributes unquoted. Properly quoted attributes can only be escaped with the corresponding quote. Unquoted attributes can be broken out of with many characters, including [space] % * + , – / ; < = > ^ and |.

    Reference: https://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet#RULE_.232_-_Attribute_Escape_Before_Inserting_Untrusted_Data_into_HTML_Common_Attributes

    Now, for your other issue that the above will nto address. If you allow just any arbitrary URL to be entered, then there is nothing stopping someone from doing something like this:

    ?url=http://myevilsite.com/redirect.php
    

    And have that page redirect the user:

    window.top.location.href = "http://www.site.com"; 
    

    The only thing you can do about that is to use a white list of acceptable URLs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a very large PHP MVC-based site that will have a large
I'm just learning wcf and can't understand one very basic thing. I'm creating a
I am creating a very basic photo uploading site that will allow users to:
I am creating a very basic web browser using JEditorPane just to teach myself
I have a very basic application that has buttons in a toolstrip. When a
I'm following a very basic book tutorial on Mac development. We're just creating a
I have a very basic question. I want to use STL's list instead of
I'm creating a very simple django upload application but I want to make it
I am very new to creating webservers - and I have had several goes
I am currently creating a very basic piece of DBMS software - I would

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.