New User? Need help? Click here to register for free! Registering removes the advertisements.

Computer Cops
image image image image image image image image
Donations
If you found this site helpful, please donate to help keep it online
Don't want to use PayPal? Try our physical address
image
Prime Choice
· Head Lines
· Advisories (All)
· Dnld of the Week!
· CCSP News Ltrs
· Find a Cure!

· Ian T's (AR 22)
· Marcia's (CO8)
· Bill G's (CO10)
· Paul's (AR 5)
· Robin's (AR 2)

· Ian T's Archive
· Marcia's Archive
· Bill G's Archive
· Paul's Archive
· Robin's Archive
image
Security Central
· Home
· Wireless
· Bookmarks
· CLSID
· Columbia
· Community
· Downloads
· Encyclopedia
· Feedback (send)
· Forums
· Gallery
· Giveaways
· HijackThis
· Journal
· Members List
· My Downloads
· PremChat
· Premium
· Private Messages
· Proxomitron
· Quizz
· Recommend Us
· RegChat
· Reviews
· Search (Topics)
· Sections
· Software
· Statistics
· Stories Archive
· Submit News
· Surveys
· Top
· Topics
· Web Links
· Your Account
image
CCSP Toolkit
· Email Virus Scan
· UDP Port Scanner
· TCP Port Scanner
· Trojan TCP Scan
· Reveal Your IP
· Algorithms
· Whois
· nmap port scanner
· IPs Banned [?]
image
Survey
How much can you give to keep Computer Cops online?

$10 up to $25 per year?
$25 up to $50 per year?
$10 up to $25 per month?
$25 up to $50 per month?
More than $50 per year?
More than $50 per month?
One time only?
Other (please comment)



Results
Polls

Votes: 760
Comments: 19
image
Translate
English German French
Italian Portuguese Spanish
Chinese Greek Russian
image
 Forum FAQForum FAQ   SearchSearch   UsergroupsUsergroups   ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin 

Help with Perl

 
Post new topic   Reply to topic       Computer Cops Forum Index -> Forum Software Packages
View previous topic :: View next topic  
Author Message
Goddame

Cadet
Cadet



Joined: Mar 04, 2004
Posts: 6
Location: Ireland

PostPosted: Thu Jun 03, 2004 9:42 am    Post subject: Help with Perl
Reply with quote

Hi i got this free software called LiveHelp from http://craftysyntax.com/livehelp/ It gives you a option to change the image that tells the user if i'm online or offline. But i want to use a flash .swf file. I found the script that tells if im on or off. Is there any way i can make it use a flash file. Below is part of the file image.php if it's the right area to try to get htis working. In the department settings there is an area to enter the path to your file. I'm assuming that $department_a[offlineimage] & $department_a[onlineimage] is this.

Any help would be great

Code:
// are we online or not..
//----------------------------------------------------------------
if($cmd == "getstate"){
       
   $query = "SELECT * FROM livehelp_users,livehelp_operator_departments WHERE livehelp_users.user_id=livehelp_operator_departments.user_id AND livehelp_users.isonline='Y' AND livehelp_users.isoperator='Y' AND livehelp_operator_departments.department='$department' ";
   $data = $mydatabase->select($query);     

if($hide == "Y"){
   Header("Location: offline.gif"); 
} else {
  if( count($data) != 0){
    // see if they left their computer but did not log off..
    $prev = mktime ( date("H"), date("i")-2, date("s"), date("m"), date("d"), date("Y") );
    $oldtime = date("YmdHis",$prev);
    $query = "UPDATE livehelp_users set isonline='N',status='offline' WHERE isoperator='Y' AND lastaction<'$oldtime'";
    $mydatabase->sql_query($query);
    $mydatabase->close_connect();
    Header("Location: $department_a[onlineimage]");   
  } else {   
      $mydatabase->close_connect();
   if($department_a[leaveamessage] == "YES"){
     if($department_a[qa_enabled] == "Y"){
       Header("Location: $department_a[qaimage]"); 
     } else {
       Header("Location: $department_a[offlineimage]");     
     }
   } else {   
     Header("Location: offline.gif"); 
   }
  }
 }
}
Back to top
View users profile Send private message Visit posters website
Goddame

Cadet
Cadet



Joined: Mar 04, 2004
Posts: 6
Location: Ireland

PostPosted: Thu Jun 03, 2004 9:56 am    Post subject:
Reply with quote

The code i put in my html file is
<script language="javascript" src="http://bm-comp.com/help/livehelp_js.php?department=1"></script>


Livehelp_js.php
Code:

<?
//****************************************************************************************/
//  Crafty Syntax Live Help (CSLH)  by Eric Gerdes (http://craftysyntax.com )
//======================================================================================
// NOTICE: Do NOT remove the copyright and/or license information from this file.
//         doing so will automatically terminate your rights to use this program.
// ------------------------------------------------------------------------------------
// ORIGINAL CODE:
// ---------------------------------------------------------
// Crafty Syntax Live Help (CSLH) http://cslh.com/
// Copyright (C) 2003  Eric Gerdes
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation;
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program in a file named LICENSE.txt .
// if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
// --------------------------------------------------------- 
// MODIFICATIONS:
// --------------------------------------------------------- 
// [ Programmers who change this code should cause the  ]
// [ modified changes here and the date of any change.  ]
//======================================================================================
//****************************************************************************************/
require("globals.php");

if (!isset($rand_id)) {
    // get random
   srand(time());
   $letters = array ("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0");
   $index = rand(0,35);
   $random = "$letters[$index]";
   for ($z = 1; $z < 9; $z++){
       $index = rand(0,35);
       $random = "$random" . "$letters[$index]";
   }
   $rand_id = $random;
   setcookie ("rand_id", $random,time()+3600, "/");

}

if($identity == ""){
 if($REMOTE_ADDR == ""){
    $REMOTE_ADDR = $HTTP_SERVER_VARS["REMOTE_ADDR"];
 }
 if($HTTP_USER_AGENT == ""){
    $HTTP_USER_AGENT = $HTTP_SERVER_VARS["HTTP_USER_AGENT"];
 }
 $identity = $REMOTE_ADDR . $HTTP_USER_AGENT . $rand_id;
 $referer = $HTTP_REFERER;
 $identity = ereg_replace(" ","",$identity);
 setcookie ("identity", $identity,time()+3600, "/");
}

require_once 'config.php';
require_once 'config_cslh.php';
print "var WEBPATH = \"" . $webpath . "\"; ";
?>
//-----------------------------------------------------------------
// File: livehelp.js :
//      - This is the client side Javascript file to control the
//        image shown on the clients website. It should be called
//        on the clients HTML page as a javascript include such as:
//        script src="http://yourwebsite.com/livehelp/livehelp_js.php"
//        This js file will show the image of online.gif if an operator
//        is online otherwise it will show offline.gif . Also a
//        second image is placed on the site as a control image
//        where the width of the image controls the actions made by
//        the operator to the poor little visitor.. 
//
//-----------------------------------------------------------------

// GLOBALS..
//------------
// This is the control image where the width of it controls the
// actions made by the operator.
cscontrol= new Image;
// this is a flag to control if the image is set on the page
// yet or not..
var csloaded = false;

// just to make sure that people do not just open up the page
// and leave it open the requests timeout after 999 requests.
var csTimeout = 99;

// The id of the page request.
var csID = null;

// if the operator requests a chat we only want to open one window...
var openLiveHelpalready = false;

//-----------------------------------------------------------------
// loop though checking the image for updates from operators.
function csrepeat()
{
     // if the request has timed out do not do anything.
     if (csTimeout < 0)
   return;
     
     csTimeout--;

     // update image for requests from operator.
     csgetimage();
         
     // check image for updates from operators.
     cslookatimage();

     // do it again.
     setTimeout('csrepeat()', 7000);
}   

