Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
projet-cdaw
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thibaut Felten
projet-cdaw
Commits
89ae27da
Commit
89ae27da
authored
Nov 10, 2020
by
thibaut-felten
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Config
parent
f72b8878
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
23 deletions
+5
-23
DatabaseConnector.php
backend/tp2/DatabaseConnector.php
+4
-4
UserController.php
backend/tp2/UserController.php
+0
-2
config.php
backend/tp2/config.php
+1
-17
No files found.
backend/tp2/DatabaseConnector.php
View file @
89ae27da
...
...
@@ -14,14 +14,14 @@ class DatabaseConnector {
protected
static
function
createPDO
()
{
// $db = new PDO("sqlite::memory");
$connectionString
=
"mysql:host="
.
DB
_HOST
;
$connectionString
=
"mysql:host="
.
_MYSQL
_HOST
;
if
(
defined
(
'_MYSQL_PORT'
))
$connectionString
.=
";port="
.
DB
_PORT
;
$connectionString
.=
";port="
.
_MYSQL
_PORT
;
$connectionString
.=
";dbname="
.
DB
_DATABASE
;
$connectionString
.=
";dbname="
.
_MYSQL
_DATABASE
;
static
::
$pdo
=
new
PDO
(
$connectionString
,
DB_USERNAME
,
DB
_PASSWORD
);
static
::
$pdo
=
new
PDO
(
$connectionString
,
_MYSQL_USERNAME
,
_MYSQL
_PASSWORD
);
static
::
$pdo
->
setAttribute
(
PDO
::
ATTR_ERRMODE
,
PDO
::
ERRMODE_EXCEPTION
);
}
}
\ No newline at end of file
backend/tp2/UserController.php
View file @
89ae27da
...
...
@@ -37,5 +37,3 @@ class UsersController {
return
$response
;
}
}
}
\ No newline at end of file
backend/tp2/config.php
View file @
89ae27da
...
...
@@ -4,19 +4,3 @@ define('_MYSQL_PORT',3306);
define
(
'_MYSQL_DBNAME'
,
'dbtest'
);
define
(
'_MYSQL_USER'
,
'root'
);
define
(
'_MYSQL_PASSWORD'
,
'root'
);
\ No newline at end of file
$connectionString
=
"mysql:host="
.
_MYSQL_HOST
;
if
(
defined
(
'_MYSQL_PORT'
))
$connectionString
.=
";port="
.
_MYSQL_PORT
;
$connectionString
.=
";dbname="
.
_MYSQL_DBNAME
;
$options
=
array
(
PDO
::
MYSQL_ATTR_INIT_COMMAND
=>
'SET NAMES utf8'
);
try
{
$pdo
=
new
PDO
(
$connectionString
,
_MYSQL_USER
,
_MYSQL_PASSWORD
,
$options
);
$pdo
->
setAttribute
(
PDO
::
ATTR_ERRMODE
,
PDO
::
ERRMODE_EXCEPTION
);
}
catch
(
PDOException
$erreur
)
{
myLog
(
'Erreur : '
.
$erreur
->
getMessage
());
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment