Avatar billede kimbork Nybegynder
06. marts 2010 - 21:58 Der er 26 kommentarer og
1 løsning

password hjælp

Hej eksperten.

Jeg vil lige høre om der er nogen der kan hjælpe mig med at lave sådan at når man er logget ind på min hjemmeside viser den det brugernavn som er logget ind og hvis der ikke er nogen der er logget ind så skal den vise min brugernavn password form.

<form action="pass/login.php" method="post" class="loginform">
<lable class="inputlable">»Brugernavn:</lable>
<input type="text" name="brugernavn" class="input"/>
<lable class="inputlable">»Kodeord:</lable>
<input type="password" name="password" class="input"/><br><br>
<input type="submit" name="login" class="submit" value="Login"/><a href="admin.php">Admin</a>
</form> 

hilsen: kim bork
Avatar billede jokerper Nybegynder
06. marts 2010 - 22:49 #1
Så er det nok denne fil du skal lægge ind:

action="pass/login.php"
Avatar billede kimbork Nybegynder
06. marts 2010 - 23:18 #2
<?php
header ("Location: ../info.php");
?>
<?php
session_start();
?>
<? $strTitle="Passwordkontrol med php";?>

<? include("header.inc"); ?>

<body>

<div class="indhold">

<?
$db=mysql_connect("localhost", "xxxx", "xxxx"); mysql_select_db("xxxx");
$result = mysql_query("SELECT NULL FROM users WHERE brugernavn =
'".$_POST['brugernavn']."' AND password = '".$_POST['password']."'") or die
(mysql_error());
if ($antal_raekker=mysql_num_rows($result)>0){
$_SESSION['logget_ind']=1;
  $_SESSION['brugernavn'] = $brugernavn;
  $_SESSION['password'] = $password;

}
else
{
    echo "<h1>Ukorrekt login</h1>
   
    <p>Du skal være logget ind for at se disse sider. <a href=\"../index.php\">Log in</a></p>";
}
?>

</div>

<? include("menu1.inc"); ?>

</body>

</html>
Avatar billede jokerper Nybegynder
07. marts 2010 - 02:18 #3
Så skrive du

<?php
echo $_SESSION['brugernavn'];
?>

<?php tagget - hvis det er i html kode-delen.

Der hvor du gerne vil have det.
Avatar billede jokerper Nybegynder
07. marts 2010 - 02:19 #4
echo $_SESSION['brugernavn'];

der hvor det skal være:
Avatar billede jokerper Nybegynder
07. marts 2010 - 02:33 #5
Jeg lægger et svar hvis du kunne bruge hjælp!!!, god nat!
Avatar billede kimbork Nybegynder
07. marts 2010 - 08:05 #6
her er den login boks taget fra mit index.php
det jeg mener er at jeg vil ha boksen til at vise hvem der er logget ind og en loggud knap. og når man så er logget ud så forsvinder det og så kommer det frem hvor man logger ind. i samme boks hvis det kan lade sig gøre.

hilsen kim bork

<td class="grayheader" style="padding-left:8px;">Login:</td>
      </tr>
      <tr>
        <td class="graybox" valign="top" style="padding:8px;">
<form action="pass/login.php" method="post" class="loginform">
                            <lable class="inputlable">&#187;Brugernavn:</lable>
                            <input type="text" name="brugernavn" class="input"/>
                            <lable class="inputlable">&#187;Kodeord:</lable>
                            <input type="password" name="password" class="input"/><br><br>
                        <input type="submit" name="login" class="submit" value="Login"/><a href="admin.php">Admin</a>
                        </form> 



       
                 
      </td> 
      </tr>
Avatar billede jokerper Nybegynder
07. marts 2010 - 09:49 #7
if ($_SESSION['logget_ind']==1) {
echo $_SESSION['brugernavn'];
?>
<form action="pass/logout.php" method="post" class="loginform">
<input type="submit" name="logud" class="submit" value="Logud"/>
</form>
<?php
} else {
?>
<td class="grayheader" style="padding-left:8px;">Login:</td>
      </tr>
      <tr>
        <td class="graybox" valign="top" style="padding:8px;">
<form action="pass/login.php" method="post" class="loginform">
                            <lable class="inputlable">&#187;Brugernavn:</lable>
                            <input type="text" name="brugernavn" class="input"/>
                            <lable class="inputlable">&#187;Kodeord:</lable>
                            <input type="password" name="password" class="input"/><br><br>
                        <input type="submit" name="login" class="submit" value="Login"/><a href="admin.php">Admin</a>
                        </form>



     
               
      </td>
      </tr>
<?php
}
?>

Noget i denne stil..
Avatar billede kimbork Nybegynder
07. marts 2010 - 10:06 #8
<?php
session_start();
?>
<head>
<SCRIPT LANGUAGE="JavaScript">
<!--
Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=600,left = 570,top = 150');");
}
// En
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>
<!-- Minus AutoDato -->
<meta name="Generator" content="Stone's WebWriter 4">
<link rel="stylesheet" href="css/styles.css" type="text/css" />
</head>
<html>
    <head>
        <title>Kim Bork - Forside</title>
        <link rel="stylesheet" type="text/css" href="css/styles.css">
    </head>
