Login system

Her kan du få hjælp og stille spørgsmål til JavaScript!
Besvar
MadsHaupt
Entusiast
Entusiast
Indlæg: 48
Tilmeldt: 8. jan 2013, 14:00

Login system

Indlæg af MadsHaupt » 10. jan 2013, 14:26

Mit login system virker ikke på mac computer.
Hvad skal jeg gøre? :(

Brugeravatar
Daniel
Admin
Admin
Indlæg: 625
Tilmeldt: 14. jun 2011, 09:27
Geografisk sted: Danmark, Fyn, Nørre Aaby
Kontakt:

Re: Login system

Indlæg af Daniel » 10. jan 2013, 14:42

Hej Mads.

Tror du ikke det er browseren Safari at det ikke virker i? :)

Eventuelt kom med koderne til dit login system, så skal vi kigge på det.

MadsHaupt
Entusiast
Entusiast
Indlæg: 48
Tilmeldt: 8. jan 2013, 14:00

Re: Login system

Indlæg af MadsHaupt » 10. jan 2013, 16:39

code:
#index.php

<!DOCTYPE html>
<html lang="da" manifest="https://madshaupt.dk/manifest.txt">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="keywords" content="madshaupt.dk, login" />
<meta name="description" content="login på madshaupt.dk" />
<link rel="stylesheet" type="text/css" href="Login.css" />
<link rel="stylesheet" type="text/css" href="https://madshaupt.dk/bodystyle.css" />
<style>
form {
position: relative;
}
label.a {
position: absolute;
top: 15px;
}
label.b {
position: absolute;
top: 63px;
}
label {
position: absolute;
left: 33px;
}
input {
margin-top: 20px;
}
div {
position: absolute;
left: 44%;
top: 340px;
}
</style>
<script type="text/javascript" src="Login.js"></script>
<script type="text/javascript" src="https://madshaupt.dk/MHIE/download/down ... "></script>
<title>MadsHaupt.dk - Login</title>
</head>
<body>
<div></div>
<?php
mysql_connect("host", "username", "password") or die(mysql_error());
mysql_select_db("database") or die(mysql_error());
$data = mysql_query("SELECT * FROM Users") or die(mysql_error());

$a;

$password = "";

if (isset($_POST["loglo"])) {
if ($_POST["loglo"] != "") {
$a = $_POST["loglo"];
}
else {
$a = "https://madshaupt.dk/";
}
}
else {
$a = "https://madshaupt.dk/";
}

if (isset($_POST["login"])) {
while ($userinfo = mysql_fetch_array($data)) {
if ($userinfo["brugernavn"] == $_POST["brn"]) {
$password = $userinfo["password"];
}
}
if ($password == $_POST["pws"]) {
echo '<script type="text/javascript">
login('."'".$a."', '".$_POST["brn"]."'".');
</script>
';
}
else {
echo '<p style="color: red;"><b>Forkert brugernavn<br />eller password!!</b></p>
<div>
<form method="post" action="" name="login" onsubmit="return logintjek();"><center>
<label for="UserName" class="a">Brugernavn:</label>
<input type="text" id="UserName" name="brn" autofocus placeholder="marck1998" /><br />
<label for="Password" class="b">Password:</label>
<input type="password" id="Password" name="pws" placeholder="Dit password" /><br />
<input type="submit" id="submit" value="Login" name="login" /><br />
<input class="log" name="loglo" value="'.$_POST["loglo"].'" />
</center>
</form>
</div>
';
}
}
if (!isset($_POST["login"])) {
echo '<div>
<form method="post" action="" name="login" onsubmit="return logintjek();"><center>
<label for="UserName" class="a">Brugernavn:</label>
<input type="text" id="UserName" name="brn" autofocus placeholder="marck1998" /><br />
<label for="Password" class="b">Password:</label>
<input type="password" id="Password" name="pws" placeholder="Dit password" /><br />
<input type="submit" id="submit" value="Login" name="login" /><br />
<input class="log" name="loglo" value="'.$_POST["loglo"].'" />
</center>
</form>
</div>
';
}
?>
</body>
</html>

__________________________________________________________________________________________________
#/MHIE/download/download.js

function windows() {
if (navigator.userAgent.split("Windows NT ")[1].split(";")[0] == "6.1") {
return "Windows 7";
}
else if (navigator.userAgent.split("Windows NT ")[1].split(";")[0] == "5.1" ) {
return "Windows XP";
}
else {
return navigator.userAgent.split("Windows NT ")[1].split(";")[0];
}
}
function download() {
var a = "";
if (windows() == "Windows 7") {
a = "I";
}
else if (windows() == "Windows Vista") {
a = "I";
}
else if (windows() == "Windows XP") {
a = "I";
}
else {
alert("Programet kan kun kør på Windows XP, Vista, 7");
}
if (a == "I") {
if (document.getElementById("radio1").checked == true) {
document.location.href = "../Installers/MHIEv1Ins.exe";
}
}
}
function logud(location) {
var a = document.getElementsByTagName("div")[0];
a.innerHTML = '<form method="post" action="https://madshaupt.dk/logud.php"><input name="logud" value="' + location + '" class="log" /></form>';
var b = document.getElementsByTagName("form")[0];
b.submit();
}
function logpå(location) {
var a = document.getElementsByTagName("div")[0];
a.innerHTML = '<form method="post" action="https://madshaupt.dk/Login/"><input name="loglo" value="' + location + '" class="log" /></form>';
var b = document.getElementsByTagName("form")[0];
b.submit();
}
function login(location, username) {
var a = document.getElementsByTagName("div")[0];
a.innerHTML = '<form method="post" action="https://madshaupt.dk/log.php"><div style="position: absolute; left: auto; right: auto; top: auto; bottom: auto;"><label style="font-size: 25px;">Logger ind...</label></div><input name="logpmadshdk1" value="' + location + '" class="log" /><input name="logpmadshdk2" value="' + username + '" class="log" /></form>';
var b = document.getElementsByTagName("form")[0];
b.submit();
}
function header(to) {
var a = document.getElementsByTagName("div")[0];
a.innerHTML = '<form method="post" action="https://madshaupt.dk/header.php"><input name="header" value="' + to + '" class="log" /></form>';
var b = document.getElementsByTagName("form")[0];
b.submit();
}
_____________________________________________________________________________________________________
#/log.php

<?php

session_start();

if (isset($_POST["logpmadshdk1"]) && isset($_POST["logpmadshdk2"])) {
$_SESSION["logt"] = $_POST["logpmadshdk2"];
header("location: ".$_POST["logpmadshdk1"]);
}

else {
echo 'Du har ikke adgang til dette websted!!';
}

?>

Besvar