//-----------------------------------------------------------------
// Update the control image. This is the image that the operators
// use to communitate with the visitor.
function csgetimage()
{   
    // set a number to identify this page .
    if (csID==null) csID=Math.round(Math.random()*9999);
       
    var u = WEBPATH + 'image.php?' +
               'cmd=userstat' +
               '&page=' + escape(document.location) +
               '&title=' + escape(document.title) +
               '&referrer=' + escape(document.referrer) +
               '&pageid=' + csID +
               '&department=' + <?= $department ?>;
    cscontrol.src = u;
    csloaded = true;
}

// looks at the size of the control image and if the width is 55
// then open the chat.
//-----------------------------------------------------------------
function cslookatimage()
{
   if (csloaded) {
      var w = cscontrol.width;
      if (w == 0)
         return;
      csloaded = false;
      if ((w == 55) && (openLiveHelpalready == false)) {
           openWantsToChat();
         openLiveHelpalready = true;
           }
   }
}


//-----------------------------------------------------------------
// opens live help
function openLiveHelp()
{
  window.open(WEBPATH + 'livehelp.php?department=<?= $department ?>', 'chat54050872', 'width=540,height=390,menubar=no,scrollbars=0,resizable=1');
}

//-----------------------------------------------------------------
// The Operator wants to chat with the visitor about something.
function openWantsToChat()

  // ok we asked them .. now lets not ask them again for awhile...
  var u = WEBPATH + 'image.php?' +
               'cmd=browse' +
               '&page=' + escape(document.location) +
               '&title=' + escape(document.title) +
               '&referrer=' + escape(document.referrer) +
               '&pageid=' + csID +
               '&department=' + <?= $department ?>;
  cscontrol.src = u; 

  // open the window..
  window.open(WEBPATH + 'livehelp.php?cmd=chatinsession&department=<?= $department ?>', 'chat54050872', 'width=540,height=390,menubar=no,scrollbars=0,resizable=1');
}

<?
 if ($cmd != "hidden"){
?>
//table  holding the live help icon...
document.write('<table border="0" cellspacing="0" cellpadding="0">');
document.write('<tr>');
document.write('<td align="center" valign="top"><a name="chatRef" href="javascript:openLiveHelp()"><img name="csIcon" src="' + WEBPATH + 'image.php?cmd=getstate&department=<?= $department ?>" alt="Powered by CSLH" border="0"></a></td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td align="center" valign="top"><a name="byRef" href="http://www.cslh.com" target="_blank"><img name="myIcon" src="' + WEBPATH + 'image.php?cmd=getcredit&department=<?= $department ?>" alt="Powered by CSLH" border="0"></a></td>');
document.write('</tr>');
document.write('</table>');
<?
 }
 // see if anyone is online..
 $query = "SELECT * FROM livehelp_users,livehelp_operator_departments WHERE livehelp_users.user_id=livehelp_operator_departments.user_id AND livehelp_users.isonline='Y' AND livehelp_users.isoperator='Y' AND livehelp_operator_departments.department='$department' ";
 $data = $mydatabase->select($query);
 // getting the party started if someone is online..

 if( count($data) != 0){ ?>
   setTimeout('csrepeat()', 2050);
<? } else { ?>
   setTimeout('csgetimage()', 250);
<? } ?>


Image.php
Code:

<?
//****************************************************************************************/
//  Crafty Syntax Live Help (CSLH)  by Eric Gerdes (http://craftysyntax.com )
//======================================================================================
// NOTICE: Do NOT remove the copyright and/or license information from this file.
//         doing so will automatically terminate your rights to use this program.
// ------------------------------------------------------------------------------------
// ORIGINAL CODE:
// ---------------------------------------------------------
// Crafty Syntax Live Help (CSLH) http://cslh.com/
// Copyright (C) 2003  Eric Gerdes
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation;
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program in a file named LICENSE.txt .
// if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
// --------------------------------------------------------- 
// MODIFICATIONS:
// --------------------------------------------------------- 
// [ Programmers who change this code should cause the  ]
// [ modified changes here and the date of any change.  ]
//======================================================================================
//****************************************************************************************/
require("globals.php");

