<?php
include("postget.php");
include_once("common.php");
checklevel(4,$_REQUEST['clientid']);
if ($config[56][1]==1){
	$disabled=" disabled ";
	$mensaje= " "._CHANGE_NOT_ALLOWED_IN_DEMO_MODE;
}else{
	$disabled=" ";
	$mensaje= "";
}


//////////////////////////////////////////////////////////////// si se envi� el formulario, cargar los errores
if ($_REQUEST[sendclick]==""._CHANGE."") {
	$estiloerror = "class='formfielderror'";
	$errors = '';
	if ($_POST['new101']<4 OR $_POST['new101']>10 OR !is_numeric($_POST['new101'])) {$errors.= "<br>".ucfirst(_NUMBER_OF_DIGITS_TO_GENERATE_THE_NUMBERS_OF_CUSTOMERS)." "._SHOULD_BE." > 3 "._AND." < 11"; $estilonew101=$estiloerror;}
}


//////////////////////////////////////////////////////////////// si no hay errores y se presion� SEND
if($errors=='' AND $_REQUEST[sendclick] ==""._CHANGE."") {
	mysql_query("UPDATE hd_config SET valor='$new101' WHERE ref='101'",$db_link);
	mysql_query("ALTER TABLE hd_history AUTO_INCREMENT = ".$Xnextevent."",$db_link);
	mysql_query("ALTER TABLE hd_tickets AUTO_INCREMENT = ".$Xnextticket."",$db_link);

	messagetop(_THE_CHANGES_WHERE_MADE_SUCCESSFULLY,'','preferences.php',1);
}



echo tip(56)." ". _NUMBERS_OF_NEXTS_RECORDS;

print errors($errors); $errors = '';

print("<form method='POST'>");
echo '<table class="table table-striped">';

print("<tr><td><b>"._NEXT_RECORD_IN."</b></td><td></td></tr>");


echo '<tr>';
print("<td>".ucfirst(_HISTORY_FILE).": </td><td>");
print("<input name=Xnextevent value=");
$query = 'SELECT * FROM hd_history ORDER BY eventid DESC LIMIT 0,1';
$result = mysql_query ($query);
$data = mysql_fetch_array ($result);
if (!$data[0]) {
	echo '1';
}else{
	echo $data[0]+1;
}

print("></td></tr>");

echo '<tr>';
print("<td>".ucfirst(_TICKETS).": </td><td>");
print("<input name=Xnextticket value=");
$query = 'SELECT * FROM hd_tickets ORDER BY ticketid DESC LIMIT 0,1';
$result = mysql_query ($query);
$data = mysql_fetch_array ($result);
if (!$data[0]) {
	echo '1';
}else{
	echo $data[0]+1;
}

print("></td></tr>");


print("<tr><td colspan=2 height=44>&nbsp;</td></tr>");


echo '<tr>';
print("<td>".ucfirst(_NUMBER_OF_DIGITS_TO_GENERATE_THE_NUMBERS_OF_CUSTOMERS).": </td><td>");
print("<input $estilonew101 name=new101 size=4 value=".$config[101][1]."></td></tr>");

print("</table>");
print("<input type=submit name=sendclick value="._CHANGE." $disabled>$mensaje<input type=hidden name=sendclick value="._CHANGE."></form>");


?>