function LogIn($username, $password) { $config = LoadConfig(); $database = OpenDatabase($config->map_database->data_source_name, $config->map_database->username_readonly, $config->map_database->password_readonly); $user_read = new UserRead($database, "SELECT {0} FROM `map_server_users` WHERE username = ?"); $user_read->ExecuteQuery(array($username)); if (!$user_read->MoveNext()) { return false; } $password_hash = new PasswordHash(8, true); if ($password_hash->CheckPassword($password, $user_read->password_hash)) { $this->is_logged_in = true; $user = new User(); $user->username = $user_read->username; $user->user_control_permissions = $user_read->user_control_permissions; $user->map_database_permissions = $user_read->map_database_permissions; $this->logged_in_user = $user; } else { $this->is_logged_in = false; $this->logged_in_user = null; } $database = null; return $this->is_logged_in; }
if ($use_hard_limit && $state->server_bandwidth->bandwidth_used + 1024576 > $config->map_server->bandwidth_cap_hard) { header("HTTP/1.0 404 Not Found"); return; } // execution should continue until the bandwidth state has been updated $user_abort_orig = ignore_user_abort(); ignore_user_abort(true); $data_sent = TransferFile($map_entry->map_parts_path . "/" . $map_part_name); // update web bandwidth state $state = LoadState(); $state->server_bandwidth->bandwidth_used += $data_sent; SaveState($state); ignore_user_abort($user_abort_orig); } // open the sql database $database = OpenDatabase($config->map_database->data_source_name, $config->map_database->username_readonly, $config->map_database->password_readonly); $map_name_set = isset($_REQUEST['map']) && !empty($_REQUEST['map']); $map_part_set = isset($_REQUEST['part']) && !empty($_REQUEST['part']); // the client is requesting a map part if both the map and part queries are set // the client is requesting a map part definition if only the map query is set if ($map_name_set) { $map_entry = new MapEntryReader($database, "SELECT {0} FROM `map_list` WHERE LOWER(map_name) = LOWER(?)"); $map_entry->ExecuteQuery(array($_REQUEST['map'])); if (!$map_entry->MoveNext() || $map_entry->map_compression_stage != 1) { header("HTTP/1.0 404 Not Found"); } else { if ($map_part_set) { SendMapPart($map_entry, $_REQUEST['part']); } else { SendMapPartDefinition($map_entry, $database); }
<?php global $db_username, $db_password, $db_database, $db_host, $tbl_product, $tbl_users, $tbl_product, $tbl_post, $tbl_users, $tbl_test; $db_database = "IE"; //change here $db_host = "localhost"; $db_username = "******"; $db_password = "******"; $tbl_product = "Product"; $tbl_users = "Users"; $tbl_test = "test"; $login = false; // echo "string \n"; OpenDatabase($db_host, $db_database, $db_username, $db_password); // createproducttable(); // echo "string"; class product { public $pro_iD; public $pro_name; public $pro_score; public $pro_price; public $pro_category; public $pro_color1; public $pro_color2; public $pro_color3; public $pro_color4; public $pro_tag1; public $pro_tag2; public $pro_tag3; public $pro_tag4;
//require('template.php'); //session_start(); require_once "oid_common.php"; // Complete the authentication process using the server's response. $response = $consumer->complete($_GET); if ($response->status == Auth_OpenID_CANCEL) { // This means the authentication was cancelled. print 'Verification canceled.'; exit; } else { if ($response->status == Auth_OpenID_FAILURE) { print "OpenID authentication failed: " . $response->message; exit; } else { if ($response->status == Auth_OpenID_SUCCESS) { OpenDatabase(); // This means the authentication succeeded. $openid = $response->identity_url; if ($response->endpoint->canonicalID) { $canon = $response->endpoint->canonicalID; } $sreg = $response->extensionResponse('sreg'); $addition = false; if ($_SESSION["acct_auth"] && $_SESSION["acct_official"] != ($canon ? $canon : $openid)) { # New OpenID associated $s = findAccount($_SESSION["acct_official"]); addAccountUsername($s['id'], $canon ? $canon : $openid, $openid); $addition = true; } $_SESSION["acct_auth"] = true; $_SESSION["acct_username"] = $openid;
<?php /* Yelo: Open Sauce SDK Halo 1 (CE) Edition See license\OpenSauce\Halo1_CE for specific license information */ function OpenDatabase($data_source_name, $username, $password) { try { $dbConnection = new PDO($data_source_name, $username, $password); $dbConnection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $e) { die("ERROR: Failed to open the SQL database. (" . $e . ")</br>"); // Exit, displaying an error message } return $dbConnection; } // open the sql database $database = OpenDatabase($config->map_database->data_source_name, $config->map_database->username, $config->map_database->password);
*/ ### Overall Pastebin statistics require "include/global.inc.php"; $t = new Template("Pastebin Statistics"); $t->display('statistics.tpl'); exit; if (preg_match(',(msnbot|Googlebot),', $_SERVER["HTTP_USER_AGENT"])) { header("403 Robots Not Allowed"); print "Robots are not allowed access to this page. Please respect robots.txt."; exit; } require "template.php"; session_write_close(); pageHeader(_("pastebin.ca statistics")); pageSidebar(); $db = OpenDatabase(); print '<style type="text/css">table td, table th { padding-left: 5pt; padding-right: 5pt; }</style>'; makeSection(_('statistics')); $res = cache_pg_exec($db, "SELECT count(*) AS posts,sum(case when expiry is null then 1 else 0 end) as non_expiring,sum(case when expiry='-30 minutes' then 1 else 0 end) as spam,avg(length(content)) AS avg_content,avg(length(formatted_content)) AS avg_formatted,avg(expiry) AS avg_expiry,sum(length(content)) AS sum_content,sum(length(formatted_Content)) AS sum_formatted,min(expiry) as min_expiry,max(expiry) as max_expiry,min(length(content)) as min_content,max(length(content)) as max_content FROM bin", 3600); $r = $res[0]; $res2 = cache_pg_exec($db, "SELECT avg(hits) AS hits FROM bin_hits", 86400); $r2 = $res2[0]; print '<p>' . _('Here are some operational statistics for the Pastebin. These include all private and public subdomains. All of the Pastebin runs on 17,431 lines of PHP and Perl written by slePP. Total line count with all the other packages included is 117,329.') . '</p>'; makeSection(_('posts')); print '<table style="text-align:left">'; print '<tr><th>' . _('Total Posts') . ':</th><td>' . number_format($r['posts'], 0) . '</td></tr>'; print '<tr><th>' . _('Never Expiring') . ':</th><td>' . number_format($r['non_expiring'], 0) . ' (' . sprintf("%0.1f", $r['non_expiring'] / $r['posts'] * 100) . '%)</td></tr>'; print '<tr><th>' . _('Expired or Expiring') . ':</th><td>' . number_format($r['posts'] - $r['non_expiring'] - $r['spam'], 0) . ' (' . sprintf("%0.1f", ($r['posts'] - $r['non_expiring'] - $r['spam']) / $r['posts'] * 100) . '%)</td></tr>'; print '<tr><th>' . _('Tagged as Spam') . ':</th><td>' . number_format($r['spam'], 0) . ' (' . sprintf("%0.1f", $r['spam'] / $r['posts'] * 100) . '%)</td></tr>'; print '<tr><th>' . _('Average Hits per Post') . ':</th><td>' . number_format($r2['hits'], 2) . '</td></tr>'; print '</table>';
echo "<br>"; echo "<p><input type=\"button\" onclick=\"searchartikle()\" style=\"font-family: Arial; font-size: 12pt; height: 24px\" value=\"Artikelstamm aktualisieren\"/></p>"; echo "<p id='result'></p>"; } else { $order = substr($eanorder, 0, strlen($eanorder) - 1); $order = ltrim($order, '0'); if ($order != "") { $order_db = GetOrder($order); $orderlines = GetOrderLine($order_db->entity_id, $order); if ($order_db->entity_id != "") { echo CreateOrderHead($order_db, $MKZ, $UGP); echo CreateOrderArticle($orderlines, $MKZ, $UGP, true); $orderfound = true; } else { $orderfound = false; $link = OpenDatabase(); $sql = "SELECT * FROM `Artikel` where `ean` = " . $eanorder; $res = mysql_query($sql, $link); $art = new Article(); $articlefound = false; if ($art = mysql_fetch_object($res)) { $articlefound = true; echo GetUserInfo(); echo "<table border=\"0\" style='width: 1024px; border-collapse: collapse; '>"; echo "<tr>"; echo "<th>EAN-Nummer</th>"; echo "<th>SKU</th>"; echo "<th>Hersteller</th>"; echo "<th>Artikel</th>"; echo "<th>Preis</th>"; echo "<th>Shop</th>";
function ProcessAddMapEntry() { global $config; $result = new AddMapEntryResult(); $result->messages = array(); // collect config variables and arguments $map_compressed_dir = $config->map_server->map_compressed_dir; $map_parts_path = $config->map_server->map_parts_path; $map_file = $_POST["map_file"]; // check the arguments are valid if (!isset($map_file) || empty($map_file)) { $result->success = false; $result->error_message = "ERROR: Map file parameter not set.<br/>"; return $result; } if (!file_exists($map_file)) { $result->success = false; $result->error_message = "Provided file does not exist.<br/>"; return $result; } $map_file_info = pathinfo($map_file); $map_file_name = $map_file_info["filename"]; $map_file_extension = $map_file_info["extension"]; $map_file_directory = $map_file_info["dirname"]; // check the extension of the map file (.map, .yelo or .xml) $file_type = 0; if (strcmp($map_file_extension, "map") == 0) { $file_type = 1; } if (strcmp($map_file_extension, "yelo") == 0) { $file_type = 1; } if (strcmp($map_file_extension, "xml") == 0) { $file_type = 2; } if ($file_type == 0) { $result->success = false; $result->error_message = "Provided file is not valid.<br/>"; return $result; } // create the server defined locations if they don't already exist if (!file_exists($map_parts_path)) { if (mkdir($map_parts_path, 0760, true)) { $result->messages[] = "Created map parts folder <b>" . $map_parts_path . "<br/>"; } else { $result->success = false; $result->error_message = "Failed to create the map parts folder.<br/>"; return $result; } } if (!file_exists($map_compressed_dir)) { if (mkdir($map_compressed_dir, 0760, true)) { $result->messages[] = "Created compressed map folder <b>" . $map_compressed_dir . "<br/>"; } else { $result->success = false; $result->error_message = "Failed to create the compressed map output folder.<br/>"; return $result; } } // fill a map definition class, either manually or from an xml $map_definition = null; $map_name_info = null; switch ($file_type) { case 1: // provided file is a map, set the definition variables manually $map_definition = new MapDefinition(); $map_definition->algorithm = 0; $map_definition->name = $map_file_name; $map_definition->md5 = md5_file($map_file); $map_definition->uncompressed_size = filesize($map_file); $map_name_info = pathinfo($map_file); break; case 2: // provided file is an xml, set the definition variables by reading it as a map part definition $map_definition = LoadDefinition($map_file); if ($map_definition == null) { $result->success = false; $result->error_message = "Failed to load map part definition.<br/>"; return $result; } $map_name_info = pathinfo($map_definition->name); break; } // open the database $database = OpenDatabase($config->map_database->data_source_name, $config->map_database->username, $config->map_database->password); // look for the map in the database $map_entry = new MapEntryReader($database, "SELECT {0} FROM `map_list` WHERE map_name = ?"); $map_entry->ExecuteQuery(array($map_name_info["filename"])); if ($map_entry->MoveNext()) { // map already in database if ($map_entry->map_compression_stage != 1) { // the map was not added successfully so remove the entry and reprocess the map $result->messages[] = "WARNING: Reprocessing a map that previously failed, map will be removed and reprocessed."; $remove_map_entry_result = RemoveMapEntry($database, $map_entry->file_id, $map_compressed_dir); if (!$remove_map_entry_result->success) { $result->success = false; $result->error_message = $remove_map_entry_result->error_message; return $result; } $result->messages = array_merge($result->messages, $remove_map_entry_result->messages); } else { $result->success = false; $result->error_message = "Map <i>" . $map_name_info["filename"] . "</i> already exists in the database.<br/>"; return $result; } $map_entry = NULL; } // file not in database so insert a new row in to the map_list table $map_writer = new MapEntryWriter($database, "INSERT INTO `map_list` ({0}) VALUES ({1})"); $map_writer->map_name = $map_file_name; $map_writer->map_extension = $map_name_info["extension"]; $map_writer->map_md5 = $map_definition->md5; $map_writer->map_uncompressed_size = $map_definition->uncompressed_size; $map_writer->ExecuteQuery(NULL); $file_id = $database->lastInsertId(); $result->messages[] = "Map entry added to database for <i>" . $map_file_name . "</i>"; $parts_output_path = $map_parts_path . "/" . $map_file_name; // create the parts folder if (!file_exists($parts_output_path)) { if (mkdir($parts_output_path, 0760, true)) { $result->messages[] = "Created output folder <b>" . $parts_output_path . "</b>"; } else { $result->success = false; $result->error_message = "Failed to create the file parts output folder.<br/>"; return $result; } } // process the map file or part definition switch ($file_type) { case 1: // the provided file is a map // compress the map $result->messages[] = "Compressing <b>" . $map_file . "</b>..."; $output_file = $map_compressed_dir . "/" . $map_file_name . ".zip"; if (!CompressFiles(array($map_file, $map_file_name . "." . $map_file_extension), $output_file, 0)) { $result->success = false; $result->error_message = "Failed to create <b>" . $output_file . "</b>"; return $result; } $result->messages[] = "<b>" . $output_file . "</b> created."; $map_definition->compressed_size = filesize($output_file); // split the archive $result->messages[] = "Splitting the archive..."; if (($part_manifest = SplitFile($output_file, $parts_output_path, 1048576, false)) == null) { $result->success = false; $result->error_message = "Failed to split map archive.<br/>"; return $result; } if (!unlink($output_file)) { $result->success = false; $result->error_message = "Failed to delete temporary zip archive <b>" . $output_file . "</b>.<br/>"; return $result; } // build the parts list for ($i = 0; $i < count($part_manifest); $i++) { $part = new PartDefinition(); $part_info = pathinfo($part_manifest[$i]); $part->name = $part_info["basename"]; $part->index = $i; $part->md5 = md5_file($part_manifest[$i]); $part->size = filesize($part_manifest[$i]); $map_definition->part[] = $part; } break; case 2: $result->messages[] = "Copying map parts to web directory..."; foreach ($map_definition->part as $value) { // verify map part if ($value->encrypted) { $result->messages[] = "WARNING: Encrypted part encountered. If this is a master server do NOT use encrypted maps."; } $part_source_path = $map_file_directory . "/" . $value->name; if (!file_exists($part_source_path)) { $result->success = false; $result->error_message = "A map part is missing.<br/>"; return $result; } if (strcasecmp(md5_file($part_source_path), $value->md5) != 0) { $result->success = false; $result->error_message = "Uploaded part's md5 does not match that in the definition.<br/>"; return $result; } // copy part to parts folder if (!copy($part_source_path, $parts_output_path . "/" . $value->name)) { $result->success = false; $result->error_message = "Failed to copy a part to the parts folder.<br/>"; return $result; } } break; } // add parts to database $part_entry = new MapPartWriter($database, "INSERT INTO `map_part_list` ({0}) VALUES ({1})"); for ($i = 0; $i < count($map_definition->part); $i++) { $part_entry->map_file_id = $file_id; $part_entry->part_id = $map_definition->part[$i]->index; $part_entry->part_name = $map_definition->part[$i]->name; $part_entry->part_md5 = $map_definition->part[$i]->md5; $part_entry->part_size = $map_definition->part[$i]->size; $result->messages[] = "Part: <i>" . $part_entry->part_name . "</i>\tMD5: <i>" . $part_entry->part_md5 . "</i>"; $part_entry->ExecuteQuery(NULL); } $result->messages[] = "Part entries added to database."; // update the maps database with the parts path $map_entry_update = new MapEntryUpdater($database, "UPDATE `map_list` SET {0} WHERE file_id = ?"); $map_entry_update->map_compressed_size = $map_definition->compressed_size; $map_entry_update->map_compression_type = $map_definition->algorithm; $map_entry_update->map_parts_path = $map_parts_path . "/" . $map_file_name; $map_entry_update->map_part_count = count($map_definition->part); $map_entry_update->ExecuteQuery(array($file_id)); // update map progress to process completed $compression_stage = new MapCompressionUpdater($database, "UPDATE `map_list` SET {0} WHERE file_id = ?"); $compression_stage->map_compression_stage = 1; $compression_stage->ExecuteQuery(array($file_id)); $result->messages[] = "Map added to server successfully!"; $result->success = true; return $result; }