<body>
<br>
<table cellpadding="0" cellspacing="0" border="0" align="center" width="900" class="htable">
<tr>
  <td class="logo">&nbsp;
  </td>       
</tr>
<tr>
  <td class="menubg">
    &nbsp;&nbsp;<a href="index.php" class="menu">Forside</a> &nbsp;&nbsp;<img src="img/menu_splitter.jpg" align="absmiddle">
    &nbsp;&nbsp;<a href="info.php" class="menu">Info</a> &nbsp;&nbsp;<img src="img/menu_splitter.jpg" align="absmiddle">
    &nbsp;&nbsp;<a href="logout.php" class="menu">Logout</a> &nbsp;&nbsp;<img src="img/menu_splitter.jpg" align="absmiddle">
        </td>       
</tr>
<tr>
  <td class="submenu">
  <!-- Fri tekst starter her -->

  <!-- Fri tekst stopper her -->
  </td>       
</tr>
<tr>
  <td class="content">
  <br>
  <table cellpadding="0" cellspacing="0" border="0" align="center" width="100%">
    <tr>
    <td><img src="img/spacer.gif" height="1" width="10"></td>
    <td width="194px" valign="top">
      <table cellpadding="0" cellspacing="0" border="0" align="center" width="194">
      <tr>
        <td class="grayheader" style="padding-left:8px;">Login:</td>
      </tr>
      <tr>
        <td class="graybox" valign="top" style="padding:8px;">
<form action="pass/login.php" method="post" class="loginform">
                            <lable class="inputlable">&#187;Brugernavn:</lable>
                            <input type="text" name="brugernavn" class="input"/>
                            <lable class="inputlable">&#187;Kodeord:</lable>
                            <input type="password" name="password" class="input"/><br><br>
                        <input type="submit" name="login" class="submit" value="Login"/><a href="admin.php">Admin</a>
                        </form> 



       
                 
      </td> 
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td class="blueheader" style="padding-left:8px;">Tom:</td>
      </tr>
      <tr>
        <td class="allbox" valign="top" style="padding:8px;"> 
              Tom!
      </td>     
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
        <tr>
        <td class="redheader" style="padding-left:8px;">Tom:</td>
      </tr>
      <tr>
        <td class="redbox" valign="top" style="padding:8px;">
            Tom!
            </td>
      </tr>
      </table>
    </td>
    <td><img src="img/spacer.gif" height="1" width="5"></td>
    <td width="80%" valign="top">
      <table cellpadding="0" cellspacing="0" border="0" align="center" width="100%">
      <tr>
        <td valign="bottom" align="right"><img src="img/tlc.gif" width="4" height="4"></td>
        <td class="content_top" width="100%"><img src="img/spacer.gif" height="4" width="1"></td>
        <td valign="bottom" align="left"><img src="img/trc.gif" width="4" height="4"></td>
      </tr>
      <tr>
        <td class="content_left">&nbsp;</td>
        <td class="content_text" width="100%" valign="top" style="padding: 10px;">
          <script LANGUAGE="JavaScript"><!--
function Info()
document.writeln(Info())
<!--End-->
</script>

<?php
if (isset($_SESSION["logget_ind"])) {
  echo(<<< EOFILE
    <h1> $strTitle </h1>

    <p>
       
    </p>
EOFILE
  );
  // Det er vigtigt at afslutning af EOFILE ikke er indenteret på nogen måde, hverken med space eller tab
} else echo(
  "<h1>Login!</h1>"
);
?>
          <span class="content_left"></span><br>
        </td>
        <td class="content_right">&nbsp;</td>
      </tr>
      <tr>
        <td valign="bottom" align="right"><img src="img/blc.gif" width="4" height="6"></td>
        <td class="content_bottom" width="100%"><img src="img/spacer.gif" height="1" width="1"></td>
        <td valign="bottom" align="left"><img src="img/brc.gif" width="4" height="6"></td>
      </tr>
      </table>
    </td>
    <td><img src="img/spacer.gif" height="1" width="5"></td>
    <td width="194px" valign="top">
      <table cellpadding="0" cellspacing="0" border="0" align="center" width="194">
      <tr>
        <td class="greenheader" style="padding-left:8px;">Tom:</td>
      </tr>
      <tr>
        <td class="allbox" valign="top" style="padding:8px;">
                            Tom!<br>
                   
                    </td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td class="yellowheader" style="padding-left:8px;">Tom:</td>
      </tr>
      <tr>
        <td class="allbox" valign="top" style="padding:8px;">
        Tom!
        </td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
        <tr>
        <td class="pinkheader" style="padding-left:8px;">Tom:</td>
      </tr>
      <tr>
        <td class="allbox" valign="top" style="padding:8px;">
                    Tom!
      </td>
      </tr>
      </table>
    </td>
    <td><img src="img/spacer.gif" height="1" width="10"></td>
    </tr>
  </table>
  <br>
  </td>       
