<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Code The World — Simple singe page password protection]]></title>
	<link rel="self" href="https://codetheworld.com/extern.php?action=feed&amp;tid=4&amp;type=atom" />
	<updated>2008-06-15T01:01:27Z</updated>
	<generator>PunBB</generator>
	<id>https://codetheworld.com/viewtopic.php?id=4</id>
		<entry>
			<title type="html"><![CDATA[Simple singe page password protection]]></title>
			<link rel="alternate" href="https://codetheworld.com/viewtopic.php?pid=4#p4" />
			<content type="html"><![CDATA[<p>Description<br />Password protection for a single page. Visitors are required to enter a password and username into a login form to view the page content.</p><p>The code<br /></p><div class="codebox"><pre><code>&lt;?php

// Define your username and password
$username = &quot;someuser&quot;;
$password = &quot;somepassword&quot;;

if ($_POST[&#039;txtUsername&#039;] != $username || $_POST[&#039;txtPassword&#039;] != $password) {

?&gt;

&lt;h1&gt;Login&lt;/h1&gt;

&lt;form name=&quot;form&quot; method=&quot;post&quot; action=&quot;&lt;?php echo $_SERVER[&#039;PHP_SELF&#039;]; ?&gt;&quot;&gt;
    &lt;p&gt;&lt;label for=&quot;txtUsername&quot;&gt;Username:&lt;/label&gt;
    &lt;br /&gt;&lt;input type=&quot;text&quot; title=&quot;Enter your Username&quot; name=&quot;txtUsername&quot; /&gt;&lt;/p&gt;

    &lt;p&gt;&lt;label for=&quot;txtpassword&quot;&gt;Password:&lt;/label&gt;
    &lt;br /&gt;&lt;input type=&quot;password&quot; title=&quot;Enter your password&quot; name=&quot;txtPassword&quot; /&gt;&lt;/p&gt;

    &lt;p&gt;&lt;input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;Login&quot; /&gt;&lt;/p&gt;

&lt;/form&gt;

&lt;?php

}
else {

?&gt;

&lt;p&gt;This is the protected page. Your private content goes here.&lt;/p&gt;

&lt;?php

}

?&gt;</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Casper]]></name>
				<uri>https://codetheworld.com/profile.php?id=5</uri>
			</author>
			<updated>2008-06-15T01:01:27Z</updated>
			<id>https://codetheworld.com/viewtopic.php?pid=4#p4</id>
		</entry>
</feed>
