Exemplo n.º 1
0
function storeData($sql, $eMore)
{
    $eMore = "";
    $hn = 'localhost';
    $user = '******';
    $pw = 'password123';
    $cn = MySQL_connect($hn, $user, $pw);
    if ($cn) {
        $dbname = 'advocacy_db';
        $connect = MySQL_select_db($dbname);
        if ($connect) {
            $return = MySQL_query($sql, $cn);
            if ($return == TRUE) {
                //success...
            } else {
                $eMore .= "Query (return) was not successful.\n";
                //error...
            }
            MySQL_close($cn);
        } else {
            $eMore .= "DB selection was not successful.\n";
        }
    } else {
        $eMore .= "Connection to db was not successful.\n";
    }
    return $eMore;
}
Exemplo n.º 2
0
	/** connect to database using $mysql_info array
	 * possibly should be replaced with PEAR equivalent 
	 */
	public static function connect( $mysql_info ) {
		$server = $mysql_info["server"];
		$user = $mysql_info["user"];
		$password = $mysql_info["password"];
		$dbname = $mysql_info["dbname"];

		$connection = MySQL_connect( $server, $user, $password );
		if ( !$connection )die( "Cannot connect to SQL server. Try again later." );
		MySQL_select_db( $dbname ) or die( "Cannot open database" );
		mysql_query( "SET NAMES 'utf8'" );
	}
Exemplo n.º 3
0
function connect() {
	$server = "localhost";
	$user = "******";
	$password = "";
	$dbname = "trainer";

	$connection = MySQL_connect( $server, $user, $password );
	if ( !$connection )die( "Cannot connect to SQL server. Try again later." );
	MySQL_select_db( $dbname ) or die( "Cannot open database" );
	mysql_query( "SET NAMES 'utf8'" );
}
Exemplo n.º 4
0
function connect() {

	global $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname;

	$db1 = $wgDBserver;  # hostname
	$db2 = $wgDBuser;  # user
	$db3 = $wgDBpassword;  # pass
	$db4 = $wgDBname;  # db-name

	$connection = MySQL_connect( $db1, $db2, $db3 );
	if ( !$connection )die( "Cannot connect to SQL server. Try again later." );
	MySQL_select_db( $db4 ) or die( "Cannot open database" );
	mysql_query( "SET NAMES 'utf8'" );
}
Exemplo n.º 5
0
<?php
header( "Content-type: text/html; charset=UTF-8" );
$dc = "umls";

define( 'MEDIAWIKI', true );
include_once( "../../../../LocalSettings.php" );
global $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname;

$db1 = $wgDBserver;  # hostname
$db2 = $wgDBuser;  # user
$db3 = $wgDBpassword;  # pass
$db4 = $wgDBname;  # db-name

$connection = MySQL_connect( $db1, $db2, $db3 );
if ( !$connection )die( "Cannot connect to SQL server. Try again later." );
MySQL_select_db( $db4 ) or die( "Cannot open database" );
mysql_query( "SET NAMES 'utf8'" );

echo "
<style type=\"text/css\"><!--
body {font-family:arial,sans-serif}
--></style>
";

function stopwatch() {
   list( $usec, $sec ) = explode( " ", microtime() );
   return ( (float)$usec + (float)$sec );
}

/*
$result = mysql_query("SELECT 
Exemplo n.º 6
0
    $web = clean($web);
    $loc = $_POST['q3_location'];
    // clean input
    $loc = clean($loc);
    // mysql query
    mysql_query("UPDATE users SET website= '{$web}', location='{$loc}', avatar='{$imgData}' WHERE username ='******'");
    header("refresh:0; url=../{$user}");
    // if an avatar is not uploaded then do not include it in the query because it will override the one in the database
} else {
    $web = $_POST['q4_website'];
    // clean input
    $web = clean($web);
    $loc = $_POST['q3_location'];
    // clean input
    $loc = clean($loc);
    // connect to database
    MySQL_connect("{$dbhost}", "{$dbusername}", "{$dbpasswd}");
    mysql_select_db($database_name) or die("Could not select database") or die("Couldn't connect to server.");
    // query
    mysql_query("UPDATE users SET website= '{$web}', location='{$loc}' WHERE username ='******'");
    // redirect when complete
    header("refresh:0; url=../{$user}");
}
// clean users input
function clean($var)
{
    $var = htmlspecialchars($var);
    $var = mysql_real_escape_string($var);
    $var = strip_tags($var);
    return $var;
}
Exemplo n.º 7
0
<?php

$userid = $_GET['userid'];
$btype = $_GET['btype'];
$dbs = MySQL_connect("192.168.234.129", "toryzen", "q1w2e3r4");
MySQL_select_db("qqnotic", $dbs);
mysql_query("set names utf8");
$now = time();
if ($userid && $btype) {
    $sql1 = "INSERT INTO qqnotic VALUES ('NULL','{$btype}','{$userid}','',0,'{$now}',0)";
    $result = MySQL_query($sql1);
    echo "ok";
} else {
    echo "erro";
}
mysql_close($dbs);