public function Open() { #------------------------------------------------------------------------------- $Settings = $this->Settings; #------------------------------------------------------------------------------- $Address = SPrintF('%s:%u', $Settings['Server'], $Settings['Port']); #------------------------------------------------------------------------------- $this->Link = @MySQL_Connect($Address, $User = $Settings['User'], $Settings['Password'], TRUE); #------------------------------------------------------------------------------- if (!Is_Resource($this->Link)) { return ERROR | @Trigger_Error(SPrintF('[MySQL->Open]: не возможно соединиться с (%s@%s)', $User, $Address)); } #------------------------------------------------------------------------------- Debug(SPrintF('[MySQL->Open]: связь как (%s@%s) установлена', $User, $Address)); #------------------------------------------------------------------------------- $Init = System_XML('config/MySqlInit.xml'); #------------------------------------------------------------------------------- if (Is_Error($Init)) { return ERROR | @Trigger_Error('[MySQL->Open]: не возможно загрузить запросы инициализации'); } #------------------------------------------------------------------------------- foreach ($Init as $Query) { if (Is_Error($this->Query($Query))) { return ERROR | @Trigger_Error('[MySQL->Open]: не удалось произвести инициализацию подключения'); } } #------------------------------------------------------------------------------- return TRUE; #------------------------------------------------------------------------------- }
<?//Include "library.php"; $mysql_host = "localhost"; //MySQL host (usualy localhost) $mysql_user = "******"; //MySQL username $mysql_password = ""; //MySQL password $mysql_database = "verlihub"; //MySQL database name $DB_HUB = MySQL_Connect($mysql_host, $mysql_user, $mysql_password) OR Die(MySQL_Error()); MySQL_Select_DB($mysql_database, $DB_HUB) OR Die(MySQL_Error()); $file_en = File("scripts/languages/en.php"); $file = File("scripts/languages/en.php"); FOR($i = 0; $i < Count($file); $i++) { $file[$i] = Ereg_Replace("([\$\"\;\t])", "", $file[$i]); $file[$i] = Str_Replace("( =)|(\\\\)", "|", $file[$i]); $lang = Explode("|", $file[$i]); $lang[1] = MySQL_Escape_String($lang[1]); Query("INSERT delayed ignore INTO va_languages VALUES ('en', '".$lang[0]."', '".$lang[1]."', '".$lang[2]."')") OR Die("#".MySQL_ErrNo()." : ".MySQL_Error()); } UnSet($file); $file = File("scripts/languages/cz.php"); FOR($i = 0; $i < Count($file); $i++) { $file[$i] = Ereg_Replace("([\$\"\;\t])", "", $file[$i]); $file[$i] = Str_Replace(" =", "|", $file[$i]); $lang = Explode("|", $file[$i]); $lang[1] = MySQL_Escape_String($lang[1]); Query("INSERT delayed ignore INTO va_languages VALUES ('cz', '".$lang[0]."', '".$lang[1]."', '".$lang[2]."')") OR Die("#".MySQL_ErrNo()." : ".MySQL_Error()); } FOR($i = 0; $i < Count($file_en); $i++) {
<? // Import dat z predchoziho systemu // Version 1.05 // Date 2013-08-29 define ('AUTH_DB_HOST', 'sql.satoya.cz'); // kde bezi MySQL server define ('AUTH_DB_USER', 'gymfed_demo'); // uzivatelske jmeno define ('AUTH_DB_PASS', 'HuuJNUw6GpjMjqfx'); // uzivatelske heslo //define ('AUTH_DB_USER', 'gymfed'); // ostry uzivatel //define ('AUTH_DB_PASS', 'PxPSXn2G7dB5bCwZ'); // ostre heslo define ('AUTH_DB_NAME', AUTH_DB_USER); // jmeno databaze (casto jako uzivatel) define ('AUTH_DB_CODEPAGE', 'UTF8'); // kodova stranka spojeni echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'."\n"; @MySQL_Connect (AUTH_DB_HOST,AUTH_DB_USER,AUTH_DB_PASS) or die ("Autorizacni modul se nemuze pripojit k databazi"); if (defined('AUTH_DB_NAME')) @MySQL_Select_DB(AUTH_DB_NAME) or die ("Autorizacni modul nenasel databazi"); if (defined('AUTH_DB_CODEPAGE')) @MySQL_Query("SET NAMES '".AUTH_DB_CODEPAGE."'") or die("Nelze nastavit znakovou sadu databaze"); echo date("H:i:s")." připojení k databázi<br>\n"; include "lib.php"; switch ($_GET[action]): case "osoby_create": $query="DROP TABLE IF EXISTS osoby"; MySQL_Query($query) or die("nepovedlo se smazat osoby"); $query="CREATE TABLE osoby ( `id` int(6) unsigned NOT NULL, `username` varchar(50) NOT NULL, `password` varchar(100) NOT NULL, `titul` varchar(20) NOT NULL,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. // You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or visit http://www.gnu.sk/ for Vseobecna zverejnovacia licencia GNU $server_name = "localhost"; //host $db_name = "uniletim"; //db name $db_user = "******"; //user name $db_pass = "******"; //password $app_lang = "english"; // application language $app_design = "xhtml"; $app_style = "green"; @($conn = MySQL_Connect($server_name, $db_user, $db_pass)) or die(_NO_MYSQL_CONNECT); //connect to database @($sdb = MySQL_Select_DB($db_name)) or die(_NO_DB_CONNECT); //select database $hash_secret = "Jabb"; // please, change the hash secret for better security $admin_mail = "*****@*****.**"; if ($app_design != "lets_sk") { $welcome_call = ", welcome to <b>uniLETIM</b><br>"; $welcome_call_unauth = ""; $foot_call = "<hr size=1 width=90% noshade><div align=center>runs on <a href=http://uniletim.sourceforge.net/>uniLETIM</a></div>"; } else { $welcome_call = ", welcome to our LETS/TimeBank group"; $welcome_call_unauth = "<b><h3>Welcome to www.letsportal.com</h3></b><br>\n\t\t\tif you are a registered user, please login...<br><br>\n\t\t\tif not, you can try the uniLETIM application in demo-mode as user or administrator"; $foot_call = "<hr size=1 noshade><div align=center>runs on <a href=http://uniletim.sourceforge.net/>uniLETIM</a></div>"; }
function DB_spojeni ($db, &$error, &$spojeni) { $error = ""; $file = securefiles()."/".$db; if (!file_exists($file)) { $error = "konfiguracni soubor pro databazi ".$db." nenalezen"; return false; } else { $fo = fopen($file, "r"); if (!$fo) { $error = "nelze otevrit konfiguracni soubor pro databazi".$db; return false; } else { $record = fgets ($fo, 30); fclose($fo); list($user, $passwd, $bogus) = explode (":", $record); // $spojeni = MySQL_Connect("localhost", "uziv", "68t8g6er867"); // echo "<P>uzivatel $user - $passwd"; $spojeni = MySQL_Connect("localhost", $user, $passwd); if (!$spojeni) { $error = "pristup odmitnut"; return false; } if (!MySQL_Select_DB($db)) { $error = "nelze zpristupnit databazi ".$db; MySQL_close($spojeni); return false; } } } return true; }
function dbConnect($host, $port, $user, $password, $db) { if ($this->connection) { return; } $this->connection = @MySQL_Connect($host . ($port ? ":{$port}" : ""), $user, $password); if (!$this->connection) { echo "MYSQL CONNECTION FAILED!<br>"; } if ($this->connection) { $ok = @MySQL_Select_DB($db); if (!$ok) { $this->error(); } } }
FUNCTION VA_MySQL($host, $user, $password, $database) { $this->DB = MySQL_Connect($host, $user, $password) OR Die(MySQL_Error()); MySQL_Select_DB($database, $this->DB) OR Die(MySQL_Error()); $this->mysql_queries += 2; $this->server_info = MySQL_Get_Server_info($this->DB); }
<?php //Konfigurace připojení k DB static $cfg_db = array("dbhost" => "localhost", "dbuser" => "user_name", "dbpass" => "password", "dbname" => "nag_meteo"); //Konfigurace static $cfg = array("input_id" => "aaa111bbb222", "actual" => "meteo_actual", "hour" => "meteo_hour", "day" => "meteo_day", "location_name" => "VELEŠÍN", "owm_location_id" => "3067696", "owm_appid" => "aaa111bbb222"); //Spojeni s databazi $conn = false; $conn = @MySQL_Connect($cfg_db['dbhost'], $cfg_db['dbuser'], $cfg_db['dbpass']) or $conn = true; @MySQL_Select_DB($cfg_db['dbname']) or $conn = true; if (!$conn) { mysql_query("SET NAMES utf8;", $conn); } $tblTranslated = replaceTblArray();