everything should be db.inc not hardcoded!

This commit is contained in:
Thies Mueller 2021-01-10 12:17:26 +01:00
parent d900b2a57f
commit cbebd4339c
8 changed files with 8 additions and 8 deletions

View File

@ -7,7 +7,7 @@
</head> </head>
<body> <body>
<?php <?php
$pdo = new PDO('mysql:host=localhost;dbname=usertable', 'usertable', 'password'); include 'db.inc.php';
if(!isset($_GET['userid']) || !isset($_GET['code'])) { if(!isset($_GET['userid']) || !isset($_GET['code'])) {
die('<div class="alert alert-warning" role="alert">No code delivered. nothing to do here.</div>'); die('<div class="alert alert-warning" role="alert">No code delivered. nothing to do here.</div>');

View File

@ -8,7 +8,7 @@
<body> <body>
<?php <?php
session_start(); session_start();
$pdo = new PDO('mysql:host=localhost;dbname=usertable', 'usertable', 'password'); include 'db.inc.php';
function random_string() { function random_string() {
if(function_exists('random_bytes')) { if(function_exists('random_bytes')) {

View File

@ -4,6 +4,6 @@ $dbname = 'usertable';
$dbuser = 'usertable'; $dbuser = 'usertable';
$dbpass = 'password'; $dbpass = 'password';
$pdo = new PDO('mysql:host='.$mysqlhost.';dbname='.$dbname.'', $dbuser , $dbpass); $pdo = new PDO('mysql:host='.$mysqlhost.';dbname='.$dbname.'', $dbuser , $dbpass);
//$pdo = new PDO('mysql:host=localhost;dbname=usertable', 'usertable', 'password');
?> ?>

View File

@ -7,7 +7,7 @@
</head> </head>
<body> <body>
<?php <?php
$pdo = new PDO('mysql:host=localhost;dbname=usertable', 'usertable', 'password'); include 'db.inc.php';
function random_string() { function random_string() {
if(function_exists('random_bytes')) { if(function_exists('random_bytes')) {

View File

@ -1,7 +1,7 @@
<?php <?php
session_start(); session_start();
$pdo = new PDO('mysql:host=localhost;dbname=usertable', 'usertable', 'password'); include 'db.inc.php';
if(isset($_GET['login'])) { if(isset($_GET['login'])) {
$username = $_POST['username']; $username = $_POST['username'];

View File

@ -1,7 +1,7 @@
<?php <?php
session_start(); session_start();
$pdo = new PDO('mysql:host=localhost;dbname=usertable', 'usertable', 'password'); include 'db.inc.php';
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>

View File

@ -7,7 +7,7 @@
</head> </head>
<body> <body>
<?php <?php
$pdo = new PDO('mysql:host=localhost;dbname=usertable', 'usertable', 'password'); include 'db.inc.php';
if(!isset($_GET['userid']) || !isset($_GET['code'])) { if(!isset($_GET['userid']) || !isset($_GET['code'])) {
die('<div class="alert alert-warning" role="alert">No code delivered. nothing to do here.</div>'); die('<div class="alert alert-warning" role="alert">No code delivered. nothing to do here.</div>');

View File

@ -1,6 +1,6 @@
<?php <?php
session_start(); session_start();
//$pdo = new PDO('mysql:host=localhost;dbname=usertable', 'usertable', 'password');
include 'db.inc.php'; include 'db.inc.php';
$username = $_SESSION['username']; $username = $_SESSION['username'];