⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Leginon
All Projects
Leginon
Overview
Activity
Roadmap
Issues
News
Documents
Wiki
Forums
Files
Download (778 Bytes)
RE: Where/when is the myamiweb administrator account crea...
ยป testSetUserId.php
Anchi Cheng
, 11/13/2017 05:04 PM
<?php
require_once
(
'./config.php'
);
require_once
(
'inc/mysql.inc'
);
class
testQuery
{
var
$mysqld
;
// make sure this is using the leginon database
function
testQuery
()
{
$this
->
mysqld
=
new
mysql
(
DB_HOST
,
DB_USER
,
DB_PASS
);
$dbLink
=
$this
->
mysqld
->
connect_db
();
$this
->
mysqld
->
select_db
(
DB_LEGINON
,
$dbLink
);
$userId
=
$this
->
setUserId
();
}
function
setUserId
(){
$sql
=
'SELECT `DEF_id` from `UserData` where `username` like "administrator" or "Administrator"'
;
echo
"query is: "
.
$sql
.
" "
;
$results
=
$this
->
mysqld
->
getSQLResult
(
$sql
);
$userId
=
$results
[
0
][
'DEF_id'
];
echo
"Result is "
;
var_dump
(
$userId
);
if
(
$userId
<
1
){
echo
"<h3> Error: Create administrator user first </h3>"
;
exit
();
}
return
$userId
;
}
}
new
testQuery
();
?>
(1-1/1)
Loading...