Celauran wrote:Unless you have defined them as constants somewhere, you'll need quotes around your MySQL login credentials.
You havebut I don't see $password defined anywhere, so the comparison will always fail.Code: Select all
if ($peanut == $password)
You've defined a function that never gets called. You've queried the database but aren't doing anything with the result ($result). Is this the complete code?
One Time Password
Moderator: General Moderators
Re: One Time Password
Re: One Time Password
yes this is the complete code i have
Re: One Time Password
do you want me to post that code i have again for you
Re: One Time Password
Code: Select all
$result = mysql_query("SELECT * FROM Codes") or die(mysql_error());Code: Select all
function get_rand_letters($length)
{
if ($length > 0)
{
$rand_id = "";
for ($i = 1; $i <= $length; $i++)
{
mt_srand((double) microtime() * 1000000);
$num = mt_rand(1, 5);
$rand_id .= assign_rand_value($num);
}
}
return $rand_id;
}Code: Select all
if ($peanut == $password)The password your users are supposed to enter, where is it coming from? Where is it being stored? How do you ensure it can only be used once?
Re: One Time Password
it is coming from the database Purchase table codes
and i not sure how to make it only used once.
and that $length is for to generate random codes like 0983843 to put in the text box
and i not sure how to make it only used once.
and that $length is for to generate random codes like 0983843 to put in the text box
-
mdiendd123456
- Forum Newbie
- Posts: 1
- Joined: Tue Dec 06, 2011 12:48 am
Re: One Time Password
ebgames56 wrote:I need a script to make a one time password but with a bunch of passwords only to be able to use once to download a file.
Thanks
i cant get it to well see i have a database with number passwords its just not letting me login in with the numbers
Re: One Time Password
You need to listen to 'Celauran' as your code does nothing at the moment just like 'Celauran' is trying to tell you.
It would be easier to create your download link, email to user, save link code to database, set dl=0, when user clicks link code sets dl=1, when they try click link again your code would recognise dl=1 in database and the link would not work.
You can have your code do this automatically for you so you don't need to do anything with your database once you have coded it.
Seriously, listen to 'Celauran' and you might get what you want buddy.
It would be easier to create your download link, email to user, save link code to database, set dl=0, when user clicks link code sets dl=1, when they try click link again your code would recognise dl=1 in database and the link would not work.
You can have your code do this automatically for you so you don't need to do anything with your database once you have coded it.
Seriously, listen to 'Celauran' and you might get what you want buddy.