if($identity == ""){
 if($REMOTE_ADDR == ""){
    $REMOTE_ADDR = $HTTP_SERVER_VARS["REMOTE_ADDR"];
 }
 if($HTTP_USER_AGENT == ""){
    $HTTP_USER_AGENT = $HTTP_SERVER_VARS["HTTP_USER_AGENT"];
 }
 $identity = $REMOTE_ADDR . $HTTP_USER_AGENT . $rand_id;
 $referer = $HTTP_REFERER;
 $identity = ereg_replace(" ","",$identity);
 setcookie ("identity", $identity,time()+3600, "/");
}

require_once 'config.php';
require_once 'config_cslh.php';

function gettrans($channel){
  global $mydatabase;
  $trans = "";
  $query = "SELECT * FROM livehelp_messages WHERE channel='$channel' ORDER by timeof ";   
  $messages = $mydatabase->select($query);
  if ( count($messages) == 0)
    return "";
  for($i=0;$i<count($messages);$i++){
    $row = $messages[$i];
    $message = $row[message];
    $timeof = $row[timeof];
    $id_num = $row[id_num];
    $saidfrom = $row[saidfrom];
    $saidto = $row[saidto];
    // this is in a seprate query because left join queries take too long..
    $query = "SELECT * FROM livehelp_users WHERE uid='$saidfrom'";
    $username_s = $mydatabase->select($query);
    $username_a = $username_s[0];
    $username = $username_a[username];
    $abort_counter = 0;
    $trans .= " $username : $message <br>";      
    }
  return $trans;
}

// get department information...
$where="";
if( ($department!=0) && ($department!="")){ $where = " WHERE recno='$department' "; }
$query = "SELECT * FROM livehelp_departments $where ";
$data_d = $mydatabase->select($query); 
$department_a = $data_d[0];
$department = $department_a[recno];
$creditline  = $department_a[creditline];

/// make sure the department is right.
  $query = "UPDATE livehelp_users set department='$department' WHERE identity='$identity'";   
  $mydatabase->sql_query($query);
 
if($cmd == ""){ $cmd = "getstate"; }

//----------------------------------------------------------------
if($cmd == "nameme"){
   $query = "UPDATE livehelp_users set uname='$name',isnamed='Y' WHERE identity='$identity'";
   $mydatabase->sql_query($query);
   $mydatabase->close_connect();
   Header("Location: browse.gif");
}

//----------------------------------------------------------------
if($cmd == "alive"){
   print $version . "-";
   $query = "SELECT * FROM livehelp_users,livehelp_operator_departments WHERE livehelp_users.user_id=livehelp_operator_departments.user_id AND livehelp_users.isonline='Y' AND livehelp_users.isoperator='Y' ";
   $data = $mydatabase->select($query); 
  if( count($data) == 0){
    print "offline";
  } else {
    for($i=0;$i<count($data);$i++){
      print $data['department'] . ",";     
    }
  }
  $mydatabase->close_connect();
  exit;
}

//----------------------------------------------------------------
if($cmd == "startedtyping"){       
   $timeof = date("YmdHis");
   $array = split("__",$channelsplit);
   if($array[1] != ""){
     $saidto = $array[1];   
     $channel = $array[0];
   } else {
     $channel = $channelsplit;
   }
   // i am typing messages..
   $query = "DELETE FROM livehelp_messages WHERE message='<font color=AAAAAA>typing message...</font>'";
   $mydatabase->sql_query($query);
     
   $comment = "<font color=AAAAAA>typing message...</font>";   
   $query = "UPDATE livehelp_users set status='chat' WHERE uid='$fromwho'";
   $mydatabase->sql_query($query);
   $query = "INSERT INTO livehelp_messages (message,channel,timeof,saidfrom,saidto) VALUES ('$comment','$channel','$timeof','$fromwho','$saidto')";   
   $mydatabase->insert($query);
   $mydatabase->close_connect();
   Header("Location: browse.gif");
}

//----------------------------------------------------------------
if($cmd == "browse"){
      $mydatabase->close_connect();
      Header("Location: browse.gif");
      exit;
}

