using a new template now...
Code: Select all
<?php
/************* Membership V1.0 *******************/
/*
Released by AwesomePHP.com, under the GPL License, a
copy of it should be attached to the zip file, or
you can view it on http://AwesomePHP.com/gpl.txt
*/
/************* Membership V1.0 *******************/
//Call Database & Connect
require_once('headers/database.php');
connect();
//We need functions
require_once('headers/functions.php');
//Get Admin Values
$get_cd = mysql_query("SELECT * FROM `memb_config`");
while($each = mysql_fetch_assoc($get_cd)){$$each['config_name'] = $each['config_value'];}
//If retrieving password
if($_POST['Submit'] == 'Login'){
//Check standard fields
if(is_valid_email($_POST['user_email']) == false){$message = 'Please enter a valid email.';}
if($message == NULL && $_POST['user_password'] == NULL){$message = 'Please enter password.';}
//Check Cpatcha
if($message == NULL){
$realanswer = trim(encode_decode(hex2bin($_POST['registration_id']),$CF_ENCDEC));
if($CF_CAPTHCA == 'IMAGE'){
if($_POST['answer'] != $realanswer){
$message = 'Please enter the correct verification code.';
}
} else {
if($realanswer != '*' AND $realanswer != $_POST['answer']){
$message = 'Please answer the question correctly.';
}
}
}
//Everything OK, procceed
if($message == NULL){
$_POST['user_email'] = mysql_escape_string($_POST['user_email']);
$_POST['user_password'] = mysql_escape_string($_POST['user_password']);
$get_user = mysql_fetch_assoc(mysql_query("SELECT * FROM `memb_userlist` WHERE `user_email`='$_POST[user_email]' AND
`user_password`='$_POST[user_password]'"));
if($get_user['user_email'] == $_POST['user_email']){
@session_start();
$usersession = generate_session(100);
$host_name = '.'.str_replace('www.','',$_SERVER['HTTP_HOST']);
setcookie("usersession", $usersession, time()+31104000000, "/", $host_name, 0);
$_SESSION['usersession'] = $usersession;
$user_ip = get_ip();
$insert_session = @mysql_query("INSERT INTO `memb_usersessions`
(`session_id`,`user_id`,`session_date`) VALUES ('$usersession','$get_user[user_id]',NOW())");
$update_acces = @mysql_query("UPDATE `user_list` SET `last_access`= NOW(),`last_ip`='$user_ip'
WHERE `user_id`='$get_user[user_id]' LIMIT 1");
die('Please proceed to <a href="profile.php">profile.php</a>');
} else{
$message = 'Invalid login credentials.';
}
}
}
//Disconnect Database
disconnect_data();
?>
<form name="login" id="login" method="post" action="<?php=$_SERVER['PHP_SELF'];?>" style="display:inline;">
<table width="100%" border="1" cellspacing="0" cellpadding="5">
<tr>
<td colspan="2"><div align="center"><font color="#999999" size="4">User Login </font></div></td>
</tr>
<?php
if($message != NULL){
?>
<tr bgcolor="#FFDDDD">
<td colspan="2"><strong><font color="#FF0000"><?php=$message;?></font></strong></td>
</tr>
<?php } ?>
<tr>
<td width="50%">Please enter Email: </td>
<td width="50%"><input name="user_email" type="text" id="user_email" value="<?php=$_POST['user_email'];?>">
</td>
</tr>
<tr>
<td>Please enter Password: </td>
<td width="50%"><input name="user_password" type="password" id="user_password"></td>
</tr>
<?php
if($CF_CAPTHCA == 'IMAGE'){?>
<tr>
<td>Enter Verification Code: </td>
<td><table border="0" cellspacing="0" cellpadding="5">
<tr>
<td class="acont"><div align="center">
<?php
$referenceid = md5(mktime()*rand());
//Generate the random string
$chars = array("a","A","b","B","c","C","d","D","e","E","f","F","g","G","h","H","i","I","j","J","k",
"K","l","L","m","M","n","N","o","O","p","P","q","Q","r","R","s","S","t","T","u","U","v",
"V","w","W","x","X","y","Y","z","Z","1","2","3","4","5","6","7","8","9");
$length = $CF_LENGH;
$textstr = "";
for ($i=0; $i<$length; $i++) {
$textstr .= $chars[rand(0, count($chars)-1)];
}
$new_string = encode_decode($textstr,$CF_ENCDEC);
$image_link = bin2hex($new_string);
?>
<img src="captcha.php?code=<?php=$image_link;?>">
<input name="registration_id" type="hidden" id="registration_id" value="<?php=$image_link;?>">
</div></td>
</tr>
<tr>
<td class="acont"><div align="center">
<input name="answer" type="text" id="answer">
</div></td>
</tr>
</table></td>
</tr>
<?php
} else {
$f = fopen($CF_QUESTIONFILE,'r');
while($t = fread($f,102465)){
$content .= $t;
}
fclose($f);
$content = trim(preg_replace('/\/\*.*\*\//ism', '', $content));
$temp = explode("\n",$content);
$random = rand(0,count($temp)-1);
$rand = $temp[$random];
list($question,$registration_id) = explode('\n\\',$rand);
$registration_id = bin2hex(encode_decode($registration_id,$CF_ENCDEC));
?>
<tr>
<td>Answer this: <strong><?php=$question;?></strong> </td>
<td><input name="answer" type="text" id="answer" value="<?php=$_POST['answer'];?>">
<input name="registration_id" type="hidden" id="registration_id" value="<?php=$registration_id;?>"></td>
</tr>
<?php } ?>
<tr>
<td colspan="2"><div align="center">
<input type="submit" name="Submit" id="Submit" value="Login">
</div></td>
</tr>
<tr>
<td colspan="2"><div align="center">[<a href="forgotpass.php">Forgot Password </a> - <a href="register.php">Register</a>] </div></td>
</tr>
</table>
</form>Code: Select all
<?php=$_POST['user_email'];?>Code: Select all
<?php=$_POST['answer'];?>can some one help me with this, im new to php and im still learning...
thanks