</tr>
<tr>
  <td class="footer">&nbsp;Kim Bork - Version 1,0
</td>       
</tr>
</table>
</body>
</html>

Kan du ikke sætte det ind i koden for mig :)
Avatar billede kimbork Nybegynder
07. marts 2010 - 18:14 #9
har fået det til at virke den viser bare kun logout knappen og ikke hvem der er online
Avatar billede jokerper Nybegynder
08. marts 2010 - 07:14 #10
Så prøv lige dette

echo $_SESSION['brugernavn'] = "Dit Navn";

der hvor det skal være, se om det virker?
Avatar billede jokerper Nybegynder
08. marts 2010 - 07:15 #11
Så prøv lige dette

$_SESSION['brugernavn'] = "Dit Navn";

echo $_SESSION['brugernavn'];

der hvor det skal være, se om det virker?
Avatar billede kimbork Nybegynder
08. marts 2010 - 08:51 #12
Der er en fejl i det nu, kan du ikke lige prøve at indsætte det?

<?php
session_start();
?>
<head>
<SCRIPT LANGUAGE="JavaScript">
<!--
Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=600,left = 570,top = 150');");
}
// En
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>
<!-- Minus AutoDato -->
<meta name="Generator" content="Stone's WebWriter 4">
<link rel="stylesheet" href="css/styles.css" type="text/css" />
</head>
<html>
    <head>
        <title>Kim Bork - Forside</title>
        <link rel="stylesheet" type="text/css" href="css/styles.css">
    </head>
<body>
<br>
<table cellpadding="0" cellspacing="0" border="0" align="center" width="900" class="htable">
<tr>
  <td class="logo">&nbsp;
  </td>       
</tr>
<tr>
  <td class="menubg">
    &nbsp;&nbsp;<a href="index.php" class="menu">Forside</a> &nbsp;&nbsp;<img src="img/menu_splitter.jpg" align="absmiddle">
    &nbsp;&nbsp;<a href="info.php" class="menu">Info</a> &nbsp;&nbsp;<img src="img/menu_splitter.jpg" align="absmiddle">
        </td>       
</tr>
<tr>
  <td class="submenu">
  <!-- Fri tekst starter her -->

  <!-- Fri tekst stopper her -->
  </td>       
</tr>
<tr>
  <td class="content">
  <br>
  <table cellpadding="0" cellspacing="0" border="0" align="center" width="100%">
    <tr>
    <td><img src="img/spacer.gif" height="1" width="10"></td>
    <td width="194px" valign="top">
      <table cellpadding="0" cellspacing="0" border="0" align="center" width="194">
      <tr>
        <td class="grayheader" style="padding-left:8px;">Login:</td>
      </tr>
      <tr>
        <td class="graybox" valign="top" style="padding:8px;">
<?php
if $_SESSION['brugernavn'] = "Dit Navn";
echo $_SESSION['brugernavn'];
?>
<form action="logout.php" method="post" class="loginform">
<input type="submit" name="logud" class="submit" value="Logud"/>
</form>
<?php
} else {
?>       
<form action="login.php" method="post" class="loginform">
                            <lable class="inputlable">&#187;Brugernavn:</lable>
                            <input type="text" name="brugernavn" class="input"/>
                            <lable class="inputlable">&#187;Kodeord:</lable>
                            <input type="password" name="password" class="input"/><br><br>
                        <input type="submit" name="login" class="submit" value="Login"/><a href="admin.php">Admin</a>
                        </form>
<?php
}
?>
      </td> 
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td class="blueheader" style="padding-left:8px;">Tom:</td>
      </tr>
      <tr>
        <td class="allbox" valign="top" style="padding:8px;"> 
              Tom!
      </td>     
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
        <tr>
        <td class="redheader" style="padding-left:8px;">Tom:</td>
      </tr>
      <tr>
        <td class="redbox" valign="top" style="padding:8px;">
            Tom!
            </td>
      </tr>
      </table>
    </td>
    <td><img src="img/spacer.gif" height="1" width="5"></td>
    <td width="80%" valign="top">
      <table cellpadding="0" cellspacing="0" border="0" align="center" width="100%">
      <tr>
        <td valign="bottom" align="right"><img src="img/tlc.gif" width="4" height="4"></td>
        <td class="content_top" width="100%"><img src="img/spacer.gif" height="4" width="1"></td>
        <td valign="bottom" align="left"><img src="img/trc.gif" width="4" height="4"></td>
      </tr>
      <tr>
        <td class="content_left">&nbsp;</td>
        <td class="content_text" width="100%" valign="top" style="padding: 10px;">
          <script LANGUAGE="JavaScript"><!--
function Info()
document.writeln(Info())
<!--End-->
</script>

<?php
if (isset($_SESSION["logget_ind"])) {
  echo(<<< EOFILE
    <h1> $strTitle </h1>

    <p>

    </p>
EOFILE
  );
  // Det er vigtigt at afslutning af EOFILE ikke er indenteret på nogen måde, hverken med space eller tab
} else echo(
  "<h1>Login!</h1>"
);
?>
          <span class="content_left"></span><br>
        </td>
        <td class="content_right">&nbsp;</td>
      </tr>
      <tr>
        <td valign="bottom" align="right"><img src="img/blc.gif" width="4" height="6"></td>
        <td class="content_bottom" width="100%"><img src="img/spacer.gif" height="1" width="1"></td>
        <td valign="bottom" align="left"><img src="img/brc.gif" width="4" height="6"></td>
      </tr>
      </table>
    </td>
    <td><img src="img/spacer.gif" height="1" width="5"></td>
    <td width="194px" valign="top">
      <table cellpadding="0" cellspacing="0" border="0" align="center" width="194">
      <tr>
        <td class="greenheader" style="padding-left:8px;">Tom:</td>
      </tr>
      <tr>
        <td class="allbox" valign="top" style="padding:8px;">
                            Tom!<br>
                   
                    </td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td class="yellowheader" style="padding-left:8px;">Tom:</td>
      </tr>
      <tr>
        <td class="allbox" valign="top" style="padding:8px;">
        Tom!
        </td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
        <tr>
        <td class="pinkheader" style="padding-left:8px;">Tom:</td>
      </tr>
      <tr>
        <td class="allbox" valign="top" style="padding:8px;">
                    Tom!
      </td>
      </tr>
      </table>
    </td>
    <td><img src="img/spacer.gif" height="1" width="10"></td>
    </tr>
  </table>
  <br>
  </td>       
</tr>
<tr>
  <td class="footer">&nbsp;Kim Bork - Version 1,0
</td>       
</tr>
</table>
</body>
</html>
Avatar billede jokerper Nybegynder
08. marts 2010 - 17:09 #13
<?php
session_start();
?>
<head>
<SCRIPT LANGUAGE="JavaScript">
<!--
Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=600,left = 570,top = 150');");
}
// En
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>
<!-- Minus AutoDato -->
<meta name="Generator" content="Stone's WebWriter 4">
<link rel="stylesheet" href="css/styles.css" type="text/css" />
</head>
<html>
    <head>
        <title>Kim Bork - Forside</title>
        <link rel="stylesheet" type="text/css" href="css/styles.css">
    </head>
<body>
<br>
<table cellpadding="0" cellspacing="0" border="0" align="center" width="900" class="htable">
<tr>
  <td class="logo">&nbsp;
  </td>     
</tr>
<tr>
  <td class="menubg">
    &nbsp;&nbsp;<a href="index.php" class="menu">Forside</a> &nbsp;&nbsp;<img src="img/menu_splitter.jpg" align="absmiddle">
    &nbsp;&nbsp;<a href="info.php" class="menu">Info</a> &nbsp;&nbsp;<img src="img/menu_splitter.jpg" align="absmiddle">
        </td>     
</tr>
<tr>
  <td class="submenu">
  <!-- Fri tekst starter her -->

  <!-- Fri tekst stopper her -->
  </td>     
</tr>
<tr>
  <td class="content">
  <br>
  <table cellpadding="0" cellspacing="0" border="0" align="center" width="100%">
    <tr>
    <td><img src="img/spacer.gif" height="1" width="10"></td>
    <td width="194px" valign="top">
      <table cellpadding="0" cellspacing="0" border="0" align="center" width="194">
      <tr>
        <td class="grayheader" style="padding-left:8px;">Login:</td>
      </tr>
      <tr>
        <td class="graybox" valign="top" style="padding:8px;">


