Simpele ledensysteem

Gestart doorShahiem13 reacties50 weergaven

14 berichten · pagina 1 van 1

Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Wie heeft een gratis simpele ledensysteem waarmee ik kan experimenteren voor mijn Harry Potter site.

Het moet hebben:
- Registreren
- Login

Voor de rest doe ik het zelf smile
0
Berichten
5.795
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
ik kan er wel 1 voor je scripten
maar moeten de wachtwoorden dan md5 hashed?
0
Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ja smile Is goed Daimanbiggrin
0
Berichten
5.795
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
config.php
[COLOR= #0000BB]<?PHP

$server[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"localhost"[/COLOR][COLOR= #007700];[/COLOR]  [COLOR= #FF8000]//server[/COLOR]
[COLOR= #0000BB]$gebruiker[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"root"[/COLOR][COLOR= #007700];[/COLOR]  [COLOR= #FF8000]//gebruikersnaam[/COLOR]
[COLOR= #0000BB]$wachtwoord[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700];[/COLOR]  [COLOR= #FF8000]//wachtwoord[/COLOR]
[COLOR= #0000BB]$db[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700];[/COLOR]  [COLOR= #FF8000]//database[/COLOR]

[COLOR= #0000BB]$connectie[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_connect"]mysql_connect[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$server[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$gebruiker[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$wachtwoord[/COLOR][COLOR= #007700])[/COLOR]  
   or [URL="http://www.php.net/die"]die[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]"Kon niet connecteren met de server"[/COLOR][COLOR= #007700]);[/COLOR]  
[URL="http://www.php.net/mysql_select_db"]mysql_select_db[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$db[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$connectie[/COLOR][COLOR= #007700])[/COLOR]  
   or [URL="http://www.php.net/die"]die[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]"Kon de database niet selecteren"[/COLOR][COLOR= #007700]);[/COLOR]  
?>


login.php

<form name="form1" action="login1.php" method="post"> 
Naam: <input type="text" name="user" maxlength="30"><br /> 
Wachtwoord: <input name="wachtwoord" type="password" id="wachtwoord" maxlength="16"> 
<input type="submit" 

value="Login!"> 
</form>


login1.php

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/session_start"]session_start[/URL][COLOR= #007700]();[/COLOR]

[URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]config.php[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$user[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]user[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$wachtwoord[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/md5"]md5[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord[/COLOR][COLOR= #007700]]);[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$user[/COLOR] [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$wachtwoord[/COLOR][COLOR= #007700])
{[/COLOR]
   
    
    [COLOR= #0000BB]$query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/sprintf"]sprintf[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT user, wachtwoord FROM gebruikers WHERE `user`=%s AND `wachtwoord`=%s"[/COLOR][COLOR= #007700],[/COLOR]
    [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$user[/COLOR][COLOR= #007700]),[/COLOR]
    [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$wachtwoord[/COLOR][COLOR= #007700]));[/COLOR]
    
    [COLOR= #0000BB]$rows[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$query[/COLOR][COLOR= #007700]);[/COLOR]

    [COLOR= #0000BB]$numrows[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$rows[/COLOR][COLOR= #007700]);[/COLOR] 

    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$numrows[/COLOR][COLOR= #007700])
    {[/COLOR]
        [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$rows[/COLOR][COLOR= #007700]))
        {[/COLOR]
            [COLOR= #0000BB]$dbusername[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]user[/COLOR][COLOR= #007700]];[/COLOR]
            [COLOR= #0000BB]$dbpassword[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord[/COLOR][COLOR= #007700]];
           
        }[/COLOR]
        
            [URL="http://www.php.net/header"]header[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"Location: members.php"[/COLOR][COLOR= #007700]);[/COLOR] 
            
        [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]]=[/COLOR][COLOR= #0000BB]$dbusername[/COLOR][COLOR= #007700];
    }[/COLOR]
    [URL="http://www.php.net/else"]else[/URL]
        [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"Gebruikersnaam of wachtwoord is verkeerd!"[/COLOR][COLOR= #007700]);
}[/COLOR]
?>


registreer.php

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/session_start"]session_start[/URL][COLOR= #007700]( );[/COLOR]
[COLOR= #0000BB]$user[/COLOR][COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR]user[COLOR= #007700]];[/COLOR]
[URL="http://www.php.net/session_register"]session_register[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]"user"[/COLOR][COLOR= #007700]);[/COLOR]
?>


            [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR]user[COLOR= #007700]]) {[/COLOR][URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Je hebt al ingelogd op een account![/COLOR][COLOR= #007700];}[/COLOR] ?>
          [COLOR= #0000BB]<?[/COLOR]
[URL="http://www.php.net/require"]require[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"config.php"[/COLOR][COLOR= #007700]);[/COLOR]
?>
Velden met een * zijn verplicht...
<form method="POST" action="?id=1">
Email adres:<br>
  <input type="text" name="email" size="30"> *<br>
  <br>
  Gewenste gebruikersnaam:<br>
  <input type="text" name="gebruikersnaam" size="25"> *<br>
  Wachtwoord:<br>
  <input type="password" name="wachtwoord" size="12" maxlength="12"> *<br>
  Wachtwoord [ bevestig ]:<br>
  <input type="password" name="wachtwoord2" size="12" maxlength="12"> *<br>
  <input type="submit" value="Aanmelden"> <input type="reset" value="Wis velden"></p>
</form>
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR]id[COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]1[/COLOR][COLOR= #007700]){[/COLOR]
[URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]config.php[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$genre[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"gebruikers"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]//tabel[/COLOR]
[COLOR= #0000BB]$ww01[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/md5"]md5[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord[/COLOR][COLOR= #007700]]);[/COLOR]



[COLOR= #0000BB]$genreSOORT[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]];[/COLOR]



[COLOR= #0000BB]$sqlqueryGENRE[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"INSERT INTO gebruikers(user,email,wachtwoord) VALUES("[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]","[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]","[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$ww01[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]")"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$sqlqueryCHECK[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"SELECT user FROM $genre WHERE user ="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700];[/COLOR]




[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sqlqueryCHECK[/COLOR][COLOR= #007700])) <[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]){[/COLOR]
    [COLOR= #0000BB]$resultsGENRE[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sqlqueryGENRE[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR]gebruikersnaam[COLOR= #007700]];[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000] is aangemaakt[/COLOR][COLOR= #007700];
}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Dit Lid bestaad al!!"[/COLOR][COLOR= #007700];
}[/COLOR]

    [COLOR= #FF8000]//$IDGenre = mysql_insert_id();
    //echo "Laatste ID_genre: ".$IDGenre." ";[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<p>&nbsp;</p>"[/COLOR][COLOR= #007700];




    

}[/COLOR]
?>


sql

-- phpMyAdmin SQL Dump
-- version 3.2.4
-- http://www.phpmyadmin.net
--
-- Machine: localhost
-- Genereertijd: 20 Mar 2010 om 16:56
-- Serverversie: 5.1.41
-- PHP-Versie: 5.3.1

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `test`
--

-- --------------------------------------------------------

--
-- Tabelstructuur voor tabel `gebruikers`
--

CREATE TABLE IF NOT EXISTS `gebruikers` (
  `user` varchar(255) NOT NULL,
  `wachtwoord` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Gegevens worden uitgevoerd voor tabel `gebruikers`
--


/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;


succes er mee
login.php is niet bepaald xhtml valid maar was even snel getyped
en hij werkt met md5 hash wink
0
Erik

Lid

Berichten
7.109
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
PHPMyLogon?
0
Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Daiman, vind het niet zo netjes geschreven. Weet iemand waar ik de oude gls1 nog van kan halen?
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Shahiem schreef:
Daiman, vind het niet zo netjes geschreven. Weet iemand waar ik de oude gls1 nog van kan halen?
Ja dat weet ik, van mijn localhost schater
0
Berichten
1.544
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Maar die mogen wij dus niet cry
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
GLS1:
baseldekker.prutz0r.nl/leden/leden.zip
0
Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dankjewel smile
0
Berichten
6.144
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Volgens mij mag die niet gereleased worden, Rik heeft m toch niet voor niks weg gehaald?
0
Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
We zullen afwachten op zijn reactie.
0
Berichten
1.314
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
hij werkt niet helemaal lekker dat systeemwink hij redirect niet door(kan je wel zelf makkelijk aanpassen maar alsnog) en sommige dingen werken niet helemaal goed.

kenzo
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Nick had via PB toestemming gevraagd hoor smile
EN het was een van mijn eerste "grootte" scripts, verwacht er dus niet teveel van.
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren