Help
Ask questions about how to do or fix things in Arrowchat
User avatar
sello
Free
 
Posts: 1
Joined: 08 Aug 2017, 14:14

 

by sello 08 Aug 2017, 14:24

The User ID is not set < that's what i see whenn i go to debug. I have do all thing but the problem is intergration.. :(

This is my user.php of my custom php:

Code: Select all
<?php
define('_VALID', true);
require 'include/config.php';
require 'include/function_global.php';
require 'include/function_smarty.php';
require 'include/function_user.php';

$template   = 'user';
$options    = getUserQuery();
$username   = $options['username'];
$module     = $options['module'];
if ( !$username ) {
    require 'classes/auth.class.php';
    $auth   = new Auth();
    $auth->check();
}

$sql    = "SELECT * FROM signup WHERE username = '" .mysql_real_escape_string($username). "' LIMIT 1";
$rs     = $conn->execute($sql);
if ( $conn->Affected_Rows() != 1 ) {
    VRedirect::go($config['BASE_URL']. '/error/user_missing');
}
$user   = $rs->getrows();
$user   = $user['0'];
$uid    = intval($user['UID']);

$sql        = "SELECT * FROM users_online WHERE UID = " .$uid. " AND online > " .(time()-300). " LIMIT 1";
$rs     = $conn->execute($sql);
if ( $conn->Affected_Rows() == 1 )
   $online = true;
else
   $online = false;

if ( $options['module'] != '' ) {
    $profile_menu  = $module;
    $template       = 'user_' .$module;
    require 'modules/user/' .$module. '.php';
} else {
    $options    = getUserModule($options['query']);
    $module     = $options['module'];
    if ( !$module == '' ) {
        if ( $module == 'favorite' ) {
            $submodules_allowed = array('videos', 'photos', 'games');
            if ( isset($options['query']['0']) && in_array($options['query']['0'], $submodules_allowed) ) {
                $submodule  = $options['query']['0'];
                $template   = 'user_favorite_' .$submodule;
                require 'modules/user/favorite_' .$submodule. '.php';
            } else {
                session_write_close();
                header('Location: ' .$config['BASE_URL']. '/error/invalid_module');
                die();
            }
        } else {
            $template = 'user_' .$module;
            require 'modules/user/' .$module. '.php';
        }
    } else {
        $prefs          = get_user_prefs($uid);
        $is_friend      = is_friend($uid);
        $friends        = get_user_friends($uid, $prefs['show_friends'], $is_friend);
        $playlist       = get_user_playlist($uid, $prefs['show_playlist'], $is_friend);
        $favorites      = get_user_favorites($uid, $prefs['show_favorites'], $is_friend);
        $subscriptions  = get_user_subscriptions($uid, $prefs['show_subscriptions'], $is_friend);
        $subscribers    = get_user_subscribers($uid, $prefs['show_subscribers'], $is_friend);
        $albums         = get_user_albums($uid);
        $photos         = get_user_favorite_photos($uid, $prefs['show_favorites'], $is_friend);
        $favorite_games          = get_user_favorite_games($uid, $prefs['show_favorites'], $is_friend);

        $show_wall      = false;
        $wall_public    = $prefs['wall_public'];
        $walls          = array();
        $walls_total    = 0;
        if ( $wall_public == '1' ) {
            $show_wall  = true;
        } else {
            if ( $is_friend ) {
                $show_wall  = true;
            } elseif ( isset($_SESSION['uid']) && $_SESSION['uid'] == $uid ) {
                $show_wall  = true;
            }
        }
       
        if ( $show_wall ) {
            require 'classes/pagination.class.php';
            $sql            = "SELECT COUNT(wall_id) AS total_walls FROM wall WHERE OID = " .$uid. " AND status = '1'";
            $rsc            = $conn->execute($sql);
            $walls_total    = $rsc->fields['total_walls'];
            $pagination     = new Pagination(10);
            $limit          = $pagination->getLimit($walls_total);           
            $sql            = "SELECT w.wall_id, w.UID, w.message, w.addtime, u.username, u.photo, u.gender
                               FROM wall AS w, signup AS u WHERE w.OID = " .$uid. " AND w.status = '1' AND w.UID = u.UID
                               ORDER BY w.addtime DESC LIMIT 10";
            $rs             = $conn->execute($sql);
            $walls          = $rs->getrows();
            $page_link      = $pagination->getPagination('user/' .$username, 'p_wall_comments_' .$uid. '_');
         $start_num      = $pagination->getStartItem();
         $end_num        = $pagination->getEndItem();         
            $smarty->assign('page_link', $page_link);
         $smarty->assign('start_num', $start_num);
         $smarty->assign('end_num', $end_num);
        }
       
        $blog           = array();
        $sql            = "SELECT BID, UID, title, content, total_views, total_comments, addtime
                           FROM blog WHERE UID = " .$uid. " AND status = '1'
                           ORDER BY addtime DESC LIMIT 1";
        $rs             = $conn->execute($sql);
        if ( $conn->Affected_Rows() == 1 ) {
            $blog       = $rs->getrows();
            $blog       = $blog['0'];
         $blog['content'] = blog_output($blog['content']);
        }
       
        $sql            = "UPDATE signup SET profile_viewed = profile_viewed+1, popularity = popularity+0.1 WHERE UID = " .$uid. " LIMIT 1";
        $conn->execute($sql);
         
        $self_title         = $username. '\' Profiel - Gratis Nederlandse amateur porno';
     
        $smarty->assign('friends', $friends);
        $smarty->assign('playlist', $playlist);
        $smarty->assign('favorites', $favorites);
        $smarty->assign('subscriptions', $subscriptions);
        $smarty->assign('subscribers', $subscribers);
        $smarty->assign('videos', get_user_videos($uid));
        $smarty->assign('games', get_user_games($uid));
        $smarty->assign('show_wall', $show_wall);
        $smarty->assign('walls', $walls);
        $smarty->assign('walls_total', $walls_total);
        $smarty->assign('albums', $albums);
        $smarty->assign('blog', $blog);
        $smarty->assign('photos', $photos);
        $smarty->assign('favorite_games', $favorite_games);
    }
}

