Change text in index.html file using...

User 148735 Photo


Registered User
97 posts

I'd like to replace text in an index file with another text. I want to have someone update a YouTube live stream link with a new one.

The form would look like: Load New YouTube live stream link. (new line) Enter old link ____________ (new line) Enter new link.(new line) Replace button

The new link would then replace the old link in the file without the user having to go in and change the index code directly (because they usually screw up the code).

Does anyone know how to do this? (Where would I put the form so the user can click on it to open the form)

Using Site Designer latest edition
User 187934 Photo


Senior Advisor
20,181 posts
Online Now

Hi larry,
Who will be updating the link? Do you have full control over who does?
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 148735 Photo


Registered User
97 posts

One person would be updating. I have full control
User 187934 Photo


Senior Advisor
20,181 posts
Online Now

I would make a form and then use some php to only make it available to the user that has the proper link.
Here's a quick example.
No access:
https://ericrohloff.com/coffeecup/ccfor … myform.php
Access:
https://ericrohloff.com/coffeecup/ccfor … Dyww*Klad$
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 148735 Photo


Registered User
97 posts

Thanks so much, but can’t open files
User 187934 Photo


Senior Advisor
20,181 posts
Online Now

Those aren't to open.
Here's the examples simple code.
<?php
if(isset($_GET['link']) && $_GET['link']== 'qtV49Dyww*Klad$'){
echo 'My form here';
}else {
echo 'Try again';}
?>

There are a few ways to make this work depending on the need but I would put this code at the very top of the form page if your building the form within SD.
<?php
if(isset($_GET['link']) && $_GET['link']== 'qtV49Dyww*Klad$'){
?>

Then put this code at the very bottom.

<?php
}else {
header("Location: https://mydomain.com/index.html");
die();
}
?>

Adjust the mydomain to your actual domain name.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 148735 Photo


Registered User
97 posts

Thanks again. Not very familiar with php. Do I then need to put a replace code in the index file?
User 187934 Photo


Senior Advisor
20,181 posts
Online Now

No, Just add the php code to the page that the form is on. The form page will need to be a php page.
If somebody lands on the form page without the proper link code they will get bump to your index.html.
You can change that if you want. The link code qtV49Dyww*Klad$ can be customized to what ever you want.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.