function addrandom() { connecttodb(); $query = "SELECT path FROM mp3 ORDER BY Rand() LIMIT 10"; // EDIT HERE and specify your table and field names for the SQL query $result = mysql_query($query) or die("Couldn't execute query"); while ($row = mysql_fetch_array($result)) { $file = $row["path"]; #echo $file; addtoq($file); } }
<?php include $_SERVER['DOCUMENT_ROOT'] . '/sadmin/process/pro_connect/pro_connect.php'; $link = connecttodb(); mysqli_set_charset($link, "utf8"); $query = "SELECT `con_for_id`,`con_for_dat`,`con_for_nam`,`con_for_com`,`con_for_ema`,`con_for_iss`, `con_for_mes`, `con_for_vie` ,`sta_id` \nFROM `tbl_contact_form` WHERE `sta_id` <> 2 ORDER BY `con_for_id` DESC"; $sql_list_contact_form = mysqli_query($link, $query) or die(mysqli_error($link)); mysqli_close($link);
<?php /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ function connecttodb($servername,$dbname,$dbuser,$dbpassword) { $link=mysql_connect ("$servername","$dbuser","$dbpassword",TRUE); if(!$link){die("Could not connect to MySQL");} mysql_select_db("$dbname",$link) or die ("could not open db".mysql_error()); return $link; } //$cs = connecttodb("localhost","creation","creation","station1066"); $crm1 = connecttodb("localhost","admin_crm1","user_crm","Xbvt54*2"); function hash_password($pass, $userid) { $salt = md5($userid); return hash('sha256', $salt . $pass); } $q = mysql_query("select * from dpd_aauth_users order by id ASC", $crm1) or die("check"); while($row = mysql_fetch_array($q)){ $password = hash_password("Mcc2612", $row['id']); mysql_query("UPDATE dpd_aauth_users set pass = '******' where id='$row[id]'", $crm1) or die("Error"); }
<?php //MaNGOS Registration Script by kylef // SITE INFO $SITE = ""; // Site address $SITE_NAME = "MaNGOS Test Server"; // Site Name $realmlist = "mangos.mine.nu"; // Realmlist IP or DNS // DATABASE SETTINGS $HOST = "localhost"; // Host to database (usualy localhost) $DB = "mangos"; // The database for your MaNGOS $USER = ""; // Username for your MaNGOS database $PASSWORD = ""; // And password for your MaNGOS database connecttodb($HOST, $DB, $USER, $PASSWORD); function connecttodb($HOST, $DB, $USER, $PASSWORD) { global $link; $link = mysql_connect("{$HOST}", "{$USER}", "{$PASSWORD}"); if (!$link) { die("Could not connect to MySQL"); } mysql_select_db("{$DB}", $link) or die("could not open db" . mysql_error()); }
<?php //////////// Change the data part only with your database login details ///////////////// $dbservertype = 'mysql'; // hostname or ip of server $servername = 'localhost'; // username and password to log onto db server $dbusername = '******'; $dbpassword = ''; $dbname = 'db_mis'; ////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// //////////////////////////////////////// ////// DONOT EDIT BELOW ///////// /////////////////////////////////////// connecttodb($servername, $dbname, $dbusername, $dbpassword); function connecttodb($servername, $dbname, $dbuser, $dbpassword) { global $link; $link = mysql_connect("{$servername}", "{$dbuser}", "{$dbpassword}"); if (!$link) { die("Could not connect to MySQL"); } mysql_select_db("{$dbname}", $link) or die("could not open db" . mysql_error()); }
<?php session_start(); ini_set("display_errors", 1); #INCLUIMOS LA CONEXION A LA BASE DE DATOS y CON ESTA EL CONFIG require_once $_SERVER['DOCUMENT_ROOT'] . '/' . $name_proyect . '/process/pro_connect/pro_connect.php'; $connectdb = connecttodb($name_proyect); //colocar "true" como segundo parametro para hacer debug en las consultas $ifconexion = $connectdb[1]; $db = $connectdb[0]; $_error_debug = $connectdb[2]; //comprobamos si existe la conexión. if ($ifconexion == false) { $_Msg_response = $db; //Si existe la conexión, procedemos a validar. } else { #Bloque para la REGULAR PAGINATION $Page_url = "/{$name_proyect}/" . $_GET['url_module'] . "/sgd/" . $_GET['option'] . "/lst/"; $Page = intval($_GET['page']); //Page $SizePage = intval($_GET['size']); if ($SizePage == 0) { $SizePage = 10; } //Limit $Order = intval($_GET['order']); //Orden $By = intval($_GET['by']); //By - por que numero se ordena if ($Page <= 1) { $StartPage = 0;
function gettextforspecies($species) { $retstr = ""; $conn = connecttodb(); $qry = "select species, description, para_order from genus_descriptions where species like \"{$species}\" order by para_order;"; try { $stmt = $conn->prepare($qry); $stmt->execute(); $result = $stmt->fetchAll(); while ($row = array_shift($result)) { $species = $row['species']; $description = $row['description']; //$para_order = $row['para_order']; $retstr = $retstr . "<p>" . $description . "</p>"; } } catch (PDOException $e) { echo "Error: " . $e->getMessage(); } $conn = NULL; return $retstr; }