$self_title = ( isset($self_title) ) ? $self_title . ' - ' .$config['site_name'] : $config['site_name'];

$smarty->assign('errors',$errors);
$smarty->assign('err',$err);
$smarty->assign('messages',$messages);
$smarty->assign('menu', 'community');
$smarty->assign('submenu', '');
$smarty->assign('username', $username);
$smarty->assign('user', $user);
$smarty->assign('online', $online);
$smarty->assign('popularity', '$popularity');
$smarty->assign('points', '$points');
$smarty->assign('profile', true);
$smarty->assign('self_title', $self_title);
$smarty->display('header.tpl');
if ( isset($profile_menu) ) {
    $smarty->assign('profile_menu', $profile_menu);
    $smarty->display('user_profile_menu.tpl');
}
$smarty->display('errors.tpl');
$smarty->display('messages.tpl');
$smarty->display($template. '.tpl');
$smarty->display('footer.tpl');
$smarty->gzip_encode();
?>


This is my intergration.php

Code: Select all
<?php

   /*
   || #################################################################### ||
   || #                             ArrowChat                            # ||
   || # ---------------------------------------------------------------- # ||
   || #    Copyright ©2010-2012 ArrowSuites LLC. All Rights Reserved.    # ||
   || # This file may not be redistributed in whole or significant part. # ||
   || # ---------------- ARROWCHAT IS NOT FREE SOFTWARE ---------------- # ||
   || #   http://www.arrowchat.com | http://www.arrowchat.com/license/   # ||
   || #################################################################### ||
   */
   
   // UNCOMMENT THE SESSION START IF YOU ARE USING SESSIONS TO GET THE USER ID
   // session_start();

   /**
    * This function returns the user ID of the logged in user on your site.  Technical support will not
    * help you with this for stand-alone installations.  You must purchase the professional installation
    * if you are having trouble.
    *
    * Suggestion: Check out the other integration files in the functions/integrations directory for
    * many examples of how this can be done.  The easiest way is to get the user ID through a cookie.
    *
    * @return the user ID of the logged in user or NULL if not logged in
    */
   function get_user_id()
   {
      $userid = null;
      
      i1f (isset($_SESSION['UID']))
      {
         $userid = $_SESSION['username'];
      }

      return $userid;
   }

   /**
    * This function returns the SQL statement for the buddylist of the user.  You should retrieve
    * all ONLINE friends that the user is friends with.  Do not retrieve offline users.  You can use
    * global $online_timeout to get the online timeout.
    * ex: AND (arrowchat_status.session_time + 60 + " . $online_timeout . ") > " . time() . "
    *
    * @param userid the user ID of the person receiving the buddylist
    * @param the time of the buddylist request
    * @return the SQL statement to retrieve the user's friend list
    */
   function get_friend_list($userid, $time)
   {
      global $db;
      global $online_timeout;
      
      $sql = ("
         SELECT DISTINCT " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_USERID . " userid, " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_NAME . " username, arrowchat_status.session_time lastactivity, " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_AVATAR . " avatar, " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_USERID . " link, arrowchat_status.is_admin, arrowchat_status.status
         FROM " . TABLE_PREFIX . DB_FRIENDSTABLE . "
         JOIN " . TABLE_PREFIX . DB_USERTABLE . "
            ON  " . TABLE_PREFIX . DB_FRIENDSTABLE . "." . DB_FRIENDSTABLE_FRIENDID . " = " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_USERID . "
         LEFT JOIN arrowchat_status
            ON " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_USERID . " = arrowchat_status.userid
         WHERE " . TABLE_PREFIX . DB_FRIENDSTABLE . "." . DB_FRIENDSTABLE_USERID . " = '" . $db->escape_string($userid) . "'
            AND " . TABLE_PREFIX . DB_FRIENDSTABLE . "." . DB_FRIENDSTABLE_FRIENDS . " = 1
            AND (arrowchat_status.session_time + 60 + " . $online_timeout . ") > " . time() . "
         ORDER BY " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_NAME . " ASC
      ");
      
      return $sql;
   }

   /**
    * This function returns the SQL statement for all online users.  You should retrieve
    * all ONLINE users regardless of friend status.  Do not retrieve offline users.  You can use
    * global $online_timeout to get the online timeout.
    * ex: AND (arrowchat_status.session_time + 60 + " . $online_timeout . ") > " . time() . "
    *
    * @param userid the user ID of the person receiving the buddylist
    * @param the time of the buddylist request
    * @return the SQL statement to retrieve all online users
    */
   function get_online_list($userid, $time)
   {
      global $db;
      global $online_timeout;
      
      $sql = ("
         SELECT DISTINCT " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_USERID . " userid, " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_NAME . " username, arrowchat_status.session_time lastactivity, " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_AVATAR . " avatar, " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_USERID . " link, arrowchat_status.is_admin, arrowchat_status.status
         FROM " . TABLE_PREFIX . DB_USERTABLE . "
         JOIN arrowchat_status
            ON " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_USERID . " = arrowchat_status.userid
         WHERE ('" . time() . "' - arrowchat_status.session_time - 60 < '" . $online_timeout . "')
            AND " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_USERID . " != '" . $db->escape_string($userid) . "'
         ORDER BY " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_NAME . " ASC
      ");
      
      return $sql;
   }

   /**
    * This function returns the SQL statement to get the user details of a specific user.  You should
    * get the user's ID, username, last activity time in unix, link to their profile, avatar, and status.
    *
    * @param userid the user ID to get the details of
    * @return the SQL statement to retrieve the user's defaults
    */
   function get_user_details($userid)
   {
      global $db;
      
      $sql = ("
         SELECT " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_USERID . " userid, " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_NAME . " username, arrowchat_status.session_time lastactivity,  " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_USERID . " link,  " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_AVATAR . " avatar, arrowchat_status.is_admin, arrowchat_status.status
         FROM " . TABLE_PREFIX . DB_USERTABLE . "
         LEFT JOIN arrowchat_status
            ON " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_USERID . " = arrowchat_status.userid
         WHERE " . TABLE_PREFIX . DB_USERTABLE . "." . DB_USERTABLE_USERID . " = '" . $db->escape_string($userid) . "'
      ");
      
      return $sql;
   }

   /**
    * This function returns the profile link of the specified user ID.
    *
    * @param userid the user ID to get the profile link of
    * @return the link of the user ID's profile
    */
   function get_link($link, $user_id)
   {
      global $base_url;
      
      return $base_url . '../users.php?id=' . $link;
   }

   /**
    * This function returns the URL of the avatar of the specified user ID.
    *
    * @param userid the user ID of the user
    * @param image if the image includes more than just a user ID, this param is passed
    * in from the avatar row in the buddylist and get user details functions.
    * @return the link of the user ID's profile
    */
   function get_avatar($image, $user_id)
   {
      global $base_url;
      
      if (is_file(dirname(dirname(dirname(__FILE__))) . '/images/' . $image . '.gif'))
      {
         return $base_url . '../images/' . $image . '.gif';
      }
      else
      {
         return $base_url . AC_FOLDER_ADMIN . "/images/img-no-avatar.gif";
      }
   }

   /**
    * This function returns the name of the logged in user.  You should not need to
    * change this function.
    *
    * @param userid the user ID of the user
    * @return the name of the user
    */
   function get_username($userid)
   {
      global $db;
      global $language;
      global $show_full_username;
      
      $users_name = $language[83];

      $result = $db->execute("
         SELECT " . DB_USERTABLE_NAME . " name
         FROM " . TABLE_PREFIX . DB_USERTABLE . "
         WHERE " . DB_USERTABLE_USERID . " = '" . $db->escape_string($userid) . "'
      "); 

      if ($result AND $db->count_select() > 0) 
      {
         $row = $db->fetch_array($result);
         $users_name = $row['name'];
      }

      $pieces = explode(" ", $users_name);
      
      if ($show_full_username == 1)
      {
         return $users_name;
      }
      else
      {
         return $pieces[0];
      }
   }

?>
User avatar
bato3
Free
 
Posts: 5
Joined: 06 Oct 2016, 16:41

 

by bato3 14 Sep 2017, 03:07

in itegration.php you use $_SESSION['username'] and $_SESSION['UID']. Where you set it in your user.php / custom.php?

2. Probably you must enable session_start() in integration