-
Server's still not accessible maybe try this out assuming your JS (splashpage.js) is all set for the overlay.
Whatever you want to call the page where the user enters the address:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
</head>
<body>
<form id="form1" name="form1" method="post" action="new_page_name.php">
<label for="url">URL:</label>
<input input value="http://www." type="text" name="url" id="url" size="40">
<input type="submit" name="SubmitButton" value="Submit">
</form>
</body>
</html>
new_page_name.php:
PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
</head>
<?php
if (isset($_POST['url'])) {
$domain = $_POST['url'];
$correct_domain = "http://www.";
$chars_allowed = strlen($correct_domain);
if (substr($domain, 0, $chars_allowed)== $correct_domain) {
?>
<body>
<?php
$requested_page = file_get_contents($domain);
$requested_page = str_replace("<head>", "<head>\n<script type=\"text/javascript\" src=\"splashpage.js\"></script>\n", $requested_page);
echo $requested_page;
} else {
//Error, you can handle this however you want
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
</head>
<body>
<span style="color:#ff0000;">Please Enter a Valid Domain starting with <?php echo $correct_domain; ?>.</span>
<form id="form1" name="form1" method="post" action="<?php $_SERVER['PHP_SELF']?>">
<label for="url">URL:</label>
<input input value="http://www." type="text" name="url" id="url" size="40">
<input type="submit" name="SubmitButton" value="Submit">
</form>
<?php
}
}
?>
</body>
</html>
-
What do you mean by:
} else {
//Error, you can handle this however you want
-------------------------
Im also trying to replace this javascript string:
$requested_page = str_replace("<head>", "<head>\n<script type=\"text/javascript\" src=\"splashpage.js\"></script>\n", $requested_page);
with "player_page.html"
I just dont realise the correct syntax. Please give me a hint.
-
Hi bluewalrus,
your code works pretty well, there is just a problem with showing the images from the called sites. So, I mean when you write an address like google.com or whatever, the images wont show.
Otherwise, in terms of combining two sites, works great!
Got an idea how to? If you need a server to make tests, I can give you one.
-
Mine should be up it's kinda pathetic that I'm paying 2 hosts and they still cant transfer my domains. Anyway you need to set the base domain to the requested domain I'd think. Then call all your pages absolutely since you have control on that...
PHP Code:
$requested_page = str_replace("<head>", "<head>\n<base href=\"$domain\" />\n<script type=\"text/javascript\" src=\"splashpage.js\"></script>\n", $requested_page);
Is it working other than that? I just saw your post before your most recent, if any of that is still active please repost..
-
Thanks, Ill try and replay your message. Just sent you a pm.
-
Ok, what I got with your pretty code:
When using this:
PHP Code:
<?php
if (isset($_POST['url'])) {
$domain = $_POST['url'];
$correct_domain = "http://www.";
$chars_allowed = strlen($correct_domain);
if (substr($domain, 0, $chars_allowed)== $correct_domain) {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta http-equiv="refresh" content="0;url=<?php echo $domain;?>" />
</head>
<body>
<?php
$requested_page = file_get_contents($domain);
$requested_page = str_replace("<head>", "<head>\n<script type=\"text/javascript\" src=\"splashpage.js\"></script>\n", $requested_page);
//$requested_page = str_replace("<head>", "<head>\n<base href=\"$domain\" />\n<script type=\"text/javascript\" src=\"splashpage.js\"></script>\n", $requested_page);
echo $requested_page;
} else {
//Error, you can handle this however you want
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
</head>
<body>
//<span style="color:#ff0000;">Please Enter a Valid Domain starting with <?php echo $correct_domain; ?>.</span>
<?php
}
}
?>
... I get the splashpage.js on top, except the images on the page under, are not shown.
If I take out this part:
PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta http-equiv="refresh" content="0;url=<?php echo $domain;?>" />
</head>
... the page called per html shows correctly, but splashpage doesnt show on top at all.
I am desperated:-)
-
Is this live, could I see how it's functioning? I think the problem is dual html tags but want to double check.
-
-
Okay give this one a try...
PHP Code:
<?php
if (isset($_POST['url'])) {
$domain = $_POST['url'];
$correct_domain = "http://www.";
$chars_allowed = strlen($correct_domain);
if (substr($domain, 0, $chars_allowed)== $correct_domain) {
?>
<body>
<?php
$requested_page = file_get_contents($domain);
$requested_page = str_replace("<head>", "<head>\n<base href=\"$domain\" />\n<script type=\"text/javascript\" src=\"splashpage.js\"></script>\n", $requested_page);
echo $requested_page;
} else {
//Error, you can handle this however you want
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
</head>
<body>
//<span style="color:#ff0000;">Please Enter a Valid Domain starting with <?php echo $correct_domain; ?>.</span>
<?php
}
}
?>
You will need to have all of the codes on your site called absolute though with this code.
-
Hmm, splashpage doesnt show at all:-( although Ive changed html codes to absolute, as you said.
I must say, I had to change allow_url_fopen to ON, in order to get this working (I mean in the previous version):
$requested_page = file_get_contents($domain);