phpmysql-authenticatie-met-sessions

Gesponsorde koppelingen

PHP script bestanden

  1. phpmysql-authenticatie-met-sessions

« Lees de omschrijving en reacties

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php

$verify
="PD9waHANCg0KcmVxdWlyZSgiY29uZmlnLnBocCIpOw0KDQppZighZW1wdHkoJF9QT1NUWyd1c2VybmFtZSddKSkNCnsNCiAgc2Vzc2lvbl9zdGFydCgpOw0KICBteXNxbF9jb25uZWN0KCRob3N0LCR1c2VybmFtZSwkcGFzc3dvcmQpOw0KICBteXNxbF9zZWxlY3RfZGIoJGRiKTsNCiAgJHF1ZXJ5PW15c3FsX3F1ZXJ5KCJTRUxFQ1QgVVNFUl9JRCBGUk9NIFVTRVJTIFdIRVJFIFVTRVJOQU1FPSciLiRfUE9TVFsndXNlcm5hbWUnXS4iJyBBTkQgUEFTU1dPUkQ9JyIubWQ1KCRfUE9TVFsncGFzc3dvcmQnXSkuIic7Iik7DQogIGlmKG15c3FsX251bV9yb3dzKCRxdWVyeSk+MCkgICAgDQogIHsNCiAgICAkcm93PW15c3FsX2ZldGNoX2Fzc29jKCRxdWVyeSk7DQogICAgJF9TRVNTSU9OWyd1c2VyX2lkJ109JHJvd1snVVNFUl9JRCddOw0KICAgIGhlYWRlcigiTG9jYXRpb246ICIuJF9TRVJWRVJbJ1BIUF9TRUxGJ10pOw0KICAgIC8vem9hbHMgamUgemlldCB3b3JkdCBhbGxlZW4gdXNlcl9pZCBvcGdlc2xhZ2VuLiBEaXQgdWl0IHZlaWxpZ2hlaWRzb3ZlcndlZ2luZ2VuIG9tZGF0IGplIG1ldCBlZW4gcmVsYXRpZWYgZWVudm91ZGlnZSBoYW5kZWxpbmcgY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JGRiKSBvciBkaWUobXlzcWxfZXJyb3IoKSk7DQoJaWYoJF9QT1NUWydwYXNzd29yZCddIT0kX1BPU1RbJ3NlY29uZCddKQ0KCWRpZSgiRGUgb3BnZWdldmVuIHdhY2h0d29vcmRlbiBrb21lbiBuaWV0IG92ZXJlZW4iKTsNCglteXNxbF9xdWVyeSgiSU5TRVJUIElOVE8gdXNlcnMgKHVzZXJuYW1lLHBhc3N3b3JkKSBWQUxVRVMgKCciLiRfUE9TVFsndXNlcm5hbWUnXS4iJywnIi5tZDUoJF9QT1NUWydwYXNzd29yZCddKS4iJyk7Iikgb3IgZGllKG15c3FsX2Vycm9yKCkpOw0KCW15c3FsX2Nsb3NlKCk7DQp9DQoNCj8+DQo8Zm9ybSBtZXRob2Q9InBvc3QiIGFjdGlvbj0iPD9waHAgZWNobygkX1NFUlZFUlsnUEhQX1NFTEYnXSk7ID8+Ij4NCjx0YWJsZT4NCjx0cj4NCgk8dGQ+R2VicnVpa2Vyc25hYW08L3RkPjx0ZD48aW5wdXQgbmFtZT0idXNlcm5hbWUiIHR5cGU9InRleHQiIC8+PC90ZD4NCgk8dGQ+V2FjaHR3b29yZDwvdGQ+PHRkPjxpbnB1dCBuYW1lPSJwYXNzd29yZCIgdHlwZT0icGFzc3dvcmQiIC8+PC90ZD4NCgk8dGQ+QmV2ZXN0aWdlbjwvdGQ+PHRkPjxpbnB1dCBuYW1lPSJzZWNvbmQiIHR5cGU9InBhc3N3b3JkIiAvPjwvdGQ+DQo8L3RyPg0KPC90YWJsZT4NCjwvZm9ybT4=";

$fp=fopen('login_verify.php','w+');
fputs($fp,base64_decode($verify));
fclose($fp);
$fp=fopen('inc_login.php','w+');
fputs($fp,base64_decode($inc));
fclose($fp);
$fp=fopen('add_user.php','w+');
fputs($fp,base64_decode($add));
fclose($fp);

if(!empty($_POST))
{

    mysql_connect($_POST['host'],$_POST['username'],$_POST['password']) or die(mysql_error());
    if(!mysql_select_db($_POST['database']))
    {

        mysql_query("CREATE DATABASE ".$_POST['database'].";") or die(mysql_error());
        mysql_select_db($_POST['database']) or die(mysql_error());
    }

    $config="<?php\n\n";
    $config.="\$host='".$_POST['host']."';\n";
    $config.="\$username='".$_POST['username']."';\n";
    $config.="\$password='".$_POST['password']."';\n";
    $config.="\$db='".$_POST['database']."';\n";
    $config.="\n\n?>";
    $fp=fopen('config.php','w+');
    fputs($fp,$config);
    fclose($fp);
    require("config.php");
    mysql_connect($host,$username,$password) or die(mysql_error());
    mysql_select_db($db) or die(mysql_error());
    mysql_query("
    CREATE TABLE USERS (
    user_id INT AUTO_INCREMENT PRIMARY KEY,
    username VARCHAR(20),
    password VARCHAR(20)
    );
    "
) or die(mysql_error());
    mysql_close();    
}


?>

<form method="post" action="<?php echo($_SERVER['PHP_SELF']); ?>">
<table>
  <tr>
    <th colspan="2">MySQL</th>
  </tr>
  <tr>
    <td>Host</td>
    <td><input name="host" type="text" id="host" /></td>
  </tr>
  <tr>
    <td>Gebruikersnaam</td>
    <td><input name="username" type="text" id="username" /></td>
  </tr>
  <tr>
    <td>Wachtwoord</td>
    <td><input name="password" type="password" id="password" /></td>
  </tr>
  <tr>
    <td>Database</td>
    <td><input name="database" type="text" id="database" /></td>
  </tr>
  <tr>
    <td colspan="2" align="center"><input type="submit" name="Submit" value="Bevestigen" /></td>
  </tr>
</table>
</form>

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.