Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[PHP] Login Tutorial / No Mysql / DarkCoder

Junior Spellweaver
Joined
Jul 6, 2008
Messages
173
Reaction score
2
My First tutorial on My New Series Of Php Tutorials.



Discription:
Code:
Code: http://elitetactics.sytes.net/codes/index.php

Please rate and subscribe for more.
We would love it!

This is a php tutorial for people tpo login to a certain file or show a certain text.

%Tutorial
%PHP
%Html

Please Subscribe :)
 
Junior Spellweaver
Joined
Dec 2, 2006
Messages
198
Reaction score
0
Re: [RELEASE] PHP Login Tutorial / No Mysql / DarkCoder

very basic. should move to showcase
 
Custom Title Activated
Loyal Member
Joined
May 25, 2007
Messages
1,025
Reaction score
31
Hmm...very useful for beginners like me in PHP. I actually learnt a lot from this, thanks!
 
duck you, I'm a dragon
Loyal Member
Joined
Apr 29, 2005
Messages
6,407
Reaction score
130
Pretty basic, also if you're passing stuff like passwords through a form, NEVER use get it's very unsafe. Use post instead.

Also, you're coding style is sloppy, it'll make your brain explode on big projects.

This is how I would code it:

PHP:
<form name='password' action="test1.php?" method="post">
Password: <input type="text" name="pass"><br />
<input type="submit" value="Go!">
<br /> </form>

<?php
$pass=$_POST['pass'];

if ($pass == "dark") {

      echo "Password Correct.";

}
?>
 
Custom Title Activated
Loyal Member
Joined
May 25, 2007
Messages
1,025
Reaction score
31
What's wrong with $_GET?
 
Joined
Sep 10, 2006
Messages
2,817
Reaction score
1,417
/page.php?pass=thisismypweveryonecankindaread

tis s mush betta, not like you need md5 when you're not saving it anywhere though.
PHP:
$pass = md5(ahoj);
$post = md5($_POST['pass']);

if($pass == $post)
{
echo "ok";
}
else
{
echo "wrong password, you fail";
}
 
Skilled Illusionist
Loyal Member
Joined
Jun 23, 2007
Messages
310
Reaction score
1
Ahoj Foxx :)

Also, there are better ways of doing this, sessions etc. but good to learn the basics.
 
Custom Title Activated
Loyal Member
Joined
May 25, 2007
Messages
1,025
Reaction score
31
/page.php?pass=thisismypweveryonecankindaread

tis s mush betta, not like you need md5 when you're not saving it anywhere though.
PHP:
$pass = md5(ahoj);
$post = md5($_POST['pass']);

if($pass == $post)
{
echo "ok";
}
else
{
echo "wrong password, you fail";
}
OK... but what's the
PHP:
$pass = md5(ahoj);
there for?
 
Custom Title Activated
Loyal Member
Joined
May 25, 2007
Messages
1,025
Reaction score
31
But it says the password is 'pass'?
 
Joined
Sep 10, 2006
Messages
2,817
Reaction score
1,417
nope, it says that the password is "ahoj",
in that guide he did
PHP:
if ($pass == "dark") {
where "dark" is the password, i've only "stored" that password in a variable..
in his guide it would be
PHP:
$password = "dark";
if ($pass == $password) {
 
Custom Title Activated
Loyal Member
Joined
May 25, 2007
Messages
1,025
Reaction score
31
Aaah, I didn't see that.
 
Junior Spellweaver
Joined
Jul 6, 2008
Messages
173
Reaction score
2
o_O thanks dark.. Can use md5 or $post. But only other people the will see it are other people on the computer unless someonmess remote veiwing it.
 
hello
Loyal Member
Joined
Jun 24, 2004
Messages
726
Reaction score
158
That's the password, md5() is a php function which makes it encoded.

A little correction it's not encoding, cause md5 algorithm is one way, sayin other way, once you crypt ( scramble ) something with and md5 you won't decrypt it back, cause md5 is partly random and so far no one provided and inverse algorithm. And no brute force method does not count as a decryption cause always i can manage so complicated password that with brute force method you won't break it and your grand children still won't see the results.
 
Experienced Elementalist
Joined
Apr 15, 2008
Messages
256
Reaction score
0
Pretty basic, also if you're passing stuff like passwords through a form, NEVER use get it's very unsafe. Use post instead.

Also, you're coding style is sloppy, it'll make your brain explode on big projects.

This is how I would code it:

PHP:
<form name='password' action="test1.php?" method="post">
Password: <input type="text" name="pass"><br />
<input type="submit" value="Go!">
<br /> </form>

<?php
$pass=$_POST['pass'];

if ($pass == "dark") {

      echo "Password Correct.";

}
?>
Wouldn't it be:
Password:<input type="text" name="password" />
 
duck you, I'm a dragon
Loyal Member
Joined
Apr 29, 2005
Messages
6,407
Reaction score
130
No. In PHP or any coding language for that matter it's important to make your code as compact as possible while maintaining readability. That's why you should always abbreviate words if possible.

Also, notice how I called the form "Pass" and that I use $_POST['pass'] to get the contents of the form.
 
Back
Top