// userstat: return the control image for this user.
//----------------------------------------------------------------
if($cmd == "userstat"){
   
// lets do a little cleanning .. 
   $prev = mktime ( date("H"), date("i")-5, date("s"), date("m"), date("d"), date("Y") );
   $oldtime = date("YmdHis",$prev);
   $prev = mktime ( date("H"), date("i")-50, date("s"), date("m"), date("d"), date("Y") );
   $reallyoldtime = date("YmdHis",$prev);
   $query = "SELECT * FROM livehelp_users WHERE isoperator='N' AND lastaction<$oldtime";
   $old_people = $mydatabase->select($query);   

   for($i=0;$i< count($old_people); $i++){
     $old_user = $old_people[$i];
     $trans = gettrans($old_user[onchannel]);

     // if we talked to them add them to the transcripts.
     if( ($trans != "") && ($old_user[isnamed] == "Y")){
       $trans = ereg_replace("'","",$trans);
       $query = "INSERT INTO livehelp_transcripts (who,daytime,transcript) VALUES ('$old_user[username]','$old_user[lastaction]','$trans')";
       $mydatabase->insert($query);
     }
     // get rid of old messages.
     $query = "DELETE FROM livehelp_messages WHERE channel='$old_user[onchannel]'";
     $mydatabase->sql_query($query);     
         
     $dayof = date("Ymd");       
 
     // move all old data into referer tracking database..
     $camefrom = ereg_replace("'","",$old_user[camefrom]);
     $query = "SELECT * FROM livehelp_referers WHERE camefrom='$camefrom' AND dayof='$dayof'";
     $count_a = $mydatabase->select($query);
             
     if(count($count_a) == 0){        
       // update the total.
       $query = "SELECT * FROM livehelp_referers_total WHERE camefrom='$camefrom'";
       $tmp = $mydatabase->select($query);
       if( count($tmp) == 0){
            $query = "INSERT INTO livehelp_referers_total (camefrom,ctotal) VALUES ('$camefrom','1') ";     
          $mydatabase->insert($query);
       } else {
         $tmp = $tmp[0];
         $ctotal = $tmp[ctotal] + 1;
         $query = "UPDATE livehelp_referers_total set ctotal='$ctotal' WHERE camefrom='$camefrom' ";     
         $mydatabase->insert($query);
       }
       $query = "INSERT INTO livehelp_referers (camefrom,dayof,uniquevisits) VALUES ('$camefrom','$dayof','1') ";     
       $mydatabase->insert($query);
     } else {
      $count_d = $count_a[0];
      $uniquevisits = $count_d[uniquevisits] + 1; 
      $query = "SELECT * FROM livehelp_referers_total WHERE camefrom='$camefrom'";
      $tmp = $mydatabase->select($query);
      $tmp = $tmp[0];   
      $ctotal = $tmp[ctotal] + 1;     
      $query = "UPDATE livehelp_referers set uniquevisits='$uniquevisits' WHERE camefrom='$camefrom' AND dayof='$dayof' ";     
      $mydatabase->sql_query($query);
      $query = "UPDATE livehelp_referers_total set ctotal='$ctotal' WHERE camefrom='$camefrom'";     
      $mydatabase->sql_query($query);                       
     }

     // move all old data into visit tracking database..
     if($dbtype == "txt-db-api.php"){
       $query = "SELECT location FROM livehelp_visit_track WHERE id='$old_user[user_id]'";
     } else {
       $query = "SELECT DISTINCT location FROM livehelp_visit_track WHERE id='$old_user[user_id]'";
     }
     $footsteps = $mydatabase->select($query);
     for($j=0;$j<count($footsteps); $j++){
        $foot = $footsteps[$j];
        $pageurl = $foot[location];
        $pathstuff = split("\?",$pageurl);
        $pageurl = $pathstuff[0];

        $query = "SELECT * FROM livehelp_visits WHERE pageurl='$pageurl' AND dayof='$dayof'";
        $count_a = $mydatabase->select($query);
        if(count($count_a) == 0){        
          // update the total.
          $query = "SELECT * FROM livehelp_visits_total WHERE pageurl='$pageurl'";
          $tmp = $mydatabase->select($query);
          if( count($tmp) == 0){
               $query = "INSERT INTO livehelp_visits_total (pageurl,ctotal) VALUES ('$pageurl','1') ";     
             $mydatabase->insert($query);
          } else {
             $tmp = $tmp[0];
             $ctotal = $tmp[ctotal] + 1;
             $query = "UPDATE livehelp_visits_total set ctotal='$ctotal' WHERE pageurl='$pageurl' ";     
             $mydatabase->insert($query);
          }
       $query = "INSERT INTO livehelp_visits (pageurl,dayof,uniquevisits) VALUES ('$pageurl','$dayof','1') ";     
       $mydatabase->insert($query);
     } else {
      $count_d = $count_a[0];
      $uniquevisits = $count_d[uniquevisits] + 1; 
      $query = "SELECT * FROM livehelp_visits_total WHERE pageurl='$pageurl'";
      $tmp = $mydatabase->select($query);
      $tmp = $tmp[0];   
      $ctotal = $tmp[ctotal] + 1;     
      $query = "UPDATE livehelp_visits set uniquevisits='$uniquevisits' WHERE pageurl='$pageurl' AND dayof='$dayof' ";     
      $mydatabase->sql_query($query);
      $query = "UPDATE livehelp_visits_total set ctotal='$ctotal' WHERE pageurl='$pageurl'";     
      $mydatabase->sql_query($query);                       
     }
     }
     
     // let get rid of the temp data..
     $query = "DELETE FROM livehelp_visit_track WHERE id='$old_user[user_id]' ";
     $mydatabase->sql_query($query);
     $query = "DELETE FROM livehelp_users WHERE uid='$old_user[user_id]' ";
     $mydatabase->sql_query($query); 
     $query = "DELETE FROM livehelp_channels WHERE uid='$old_user[user_id]' ";
     $mydatabase->sql_query($query);       
     $query = "DELETE FROM livehelp_messages WHERE timeof<'$reallyoldtime'";
     $mydatabase->sql_query($query);     
   }
       
   // see if we already know who this guy is.
   $query = "SELECT * FROM livehelp_users WHERE identity='$identity'";
   $data = $mydatabase->select($query);   
   if (count($data) == 0){

     // we do not know them
     $lastaction = date("YmdHis");
     
     //get a good uname.. 
     $username = $REMOTE_ADDR;         
     $query = "SELECT * FROM livehelp_users WHERE uname='$username'";
     $data_tmp = $mydatabase->select($query);   
     $i = 0;
     while( count($data_tmp) != 0){
        $i++;
        $username = $REMOTE_ADDR . "_" . $i;         
        $query = "SELECT * FROM livehelp_users WHERE uname='$username'";
        $data_tmp = $mydatabase->select($query);   
     }

     $query = "INSERT INTO livehelp_users (onchannel,identity,lastaction,status,username,isoperator,password,department,camefrom) VALUES ('-1','$identity','$lastaction','Visiting','$username','N','','$department','$referrer')";
     $mydatabase->insert($query);
     //print $query;
     $query = "SELECT * FROM livehelp_users WHERE identity='$identity'";
     $data = $mydatabase->select($query);           
     $visitor = $data[0];
   } else {
     $visitor = $data[0];
   }

   // now..
   $rightnow = date("YmdHis");

   // update the visitors tracks.
   // see if we already have the page they are on.
   
   $query = "SELECT * FROM livehelp_visit_track WHERE id='$visitor[user_id]' AND page='$pageid' ";
   $data_tmp = $mydatabase->select($query);
   $count = count($data_tmp);
   if($visitor[user_id] == 0){ $count = 1; }
   if( $count == 0){
     $thisid = $visitor[user_id];

     $query = "INSERT INTO livehelp_visit_track (id,location,page,title,whendone,referrer) VALUES ('$thisid','$page','$pageid','$title','$rightnow','$referer') ";
     $mydatabase->insert($query);
   }
   
   // update their last action to now..
   $query = "UPDATE livehelp_users set lastaction='$rightnow' WHERE identity='$identity'";
   $mydatabase->sql_query($query);   

    // see if the operator wants anything with them:
    // status = R means request Chat..
    if($visitor[status] == "request"){
     $mydatabase->close_connect();
     Header("Location: requestchat.gif");
    } else {
     $mydatabase->close_connect();
     Header("Location: browse.gif");      
    }
}

