Location: PHPKode > projects > QuickTalk Forum > quicktalk/qtf_user_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   Forum
* @package    QuickTalk
* @author     Philippe Vandenberghe <hide@address.com>
* @copyright  2008-2012 The PHP Group
* @version    2.5 build:20100924
* @since      File available since Release 1.0.0
* @deprecated File deprecated in Release 3.0.0
*/

session_start();
require_once('bin/qtf_init.php');
if ( !$oVIP->CanView('U',true) ) die(Error(11));

// INITIALISE

include(Translate('qtf_reg.php'));

$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 = 'qtf_user_sign.php';
$oVIP->selfname = $L['Change_signature'];
$oVIP->exiturl = 'qtf_user.php?id='.$id;
$oVIP->exitname = '&laquo; '.$L['Profile'];

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

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

  // update user
  if ( empty($error) )
  {
    $oDB->Query('UPDATE '.TABUSER.' SET signature="'.$str.'" WHERE id='.$id);
    $oVIP->EndMessage(NULL,$L['S_update'],$_SESSION[QT]['skin_dir'],2);
  }
}

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

$intBbc=3;
if ( $_SESSION[QT]['bbc']=='1' )
{
$oVIP->arrJava[]='bin/qtf_bbc.js';
$oVIP->arrCss[] = '../bin/css/qtf_bbc.css';
}

include('qtf_p_header.php');

if ( $oVIP->role!='A' && $oVIP->id!=$id ) die($L['R_member']);

// DISPLAY PREVIOUS

$oDB->Query('SELECT signature,name,picture 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="hidden" cellspacing="0" summary="signature">
<colgroup span="2"><col width="175"></col><col></col></colgroup>
<tr class="hidden">
<td class="hidden" style="width:175px"><br/>',AsImgBox( ( empty($row['picture']) ? '' : AsImg(QTF_DIR_PIC.$row['picture']) ),'picbox','',$row['name'] ),'</td>
<td class="hidden">
';

// SIGNATURE

echo '<h2>',$L['Signature'],'</h2>
<table class="data_o" cellspacing="0" summary="settings">
<tr class="tr_o">
<td class="colct">',$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="data_o" cellspacing="0" summary="settings">
<tr class="data_o">
<td class="colct">
';
    echo '<table class="hidden" cellspacing="0" summary="edit">',N;
    if ( $_SESSION[QT]['bbc']=='1' )
    {
    echo '<tr class="hidden">',N;
    echo '<td style="height:22px"><ul class="bbc">',N;
    include('qtf_form_button.php');
    echo '</ul></td>',N;
    echo '</tr>',N;
    }
    echo '<tr class="hidden">',N;
    echo '<td class="hidden">',N;
    echo '<a href="textarea"></a><textarea id="text" name="text" rows="5" cols="75">',$row['signature'],'</textarea>',N;
    echo '</td>',N;
    echo '</tr>',N;
    echo '</table>',N;

echo '</td>
</tr>
<tr class="data_o">
<td class="colct">
<input type="hidden" name="id" value="',$id,'"/>
<input type="submit" name="ok" value="',$L['Save'],'"/>',( !empty($error) ? ' <span class="error">'.$error.'</span>' : ''),'</td>
</tr>
</table>
</form>
<p><a href="',Href($oVIP->exiturl),'">',$oVIP->exitname,'</a></p>
';

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

// HTML END

include('qtf_p_footer.php');

?>
Return current item: QuickTalk Forum