Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once('recaptchalib.php');
- $privatekey = "6LdpIMUSAAAAAMU05ziB_xjoIvolmo6N1sozeh3A ";
- $resp = recaptcha_check_answer ($privatekey,
- $_SERVER["REMOTE_ADDR"],
- $_POST["recaptcha_challenge_field"],
- $_POST["recaptcha_response_field"]);
- if (!$resp->is_valid) {
- // What happens when the CAPTCHA was entered incorrectly
- die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
- "(reCAPTCHA said: " . $resp->error . ")");
- } else {
- session_start ();
- // Clean input
- function fInClean($in, $serialized = false, $allowTags = false){
- if(!$serialized){
- if (get_magic_quotes_gpc()) { $in = stripslashes($in); }
- }
- if(!$allowTags){ $in = strip_tags($in,"<b><u><i>"); }
- return trim(mysql_real_escape_string($in));
- }
- $username = fInClean(@$_POST['username']);
- $password = fInClean(@$_POST['password']);
- if ($username&&$password)
- {
- $con = mysql_connect("DOMÄN","ANVÄNDARNAMN","PW") or die(mysql_error());
- mysql_select_db("DATABAS", $con);
- $query = mysql_query ("SELECT * FROM users WHERE username='$username'");
- $numrows = mysql_num_rows ($query);
- if ($numrows!=0)
- {
- while ($row = mysql_fetch_assoc($query))
- {
- $dbusername = $row ['username'];
- $dbpassword = $row ['password'];
- }
- //se om de passar
- if ($username==$dbusername&&md5($password)==$dbpassword)
- {
- header( 'Location: admin.php' ) ;
- $_SESSION['username']=$username;
- $_SESSION['minSession'] = 1;
- }
- else
- echo "Fel lösenord!";
- }
- else
- die("Den där användaren finns inte!");
- }
- else
- die ("Plz skriv in anvandarnamn och lösenord.");
- }
- ?>
Add Comment
Please, Sign In to add comment