//give credit to the programmer ..
//----------------------------------------------------------------
if($cmd == "getcredit"){
       
   $query = "SELECT * FROM livehelp_users,livehelp_operator_departments WHERE livehelp_users.user_id=livehelp_operator_departments.user_id AND livehelp_users.isonline='Y' AND livehelp_users.isoperator='Y' AND livehelp_operator_departments.department='$department' ";
   $data = $mydatabase->select($query); 
  if( count($data) != 0){
    // see if they left their computer but did not log off..
    $prev = mktime ( date("H"), date("i")-10, date("s"), date("m"), date("d"), date("Y") );
    $oldtime = date("YmdHis",$prev);
    $query = "UPDATE livehelp_users set isonline='N',status='offline' WHERE isoperator='Y' AND lastaction<'$oldtime'";
    $mydatabase->sql_query($query);
    $mydatabase->close_connect();
        if( ($department_a[creditline] == "L") || ($department_a[creditline] == "")){
       Header("Location: livehelp.gif");     
    }
    if($department_a[creditline] == "W"){
       Header("Location: livehelp2.gif");   
    }
    if($department_a[creditline] == "N"){
       Header("Location: livehelp3.gif");   
    } 
  } else { 
    if($department_a[leaveamessage] == "YES"){
    $mydatabase->close_connect();
    if( ($department_a[creditline] == "L") || ($department_a[creditline] == "")){
       Header("Location: livehelp.gif");     
    }
    if($department_a[creditline] == "W"){
       Header("Location: livehelp2.gif");   
    }
    if($department_a[creditline] == "N"){
       Header("Location: livehelp3.gif");   
    }   
   } else {   
   
      $mydatabase->close_connect();
      Header("Location: livehelp3.gif"); 
    }
  }
}

