Location: PHPKode > projects > QuickTicket > quickticket/quickticket/qti_usr_sign.php
<?php

/*
 * PHP versions 4 and 5
 *
 * LICENSE: This source file is subject to version 3.0 of the PHP license
 * that is available through the world-wide-web at the following URI:
 * http://www.php.net/license. If you did not receive a copy of
 * the PHP License and are unable to obtain it through the web, please
 * send a note to hide@address.com so we can mail you a copy immediately.
 *
 * @category   Troubleticket
 * @package    QuickTicket
 * @author     Philippe Vandenberghe <hide@address.com>
 * @copyright  2008-2012 The PHP Group
 * @license    http://www.php.net/license  PHP License 3.0
 * @version    1.9.0.3 build:20081001
 * @link       http://www.qt-cute.org/doc/package/qti
 * @since      File available since Release 1.0.0
 * @deprecated File deprecated in Release 2.0.0
 *
 */

session_start();
require_once('bin/qti_init.php');
if ( !$oVIP->CanAccess('U',0,true) ) die($L['R_member']);

// INITIALISE

include($_SESSION[QT]['language'].'/qti_lang_reg.inc');

$id = -1;
if ( isset($_GET['id']) ) $id = intval(strip_tags($_GET['id']));
if ( isset($_POST['id']) ) $id = intval(strip_tags($_POST['id']));
if ( $id<0 ) die('Missing parameters');
if ( $oVIP->role!='A' && $oVIP->id!=$id ) die($L['R_member']);

$oVIP->selfurl = 'qti_usr_sign.php';
$oVIP->selfname = $L['Change_signature'];
$oVIP->exiturl = 'qti_usr.php?id='.$id;
$oVIP->exitname = $L['Profile'];

// --------
// SUBMITTED
// --------

if ( isset($_POST['ok']) )
{
  // check values
  $str = trim($_POST['text']); if ( get_magic_quotes_gpc() ) $str = stripslashes($str);
  $str = substr( QTconv($str,'3',QTI_CONVERT_AMP),0,255 );

  // update domain
  if ( empty($qti_error) )
  {
    $oDB->Query('UPDATE '.TABUSER.' SET signature="'.addslashes($str).'" WHERE id='.$id);
    // exit
    $oVIP->exiturl = 'qti_usr.php?id='.$id;
    $oVIP->EndMessage(NULL,$L['S_update'],$_SESSION[QT]['skin_dir'],2);
  }
}

// --------
// HTML START
// --------

$arrJava = array('bbc'=>true,'img'=>true);

include('qti_p_header.php');

$oDB->Query('SELECT signature,name,avatar FROM '.TABUSER.' WHERE id='.$id);
$row = $oDB->Getrow();
if ( !is_string($row['signature']) ) $row['signature']='';

$strSign = QTbbc($row['signature']);
if ( empty($strSign) ) $strSign=S;

echo '
<table class="ta_hidden" cellspacing="0">
<colgroup span="2"><col width="175"></col><col></col></colgroup>
<tr class="tr_hidden">
<td class="td_hidden">',AsImgBox(AsImg( (!empty($row['avatar']) ? 'avatar/'.$id.'.'.$row['avatar'] : ''),null,$row['name']),'div_pic_box',null,$row['name']),'</td>
<td class="td_hidden">
';

// SIGNATURE

echo '
<h2>',$L['Signature'],'</h2>
<table class="ta ta_o" cellspacing="0">
<tr class="tr_o">
<td class="td_o">',$strSign,'</td>
</tr>
</table>
<p>',$L['H_no_signature'],'</p>
';

// NEW SIGNATURE

echo '
<h2>',$oVIP->selfname,'</h2>
<form method="post" action="',$oVIP->selfurl,'">
<table class="ta ta_o" cellspacing="0">
<tr class="tr_o">
<td class="td_o">
';
if ( $_SESSION[QT]['bbc']!='0' )
{
  $bJavaBbc=true;
  $bJavaBbc2=true;
  include('qti_form_button.php');
}
echo '<br/>
<textarea id="text" name="text" rows="5" wrap="virtual" cols="80">',$row['signature'],'</textarea>',N,'</td>
</tr>
<tr class="tr_o">
<td class="td_o">
<input type="hidden" name="id" value="',$id,'"/>
<input type="submit" name="ok" value="',$L['Save'],'"/>',( !empty($qti_error) ? ' <span class="error">'.$qti_error.'</span>' : ''),'</td>
</tr>
</table>
</form>
<p>&laquo;&nbsp;<a href="',$oVIP->exiturl,'">',$L['Profile'],'</a></p>
';

echo '
</td>
</tr>
</table>
';

// HTML END

include('qti_p_footer.php');

?>
Return current item: QuickTicket