-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.php
More file actions
executable file
·101 lines (85 loc) · 3.2 KB
/
main.php
File metadata and controls
executable file
·101 lines (85 loc) · 3.2 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
// +-------------------------------------------------+
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: main.php,v 1.34 2015-05-18 09:34:21 dgoron Exp $
// définition du minimum nécéssaire
$base_path=".";
$base_auth = "";
$base_title = "\$msg[308]";
$base_noheader=1;
$base_nocheck=1;
require_once ("$base_path/includes/init.inc.php");
//Est-on déjà authentifié ?
if (!checkUser('PhpMyBibli')) {
//Vérification que l'utilisateur existe dans PMB
$query = "SELECT userid,username FROM users WHERE username='$user'";
$result = pmb_mysql_query($query, $dbh);
if (pmb_mysql_num_rows($result)) {
//Récupération du mot de passe
$dbuser=pmb_mysql_fetch_object($result);
//Autentification externe si nécéssaire
if ((file_exists("$include_path/external_admin_auth.inc.php"))&&($dbuser->userid!=1)) {
include("$include_path/external_admin_auth.inc.php");
} else {
// on checke si l'utilisateur existe et si le mot de passe est OK
$query = "SELECT count(1) FROM users WHERE username='$user' AND pwd=password('$password') ";
$result = pmb_mysql_query($query, $dbh);
$valid_user = pmb_mysql_result($result, 0, 0);
}
}
} else
$valid_user=2;
if(!$valid_user) {
header("Location: index.php?login_error=1");
} else {
if ($valid_user==1)
startSession('PhpMyBibli', $user, $database);
}
if(SESSlang) {
$lang=SESSlang;
$helpdir = $lang;
}
// localisation (fichier XML)
$messages = new XMLlist("$include_path/messages/$lang.xml", 0);
$messages->analyser();
$msg = $messages->table;
require("$include_path/templates/common.tpl.php");
header ("Content-Type: text/html; charset=$charset");
if ((!$param_licence)||($pmb_bdd_version!=$pmb_version_database_as_it_should_be)||($pmb_subversion_database_as_it_shouldbe!=$pmb_bdd_subversion)) {
require_once("$include_path/templates/main.tpl.php");
print $std_header;
print $menu_bar;
print $extra;
if($use_shortcuts) {
include("$include_path/shortcuts/circ.sht");
}
print $main_layout;
if ($pmb_bdd_version!=$pmb_version_database_as_it_should_be) {
echo "<h1>".$msg["pmb_v_db_pas_a_jour"]."</h1>";
echo "<h1>".$msg[1803]."<font color=red>".$pmb_bdd_version."</font></h1>";
echo "<h1>".$msg[pmb_v_db_as_it_should_be]."<font color=red>".$pmb_version_database_as_it_should_be."</font></h1>";
echo "<a href='./admin.php?categ=alter&sub='>".$msg["pmb_v_db_mettre_a_jour"]."</a>";
echo "<SCRIPT>alert(\"".$msg["pmb_v_db_pas_a_jour"]."\\n".$pmb_version_database_as_it_should_be." <> ".$pmb_bdd_version."\");</SCRIPT>";
} elseif ($pmb_subversion_database_as_it_shouldbe!=$pmb_bdd_subversion) {
echo "<h1>Minor changes in database in progress...</h1>";
include("./admin/misc/addon.inc.php");
echo "<h1>Changes applied in database.</h1>";
}
if (!$param_licence) {
include("$base_path/resume_licence.inc.php");
print $PMB_texte_licence ;
}
print $main_layout_end;
print $footer;
pmb_mysql_close($dbh);
exit ;
}
if ($ret_url) {
print "<SCRIPT>document.location=\"$ret_url\";</SCRIPT>";
exit ;
}
//chargement de la première page
require_once($include_path."/misc.inc.php");
go_first_tab();
pmb_mysql_close($dbh);