// are we online or not..
//----------------------------------------------------------------
if($cmd == "getstate"){
       
   $query = "SELECT * FROM livehelp_users,livehelp_operator_departments WHERE livehelp_users.user_id=livehelp_operator_departments.user_id AND livehelp_users.isonline='Y' AND livehelp_users.isoperator='Y' AND livehelp_operator_departments.department='$department' ";
   $data = $mydatabase->select($query);     

if($hide == "Y"){
   Header("Location: offline.gif"); 
} else {
  if( count($data) != 0){
    // see if they left their computer but did not log off..
    $prev = mktime ( date("H"), date("i")-2, date("s"), date("m"), date("d"), date("Y") );
    $oldtime = date("YmdHis",$prev);
    $query = "UPDATE livehelp_users set isonline='N',status='offline' WHERE isoperator='Y' AND lastaction<'$oldtime'";
    $mydatabase->sql_query($query);
    $mydatabase->close_connect();
    Header("Location: $department_a[onlineimage]");   
  } else {   
      $mydatabase->close_connect();
   if($department_a[leaveamessage] == "YES"){
     if($department_a[qa_enabled] == "Y"){
       Header("Location: $department_a[qaimage]"); 
     } else {
       Header("Location: $department_a[offlineimage]");     
     }
   } else {   
     Header("Location: offline.gif"); 
   }
  }
 }
}






?>
Back to top
View users profile Send private message Visit posters website
Display posts from previous:   
Post new topic   Reply to topic       Computer Cops Forum Index -> Forum Software Packages All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB 2.0.8a © 2001 phpBB Group

Version 2.0.6 of PHP-Nuke Port by Tom Nitzschner © 2002 www.toms-home.com
Version 2.2 by Paul Laudanski © 2003-2004 Computer Cops