Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[PHP] Syntax Error

Status
Not open for further replies.
Newbie Spellweaver
Joined
Apr 15, 2007
Messages
32
Reaction score
0
PHP:
<?php
define("IN_TROPICANCM", TRUE);
session_start();

@include('./config.php');

$remote_ip = $_SERVER[REMOTE_ADDR];
$configsql = mysql_query("SELECT * FROM system_data LIMIT 1") or die(mysql_error());
$config = mysql_fetch_assoc($configsql);
$sitename = $config['sitename'];
$maintenance = $config['site_closed'];
$H = date('H');
$i = date('i');
$s = date('s');
$m = date('m');
$d = date('d');
$Y = date('Y');
$j = date('j');
$n = date('n');
$today = $d;
$month = $m;
$year = $Y;
$date_normal = date('d-m-Y',mktime($m,$d,$Y));
$date_reversed = date('Y-m-d', mktime($m,$d,$y));
$date_full = date('d-m-Y H:i:s',mktime($H,$i,$s,$m,$d,$Y));
$date_time = date('H:i:s',mktime($H,$i,$s));
$date_tv = "".$j."-".$n."-".$Y."";
$regdate = $date_normal;
$s1ql = mysql_query("SELECT * FROM system LIMIT 1");
$r1ow = mysql_fetch_assoc($s1ql);

