/    Sign up×
Community /Pin to ProfileBookmark

how to – password & exp date

I’d like to put a password requirement in this program & an expiration date (database record)so that at 11 months I output an alert and at the end of one year it shuts down. ?

[code=html]

<HTML><HEAD>
</head>
<frameset rows=”25%,75%” frameborder=”0″ border=”0″ framespacing=”0″>
<frame src=”hologo.html” name=”Logo” marginwidth=”0″ marginheight=”0″ noresize scrolling=”no”>
<frameset cols=”170,*” frameborder=”0″ border=”0″ framespacing=”0″>
<frame src=”honav.html” name=”Navigation” noresize scrolling=”auto” marginwidth=”0″ marginheight=”0″>
<frame src=”hocalendar.html” name=”Main” noresize scrolling=”auto” marginwidth=”0″ marginheight=”0″>
</frameset>
<noframes>
<em>Sorry, your browser does not support frames.</em>
To visit our unframed site <a href=”hoinfo.html”>click here</a>
</noframes>
</frameset>
</html>

[/code]

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@xeteaOct 24.2010 — First: learn HTML. (Try http://htmldog.com, it's a nice site.)

Second: learn CSS. (optional)

Third: learn PHP. (E g here: http://www.tuxradar.com/practicalphp/)

You should find your answer somewhere along the way.
Copy linkTweet thisAlerts:
@ckdoublenecksauthorOct 24.2010 — I think the below code will do the password If I can figure out how to direct the program to the above program if the password is correct. Can someone help me with the link to the URL, please?

[code=php]<?php
mysql_connect(localhost,root,"");
mysql_select_db(entrydb) or die( "Unable to select database");
if(!empty($_POST["submit"]))
{
$password = $_POST['password'];
$expdate = $_POST['expdate'];
$query="SELECT password, expdate FROM entrydata Where password='$password'";
$result=mysql_query($query);
if(mysql_num_rows($result))
{
echo "<form action='#' method='post'>";

echo "</form>";
}
else{echo "Access denied<br />";}
}
?>
<form method="post" action="#"><br />
<input type="text" name="password"/><p>
<input type="submit" name="submit" value="enter password"/>
</form>[/code]
Copy linkTweet thisAlerts:
@ryanlundOct 24.2010 — Please please please don't use that code you posted on ANY site ever....please. My advice is to learn html,css,php in detail before trying to write any code for an actual website. Learning how to program isnt a race to get something online - just take your time and get some practise in ?
Copy linkTweet thisAlerts:
@ckdoublenecksauthorOct 25.2010 — I appreciate your response but it would help if you would explain what is so bad about my code. That way I might learn to do it right. This is for a localhost system I developed and have been using for some time, I just wanted to try to learn more. Maybe you could look at a couple of other sites which have been online for years and let me know how to improve them?


www.ckdoublenecks.com and www.kirk-websites.com
Copy linkTweet thisAlerts:
@ryanlundOct 25.2010 — Ah ok sorry. Ill just give you a quick list, and will look at the sites in a min ?

a) please don't keep database passwords in the same file as the code. keep it outside the web accessible directory and include it.

b) dont just check if the submit button data was sent. check all the fields you want to use are sent before using them or you will get warnings when they are blank.

c) validate or clean up all user data before using it in a query. The easiest way to do this is something like

[code=php]
$password=mysql_real_escape_string($_POST['password']);
[/code]


d) before using the data that the query provides it would probably be better to check the query was successful and returned the right amount of data.

Will have a look at your sites now and let you know ?
Copy linkTweet thisAlerts:
@DasherOct 25.2010 — The password should be stored in the database encrypted, and the password at log in would then be also encrypted and the two encrypted values compared. It is never a good idea to store a password raw.
×

Success!

Help @ckdoublenecks spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...