Naam van ingelogde Beheerde lukt me niet.

Gestart doorAdmir3 reacties33 weergaven

4 berichten · pagina 1 van 1

Admir

Lid · Topicstarter

Berichten
1.950
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hey na het inloggen zie ik dan de naam Hey admir welkom blabla.

Ben nou even nieuwe script aan het maken, voor me site. je ziet hier de script http://straat-power.nl/admin/test.php Ik wil onder "Artiest:" (daar zie je
0
Berichten
5.957
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Wat wil je nu want ik snap het niet helemaalbloos
* edit * Ik denk dat ik het snap dus ik ga even kijken naar je script.

Heb je mischien een login?
0
Admir

Lid · Topicstarter

Berichten
1.950
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
yup

[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= #007700]([/COLOR][COLOR= #DD0000]../config.php[/COLOR][COLOR= #007700]);[/COLOR]
?>
<html>
<head>
<link rel="stylesheet" href="../style.css" type="text/css" />
<title>Beheerpagina - Inloggen</title>
</head>
<body>
[COLOR= #0000BB]<?php[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]login[/COLOR][COLOR= #007700]]))[/COLOR] [COLOR= #FF8000]//Als er op Inloggen is geklikt[/COLOR]
[COLOR= #007700]{[/COLOR]
    
    [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]] =[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]]);[/COLOR]
    [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]] =[/COLOR] [URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]]);[/COLOR]
    
    [COLOR= #FF8000]//Check of de gebruikersnaam bestaat[/COLOR]
    [COLOR= #0000BB]$gebruikersnaam_check[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"
    
        SELECT
            gebruikersnaam
        FROM
            beheerders
        WHERE 
            gebruikersnaam = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"
        LIMIT 1
    
    "[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][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][COLOR= #0000BB]$gebruikersnaam_check[/COLOR][COLOR= #007700]) >=[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700])[/COLOR] [COLOR= #FF8000]//Als de gebruikersnaam niet bestaat[/COLOR]
    [COLOR= #007700]{[/COLOR]
        
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Deze gebruikersnaam komt niet voor in onze database.<br />
        <a href="inloggen.php">Klik hier om terug te gaan</a>."[/COLOR][COLOR= #007700];
        
    }[/COLOR]
    [URL="http://www.php.net/else"]else[/URL] [COLOR= #FF8000]//Als de gebruikersnaam we bestaat[/COLOR]
    [COLOR= #007700]{[/COLOR]
        
        [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord[/COLOR][COLOR= #007700]] =[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord[/COLOR][COLOR= #007700]]);[/COLOR]
        [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord[/COLOR][COLOR= #007700]] =[/COLOR] [URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord[/COLOR][COLOR= #007700]]);[/COLOR]
        
        [COLOR= #FF8000]//Check of de gebruikersnaam en het wachtwoord met elkaar overeenkomen in de database[/COLOR]
        [COLOR= #0000BB]$wachtwoord_check[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"
        
            SELECT
                id,
                                gebruikersnaam,
                                wachtwoord
            FROM
                beheerders
            WHERE 
                gebruikersnaam = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"
            AND
                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][COLOR= #DD0000]"
            LIMIT 1
        
        "[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][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][COLOR= #0000BB]$gebruikersnaam_check[/COLOR][COLOR= #007700]))[/COLOR] [COLOR= #FF8000]//Als de gebruikersnaam en het wachtwoord niet overeenkomen[/COLOR]
        [COLOR= #007700]{[/COLOR]
            
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"De gebruikersnaam en het wachtwoord komen niet overeen met elkaar.<br />
            <a href="inloggen.php">Klik hier om terug te gaan</a>."[/COLOR][COLOR= #007700];
            
        }[/COLOR]
        [URL="http://www.php.net/else"]else[/URL] [COLOR= #FF8000]//Als de gebruikersnaam en het wachtwoord wel overeenkomen[/COLOR]
        [COLOR= #007700]{[/COLOR]
            
            [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$beheerder[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$wachtwoord_check[/COLOR][COLOR= #007700]))
            {[/COLOR]
                [COLOR= #FF8000]//Sessions aanmaken[/COLOR]
                [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]];[/COLOR]
                [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]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]
                [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #0000BB]$beheerder[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];[/COLOR]
                
                [COLOR= #FF8000]//Welkom en doorsturen[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<head><meta http-equiv="refresh" content="2; url=index.php"></head>
                
                Welkom "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]", je bent succesvol ingelogd.<br />
                <a href="index.php">Klik hier als je niet wordt doorgestuurd naar de beheerpagina</a>.<br />"[/COLOR][COLOR= #007700];
        
            }
            
        }
        
    }[/COLOR]
    
    [URL="http://www.php.net/mysql_close"]mysql_close[/URL][COLOR= #007700]();[/COLOR] [COLOR= #FF8000]//De databaseconnectie verbreken[/COLOR]
    
[COLOR= #007700]}[/COLOR]
[URL="http://www.php.net/else"]else[/URL] [COLOR= #FF8000]//Als er nog niet op Inloggen is geklikt[/COLOR]
[COLOR= #007700]{[/COLOR]
    [COLOR= #FF8000]//Het formulier[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<h2>Inloggen</h2>
    <form method="post" action="inloggen.php">
        <table>
            <tr>
                <td width="100" align="right">
                    Gebruikersnaam:
                </td>
                <td align="left">
                    <input type="text" name="gebruikersnaam" size="30" />
                </td>
            </tr>
            <tr>
                <td align="right">
                    Wachtwoord:
                </td>
                <td align="left">
                    <input type="password" name="wachtwoord" size="30" />
                </td>
            </tr>
        </table>
        <input type="submit" name="login" value="Inloggen" />
    </form>"[/COLOR][COLOR= #007700];
    
}[/COLOR]
?>
0
Lars

Lid

Berichten
3.416
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Artiest veld kan je weghalen en gewoon neerzetten met session_gebruiksnaam ofzo...
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