New Method to launch a new website
Hello Everybody,
As all coders have no time I will bring it up directly.
1- We are launching a new website at a small ceremony.
2- The website will have initial page that has a button says "Launch Me".
3- When the official presses the Launch Me button we need it to rename the index file with the official page for the full website we created.
We thought about coding a batch file that will have the FTP details and commands to rename the index file with the Official page, but the problem here is that we don't know how to create such a button that will execute the .bat file on the server side. All what we need is a button or any way that will rename the index file with the official one by pressing a button.
Any tips people?
Thanks in-advance.
Re: New Method to launch a new website
Use a server-side scripting language, like PHP.
This script would be named index.php and should be fairly self-explanatory. It would contain the HTML for the "Launch" button page as well as a "The page has been launched" page. If the latter page is unneeded, it could simply redirect to the new page instead (using the PHP header() function).
PHP Code:
<?php
// Flag to determine whether or not to display the "Launch" button
$showLaunch = true;
if($_SERVER['REQUEST_METHOD'] == "POST"){
if(isset($_POST['launch']) && $_POST['launch'] == "true"){
// Rename this index file
rename("index.php", "index-launched.php");
// Rename new index file
rename("index-launch.htm", "index.htm");
$showLaunch = false;
}
}
?>
<?php if($showLaunch): ?>
<!-- HTML for "Launch" button page -->
<form method="post" action="index.php">
<input type="hidden" name="launch" value="true" />
<input type="submit" value="Launch the site!" />
</form>
<?php else: ?>
<!-- HTML for "Site has been launched" page -->
<p>The site has been launched! <a href="index.htm">Click here</a> to visit it</p>
<?php endif; ?>
The "unlaunched" index file in this example is named index-launch.htm, and will be renamed index.htm after pressing the "Launch" button. Just as well, this launching script will be renamed index-launched.php, so that it won't have any chance of being displayed again. It could also be deleted instead, but if it's simply renamed then you at least still have it there if you need to test it or whatever.
If you have any questions about the code or need help customizing it, let me know.
Hope that helps.
Re: New Method to launch a new website
Welcome to VBForums :wave:
Duplicate threads merged - please post each question (or variation of it) only once. If you think you have posted in the wrong forum, click the "report" icon on the left of a post (or PM a moderator) to ask for it to be moved.
Re: New Method to launch a new website
Hello kows,
You are an angel ... really appreciated I MEAN IT.
Could you give us an example, for instance the FTP details username 123 pass 123.
How it will look like in the final result ... and is it possible to relate it to a button in DreamWeaver dreictly? please and thank you.
to be honest with you, .... we only need a plain page with a button like those submit button just press on it and everything is changed.
Your help is Mucha-appreciated.
Re: New Method to launch a new website
Hello si_the_geek,
Sorry for that maybe because we are desperate about it. We are sorry accept our apology, we needed help as much as we can.
Thank you.
Re: New Method to launch a new website
This has nothing to do with FTP and nothing to do with Dreamweaver. This is a server-side scripting language, which means it would run on the server. It would be a script on the same server as the website you're launching. The example I posted already works -- it just needs to be changed slightly if you want to customize the way it looks. And the filenames would most likely need to be changed as well.
Re: New Method to launch a new website
Hello kows,
YOU ARE GENIUS, YOU ARE OUR BILL GATES.
it works in a marvelous way, everything is working great and fine. your help is something we will not forget.
we have a last question, when the button is pressed it says The site has been launched! Click here to visit it. is it possible to make it redirect in lets say 3 seconds to the main page.
Any help to add something to this code :
<p>The site has been launched! <a href="index.htm">Click here</a> to visit it</p>
that within seconds it redirects directly without letting the official to click on Click here.
YOU ARE OUR ANGEL, OUR BILL GATES, EVEN OUR STEVE JOBS. Because You saved us as an angel, and Helped us in our lives to make them easier as BILL and STEVE. You are the mixture of the ideal human.
Thank you we really appreciate your efforts enormously.
Re: New Method to launch a new website
Hello kows,
thank you so much, we used the header function. Everything is working fine beyond our expectations. You are a master. Thanks a-much kows for your efforts and your kind response.
Greets to VBForums.
Re: New Method to launch a new website
I'll admit it: the praise is a little weird, but I'll allow it.
Good luck with the launch!