Salve a tutti dopo aver modificato il file che posto qui sotto il sistema mi da questo errore, da come potrete notare è un'applicazioni facebook che sto sviluppando.
Parse error: syntax error, unexpected T_STRING in /home/orangeworks/www.orangeworks.it/lovefinder/dbinfo.php on line 57
codice:
<?php
require_once 'appinclude.php';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname, $conn);
function query($q) {
global $conn;
$result = mysql_query($q, $conn);
if (!$result) {
die("Invalid query -- $q -- " . mysql_error());
}
return $result;
}
//====================================
// Check if user exists
//====================================
function check_user( $u ) {
$res = query("SELECT COUNT(*) FROM `appuser` WHERE `userid` = $u");
list($total_rows) = mysql_fetch_array($res);
if( $total_rows > 0 ) return true;
else return false;
}
//====================================
// Add a new user data
//====================================
function add_user( $u ) {
$s = get_user_sex($u);
if( empty($s) ) $s = 'male';
$bc = get_user_born_city($u);
if( empty($bc) ) $bc = 'none-bc';
$bd = get_user_born_day($u);
if( empty($bd) ) $bd = 'none-bd';
$sp = get_user_sex_preference($u);
if( empty($sp) ) $sp = 'none-sp';
$res = query("INSERT INTO `appuser` (`userid`, `sex`, `vote`, `born_city`, `born_day`, `sex_preference`) VALUES ($u, \"$s\", 0, \"$bc\", \"$bd\", \"$sp\");
}
//============================
// Get User Sex FROM DB
//============================
function db_get_user_sex( $u ) {
$Sex = "aa";
$res = query("SELECT * FROM `appuser` WHERE `userid`=$u");
while( $row = mysql_fetch_array($res) ) {
$Sex = $row[sex];
}
if( empty($Sex) ) $Sex = 'male';
return $Sex;
}
//============================
// Get User Sex
//============================
function get_user_sex( $u ) {
global $facebook;
$info = $facebook->api_client->users_getInfo($u, 'sex');
$usersex = $info[0]['sex'];
return $usersex;
}
//============================
// Get User Born City FROM DB
//============================
function db_get_user_born_city( $u ) {
$born_city = "";
$res = query("SELECT * FROM `appuser` WHERE `userid`=$u");
while( $row = mysql_fetch_array($res) ) {
$born_city = $row[born_city];
}
if( empty($born_city) ) $born_city = '0';
return $born_city;
}
//============================
// Get User Born City
//============================
function get_user_born_city( $u ) {
global $facebook;
$info = $facebook->api_client->users_getInfo($u, 'hometown_location');
$born_city = $info[0]['born_city'];
return $born_city;
}
//============================
// Get User Born Day FROM DB
//============================
function db_get_user_born_day( $u ) {
$born_day = "";
$res = query("SELECT * FROM `appuser` WHERE `userid`=$u");
while( $row = mysql_fetch_array($res) ) {
$born_day = $row[born_day];
}
if( empty($born_day) ) $born_day = 'ND';
return $born_day;
}
//============================
// Get User sex_preference FROM DB
//============================
function db_get_user_sex_preference( $u ) {
$sex_preference = "";
$res = query("SELECT * FROM `appuser` WHERE `userid`=$u");
while( $row = mysql_fetch_array($res) ) {
$sex_preference = $row[sex_preference];
}
if( empty($sex_preference) ) $sex_preference = 'ND';
return $sex_preference;
}
//============================
// Get User sex_preference
//============================
function get_user_sex_preference( $u ) {
global $facebook;
$info = $facebook->api_client->users_getInfo($u, 'meeting_sex');
$sex_preference = $info[0]['sex_preference'];
return $sex_preference;
}
//============================
// Get User Born Day
//============================
function get_user_born_day( $u ) {
global $facebook;
$info = $facebook->api_client->users_getInfo($u, 'birthday');
$born_day = $info[0]['born_day'];
return $born_day;
}
//====================================
// Get user's Total Vote
//====================================
function get_total_vote( $u ) {
$res = query("SELECT * FROM `appuser` WHERE `userid`=$u");
$row = mysql_fetch_assoc($res);
return $row[vote];
}
//====================================
// Get user's Total YES Vote
//====================================
function get_yes_vote( $u ) {
$res = query("SELECT COUNT(*) FROM `vote_log` WHERE `userid`=$u AND vote=1");
list($total_row) = mysql_fetch_array($res);
return $total_row;
}
//====================================
// Get user's Total NO Vote
//====================================
function get_no_vote( $u ) {
$res = query("SELECT COUNT(*) FROM `vote_log` WHERE `userid`=$u AND vote=0");
list($total_row) = mysql_fetch_array($res);
return $total_row;
}
//====================================
// Get user's Rank
//====================================
function get_user_rank($u) {
$res = query("SELECT * FROM `appuser` ORDER BY `vote` DESC");
$rank = 1;
while( $row = mysql_fetch_array($res) ) {
if( $row[userid] == $u ) break;
$rank++;
}
return $rank;
}
//====================================
// Check If User Already Voted
//====================================
function check_if_voted( $u, $voter ) {
$res = query("SELECT COUNT(*) FROM `vote_log` WHERE `userid`=$u AND `voteby`=$voter");
list($total_row) = mysql_fetch_array($res);
if( $total_row > 0 ) return 0;
else return $u;
}
//====================================
// Check If User Already Voted
//====================================
function get_total_user() {
$res = query("SELECT COUNT(*) FROM `appuser`");
list($total_row) = mysql_fetch_array($res);
return total_row;
}
?>