Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[PHP]logging in

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Fri Jul 11, 2008 8:37 am    Post subject: [PHP]logging in Reply with quote

I'm trying to understand logging in. Because I was thinking how do I validate a correct log-in and I remember sessions. Just I don't totally get sessions. And even still, I'm not quite sure why that's important anyway, or how to use it really. I got this, but I think it's wrong....

Code:

<?php
include('connect.php');
$username = $_POST[username];
$password = $_POST[password];
$sql = "SELECT * FROM accounts WHERE username = '$username' AND password = '$password'";
if(!mysql_query($sql, $con)) {
   echo "Invalid username or password!";
   exi();
}
else {
   start_session();
   //then what o.O
}
mysql_close($con);
?>

_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Mussy69
Grandmaster Cheater
Reputation: 0

Joined: 09 Mar 2007
Posts: 842
Location: Sydney

PostPosted: Fri Jul 11, 2008 9:23 am    Post subject: Reply with quote

I'm not the best person with PHP but this should work Shocked

Code:
<?
include("connect.php");

if($_SESSION['uname'] <= ""){
echo ' | <a href="otherfeatures.php">other features</a> | <a href="other features.php">Other features</a>';
} else {
echo ' | <a href="otherfeatures.php">other features</a> | <a href="other features.php">other features</a>';
}

?>
<br>
<strong>
<center>
<?
$submit = $_POST['submit'];
$uname = $_POST['uname'];
$pword1 = $_POST['pword'];
$pwordq = stripslashes("$pword1");
$what = array('"');
$then = array('');
$output  = str_replace($what, $then, $pwordq);
$pword = $output;

if($_POST['submit'] == "1"){
$checkpass = "SELECT password FROM accounts WHERE name = '$uname'";
$checkpassq = @mysql_query("$checkpass");
$checkpassr = @mysql_result($checkpassq,0);

$checkpass = "SELECT name FROM accounts WHERE name = '$uname'";
$checkpassq = @mysql_query("$checkpass");
$num_rows = @mysql_num_rows($checkpassq);

if($num_rows > "0"){
if($pword == $checkpassr){
$_SESSION['uname'] = $uname;
$_SESSION['log'] = "yes";
echo "Whatever you want your message to display after login ( will redirect after 3 seconds ).";
echo "<meta http-equiv=refresh content=3;url=/>";
} else {
echo "The information you have entered is incorrect.";
}
} else {
echo "That account has not been registered";
}
}
?>
<b><form method="post">
<input type=hidden name="submit" value="1">
Username:
<input type=text name="uname"><? if($uname == "") { echo '<font color=red>*</font>'; } ?><br>
Password:&nbsp;
<input type=password name="pword"><? if($pword == "") { echo '<font color=red>*</font>'; } ?><br>
<input type=submit value="Login">
</form>
</b></font>
</center>
</STRONG>


Edit that code to your variables or whatever lawl

_________________
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites