This is a command line LimeSurvey Survey importer. Usage: php [ ] has to be a LimeSurvey survey dump. and are only required if the control access is active With the --help, -help, -h, or -? options, you can get this help. 2)? $argv[2] : ""; $userpass = ($argc>3)? $argv[3] : ""; } if (!file_exists($the_full_file_path)) { echo "\nThe file $the_full_file_path does not exist\n"; exit; } $_SERVER['SERVER_NAME'] = ""; // just to avoid notices $_SERVER['SERVER_SOFTWARE'] = ""; // just to avoid notices require_once(dirname(__FILE__).'/../config-defaults.php'); require_once(dirname(__FILE__).'/../common.php'); if (isset($_REQUEST['homedir'])) {die('');} require_once($homedir."/classes/core/sha256.php"); $adminoutput =""; // just to avoid notices include("database.php"); $query = "SELECT uid, password, lang FROM ".db_table_name('users')." WHERE users_name=".$connect->qstr($username); $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; $result = $connect->SelectLimit($query, 1) or die ($query."\n".$connect->ErrorMsg()); if ($result->RecordCount() < 1) { // wrong or unknown username and/or email echo "\n".$clang->gT("User name invalid!")."\n"; exit; } else { $fields = $result->FetchRow(); if (SHA256::hashing($userpass) == $fields['password']) { $_SESSION['loginID'] = intval($fields['uid']); $clang = new limesurvey_lang($fields['lang']); GetSessionUserRights($_SESSION['loginID']); if (!$_SESSION['USER_RIGHT_CREATE_SURVEY']) { // no permission to create survey! echo "\n".$clang->gT("You are not allowed to import a survey!")."\n"; exit; } } else { // password don't match username echo "\n".$clang->gT("User name and password do not match!")."\n"; exit; } } echo "\n"; $importsurvey = ""; $importingfrom = "cmdline"; // "http" for the web version and "cmdline" for the command line version include("importsurvey.php"); ?>