Location: PHPKode > projects > QuickTalk Forum > quicktalk/qtf_user_new.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('V0') ) HtmlPage(11);

// INITIALISE

include(Translate('qtf_reg.php'));
$intY = ''; // no year at start-up
$intM = 1;
$intD = 1; 
if ( isset($_GET['y']) ) { $intY = intval($_GET['y']); } 
if ( isset($_GET['m']) ) { $intM = intval($_GET['m']); } 
if ( isset($_GET['d']) ) { $intD = intval($_GET['d']); } 
if ( isset($_POST['y']) ) { $intY = intval(strip_tags($_POST['y'])); } 
if ( isset($_POST['m']) ) { $intM = intval(strip_tags($_POST['m'])); } 
if ( isset($_POST['d']) ) { $intD = intval(strip_tags($_POST['d'])); } 

$oVIP->selfurl = 'qtf_user_new.php';
$oVIP->selfname = $L['Register'];
$oVIP->exitname = '&laquo;'.S.$L['Register'];

// --------
// EXECUTE FORM
// --------

if ( isset($_POST['ok']) )
{
  if ( !isset($_POST['agreed']) )
  {
    include('qtf_p_header.php');
    HtmlMsg(0,'370px','login_header',$oVIP->selfname,'login');
    $strFile=GetLang().'sys_not_agree.txt';
    if ( file_exists($strFile) ) { include($strFile); } else { echo 'Rules not agreed...'; }
    echo '<p><a href="',$oVIP->selfurl,'?y=',$intY,'&m=',$intM,'&d=',$intD,'">',$L['Register'],'</a></p>';
    HtmlMsg(1);
    include('qtf_p_footer.php');
    Exit;
  }
  if ( !QTisvaliddate($intY*10000+$intM*100+$intD,true,false,false) ) $error = $L['Birthday'].S.$L['E_invalid'];  

  if ( empty($error) )
  {
    // continue to registration form
    if ( headers_sent() )
    {
    echo '<a id="exiturl" href="qtf_form_reg.php?y=',$intY,'&amp;m=',$intM,'&amp;d=',$intD,'">',$L['Register'],'</a><meta http-equiv="REFRESH" content="0;url=qtf_form_reg.php?y=',$intY,'&m=',$intM,'&d=',$intD,'">';
    }
    else
    {
    header('Location: qtf_form_reg.php?y='.$intY.'&m='.$intM.'&d='.$intD);
    }
    Exit;
  }
}

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

$oVIP->arrCss[] = 'qtf_main2.css';

$bJava=true;
include('qtf_p_header.php');

echo '
<script type="text/javascript">
<!--
function ValidateForm(theForm)
{
  if (theForm.y.value.length!=4) { alert(qtHtmldecode("',$L['E_mandatory'],': ',$L['Year'],' (yyyy)")); return false; }
  return null;
}
-->
</script>
';

echo '<form method="post" action="',Href($oVIP->selfurl),'" onsubmit="return ValidateForm(this);">',N;
echo '<div class="scrollmessage">',N;

$strFile = GetLang().'sys_rules.txt';
if (file_exists($strFile)) { include($strFile); } else { echo 'Missing file:<br/>',$strFile; }

echo '</div>',N;
echo '<p><input type="checkbox" id="agreed" name="agreed"/><label for="agreed"><b>&nbsp;',$L['Agree'],'</b></label></p>',N;

HtmlMsg(0,'300px','login_header',$oVIP->selfname,'login');

echo '<p><label for="y">',$L['Birthday'],'</label></p><p>';
echo '<select name="d" size="1">',N;
echo QTasTag(array(1=>1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31),$intD);
echo '</select>',N;
echo '<select name="m" size="1">',N;
echo QTasTag($L['dateMMM'],$intM);
echo '</select>',N;
echo '<input type="text" id="y" name="y" size="4" maxlength="4" value="',(empty($intY) ? '' : $intY),'"/>';
echo '</p>',( !empty($error) ? '<p class="error">'.$error.'</p>' : ''),'<p><input type="submit" name="ok" value="',$L['Register'],'"/></p>';

HtmlMsg(1);
echo'
</form>
';

// HTML END

include('qtf_p_footer.php');

?>
Return current item: QuickTalk Forum