<?php
if $_SESSION['logget_ind']==1 {
$_SESSION['brugernavn'] = "Dit Navn";
echo $_SESSION['brugernavn'];
?>
<form action="logout.php" method="post" class="loginform">
<input type="submit" name="logud" class="submit" value="Logud"/>
</form>
<?php
} else {
?>     
<form action="login.php" method="post" class="loginform">
                            <lable class="inputlable">&#187;Brugernavn:</lable>
                            <input type="text" name="brugernavn" class="input"/>
                            <lable class="inputlable">&#187;Kodeord:</lable>
                            <input type="password" name="password" class="input"/><br><br>
                        <input type="submit" name="login" class="submit" value="Login"/><a href="admin.php">Admin</a>
                        </form>
<?php
}
?>
      </td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td class="blueheader" style="padding-left:8px;">Tom:</td>
      </tr>
      <tr>
        <td class="allbox" valign="top" style="padding:8px;">
              Tom!
      </td>   
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
        <tr>
        <td class="redheader" style="padding-left:8px;">Tom:</td>
      </tr>
      <tr>
        <td class="redbox" valign="top" style="padding:8px;">
            Tom!
            </td>
      </tr>
      </table>
    </td>
    <td><img src="img/spacer.gif" height="1" width="5"></td>
    <td width="80%" valign="top">
      <table cellpadding="0" cellspacing="0" border="0" align="center" width="100%">
      <tr>
        <td valign="bottom" align="right"><img src="img/tlc.gif" width="4" height="4"></td>
        <td class="content_top" width="100%"><img src="img/spacer.gif" height="4" width="1"></td>
        <td valign="bottom" align="left"><img src="img/trc.gif" width="4" height="4"></td>
      </tr>
      <tr>
        <td class="content_left">&nbsp;</td>
        <td class="content_text" width="100%" valign="top" style="padding: 10px;">
          <script LANGUAGE="JavaScript"><!--
function Info()
document.writeln(Info())
<!--End-->
</script>

<?php
if (isset($_SESSION["logget_ind"])) {
  echo(<<< EOFILE
    <h1> $strTitle </h1>

    <p>

    </p>
EOFILE
  );
  // Det er vigtigt at afslutning af EOFILE ikke er indenteret på nogen måde, hverken med space eller tab
} else echo(
  "<h1>Login!</h1>"
);
?>
          <span class="content_left"></span><br>
        </td>
        <td class="content_right">&nbsp;</td>
      </tr>
      <tr>
        <td valign="bottom" align="right"><img src="img/blc.gif" width="4" height="6"></td>
        <td class="content_bottom" width="100%"><img src="img/spacer.gif" height="1" width="1"></td>
        <td valign="bottom" align="left"><img src="img/brc.gif" width="4" height="6"></td>
      </tr>
      </table>
    </td>
    <td><img src="img/spacer.gif" height="1" width="5"></td>
    <td width="194px" valign="top">
      <table cellpadding="0" cellspacing="0" border="0" align="center" width="194">
      <tr>
        <td class="greenheader" style="padding-left:8px;">Tom:</td>
      </tr>
      <tr>
        <td class="allbox" valign="top" style="padding:8px;">
                            Tom!<br>
                 
                    </td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td class="yellowheader" style="padding-left:8px;">Tom:</td>
      </tr>
      <tr>
        <td class="allbox" valign="top" style="padding:8px;">
        Tom!
        </td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
        <tr>
        <td class="pinkheader" style="padding-left:8px;">Tom:</td>
      </tr>
      <tr>
        <td class="allbox" valign="top" style="padding:8px;">
                    Tom!
      </td>
      </tr>
      </table>
    </td>
    <td><img src="img/spacer.gif" height="1" width="10"></td>
    </tr>
  </table>
  <br>
  </td>     
</tr>
<tr>
  <td class="footer">&nbsp;Kim Bork - Version 1,0
</td>     
</tr>
</table>
</body>
</html>




-------------------
Prøv lige dette
-----------
Avatar billede kimbork Nybegynder
08. marts 2010 - 17:25 #14
Det virker ikke :(
Avatar billede jokerper Nybegynder
08. marts 2010 - 17:32 #15
Hvad sker der???

Den viser vel, "dit navn" et eller andet sted, ik´
Avatar billede kimbork Nybegynder
08. marts 2010 - 17:40 #16
nej den viser Parse error: syntax error, unexpected T_VARIABLE, expecting '(' in /usr/home/whitehat/users/kbork/index.php on line 65
Avatar billede jokerper Nybegynder
08. marts 2010 - 18:12 #17
Så prøv nu...


<?php
session_start();
?>
<head>
<SCRIPT LANGUAGE="JavaScript">
<!--
Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=600,left = 570,top = 150');");
}
// En
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>
<!-- Minus AutoDato -->
<meta name="Generator" content="Stone's WebWriter 4">
<link rel="stylesheet" href="css/styles.css" type="text/css" />
</head>
<html>
    <head>
        <title>Kim Bork - Forside</title>
        <link rel="stylesheet" type="text/css" href="css/styles.css">
    </head>
<body>
<br>
<table cellpadding="0" cellspacing="0" border="0" align="center" width="900" class="htable">
<tr>
  <td class="logo">&nbsp;
  </td>   
