Jump to content

Recommended Posts

I made some code,

<?php

$construction="yes";

if($construction == "yes"){
echo ?>

<html>
<center><br><br><br><br><br><h1>
Website is under construction, please remain patient, thank you.
</h1>
</center>
</html>

<?php
} else {
?>



THE WEBSITE PAGES HERE OR WHATEVER



<?php
}
?>

 

I want so i can toggle "yes" and "no" for $construction (like a CMS system) without going into my ftp/file manager.

thanks dezkit. i got the admin login page already setup....

 

<?php
$username = "someuser";
$password = "somepassword";
if ($_POST['txtUsername'] != $username || $_POST['txtPassword'] != $password) {
?>
<h1>Login</h1>
<form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<table>
<tr
<td>Username:
<td><input type="text" title="Enter your Username" name="txtUsername" /></p>
<tr>
<td>Password:
<td><input type="password" title="Enter your password" name="txtPassword" /></p>
<tr>
<td colspan="2" align="right"><input type="submit" name="Submit" value="Login">
</table>
</form>
<?php
}
else {
?>

CMS STUFF HERE.

<?php
}
?> 

Link to comment
https://forums.phpfreaks.com/topic/101932-solved-php-under-construction-admin/
Share on other sites

what are you guys talking about????

 

all i want is a password protected page, that has a password of "123456", and whenever i login,

 

it says "Welcome dezkit, the current status of the website is live, to turn off the website, please click here"

 

and whenever i click the link, it changes the "no" to a "yes"

<?php

$construction="no";

if($construction == "yes"){
echo ?>

<html>
<center><br><br><br><br><br><h1>
Website is under construction, please remain patient, thank you.
</h1>
</center>
</html>

<?php
} else {
?>

 

to

 

<?php

$construction="yes";

if($construction == "yes"){
echo ?>

<html>
<center><br><br><br><br><br><h1>
Website is under construction, please remain patient, thank you.
</h1>
</center>
</html>

<?php
} else {
?>

That would require the PHP script to modify it's self.

 

You need to have some sort of data storage system.

 

You can use flat file databases or MySQL or even serialize php variables. http://us3.php.net/serialize

 

Serializing is pretty nice for storing complex PHP variables when you don't want to create a MySQL table for that info.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.