Cyber Anakins Lightsaber - A Minishell-based backdoor

Current Path : /home/bjb2293782/xn--80abaeoqbbrbgf8aea5a2a2z.xn--p1ai/docs/
Upload File :
Current File : /home/bjb2293782/xn--80abaeoqbbrbgf8aea5a2a2z.xn--p1ai/docs/create_db.php

<?php

require("std2.php");

$mysql = mysqlopen();


print "Creating libAdmins...<br>\n";
mysqli_query($mysql,"CREATE TABLE IF NOT EXISTS `libAdmins` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `name` VARCHAR(128),
  `login` VARCHAR(128),
  `password` VARCHAR(128),
  `email` VARCHAR(128),
  `rights` INT,
  `filial` INT,
  `invateCode` VARCHAR(6),
  `invateCodeDate` DATETIME
)");
if (mysqli_errno($mysql)) die("ERROR: ".mysqli_error($mysql)." at line ".__LINE__." of file ".__FILE__."\n");
print "OK<br>\n";



print "Creating libNews...<br>\n";
mysqli_query($mysql,"CREATE TABLE IF NOT EXISTS `libNews` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `filial` INT,
  `title` VARCHAR(255),
  `impotant` BOOL DEFAULT 0,
  `date` DATETIME,
  `text` MEDIUMTEXT,
  `poster` VARCHAR(128),
  `video` VARCHAR(128) DEFAULT '',
  `author` INT
)");
if (mysqli_errno($mysql)) die("ERROR: ".mysqli_error($mysql)." at line ".__LINE__." of file ".__FILE__."\n");
print "OK<br>\n";



print "Creating libEvents...<br>\n";
mysqli_query($mysql,"CREATE TABLE IF NOT EXISTS `libEvents` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `title` VARCHAR(255),
  `date` DATETIME,
  `duration` INT DEFAULT 60,
  `poster` VARCHAR(128),
  `desc` MEDIUMTEXT,
  `filial` INT,
  `scripts` TEXT,
  `people` INT DEFAULT 10,
  `place` VARCHAR(255),
  `category` INT DEFAULT 0,
  `author` INT,
  `showDate` BOOL DEFAULT 1,
  `publicDate` DATETIME,
  `script` TEXT,
  `impotant` BOOL DEFAULT 0,
  `price` DOUBLE DEFAULT 0.0
)");
if (mysqli_errno($mysql)) die("ERROR: ".mysqli_error($mysql)." at line ".__LINE__." of file ".__FILE__."\n");
print "OK<br>\n";

/*
mysqli_query($mysql,"ALTER TABLE `libEvents` ADD `impotant` BOOL DEFAULT 0");
if (mysqli_errno($mysql)) die("ERROR: ".mysqli_error($mysql)." at line ".__LINE__." of file ".__FILE__."\n");
print "OK<br>\n";
//*/


print "Creating libOnlineEvents...<br>\n";
mysqli_query($mysql,"CREATE TABLE IF NOT EXISTS `libOnlineEvents` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `title` VARCHAR(255),
  `date` DATETIME,
  `duration` INT DEFAULT 60,
  `poster` VARCHAR(128),
  `desc` MEDIUMTEXT,
  `kind` TINYINT DEFAULT 0,
  `people` INT DEFAULT 10,
  `filial` INT,
  `category` INT DEFAULT 0,
  `author` INT,
  `publicDate` DATETIME
)");
if (mysqli_errno($mysql)) die("ERROR: ".mysqli_error($mysql)." at line ".__LINE__." of file ".__FILE__."\n");
print "OK<br>\n";

//mysqli_query($mysql,"ALTER TABLE `libOnlineEvents` ADD `kind` TINYINT DEFAULT 0");
//if (mysqli_errno($mysql)) die("ERROR: ".mysqli_error($mysql)." at line ".__LINE__." of file ".__FILE__."\n");
//print "OK<br>\n";



print "Creating libPrograms...<br>\n";
mysqli_query($mysql,"CREATE TABLE IF NOT EXISTS `libPrograms` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `filial` INT,
  `weekDay` INT,
  `since` TIME,
  `to` TIME,
  `desc` INT,
  `comment` VARCHAR(255)
)");
if (mysqli_errno($mysql)) die("ERROR: ".mysqli_error($mysql)." at line ".__LINE__." of file ".__FILE__."\n");
print "OK<br>\n";


print "Creating libProgDescriptions...<br>\n";
mysqli_query($mysql,"CREATE TABLE IF NOT EXISTS `libProgDescriptions` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `name` VARCHAR(255),
  `subname` VARCHAR(255),
  `filial` INT,
  `desc` MEDIUMTEXT,
  `category` INT DEFAULT 0,
  `people` INT DEFAULT 10,
  `needRegister` BOOL DEFAULT 0,
  `howToRegister` TEXT,
  `whenRegister` DATETIME,
  `author` INT,
  `editTime` DATETIME
)");
if (mysqli_errno($mysql)) die("ERROR: ".mysqli_error($mysql)." at line ".__LINE__." of file ".__FILE__."\n");
print "OK<br>\n";




print "Creating libVideos...<br>\n";
mysqli_query($mysql,"CREATE TABLE IF NOT EXISTS `libVideos` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `filial` INT,
  `name` VARCHAR(255),
  `desc` TEXT,
  `video` VARCHAR(128),
  `date` DATETIME,
  `duration` INT,
  `visits` INT DEFAULT 0,
  `author` INT,
  `publicDate` DATETIME
)");
if (mysqli_errno($mysql)) die("ERROR: ".mysqli_error($mysql)." at line ".__LINE__." of file ".__FILE__."\n");
print "OK<br>\n";



print "Creating libQuizs...<br>\n";
mysqli_query($mysql,"CREATE TABLE IF NOT EXISTS `libQuizs` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `name` VARCHAR(255),
  `desc` TEXT,
  `link` VARCHAR(128),
  `video` VARCHAR(128),
  `date` DATETIME,
  `author` INT
)");
if (mysqli_errno($mysql)) die("ERROR: ".mysqli_error($mysql)." at line ".__LINE__." of file ".__FILE__."\n");
print "OK<br>\n";




print "Creating libForum...<br>\n";
mysqli_query($mysql,"CREATE TABLE IF NOT EXISTS `libForum` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `parent` INT DEFAULT 0,
  `name` VARCHAR(255),
  `email` VARCHAR(255),
  `subject` VARCHAR(255),
  `moderated` BOOL DEFAULT 0,
  `text` TEXT,
  `date` DATETIME
)");
if (mysqli_errno($mysql)) die("ERROR: ".mysqli_error($mysql)." at line ".__LINE__." of file ".__FILE__."\n");
print "OK<br>\n";


print "Creating libPriceList...<br>\n";
mysqli_query($mysql,"CREATE TABLE IF NOT EXISTS `libPriceList` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `name` VARCHAR(255),
  `unit` VARCHAR(128),
  `price` DOUBLE,
  `number` INT,
  `online` TINYINT DEFAULT 0
)");
if (mysqli_errno($mysql)) die("ERROR: ".mysqli_error($mysql)." at line ".__LINE__." of file ".__FILE__."\n");
print "OK<br>\n";

/*
mysqli_query($mysql,"ALTER TABLE `libPriceList` MODIFY price DOUBLE");
if (mysqli_errno($mysql)) die("ERROR: ".mysqli_error($mysql)." at line ".__LINE__." of file ".__FILE__."\n");
print "OK<br>\n";
*/



print "Creating libOrders...<br>\n";
mysqli_query($mysql,"CREATE TABLE IF NOT EXISTS `libOrders` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `date` DATETIME,
  `payDate` DATETIME DEFAULT NULL,
  `sum` double,
  `payer` VARCHAR(255),
  `yookassa_id` VARCHAR(42)
)");
if (mysqli_errno($mysql)) die("ERROR: ".mysqli_error($mysql)." at line ".__LINE__." of file ".__FILE__."\n");
print "OK<br>\n";


/*
mysqli_query($mysql,"ALTER TABLE `libOrders` ADD `yookassa_id` VARCHAR(42)");
if (mysqli_errno($mysql)) die("ERROR: ".mysqli_error($mysql)." at line ".__LINE__." of file ".__FILE__."\n");
print "OK<br>\n";
//*/


print "Creating libOrderItems...<br>\n";
mysqli_query($mysql,"CREATE TABLE IF NOT EXISTS `libOrderItems` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `order` INT,
  `itemType` INT DEFAULT 0, # 1-event, 2-priceListItem
  `item` INT DEFAULT 0,
  `desc` TEXT,
  `price` DOUBLE,
  `count` INT DEFAULT 1,
  `used` INT DEFAULT 0
)");
if (mysqli_errno($mysql)) die("ERROR: ".mysqli_error($mysql)." at line ".__LINE__." of file ".__FILE__."\n");
print "OK<br>\n";


/*
mysqli_query($mysql,"ALTER TABLE `libOrderItems` ADD `used` INT DEFAULT 0");
if (mysqli_errno($mysql)) die("ERROR: ".mysqli_error($mysql)." at line ".__LINE__." of file ".__FILE__."\n");
print "OK<br>\n";
*/



$count = 1;
$result = mysqli_query($mysql, "SELECT COUNT(*) FROM libAdmins");
if (mysqli_errno($mysql)) die("ERROR: ".mysqli_error($mysql)." at line ".__LINE__." of file ".__FILE__."\n");
if ($row = mysqli_fetch_row($result)) $count = $row[0];
mysqli_free_result($result);

if ($count == 0)
{
	mysqli_query($mysql, "INSERT INTO libAdmins (`name`,`login`,`password`,`rights`,`filial`) VALUES ('Супер администратор','admin','admin',65535,-1)");
	if (mysqli_errno($mysql)) die("ERROR: ".mysqli_error($mysql)." at line ".__LINE__." of file ".__FILE__."\n");
}


?>

May the force be with you, always.