</tr>
<tr>
  <td class="menubg">
    &nbsp;&nbsp;<a href="index.php" class="menu">Forside</a> &nbsp;&nbsp;<img src="img/menu_splitter.jpg" align="absmiddle">
    &nbsp;&nbsp;<a href="info.php" class="menu">Info</a> &nbsp;&nbsp;<img src="img/menu_splitter.jpg" align="absmiddle">
        </td>   
</tr>
<tr>
  <td class="submenu">
  <!-- Fri tekst starter her -->

  <!-- Fri tekst stopper her -->
  </td>   
</tr>
<tr>
  <td class="content">
  <br>
  <table cellpadding="0" cellspacing="0" border="0" align="center" width="100%">
    <tr>
    <td><img src="img/spacer.gif" height="1" width="10"></td>
    <td width="194px" valign="top">
      <table cellpadding="0" cellspacing="0" border="0" align="center" width="194">
      <tr>
        <td class="grayheader" style="padding-left:8px;">Login:</td>
      </tr>
      <tr>
        <td class="graybox" valign="top" style="padding:8px;">


<?php
if ($_SESSION['logget_ind']==1) {
$_SESSION['brugernavn'] = "Dit Navn";
echo $_SESSION['brugernavn'];
?>
<form action="logout.php" method="post" class="loginform">
<input type="submit" name="logud" class="submit" value="Logud"/>
</form>
<?php
} else {
?>   
<form action="login.php" method="post" class="loginform">
                            <lable class="inputlable">&#187;Brugernavn:</lable>
                            <input type="text" name="brugernavn" class="input"/>
                            <lable class="inputlable">&#187;Kodeord:</lable>
                            <input type="password" name="password" class="input"/><br><br>
                        <input type="submit" name="login" class="submit" value="Login"/><a href="admin.php">Admin</a>
                        </form>
<?php
}
?>
      </td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td class="blueheader" style="padding-left:8px;">Tom:</td>
      </tr>
      <tr>
        <td class="allbox" valign="top" style="padding:8px;">
              Tom!
      </td> 
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
        <tr>
        <td class="redheader" style="padding-left:8px;">Tom:</td>
      </tr>
      <tr>
        <td class="redbox" valign="top" style="padding:8px;">
            Tom!
            </td>
      </tr>
      </table>
    </td>
    <td><img src="img/spacer.gif" height="1" width="5"></td>
    <td width="80%" valign="top">
      <table cellpadding="0" cellspacing="0" border="0" align="center" width="100%">
      <tr>
        <td valign="bottom" align="right"><img src="img/tlc.gif" width="4" height="4"></td>
        <td class="content_top" width="100%"><img src="img/spacer.gif" height="4" width="1"></td>
        <td valign="bottom" align="left"><img src="img/trc.gif" width="4" height="4"></td>
      </tr>
      <tr>
        <td class="content_left">&nbsp;</td>
        <td class="content_text" width="100%" valign="top" style="padding: 10px;">
          <script LANGUAGE="JavaScript"><!--
function Info()
document.writeln(Info())
<!--End-->
</script>

<?php
if (isset($_SESSION["logget_ind"])) {
  echo(<<< EOFILE
    <h1> $strTitle </h1>

    <p>

    </p>
EOFILE
  );
  // Det er vigtigt at afslutning af EOFILE ikke er indenteret på nogen måde, hverken med space eller tab
} else echo(
  "<h1>Login!</h1>"
);
?>
          <span class="content_left"></span><br>
        </td>
        <td class="content_right">&nbsp;</td>
      </tr>
      <tr>
        <td valign="bottom" align="right"><img src="img/blc.gif" width="4" height="6"></td>
        <td class="content_bottom" width="100%"><img src="img/spacer.gif" height="1" width="1"></td>
        <td valign="bottom" align="left"><img src="img/brc.gif" width="4" height="6"></td>
      </tr>
      </table>
    </td>
    <td><img src="img/spacer.gif" height="1" width="5"></td>
    <td width="194px" valign="top">
      <table cellpadding="0" cellspacing="0" border="0" align="center" width="194">
      <tr>
        <td class="greenheader" style="padding-left:8px;">Tom:</td>
      </tr>
      <tr>
        <td class="allbox" valign="top" style="padding:8px;">
                            Tom!<br>
               
                    </td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td class="yellowheader" style="padding-left:8px;">Tom:</td>
      </tr>
      <tr>
        <td class="allbox" valign="top" style="padding:8px;">
        Tom!
        </td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
        <tr>
        <td class="pinkheader" style="padding-left:8px;">Tom:</td>
      </tr>
      <tr>
        <td class="allbox" valign="top" style="padding:8px;">
                    Tom!
      </td>
      </tr>
      </table>
    </td>
    <td><img src="img/spacer.gif" height="1" width="10"></td>
    </tr>
  </table>
  <br>
  </td>   
</tr>
<tr>
  <td class="footer">&nbsp;Kim Bork - Version 1,0
</td>   
</tr>
</table>
</body>
</html>
Avatar billede jokerper Nybegynder
08. marts 2010 - 18:12 #18
Jeg glemte lige "( )"

if ($_SESSION['logget_ind']==1) {
Avatar billede kimbork Nybegynder
08. marts 2010 - 18:44 #19
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /usr/home/whitehat/users/kbork/login.php on line 139
Avatar billede kimbork Nybegynder
08. marts 2010 - 18:45 #20
Kan du lige se hvad der er galt her?

<?php
header ("Location: index.php");
?>
<?php
session_start();
?>
<head>
<SCRIPT LANGUAGE="JavaScript">
<!--
Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=600,left = 570,top = 150');");
}
// En
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>
<!-- Minus AutoDato -->
<meta name="Generator" content="Stone's WebWriter 4">
<link rel="stylesheet" href="css/styles.css" type="text/css" />
</head>
<html>
    <head>
        <title>Kim Bork - login</title>
        <link rel="stylesheet" type="text/css" href="css/styles.css">
    </head>
<body>
<br>
<table cellpadding="0" cellspacing="0" border="0" align="center" width="900" class="htable">
<tr>
  <td class="logo">&nbsp;
  </td>       
</tr>
<tr>
  <td class="menubg">
    &nbsp;&nbsp;<a href="index.php" class="menu">Forside</a> &nbsp;&nbsp;<img src="img/menu_splitter.jpg" align="absmiddle">
    &nbsp;&nbsp;<a href="info.php" class="menu">Info</a> &nbsp;&nbsp;<img src="img/menu_splitter.jpg" align="absmiddle">
        </td>       
</tr>
<tr>
  <td class="submenu">
  <!-- Fri tekst starter her -->

  <!-- Fri tekst stopper her -->
  </td>       
</tr>
<tr>
  <td class="content">
  <br>
  <table cellpadding="0" cellspacing="0" border="0" align="center" width="100%">
    <tr>
    <td><img src="img/spacer.gif" height="1" width="10"></td>
    <td width="194px" valign="top">
      <table cellpadding="0" cellspacing="0" border="0" align="center" width="194">
      <tr>
        <td class="grayheader" style="padding-left:8px;">Login:</td>
      </tr>
      <tr>
        <td class="graybox" valign="top" style="padding:8px;">
<?php
if ($_SESSION['logget_ind']==1) {
echo $_SESSION['brugernavn'];
?>
<form action="logout.php" method="post" class="loginform">
<input type="submit" name="logud" class="submit" value="Logud"/>
</form>
<?php
} else {
?>       
<form action="login.php" method="post" class="loginform">
                            <lable class="inputlable">&#187;Brugernavn:</lable>
                            <input type="text" name="brugernavn" class="input"/>
                            <lable class="inputlable">&#187;Kodeord:</lable>
                            <input type="password" name="password" class="input"/><br><br>
                        <input type="submit" name="login" class="submit" value="Login"/><a href="admin.php">Admin</a>
                        </form>
<?php
}
?>
      </td> 
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td class="blueheader" style="padding-left:8px;">Tom:</td>
      </tr>
      <tr>
        <td class="allbox" valign="top" style="padding:8px;"> 
              Tom!
      </td>     
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
        <tr>
        <td class="redheader" style="padding-left:8px;">Tom:</td>
      </tr>
      <tr>
        <td class="redbox" valign="top" style="padding:8px;">
            Tom!
            </td>
      </tr>
      </table>
    </td>
    <td><img src="img/spacer.gif" height="1" width="5"></td>
    <td width="80%" valign="top">
      <table cellpadding="0" cellspacing="0" border="0" align="center" width="100%">
      <tr>
        <td valign="bottom" align="right"><img src="img/tlc.gif" width="4" height="4"></td>
        <td class="content_top" width="100%"><img src="img/spacer.gif" height="4" width="1"></td>
        <td valign="bottom" align="left"><img src="img/trc.gif" width="4" height="4"></td>
      </tr>
      <tr>
        <td class="content_left">&nbsp;</td>
        <td class="content_text" width="100%" valign="top" style="padding: 10px;">
          <script LANGUAGE="JavaScript"><!--
function Info()
document.writeln(Info())
<!--End-->
</script>

