• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Trying to Add Login Page to Existing Site

New Here ,
Jul 31, 2020 Jul 31, 2020

Copy link to clipboard

Copied

I have an html website in DW and am trying to add a login screen to one section. I've tried to create a mySQL table for it on my hosting server, and am now trying to use MAMP to link the html to the php db. I'm a novice at this and nothing is working. Can anyone walk me through the steps of how to do this? Thanks.

Views

122

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 31, 2020 Jul 31, 2020

Copy link to clipboard

Copied

Using DMXzone extensions, have a look here https://www.dmxzone.com/go/32980/creating-a-complete-login-system-with-dmxzone-security-provider/

 

Hand coding, see here https://www.tutorialrepublic.com/php-tutorial/php-mysql-login-system.php

Wappler, the only real Dreamweaver alternative.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 01, 2020 Aug 01, 2020

Copy link to clipboard

Copied

LATEST

Does your server support PHP code? 

Are you naming your log-in page and scripts with a .php file extension? 

 

Single page, password protected.  Save as log-in.php.

 

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Password Protected Content</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">

<!--minimal demo styles-->
<style>
html {font-size:16px}

body {font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", "DejaVu Sans", Verdana, "sans-serif";
font-size: 1.5rem;
width:80%;
margin:0 auto;
}
</style>
</head>
<body>


<?php
// Define your username and password here
$username = "admin";
$password = "pass123";

if (isset($_POST['txtUsername']) != $username || $_POST['txtPassword'] != $password) {
?>
<!--LOG-IN FORM-->
<form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<fieldset>
<legend>Log-In</legend>

<p><label for="txtUsername">Username:</label>
<br>
<input type="text" title="Enter your Username" name="txtUsername" id="txtUsername" required placeholder="5 characters"></p>

<p><label for="txtPassword">Password:</label>
<br>
<input type="password" title="Enter your password" name="txtPassword" id="txtPassword" required placeholder="7 characters"></p>

<button type="submit">Submit</button>
</fieldset>
</form>

<?php
}
else {
?>

<!--PROTECTED CONTENT-->
<h2>Log-In Success!</h2>
<p>You have reached a password protected area of this page. What would you like to do next?</p>

<!--Links to other pages-->
<ul>
<li> <a href="download.html">Download Files</a></li>
<li><a href="#">Upload Files</a></li>
<li><a href="#">Watch Videos</a></li>
<li><a href="#">Play a Game</a></li>
</ul>
<?php
}
?> 
<!--END PROTECTED CONTENT-->

</body>
</html>

 

 

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines