-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigurationDatabase.php
43 lines (37 loc) · 1.14 KB
/
configurationDatabase.php
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
<?php
$password = 'root';
$count = 0;
$loopFlag = true;
while ($loopFlag)
{
//if connection is not made to mySQL server with root password
//the @ symbol surpress warning for not connecting with my password
if(!$DataBaseCon = @mysqli_connect("localhost","root", $password)){
//try connecting with other passwords
if ($count == 0)
$password = ''; //use Poleaps password
if ($count == 1)
$password = '2031'; //use linhs password
if ($count == 2)
$password = 'Jvm1337!'; //use jeans password
if ($count == 3)
{
//**If not connect message error
echo "Error connecting to Data Base <br />";
exit();//exit function will print the error message first, and exit the current script
$loopFlag = false; //breaks loop
}
$count++;
}
else
{
$loopFlag = false; //breaks loop
}
}
//**check if the command is not select the right database, give error message
//**change the default path to specific data base table "userAndPassword"
if (!mysqli_select_db($DataBaseCon, "project")) {
//if the database is not select, it print messege error
echo "Error selecting Data Base<br />";
exit();
}//end if select database