<?php
if (isset($_SESSION["logget_ind"])) {
  echo(<<< EOFILE
    <h1> $strTitle </h1>

    <p>
<div class="indhold">

<?
$db=mysql_connect("localhost", "xxxx", "xxxx"); mysql_select_db("xxxx");
$result = mysql_query("SELECT NULL FROM users WHERE brugernavn =
'".$_POST['brugernavn']."' AND password = '".$_POST['password']."'") or die
(mysql_error());
if ($antal_raekker=mysql_num_rows($result)>0){
$_SESSION['logget_ind']=1;
  $_SESSION['brugernavn'] = $brugernavn;
  $_SESSION['password'] = $password;

}
else
{
    echo "<h1>Ukorrekt login</h1>
   
    <p>Du skal være logget ind for at se disse sider. <a href=\"index.php\">Log in</a></p>";
}
?>

</div> 
    </p>
EOFILE
  );
  // Det er vigtigt at afslutning af EOFILE ikke er indenteret på nogen måde, hverken med space eller tab
} else echo(
  "<h1>Login!</h1>"
);
?>
          <span class="content_left"></span><br>
        </td>
        <td class="content_right">&nbsp;</td>
      </tr>
      <tr>
        <td valign="bottom" align="right"><img src="img/blc.gif" width="4" height="6"></td>
        <td class="content_bottom" width="100%"><img src="img/spacer.gif" height="1" width="1"></td>
        <td valign="bottom" align="left"><img src="img/brc.gif" width="4" height="6"></td>
      </tr>
      </table>
    </td>
    <td><img src="img/spacer.gif" height="1" width="5"></td>
    <td width="194px" valign="top">
      <table cellpadding="0" cellspacing="0" border="0" align="center" width="194">
      <tr>
        <td class="greenheader" style="padding-left:8px;">Tom:</td>
      </tr>
      <tr>
        <td class="allbox" valign="top" style="padding:8px;">
                            Tom!<br>
                   
                    </td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td class="yellowheader" style="padding-left:8px;">Tom:</td>
      </tr>
      <tr>
        <td class="allbox" valign="top" style="padding:8px;">
        Tom!
        </td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
        <tr>
        <td class="pinkheader" style="padding-left:8px;">Tom:</td>
      </tr>
      <tr>
        <td class="allbox" valign="top" style="padding:8px;">
                    Tom!
      </td>
      </tr>
      </table>
    </td>
    <td><img src="img/spacer.gif" height="1" width="10"></td>
    </tr>
  </table>
  <br>
  </td>       
</tr>
<tr>
  <td class="footer">&nbsp;Kim Bork - Version 1,0
</td>       
</tr>
</table>
</body>
</html>
Avatar billede jokerper Nybegynder
08. marts 2010 - 19:20 #21
<?php
if (isset($_SESSION["logget_ind"])) {
  echo(<<< EOFILE
    <h1> $strTitle </h1>
?>
    <p>
<div class="indhold">

<?php
Avatar billede jokerper Nybegynder
08. marts 2010 - 19:22 #22
Sådan ser mest korrekt ud:

<?php
if (isset($_SESSION["logget_ind"])) {
  echo(<<< EOFILE
    echo "<h1>". $strTitle ."</h1>";
?>
    <p>
<div class="indhold">

<?php
Avatar billede kimbork Nybegynder
08. marts 2010 - 21:27 #23
Så virker det men der står bare "Dit Navn" der står ikke hvem der er logget ind.
Avatar billede jokerper Nybegynder
08. marts 2010 - 21:39 #24
Så er det her

<?php
if $_SESSION['logget_ind']==1 {
$_SESSION['brugernavn'] = "Dit Navn";
echo $_SESSION['brugernavn'];
?>

skal være

<?php
if $_SESSION['logget_ind']==1 {
echo $_SESSION['brugernavn'];
?>

Så må du jo finde ud af hvorfor din session ikke bliver sat hvis det ikke virker...
Avatar billede jokerper Nybegynder
08. marts 2010 - 21:43 #25
$result = mysql_query("SELECT NULL FROM users WHERE brugernavn =
'".$_POST['brugernavn']."' AND password = '".$_POST['password']."'") or die
(mysql_error());
if ($antal_raekker=mysql_num_rows($result)>0){
$_SESSION['logget_ind']=1;
  $_SESSION['brugernavn'] = $brugernavn;
  $_SESSION['password'] = $password;


Skal være



$result = mysql_query("SELECT NULL FROM users WHERE brugernavn =
'".$_POST['brugernavn']."' AND password = '".$_POST['password']."'") or die
(mysql_error());
if ($antal_raekker=mysql_num_rows($result)>0){
$_SESSION['logget_ind']=1;
  $_SESSION['brugernavn'] = $_POST['brugernavn'];
  $_SESSION['password'] = $_POST['password'];
Avatar billede kimbork Nybegynder
08. marts 2010 - 22:13 #26
Mange tak for hjælpen :)

Du fortjener dine point :D
Avatar billede jokerper Nybegynder
09. marts 2010 - 00:29 #27
okay, tak...
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester