[PHP] Opbouw code Login-page

Pagina: 1
Acties:
  • 33 views sinds 30-01-2008

  • Janusch
  • Registratie: Mei 2005
  • Laatst online: 12:18
Ik ben bezig met een loginscherm (php) en heb al wat opgezocht (en wat gevonden dacht ik):
  1. <?
  2. function isLogged($LogInPage)
  3. {
  4. //Without this, PHP will create a local
  5. //variable called $HTTP_COOKIE_VARS.
  6. global $HTTP_COOKIE_VARS;
  7. $Host = "localhost";
  8. $Entered_UserName = "";
  9. $Entered_PassWord = "";
  10. if(isset($HTTP_COOKIE_VARS["UserName"]) &&
  11. isset($HTTP_COOKIE_VARS["PassWord"]))
  12. {
  13. $Entered_UserName = $HTTP_COOKIE_VARS["UserName"];
  14. $Entered_PassWord = $HTTP_COOKIE_VARS["PassWord"];
  15. }
  16. //I'm assuming that empty string user names and passwords are a no no.
  17. if(@mysql_connect($Host, $Entered_UserName, $Entered_PassWord) === false ||
  18. ($Entered_UserName == "" || $Entered_PassWord == ""))
  19. {
  20. //$LogInPage should be the name of an existing file
  21. //with alternative web content. If you don't wish to
  22. //provide such content, just pass the empty string.
  23. if($LogInPage != "") include($LogInPage);
  24. return(false);
  25. }
  26. else
  27. return(true);
  28. }
  29. ?>
en:
  • [list=1]
  • <form name="login">
  • <table align="center" cellpadding="10" cellspacing="0" border="1">
  • <tr>
  • <td>User Name </td>
  • <td><input type="text" name="UserName" /></td>
  • </tr>
  • <tr>
  • <td>Password</td>
  • <td><input type="password" name="PassWord" /></td>
  • </tr>
  • <tr>
  • <td colspan="2" align="right">
  • <input type="button" value="log in"
  • onclick="document.cookie = 'UserName=' + document.login.UserName.value;
  • document.cookie = 'PassWord=' + document.login.PassWord.value;
  • document.EmptyForm.submit();">
  • </td>
  • </tr>
  • </table>
  • </form>
  • <form name="EmptyForm" method="post">
  • </form>
  • [/list]
Dat laatste is voor de knoppen enzo dacht ik. Ik heb een apache, mysql,php en ftp server maar weet iemand hoe je de code opbouw om in te loggen? ik heb dit geprobeerd maar als je dan op login druk gebeurt er niks.

[ Voor 13% gewijzigd door Janusch op 11-06-2006 13:46 ]


  • XWB
  • Registratie: Januari 2002
  • Niet online

XWB

Devver
$HTTP_COOKIE_VARS["UserName"];
:X => P&W FAQ - PHP

March of the Eagles


  • Erkens
  • Registratie: December 2001
  • Niet online

Erkens

Fotograaf

Welke PHP versie gaat het over, want als ik "$HTTP_COOKIE_VARS" zie dan moet het wel een erg oude versie zijn.

offtopic:
verder is het handiger om gebruik te maken van [code=php][/code] tags om je code weer te geven

  • Janusch
  • Registratie: Mei 2005
  • Laatst online: 12:18
Erkens schreef op zondag 11 juni 2006 @ 13:48:
Welke PHP versie gaat het over, want als ik "$HTTP_COOKIE_VARS" zie dan moet het wel een erg oude versie zijn.

offtopic:
verder is het handiger om gebruik te maken van [code=php][/code] tags om je code weer te geven
Ik gebruik XAMPP maar dit heb ik van http://scripts.franciscocharrua.com/mysql-login.php gehaald waar kan ik zien welke php versie ik gebruik?

  • XWB
  • Registratie: Januari 2002
  • Niet online

XWB

Devver
PHP:
1
phpinfo();


;)

March of the Eagles


  • NMe
  • Registratie: Februari 2004
  • Laatst online: 22-01 23:51

NMe

Quia Ego Sic Dico.

Wij gaan je niet helpen met het fixen van andermans script. Mail daar de maker maar voor. GoT is geen quickfix.

We hebben trouwens ook gewoon [code]-tags. :X

'E's fighting in there!' he stuttered, grabbing the captain's arm.
'All by himself?' said the captain.
'No, with everyone!' shouted Nobby, hopping from one foot to the other.

Pagina: 1

Dit topic is gesloten.