// Session beginner
if(session_is_registered('username')){

    $rawname = $_SESSION['username'];
    $rawpass = $_SESSION['password'];

    $usersql = mysql_query("SELECT * FROM users WHERE name = '".$rawname."' AND password = '".$rawpass."' LIMIT 1");
    $myrow = mysql_fetch_assoc($usersql);

    $password_correct = mysql_num_rows($usersql);

    $my_id = $myrow['id'];
    $user_rank = $myrow['rank'];

    $check = mysql_query("SELECT * FROM users_bans WHERE userid = '".$my_id."' OR ipaddress = '".$remote_ip."' LIMIT 1") or die(mysql_error());
    $is_banned = mysql_num_rows($check);

    if($password_correct !== 1){ // Invalid credentials. Possible session hijack attempt, so we log the user out.
        
        session_destroy();
        header("location:?p=login_error");
        exit;
        
    } elseif($is_banned > 0){
        
        $bandata = mysql_fetch_assoc($check);
        $reason = $bandata['descr'];
        $expire = $bandata['date_expire'];

        $xbits = explode(" ", $expire);
        $xtime = explode(":", $xbits[1]);
        $xdate = explode("-", $xbits[0]);

        $stamp_now = time();
        $stamp_expire = mktime($xtime[0], $xtime[1], $xtime[2], $xdate[0], $xdate[1], $xdate[2]);
    
        if($stamp_now < $stamp_expire){
            
            $login_error = "You have been banned from TropicaVille for the following reason(s): \"" . $reason . "\". And will expire at " . $expire . ".";
            include('?p=logout');
            session_destroy();
            exit;
            
        } else {
            
            // Expire Ban
            mysql_query("DELETE FROM users_bans WHERE userid = '".$my_id."' OR ipaddress = '".$remote_ip."' LIMIT 1") or die(mysql_error());
            
        }
    }

    if($password_correct == 1){

    $logged_in = true;
    $name = stripslashes($myrow['name']);
    
} else {
    
    $user_rank = 0;
    $name = "Guest";
    $my_id = "GUEST";
    $myticket = "NONE";
    $logged_in = false;
    
}

if($user_rank > 3){
    if(session_is_registered(hkusername) && session_is_registered(hkpassword)){
        $rank['iAdmin'] = "1";
    } else {
        $rank['iAdmin'] = "0";
    }
} else {
    $rank['iAdmin'] = "0";
}

// VIP Days Remaining
function TVDaysLeft($my_id){

    // Query for the info we need to calculate
    $sql = mysql_query("SELECT months_left,date_monthstarted FROM users_vip WHERE userid = '".$my_id."' LIMIT 1") or die(mysql_error());
    $tmp = mysql_fetch_assoc($sql);
    $valid = mysql_num_rows($sql);

    if($valid > 0){

        // Collecting data needed for calculation.
        $months_left = $tmp['months_left'];
        $month_started = $tmp['date_monthstarted'];

        // Calculating "MONTH" String
        $days_left = $months_left * 31;

        // Spliting data.
        $tmp = explode("-", $month_started);
        $day = $tmp[0];
        $month = $tmp[1];
        $year = $tmp[2];

        // $date_compare
        $then = mktime(0, 0, 0, $month, $day, $year, 0);
        $now = time();
        $difference = $now - $then;

        // Expired_Month.Has()Began
        if ($difference < 0){
            $difference = 0;
        }

        // ()session_days(expire);
        $days_expired = floor($difference/60/60/24);

        // $days_expired stands for the days we already wasted in this month
        // Done.(vip_session(s))Begin
        $days_left = $days_left - $days_expired;

        return $days_left;

    } else {
        return 0;
    }
}

function GiveTV($user_id, $months){
    
$sql = mysql_query("SELECT * FROM users_vip WHERE userid = '".$user_id."' LIMIT 1") or die(mysql_error());
$valid = mysql_num_rows($sql);

    if($valid > 0){
        mysql_query("UPDATE users SET rank = '2' WHERE rank = '1' AND id = '".$user_id."' LIMIT 1") or die(mysql_error());
        mysql_query("UPDATE users_vip SET months_left = months_left + ".$months." WHERE userid = '".$user_id."' LIMIT 1") or die(mysql_error());
        
    } else {
        $m = date('m');
        $d = date('d');
        $Y = date('Y');
        $date = date('d-m-Y', mktime($m,$d,$Y));
        mysql_query("INSERT INTO users_club (userid,date_monthstarted,months_expired,months_left) VALUES ('".$user_id."','".$date."','0','0')") or die(mysql_error());
        GiveTV($user_id, $months);
    }
    
if(session_is_registered(username)){
$blob = time();
mysql_query("UPDATE users SET online = '".$blob."', ipaddress_last = '".$remote_ip."' WHERE id = '".$my_id."' LIMIT 1") or die(mysql_error());
    //if($phail == true){
    //echo "<b>Please wait..</b><br /><br />";
    //mysql_query("ALTER TABLE `users` ADD `online` TEXT NOT NULL ;") or die(mysql_error());
    //echo "Done!";
    //exit;
    //}
}

function IsUserBanned($my_id){
    
    $check = mysql_query("SELECT * FROM users_bans WHERE userid = '".$my_id."' LIMIT 1") or die(mysql_error());
    $is_banned = mysql_num_rows($check);
    
    if(!is_numeric($my_id)){ return false; }

    if($is_banned > 0){
        $bandata = mysql_fetch_assoc($check);
        $reason = $bandata['descr'];
        $expire = $bandata['date_expire'];

        $xbits = explode(" ", $expire);
        $xtime = explode(":", $xbits[1]);
        $xdate = explode("-", $xbits[0]);

        $stamp_now = time();
        $stamp_expire = mktime($xtime[0], $xtime[1], $xtime[2], $xdate[0], $xdate[1], $xdate[2]);
    
        if($stamp_now < $stamp_expire){
            return true;
        } else { // ban expired
            mysql_query("DELETE FROM users_bans WHERE userid = '".$my_id."' LIMIT 1") or die(mysql_error());
            return false;
        }
    } else {
        return false;
    }
?>
And I get this:
Code:
[SIZE=2]
[B]Parse error[/B]:  syntax error, unexpected $end in [B]/home/alca/public_html/tropicaville/main_core.php[/B] on line [B]212
[/B]Tell me what I'm doing wrong?
[/SIZE]
 
Custom Title Activated
Loyal Member
Joined
Mar 9, 2004
Messages
2,425
Reaction score
2
Re: Syntax Error

i cant see any 1 helping you - even the link in ur sig is fishy

This web site at habbotech.no-ip.info has been reported as a web forgery and has been blocked based on your security preferences.
 
Custom Title Activated
Loyal Member
Joined
Jun 28, 2007
Messages
2,986
Reaction score
3
Re: Syntax Error

You never end the last function with a bracket.

Do some self investigation before you post, and put the right tag in your title.
Signature reported.
 
Status
Not open for further replies.
Back
Top