Example #1
0
function SkinsConfig()
{
    $skins = AvailableSkins();
    if (count($skins) > 0) {
        ?>
<div style="clear:both">
<!--<div style="float:left; padding: 5px;">-->
<input type="radio" name="voteiu_skin" id="voteiu_skin" value="" <?php 
        IsChecked('');
        ?>
 /> Default<br />
<!--</div>-->
<?php 
        for ($i = 0; $i < count($skins); $i++) {
            ?>
<!--<div style="float:left; padding: 5px">-->
<input type="radio" name="voteiu_skin" id="voteiu_skin" value="<?php 
            echo $skins[$i];
            ?>
" <?php 
            IsChecked($skins[$i]);
            ?>
 /> <?php 
            echo ucfirst(str_replace('_', ' ', $skins[$i]));
            ?>
<br>
<!--</div>-->
<?php 
        }
    }
    ?>
</div><br />
<?php 
}
Example #2
0
   <th>
    <input type="checkbox" name="urlaubs_modus"
     />
   </th>

  </tr>
  <tr>
   <th><a title="<?php 
        echo loca("OPTIONS_ACCOUNT_DEL_TIP");
        ?>
"><?php 
        echo loca("OPTIONS_ACCOUNT_DEL");
        ?>
</a></th>
   <th><input type="checkbox" name="db_deaktjava"  <?php 
        echo IsChecked("disable");
        ?>
/>
      <?php 
        if ($GlobalUser['disable']) {
            echo "am: " . date("Y-m-d H:i:s", $GlobalUser['disable_until']);
        }
        ?>
 </th>
  </tr>
  <tr>
   <th colspan=2><input type="submit" value="<?php 
        echo loca("OPTIONS_APPLY");
        ?>
" /></th>
Example #3
0
     }
     if ($sele == "") {
         $sele = "SELECT facturas.cod_fac as cod_fac,facturas.fecha as fecha, facturas.cliente as cliente, facturas.existe_cli as existe, facturas.iva as iva, facturas.detalles as detalles, tener_f_c.concepto as concepto, tener_f_c.cantidad as cantidad, tener_f_c.precio_u as precio FROM facturas, tener_f_c WHERE tener_f_c.cod_fac=facturas.cod_fac AND tener_f_c.concepto LIKE '%{$concepto}%'";
     } else {
         $sele = $sele . " AND tener_f_c.cod_fac=facturas.cod_fac AND tener_f_c.concepto LIKE '%{$concepto}%'";
     }
 }
 if (IsChecked('buscar', 'iva')) {
     $iva = $_POST['iva'];
     if ($sele == "") {
         $sele = "SELECT facturas.cod_fac as cod_fac,facturas.fecha as fecha, facturas.cliente as cliente, facturas.existe_cli as existe, facturas.iva as iva, facturas.detalles as detalles, tener_f_c.concepto as concepto, tener_f_c.cantidad as cantidad, tener_f_c.precio_u as precio FROM facturas, tener_f_c WHERE facturas.cod_fac=tener_f_c.cod_fac AND facturas.IVA={$iva}";
     } else {
         $sele = $sele . " AND facturas.IVA={$iva}";
     }
 }
 if (!IsChecked('buscar', 'fecha') && !IsChecked('buscar', 'numero') && !IsChecked('buscar', 'cliente') && !IsChecked('buscar', 'concepto') && !IsChecked('buscar', 'iva')) {
     $sele = "SELECT facturas.cod_fac as cod_fac,facturas.fecha as fecha, facturas.cliente as cliente, facturas.existe_cli as existe, facturas.iva as iva, facturas.detalles as detalles, tener_f_c.concepto as concepto, tener_f_c.cantidad as cantidad, tener_f_c.precio_u as precio FROM facturas, tener_f_c WHERE facturas.cod_fac=tener_f_c.cod_fac";
     echo "¡ATENCIÓN! ¡Puede que te hayas olvidado de seleccionar los CheckBox!<br/><br/>";
 }
 $sele = $sele . " GROUP BY facturas.cod_fac ORDER BY facturas.cod_fac";
 //echo $sele;
 $selec = mysql_query($sele);
 if (mysql_num_rows($selec) == 0) {
     echo "<br/>¡ERROR! No hay facturas que cumplan esas condiciones.";
 } else {
     $num_fila = 0;
     echo "<table border=1>";
     while ($row = mysql_fetch_assoc($selec)) {
         echo "<tr bgcolor=\"bbbbbb\" align=center><th>Codigo</th><th>Fecha</th><th>Cliente</th><th>CIF</th><th>IVA %</th><th>Concepto</th><th>Cantidad</th><th>Precio</th><th>Subtotal</th><th>IVA €</th><th>TOTAL</th></tr>";
         $precio = 0;
         echo "<tr ";
Example #4
0
    if (empty($aDoor)) {
        echo "<p>You didn't select any buildings.</p>\n";
    } else {
        $N = count($aDoor);
        echo "<p>You selected {$N} door(s): ";
        for ($i = 0; $i < $N; $i++) {
            echo $aDoor[$i] . " ";
        }
        echo "</p>";
    }
    //Checking whether a particular check box is selected
    //See the IsChecked() function below
    if (IsChecked('formDoor', 'A')) {
        echo ' A is checked. ';
    }
    if (IsChecked('formDoor', 'B')) {
        echo ' B is checked. ';
    }
    //and so on
}
function IsChecked($chkname, $value)
{
    if (!empty($_POST[$chkname])) {
        foreach ($_POST[$chkname] as $chkval) {
            if ($chkval == $value) {
                return true;
            }
        }
    }
    return false;
}
Example #5
0
    /**
     * Select the options of the CSV load and check for CSV parsing errors
     * @param WebPage $oPage The current web page
     * @return void
     */
    function SelectOptions(WebPage $oPage)
    {
        $sOperation = utils::ReadParam('operation', 'csv_data');
        $sCSVData = '';
        switch ($sOperation) {
            case 'file_upload':
                $oDocument = utils::ReadPostedDocument('csvdata');
                if (!$oDocument->IsEmpty()) {
                    $sCSVData = $oDocument->GetData();
                }
                break;
            default:
                $sCSVData = utils::ReadPostedParam('csvdata', '', 'raw_data');
        }
        $sEncoding = utils::ReadParam('encoding', 'UTF-8');
        // Compute a subset of the data set, now that we know the charset
        if ($sEncoding == 'UTF-8') {
            // Remove the BOM if any
            if (substr($sCSVData, 0, 3) == UTF8_BOM) {
                $sCSVData = substr($sCSVData, 3);
            }
            // Clean the input
            // Todo: warn the user if some characters are lost/substituted
            $sUTF8Data = iconv('UTF-8', 'UTF-8//IGNORE//TRANSLIT', $sCSVData);
        } else {
            $sUTF8Data = iconv($sEncoding, 'UTF-8//IGNORE//TRANSLIT', $sCSVData);
        }
        $aGuesses = GuessParameters($sUTF8Data);
        // Try to predict the parameters, based on the input data
        $sSeparator = utils::ReadParam('separator', '', false, 'raw_data');
        if ($sSeparator == '') {
            $sSeparator = $aGuesses['separator'];
        }
        $iSkippedLines = utils::ReadParam('nb_skipped_lines', '');
        $bBoxSkipLines = utils::ReadParam('box_skiplines', 0);
        if ($sSeparator == 'tab') {
            $sSeparator = "\t";
        }
        $sOtherSeparator = in_array($sSeparator, array(',', ';', "\t")) ? '' : $sSeparator;
        $sTextQualifier = utils::ReadParam('text_qualifier', '', false, 'raw_data');
        if ($sTextQualifier == '') {
            $sTextQualifier = $aGuesses['qualifier'];
        }
        $sOtherTextQualifier = in_array($sTextQualifier, array('"', "'")) ? '' : $sTextQualifier;
        $bHeaderLine = utils::ReadParam('header_line', 0);
        $sClassName = utils::ReadParam('class_name', '', false, 'class');
        $bAdvanced = utils::ReadParam('advanced', 0);
        $aFieldsMapping = utils::ReadParam('field', array(), false, 'raw_data');
        $aSearchFields = utils::ReadParam('search_field', array(), false, 'field_name');
        // Create a truncated version of the data used for the fast preview
        // Take about 20 lines of data... knowing that some lines may contain carriage returns
        $iMaxLen = strlen($sUTF8Data);
        if ($iMaxLen > 0) {
            $iMaxLines = 20;
            $iCurPos = true;
            while ($iCurPos > 0 && $iMaxLines > 0) {
                $pos = strpos($sUTF8Data, "\n", $iCurPos);
                if ($pos !== false) {
                    $iCurPos = 1 + $pos;
                } else {
                    $iCurPos = strlen($sUTF8Data);
                    $iMaxLines = 1;
                }
                $iMaxLines--;
            }
            $sCSVDataTruncated = substr($sUTF8Data, 0, $iCurPos);
        } else {
            $sCSVDataTruncated = '';
        }
        $sSynchroScope = utils::ReadParam('synchro_scope', '', false, 'raw_data');
        if (!empty($sSynchroScope)) {
            $oSearch = DBObjectSearch::FromOQL($sSynchroScope);
            $sClassName = $oSearch->GetClass();
            $oSet = new DBObjectSet($oSearch);
            $iCount = $oSet->Count();
            DisplaySynchroBanner($oPage, $sClassName, $iCount);
            $aSynchroUpdate = utils::ReadParam('synchro_update', array());
        }
        $oPage->add('<h2>' . Dict::S('UI:Title:CSVImportStep2') . '</h2>');
        $oPage->add('<div class="wizContainer">');
        $oPage->add('<table><tr><td style="vertical-align:top;padding-right:50px;">');
        $oPage->add('<form enctype="multipart/form-data" id="wizForm" method="post" id="csv_options">');
        $oPage->add('<h3>' . Dict::S('UI:CSVImport:SeparatorCharacter') . '</h3>');
        $oPage->add('<p><input type="radio" name="separator" value="," onClick="DoPreview()"' . IsChecked($sSeparator, ',') . '/> ' . Dict::S('UI:CSVImport:SeparatorComma+') . '<br/>');
        $oPage->add('<input type="radio" name="separator" value=";" onClick="DoPreview()"' . IsChecked($sSeparator, ';') . '/> ' . Dict::S('UI:CSVImport:SeparatorSemicolon+') . '<br/>');
        $oPage->add('<input type="radio" name="separator" value="tab" onClick="DoPreview()"' . IsChecked($sSeparator, "\t") . '/> ' . Dict::S('UI:CSVImport:SeparatorTab+') . '<br/>');
        $oPage->add('<input type="radio" name="separator" value="other"  onClick="DoPreview()"' . IsChecked($sOtherSeparator, '', true) . '/> ' . Dict::S('UI:CSVImport:SeparatorOther') . ' <input type="text" size="3" maxlength="1" name="other_separator" id="other_separator" value="' . $sOtherSeparator . '" onClick="DoPreview()"/>');
        $oPage->add('</p>');
        $oPage->add('</td><td style="vertical-align:top;padding-right:50px;">');
        $oPage->add('<h3>' . Dict::S('UI:CSVImport:TextQualifierCharacter') . '</h3>');
        $oPage->add('<p><input type="radio" name="text_qualifier" value="&#34;" onClick="DoPreview()"' . IsChecked($sTextQualifier, '"') . '/> ' . Dict::S('UI:CSVImport:QualifierDoubleQuote+') . '<br/>');
        $oPage->add('<input type="radio" name="text_qualifier" value="&#39;"  onClick="DoPreview()"' . IsChecked($sTextQualifier, "'") . '/> ' . Dict::S('UI:CSVImport:QualifierSimpleQuote+') . '<br/>');
        $oPage->add('<input type="radio" name="text_qualifier" value="other"  onClick="DoPreview()"' . IsChecked($sOtherTextQualifier, '', true) . '/> ' . Dict::S('UI:CSVImport:QualifierOther') . ' <input type="text" size="3" maxlength="1" name="other_qualifier"  value="' . htmlentities($sOtherTextQualifier, ENT_QUOTES, 'UTF-8') . '" onChange="DoPreview()"/>');
        $oPage->add('</p>');
        $oPage->add('</td><td style="vertical-align:top;">');
        $oPage->add('<h3>' . Dict::S('UI:CSVImport:CommentsAndHeader') . '</h3>');
        $oPage->add('<p><input type="checkbox" name="header_line" id="box_header" value="1" onClick="DoPreview()"' . IsChecked($bHeaderLine, 1) . '/> ' . Dict::S('UI:CSVImport:TreatFirstLineAsHeader') . '<p>');
        $oPage->add('<p><input type="checkbox" name="box_skiplines" value="1" id="box_skiplines" onClick="DoPreview()"' . IsChecked($bBoxSkipLines, 1) . '/> ' . Dict::Format('UI:CSVImport:Skip_N_LinesAtTheBeginning', '<input type="text" size=2 name="nb_skipped_lines" id="nb_skipped_lines" onChange="DoPreview()" value="' . $iSkippedLines . '">') . '<p>');
        $oPage->add('</td></tr></table>');
        $oPage->add('<input type="hidden" name="csvdata_truncated" id="csvdata_truncated" value="' . htmlentities($sCSVDataTruncated, ENT_QUOTES, 'UTF-8') . '"/>');
        $oPage->add('<input type="hidden" name="csvdata" id="csvdata" value="' . htmlentities($sUTF8Data, ENT_QUOTES, 'UTF-8') . '"/>');
        // The encoding has changed, keep that information within the wizard
        $oPage->add('<input type="hidden" name="encoding" value="UTF-8">');
        $oPage->add('<input type="hidden" name="class_name" value="' . $sClassName . '"/>');
        $oPage->add('<input type="hidden" name="advanced" value="' . $bAdvanced . '"/>');
        $oPage->add('<input type="hidden" name="synchro_scope" value="' . $sSynchroScope . '"/>');
        foreach ($aFieldsMapping as $iNumber => $sAttCode) {
            $oPage->add('<input type="hidden" name="field[' . $iNumber . ']" value="' . $sAttCode . '"/>');
        }
        foreach ($aSearchFields as $index => $sDummy) {
            $oPage->add('<input type="hidden" name="search_field[' . $index . ']" value="1"/>');
        }
        $oPage->add('<input type="hidden" name="step" value="3"/>');
        if (!empty($sSynchroScope)) {
            foreach ($aSynchroUpdate as $sKey => $value) {
                $oPage->add('<input type="hidden" name="synchro_update[' . $sKey . ']" value="' . $value . '"/>');
            }
        }
        $oPage->add('<div id="preview">');
        $oPage->add('<p style="text-align:center">' . Dict::S('UI:CSVImport:CSVDataPreview') . '</p>');
        $oPage->add('</div>');
        $oPage->add('<input type="button" value="' . Dict::S('UI:Button:Back') . '" onClick="GoBack()"/>');
        $oPage->add('<input type="submit" value="' . Dict::S('UI:Button:Next') . '"/>');
        $oPage->add('</form>');
        $oPage->add('</div>');
        $oPage->add_script(<<<EOF
\tfunction GoBack()
\t{
\t\t\$('input[name=step]').val(1);
\t\t\$('#wizForm').submit();
\t\t
\t}
\t
\tvar ajax_request = null;
\t
\tfunction DoPreview()
\t{
\t\tvar separator = \$('input[name=separator]:checked').val();
\t\tif (separator == 'other')
\t\t{
\t\t\tseparator = \$('#other_separator').val();
\t\t}
\t\tvar text_qualifier = \$('input[name=text_qualifier]:checked').val();
\t\tif (text_qualifier == 'other')
\t\t{
\t\t\ttext_qualifier = \$('#other_qualifier').val();
\t\t}
\t\tvar do_skip_lines = 0;
\t\tif (\$('#box_skiplines:checked').val() != null)
\t\t{
\t\t\tdo_skip_lines = \$('#nb_skipped_lines').val();
\t\t}
\t\tvar header_line = 0;
\t\tif (\$('#box_header:checked').val() != null)
\t\t{
\t\t\theader_line = 1;
\t\t}
\t\tvar encoding = \$('input[name=encoding]').val();

\t\t\$('#preview').block();
\t\t
\t\t// Make sure that we cancel any pending request before issuing another
\t\t// since responses may arrive in arbitrary order
\t\tif (ajax_request != null)
\t\t{
\t\t\tajax_request.abort();
\t\t\tajax_request = null;
\t\t}
\t\t
\t\tajax_request = \$.post(GetAbsoluteUrlAppRoot()+'pages/ajax.csvimport.php',
\t\t\t   { operation: 'parser_preview', enctype: 'multipart/form-data', csvdata: \$("#csvdata_truncated").val(), separator: separator, qualifier: text_qualifier, do_skip_lines: do_skip_lines, header_line: header_line, encoding: encoding },
\t\t\t   function(data) {
\t\t\t\t \$('#preview').empty();
\t\t\t\t \$('#preview').append(data);
\t\t\t\t \$('#preview').unblock();
\t\t\t\t}
\t\t\t );
\t}
EOF
);
        $oPage->add_ready_script('DoPreview();');
    }
function print_signup_form()
{
    global $firstname_err, $lastname_err, $email_err, $phonenumber_err, $date_of_birth_err, $username_err, $password_err, $gender_err;
    global $firstname, $lastname, $email, $phonenumber, $date_of_birth, $username, $password, $interests, $gender;
    echo '<form role="form" action="signup.php" method="POST">

				<div class="form-group">
				<label for="firstname">First Name: <span class="label label-warning">' . $firstname_err . '</span></label>
				<input type="firstname" class="form-control" id="firstname" name="firstname" value="' . $firstname . '">
				<label for="lastname">Last Name: <span class="label label-warning">' . $lastname_err . '</span></label>
				<input type="lastname" class="form-control" id="lastname" name="lastname" value="' . $lastname . '">

				<label for="email">eMail: <span class="label label-warning">' . $email_err . '</span></label>
				<input type="email" class="form-control" id="email" name="email" value="' . $email . '">
				<label for="phonenumber">Phone Number: <span class="label label-warning">' . $phonenumber_err . '</span></label>
				<input type="phonenumber" class="form-control" id="phonenumber" name="phonenumber" value="' . $phonenumber . '">



				<label for="dob">Date of birth: <span class="label label-warning">' . $date_of_birth_err . '</span></label>
				<div class="input-group date" id="datetimepicker1">
				<input type="date" class="form-control" name="date_of_birth"/ value="' . $date_of_birth . '">
				<span class="input-group-addon">
				<span class="glyphicon glyphicon-calendar"></span>
				</span>
				</div>


				</div>
				<div class="form-group">
				<label for="username">Username: <span class="label label-warning">' . $username_err . '</span></label>
				<input type="username" class="form-control" id="username" name="username" value="' . $username . '">
				<label for="pwd">Password: <span class="label label-warning">' . $password_err . '</span></label>
				<input type="password" class="form-control" id="pwd" name="password" value="' . $password . '">
				</div>

				<div class="form-group">
				<label for="interests">Interests:</label><br />
				<label class="checkbox-inline"><input type="checkbox" value="Sports" name="interests[]"';
    if (IsChecked("interests", "Sports")) {
        echo 'checked';
    }
    echo '>Sports</label>
				
				<label class="checkbox-inline"><input type="checkbox" value="Music" name="interests[]"';
    if (IsChecked("interests", "Music")) {
        echo 'checked';
    }
    echo '>Music</label>
				
				<label class="checkbox-inline"><input type="checkbox" value="Food" name="interests[]"';
    if (IsChecked("interests", "Food")) {
        echo 'checked';
    }
    echo '>Food</label>
				
				<label class="checkbox-inline"><input type="checkbox" value="Books" name="interests[]"';
    if (IsChecked("interests", "Books")) {
        echo 'checked';
    }
    echo '>Books</label>
				</div>

				<div class="form-group">
				<label for="interests">Gender:  <span class="label label-warning">' . $gender_err . '</span></label><br />
				<label class="radio-inline"><input type="radio" name="gender" value="Male"';
    if ($gender == "Male") {
        echo 'checked';
    }
    echo '>Male</label>
				<label class="radio-inline"><input type="radio" name="gender" value="Female"';
    if ($gender == "Female") {
        echo 'checked';
    }
    echo '>Female</label>
				</div>

				<div class="form-group">
				<button type="submit" class="btn btn-default">Submit</button>
				</div>
				</form>
		';
}
Example #7
0
        }
    }
}
function deleteTheatre($deleteCommand, $conn)
{
    if (mysqli_query($conn, $deleteCommand)) {
        echo "<h3>Theatre room deleted successfully!</h3>";
        // echo "<button class="goBack" type="button" onclick="history.go(-1)">Go Back</button>"; // a method to redirect back to page
    } else {
        echo "<p>Problem with deleting theatre room: " . mysqli_error($conn) . "</p>";
    }
}
//end of deleteMovie function
include 'connectdb.php';
if (isset($_POST['theTheatre'])) {
    IsChecked('theTheatre', $connection);
    mysqli_close($connection);
} else {
    echo "Please make sure to select an option. Click the button to go back.";
}
?>

<hr>
         <form action="movieMod.php">
          <input type="submit" value="Back to Screenings Management">
         </form>
        <hr>
        <footer>
            &copy; Jieni and Jaisen
        </footer>
</body>
Example #8
0
        $color1 .= " 'null',";
    }
    if (IsChecked('Colors', 'Red')) {
        $color1 .= " 'red',";
    }
    if (IsChecked('Colors', 'Blue')) {
        $color1 .= " 'blue',";
    }
    //IsChecked('Colors', 'Colors_0')) { $color1 += " 'blue',"; }
    if (IsChecked('Colors', 'Green')) {
        $color1 .= " 'green',";
    }
    if (IsChecked('Colors', 'Black')) {
        $color1 .= " 'black',";
    }
    if (IsChecked('Colors', 'White')) {
        $color1 .= " 'white',";
    }
    //echo "color1: " .$color1. "<br/>";
    //echo IsChecked('Colors', 'Colors_0');
    $color = rtrim($color1, ",");
    //close list
    $color .= " )";
}
//echo "color: " . $color . "<br/>";}
if ($_POST['Types'] == "null") {
    $type = "";
} else {
    $type = "Type ='" . $_POST['Types'] . "'";
}
if (!$name and !$color and !$type) {
Example #9
0
        } else {
            $concepton = $concepn;
        }
        $updacon = "UPDATE tener_f_c SET concepto='{$concepton}' WHERE concepto='{$conceptov}'";
    }
    if (IsChecked('cambiar', 'iva')) {
        $ivav = $_POST['ivav'];
        $ivan = $_POST['ivan'];
        if ($upda1 == "") {
            $upda1 = "UPDATE facturas SET IVA='{$ivan}'";
            $upda2 = " WHERE IVA='{$ivav}'";
        } else {
            $upda1 .= ",IVA='{$ivan}'";
            $upda2 .= " AND IVA='{$ivav}'";
        }
    }
    //if (!IsChecked('cambiar','fecha') && !IsChecked('cambiar','numero') && !IsChecked('cambiar','cliente') && !IsChecked('cambiar','concepto') && !IsChecked('cambiar','iva')) {
    if (!IsChecked('cambiar', 'fecha') && !IsChecked('cambiar', 'cliente') && !IsChecked('cambiar', 'concepto') && !IsChecked('cambiar', 'iva')) {
        echo "¡ATENCIÓN! ¡Puede que te hayas olvidado de seleccionar los CheckBox!<br/><br/>";
    }
    $update = $upda1 . $upda2;
    //echo $sele;
    mysql_query($update);
    mysql_query($updacon);
}
mysql_close($dp);
?>
</div>
<a href="#" class="go-top" id="go-top">Subir</a>
</body>
</html>
Example #10
0
        }
    }
}
function deleteGenre($deleteCommand, $conn)
{
    if (mysqli_query($conn, $deleteCommand)) {
        echo "<h3>Genre deleted successfully!</h3>";
        // echo "<button class="goBack" type="button" onclick="history.go(-1)">Go Back</button>"; // a method to redirect back to page
    } else {
        echo "<p>Problem with deleting genre: " . mysqli_error($conn) . "</p>";
    }
}
//end of deleteMovie function
include 'connectdb.php';
if (isset($_POST['thegenre'])) {
    IsChecked('thegenre', $connection, $movID);
    mysqli_close($connection);
} else {
    echo "Please make sure to select an option. Click the button to go back.";
}
?>

 <hr>
         <form action="movieMod.php">
          <input type="submit" value="Back to Screenings Management">
         </form>
        <hr>
        <footer>
            &copy; Jieni and Jaisen
        </footer>
</body>
Example #11
0
<?php 
include '../../connectdb.php';
if (isset($_POST['theshowings'])) {
    function IsChecked($chkname, $connection)
    {
        if (!empty($_POST[$chkname])) {
            foreach ($_POST[$chkname] as $value) {
                $delsql = "delete from Showings where ShowingID='" . $value . "'";
                deleteShowing($delsql, $connection, $value);
            }
        }
    }
    function deleteShowing($deleteCommand, $conn, $val)
    {
        if (mysqli_query($conn, $deleteCommand)) {
            echo "<p>Showing " . $val . " deleted successfully</p>";
        } else {
            echo "<p>Problem with deleting showing: " . mysqli_error($conn) . "</p>";
        }
    }
    IsChecked('theshowings', $connection);
} else {
    echo '<p>Error: you must select a showing.</p>';
}
mysqli_close($connection);
?>
<p><a href="../staff.php">&larr; Return to staff page</a></p>

</body>
</html>
Example #12
0
/**
 * This is the function that is specific to your backend. It takes
 * the current password (as supplied by the user) and the desired
 * new password. It will return an array of messages. If everything
 * was successful, the array will be empty. Else, it will contain
 * the errormessage(s).
 * Constants to be used for these messages:
 * CPW_CURRENT_NOMATCH -> "Your current password is not correct."
 * CPW_INVALID_PW -> "Your new password contains invalid characters."
 *
 * @param array data The username/currentpw/newpw data.
 * @return array Array of error messages.
 */
function cpw_merak_dochange($data)
{
    // unfortunately, we can only pass one parameter to a hook function,
    // so we have to pass it as an array.
    $username = $data['username'];
    $curpw = $data['curpw'];
    $newpw = $data['newpw'];
    $msgs = array();
    global $merak_url, $merak_selfpage, $merak_action;
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $merak_url . $merak_selfpage);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    curl_setopt($ch, CURLOPT_USERPWD, "{$username}:{$curpw}");
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    $result = curl_exec($ch);
    curl_close($ch);
    if (strpos($result, "401 Access denied") != 0) {
        array_push($msgs, _("Cannot change password! (Is user 'Self Configurable User' ?) (401)"));
        return $msgs;
    }
    // Get URL from: <FORM METHOD="POST" ACTION="success.html?id=a9375ee5e445775e871d5e1401a963aa">
    $str = stristr($result, "<FORM");
    $str = substr($str, 0, strpos($str, ">") + 1);
    $str = stristr($str, "ACTION=");
    $str = substr(stristr($str, "\""), 1);
    $str = substr($str, 0, strpos($str, "\""));
    // Extra check to see if the result contains 'html'
    if (!stristr($str, "html")) {
        array_push($msgs, _("Cannot change password!") . " (1)");
        return $msgs;
    }
    $newurl = $merak_url . $str;
    // Get useraddr from: $useraddr = <INPUT TYPE="HIDDEN" NAME="usraddr" VALUE="*****@*****.**">
    $str = stristr($result, "usraddr");
    $str = substr($str, 0, strpos($str, ">") + 1);
    $str = stristr($str, "VALUE=");
    $str = substr(stristr($str, "\""), 1);
    $str = substr($str, 0, strpos($str, "\""));
    // Extra check to see if the result contains '@'
    if (!stristr($str, "@")) {
        array_push($msgs, _("Cannot change password!") . " (2)");
        return $msgs;
    }
    $useraddr = $str;
    //Include (almost) all input fields from screen
    $contents2 = $result;
    $tag = stristr($contents2, "<INPUT");
    while ($tag) {
        $contents2 = stristr($contents2, "<INPUT");
        $tag = substr($contents2, 0, strpos($contents2, ">") + 1);
        if (GetSub($tag, "TYPE") == "TEXT" || GetSub($tag, "TYPE") == "HIDDEN" || GetSub($tag, "TYPE") == "PASSWORD") {
            $tags[GetSub($tag, "NAME")] = GetSub($tag, "VALUE");
        }
        if ((GetSub($tag, "TYPE") == "RADIO" || GetSub($tag, "TYPE") == "CHECKBOX") && IsChecked($tag)) {
            $tags[GetSub($tag, "NAME")] = GetSub($tag, "VALUE");
        }
        $contents2 = substr($contents2, 1);
    }
    $tags["action"] = $merak_action;
    $tags["usraddr"] = $useraddr;
    $tags["usr_pass"] = $newpw;
    $tags["usr_conf"] = $newpw;
    $str2 = "";
    foreach ($tags as $key => $value) {
        $str2 .= $key . "=" . urlencode($value) . "&";
    }
    $str2 = trim($str2, "&");
    // Change password!
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $newurl);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $str2);
    $result = curl_exec($ch);
    curl_close($ch);
    if (strpos($result, "Failure") != 0) {
        array_push($msgs, _("Cannot change password!") . " (3)");
        return $msgs;
    }
    return $msgs;
}
Example #13
0
<?php 
include '../../connectdb.php';
if (isset($_POST['therooms'])) {
    function IsChecked($chkname, $connection)
    {
        if (!empty($_POST[$chkname])) {
            foreach ($_POST[$chkname] as $value) {
                $delsql = "delete from TheatreRooms where RoomNumber='" . $value . "'";
                deleteRoom($delsql, $connection, $value);
            }
        }
    }
    function deleteRoom($deleteCommand, $conn, $val)
    {
        if (mysqli_query($conn, $deleteCommand)) {
            echo "<p>Room " . $val . " deleted successfully</p>";
        } else {
            echo "<p>Problem with deleting room: " . mysqli_error($conn) . "</p>";
        }
    }
    //end of deleteMovie function
    IsChecked('therooms', $connection);
} else {
    echo '<p>Error: you must select a room.</p>';
}
mysqli_close($connection);
?>
<p><a href="../staff.php">&larr; Return to staff page</a></p>
</body>
</html>
Example #14
0
<?php

$dp = mysql_connect("localhost", "root", "");
mysql_select_db("facturas", $dp);
$data = $_GET['cod_fac'];
function IsChecked($chkname, $value)
{
    if (!empty($_POST[$chkname])) {
        foreach ($_POST[$chkname] as $chkval) {
            if ($chkval == $value) {
                return true;
            }
        }
    }
    return false;
}
if (IsChecked('cuenta', 'laboral')) {
    $laboral = "Nº Cta. Laboral: **** **** ****";
} else {
    $laboral = NULL;
}
if (IsChecked('cuenta', 'kutxa')) {
    $kutxa = "Nº Cta. Kutxa: **** **** ****";
} else {
    $kutxa = NULL;
}
$aldatu = "UPDATE facturas SET cuenta_laboral='{$laboral}',cuenta_kutxa='{$kutxa}' WHERE cod_fac={$data}";
mysql_query($aldatu);
header("Location: edit_factura.php?cod_fac={$data}");
mysql_close($dp);
Example #15
0
include '../../connectdb.php';
if (isset($_POST['thegenres'])) {
    function IsChecked($chkname, $connection)
    {
        if (!empty($_POST[$chkname])) {
            foreach ($_POST[$chkname] as $value) {
                list($keyid, $keygenre) = explode('|', $value);
                $delsql = 'delete from MovieGenres where MovieID="' . $keyid . '"and Genre="' . $keygenre . '"';
                deleteGenre($delsql, $connection, $value);
            }
        }
    }
    function deleteGenre($deleteCommand, $conn, $val)
    {
        if (mysqli_query($conn, $deleteCommand)) {
            echo "<p>Genre deleted successfully!</p>";
        } else {
            echo "<p>Problem with deleting genre: " . mysqli_error($conn) . "</p>";
        }
    }
    //end of deleteGenre function
    IsChecked('thegenres', $connection);
} else {
    echo '<p>Error: you must select a genre.</p>';
}
mysqli_close($connection);
?>
<p><a href="../staff.php">&larr; Return to staff page</a></p>
</body>
</html>
function Admin_Users()
{
    global $session;
    global $db_prefix;
    global $GlobalUser;
    global $FleetMissionList;
    $now = time();
    $resmap = array(106, 108, 109, 110, 111, 113, 114, 115, 117, 118, 120, 121, 122, 123, 124, 199);
    $unitab = LoadUniverse();
    $speed = $unitab['speed'];
    // Обработка POST-запроса.
    if (method() === "POST" && $GlobalUser['admin'] >= 2) {
        if (key_exists('player_id', $_GET)) {
            $player_id = intval($_GET['player_id']);
        } else {
            $player_id = 0;
        }
        if (key_exists('action', $_GET) && $player_id) {
            $action = $_GET['action'];
        } else {
            $action = "";
        }
        if ($action === "update") {
            $query = "UPDATE " . $db_prefix . "users SET ";
            foreach ($resmap as $i => $gid) {
                $query .= "r{$gid} = " . intval($_POST["r{$gid}"]) . ", ";
            }
            if ($_POST['deaktjava'] === "on") {
                $query .= "disable = 1, disable_until = " . ($now + 7 * 24 * 60 * 60) . ", ";
            } else {
                $query .= "disable = 0, ";
            }
            if ($_POST['vacation'] === "on") {
                $query .= "vacation = 1, vacation_until = " . ($now + 2 * 24 * 60 * 60 / $speed) . ", ";
            } else {
                $query .= "vacation = 0, ";
            }
            if ($_POST['banned'] !== "on") {
                $query .= "banned = 0, ";
            }
            if ($_POST['noattack'] !== "on") {
                $query .= "noattack = 0, ";
            }
            $query .= "pemail = '" . $_POST['pemail'] . "', ";
            $query .= "email = '" . $_POST['email'] . "', ";
            $query .= "admin = '" . $_POST['admin'] . "', ";
            $query .= "validated = " . ($_POST['validated'] === "on" ? 1 : 0) . ", ";
            $query .= "sniff = " . ($_POST['sniff'] === "on" ? 1 : 0) . ", ";
            $query .= "debug = " . ($_POST['debug'] === "on" ? 1 : 0) . ", ";
            $query .= "dm = '" . intval($_POST['dm']) . "', ";
            $query .= "dmfree = '" . intval($_POST['dmfree']) . "', ";
            $query .= "sortby = '" . intval($_POST['settings_sort']) . "', ";
            $query .= "sortorder = '" . intval($_POST['settings_order']) . "', ";
            $query .= "skin = '" . $_POST['dpath'] . "', ";
            $query .= "useskin = " . ($_POST['design'] === "on" ? 1 : 0) . ", ";
            $query .= "deact_ip = " . ($_POST['deact_ip'] === "on" ? 1 : 0) . ", ";
            $query .= "maxspy = '" . intval($_POST['spio_anz']) . "', ";
            $query .= "maxfleetmsg = '" . intval($_POST['settings_fleetactions']) . "' ";
            $query .= " WHERE player_id={$player_id};";
            dbquery($query);
            $qname = array('CommanderOff', 'AdmiralOff', 'EngineerOff', 'GeologeOff', 'TechnocrateOff');
            foreach ($qname as $i => $qcmd) {
                $days = intval($_POST[$qcmd]);
                if ($days > 0) {
                    RecruitOfficer($player_id, $qcmd, $days * 24 * 60 * 60);
                }
            }
        }
        if ($action === "create_planet") {
            $g = $_POST['g'];
            if ($g === "") {
                $g = 1;
            }
            $s = $_POST['s'];
            if ($s === "") {
                $s = 1;
            }
            $p = $_POST['p'];
            if ($p === "") {
                $p = 1;
            }
            if (!HasPlanet($g, $s, $p)) {
                $planet_id = CreatePlanet($g, $s, $p, $_GET['player_id']);
                $query = "UPDATE " . $db_prefix . "planets SET mprod = 0, kprod = 0, dprod = 0 WHERE planet_id = " . $planet_id;
                dbquery($query);
            }
        }
    }
    // Обработка GET-запроса.
    if (method() === "GET" && $GlobalUser['admin'] >= 2) {
        if (key_exists('player_id', $_GET)) {
            $player_id = intval($_GET['player_id']);
        } else {
            $player_id = 0;
        }
        if (key_exists('action', $_GET) && $player_id) {
            $action = $_GET['action'];
        } else {
            $action = "";
        }
        $now = time();
        if ($action === "recalc_stats") {
            RecalcStats($player_id);
            RecalcRanks();
        }
        if ($action === "reactivate") {
            ReactivateUser($player_id);
        }
        if ($action === "bot_start") {
            StartBot($player_id);
        }
        if ($action === "bot_stop") {
            StopBot($player_id);
        }
    }
    if (key_exists("player_id", $_GET)) {
        // Информация об игроке
        InvalidateUserCache();
        $user = LoadUser(intval($_GET['player_id']));
        ?>

    <?php 
        echo AdminPanel();
        ?>

    <table>
    <form action="index.php?page=admin&session=<?php 
        echo $session;
        ?>
&mode=Users&action=update&player_id=<?php 
        echo $user['player_id'];
        ?>
" method="POST" >
    <tr><td class=c><?php 
        echo AdminUserName($user);
        ?>
</td><td class=c>Настройки</td><td class=c>Исследования</td></tr>

        <th valign=top><table>
            <tr><th>ID</th><th><?php 
        echo $user['player_id'];
        ?>
</th></tr>
            <tr><th>Дата регистрации</th><th><?php 
        echo date("Y-m-d H:i:s", $user['regdate']);
        ?>
</th></tr>
            <tr><th>Альянс</th><th>
<?php 
        if ($user['ally_id']) {
            $ally = LoadAlly($user['ally_id']);
            echo "[" . $ally['tag'] . "] " . $ally['name'];
        }
        ?>
</th></tr>
            <tr><th>Дата вступления</th><th>
<?php 
        if ($user['ally_id']) {
            echo date("Y-m-d H:i:s", $user['joindate']);
        }
        ?>
</th></tr>
            <tr><th>Постоянный адрес</th><th><input type="text" name="pemail" maxlength="100" size="20" value="<?php 
        echo $user['pemail'];
        ?>
" /></th></tr>
            <tr><th>Временный адрес</th><th><input type="text" name="email" maxlength="100" size="20" value="<?php 
        echo $user['email'];
        ?>
" /></th></tr>
            <tr><th>Удалить игрока</th><th><input type="checkbox" name="deaktjava"  <?php 
        echo IsChecked($user, "disable");
        ?>
/>
      <?php 
        if ($user['disable']) {
            echo date("Y-m-d H:i:s", $user['disable_until']);
        }
        ?>
</th></tr>
            <tr><th>Режим отпуска</th><th><input type="checkbox" name="vacation"  <?php 
        echo IsChecked($user, "vacation");
        ?>
/>
      <?php 
        if ($user['vacation']) {
            echo date("Y-m-d H:i:s", $user['vacation_until']);
        }
        ?>
</th></tr>
            <tr><th>Заблокирован</th><th><input type="checkbox" name="banned"  <?php 
        echo IsChecked($user, "banned");
        ?>
/>
      <?php 
        if ($user['banned']) {
            echo date("Y-m-d H:i:s", $user['banned_until']);
        }
        ?>
</th></tr>
            <tr><th>Бан атак</th><th><input type="checkbox" name="noattack"  <?php 
        echo IsChecked($user, "noattack");
        ?>
/>
      <?php 
        if ($user['noattack']) {
            echo date("Y-m-d H:i:s", $user['noattack_until']);
        }
        ?>
</th></tr>
            <tr><th>Последний вход</th><th><?php 
        echo date("Y-m-d H:i:s", $user['lastlogin']);
        ?>
</th></tr>
            <tr><th>Активность</th><th>
<?php 
        $now = time();
        echo date("Y-m-d H:i:s", $user['lastclick']);
        if ($now - $user['lastclick'] < 60 * 60) {
            echo " (" . floor(($now - $user['lastclick']) / 60) . " min)";
        }
        ?>
</th></tr>
            <tr><th>IP адрес</th><th><a href="http://nic.ru/whois/?query=<?php 
        echo $user['ip_addr'];
        ?>
" target=_blank><?php 
        echo $user['ip_addr'];
        ?>
</a></th></tr>
            <tr><th>Активирован</th><th><input type="checkbox" name="validated" <?php 
        echo IsChecked($user, "validated");
        ?>
 /> <a href="index.php?page=admin&session=<?php 
        echo $session;
        ?>
&mode=Users&action=reactivate&player_id=<?php 
        echo $user['player_id'];
        ?>
">выслать пароль</a></th></tr>
            <tr><th>Главная планета</th><th>
<?php 
        $planet = GetPlanet($user['hplanetid']);
        echo "[" . $planet['g'] . ":" . $planet['s'] . ":" . $planet['p'] . "] <a href=\"index.php?page=admin&session={$session}&mode=Planets&cp=" . $planet['planet_id'] . "\">" . $planet['name'] . "</a>";
        ?>
</th></tr>
            <tr><th>Текущая планета</th><th>
<?php 
        $planet = GetPlanet($user['aktplanet']);
        echo "[" . $planet['g'] . ":" . $planet['s'] . ":" . $planet['p'] . "] <a href=\"index.php?page=admin&session={$session}&mode=Planets&cp=" . $planet['planet_id'] . "\">" . $planet['name'] . "</a>";
        ?>
</th></tr>
            <tr><th>Права</th><th>
   <select name="admin">
     <option value="0" <?php 
        echo IsSelected($user, "admin", 0);
        ?>
>Пользователь</option>
     <option value="1" <?php 
        echo IsSelected($user, "admin", 1);
        ?>
>Оператор</option>
     <option value="2" <?php 
        echo IsSelected($user, "admin", 2);
        ?>
>Администратор</option>
   </select>
</th></tr>
            <tr><th>Включить слежение</th><th><input type="checkbox" name="sniff" <?php 
        echo IsChecked($user, "sniff");
        ?>
 /></th></tr>
            <tr><th>Отладочная информация</th><th><input type="checkbox" name="debug" <?php 
        echo IsChecked($user, "debug");
        ?>
 /></th></tr>

<?php 
        if (IsBot($user['player_id'])) {
            ?>
            <tr><th colspan=2><a href="index.php?page=admin&session=<?php 
            echo $session;
            ?>
&mode=Users&action=bot_stop&player_id=<?php 
            echo $user['player_id'];
            ?>
" >[Остановить бота]</a></th></tr>
<?php 
        } else {
            ?>
            <tr><th colspan=2><a href="index.php?page=admin&session=<?php 
            echo $session;
            ?>
&mode=Users&action=bot_start&player_id=<?php 
            echo $user['player_id'];
            ?>
" >[Запустить бота]</a></th></tr>
<?php 
        }
        ?>
        </table></th>

        <th valign=top><table>
            <tr><th>Сортировка планет</th><th>
   <select name="settings_sort">
    <option value="0" <?php 
        echo IsSelected($user, "sortby", 0);
        ?>
 >порядку колонизации</option>
    <option value="1" <?php 
        echo IsSelected($user, "sortby", 1);
        ?>
 >координатам</option>
    <option value="2" <?php 
        echo IsSelected($user, "sortby", 2);
        ?>
 >алфавиту</option>
   </select>
</th></tr>
            <tr><th>Порядок сортировки</th><th>
   <select name="settings_order">
     <option value="0" <?php 
        echo IsSelected($user, "sortorder", 0);
        ?>
>по возрастанию</option>
     <option value="1" <?php 
        echo IsSelected($user, "sortorder", 1);
        ?>
>по убыванию</option>
   </select>
</th></tr>
            <tr><th>Скин</th><th><input type=text name="dpath" maxlength="80" size="40" value="<?php 
        echo $user['skin'];
        ?>
" /></th></tr>
            <tr><th>Использовать скин</th><th><input type="checkbox" name="design" <?php 
        echo IsChecked($user, "useskin");
        ?>
 /></th></tr>
            <tr><th>Декативировать проверку IP</th><th><input type="checkbox" name="deact_ip" <?php 
        echo IsChecked($user, "deact_ip");
        ?>
 /></th></tr>
            <tr><th>Количество зондов</th><th><input type="text" name="spio_anz" maxlength="2" size="2" value="<?php 
        echo $user['maxspy'];
        ?>
" /></th></tr>
            <tr><th>Количество сообщений флота</th><th><input type="text" name="settings_fleetactions" maxlength="2" size="2" value="<?php 
        echo $user['maxfleetmsg'];
        ?>
" /></th></tr>

            <tr><th colspan=2>&nbsp</th></tr>
            <tr><td class=c colspan=2>Статистика</td></tr>
            <tr><th>Очки (старые)</th><th><?php 
        echo nicenum($user['oldscore1'] / 1000);
        ?>
 / <?php 
        echo nicenum($user['oldplace1']);
        ?>
</th></tr>
            <tr><th>Флот (старые)</th><th><?php 
        echo nicenum($user['oldscore2']);
        ?>
 / <?php 
        echo nicenum($user['oldplace2']);
        ?>
</th></tr>
            <tr><th>Исследования (старые)</th><th><?php 
        echo nicenum($user['oldscore3']);
        ?>
 / <?php 
        echo nicenum($user['oldplace3']);
        ?>
</th></tr>
            <tr><th>Очки</th><th><?php 
        echo nicenum($user['score1'] / 1000);
        ?>
 / <?php 
        echo nicenum($user['place1']);
        ?>
</th></tr>
            <tr><th>Флот</th><th><?php 
        echo nicenum($user['score2']);
        ?>
 / <?php 
        echo nicenum($user['place2']);
        ?>
</th></tr>
            <tr><th>Исследования</th><th><?php 
        echo nicenum($user['score3']);
        ?>
 / <?php 
        echo nicenum($user['place3']);
        ?>
</th></tr>
            <tr><th>Дата старой статистики</th><th><?php 
        echo date("Y-m-d H:i:s", $user['scoredate']);
        ?>
</th></tr>
            <tr><th colspan=2><a href="index.php?page=admin&session=<?php 
        echo $session;
        ?>
&mode=Users&action=recalc_stats&player_id=<?php 
        echo $user['player_id'];
        ?>
" >[Пересчитать статистику]</a></th></tr>

            <tr><th colspan=2>&nbsp</th></tr>
            <tr><td class=c colspan=2>Офицеры</td></tr>
            <tr><th colspan=2><table><tr>
<?php 
        $oname = array('Командир ОГейма', 'Адмирал', 'Инженер', 'Геолог', 'Технократ');
        $odesc = array('', '<font size=1 color=skyblue>&amp;nbsp;Макс. кол-во флотов +2</font>', '<font size=1 color=skyblue>Сокращает вдвое потери в обороне+10% больше энергии</font>', '<font size=1 color=skyblue>+10% доход от шахты</font>', '<font size=1 color=skyblue>+2 уровень шпионажа, 25% меньше времени на исследования</font>');
        $qname = array('CommanderOff', 'AdmiralOff', 'EngineerOff', 'GeologeOff', 'TechnocrateOff');
        $imgname = array('commander', 'admiral', 'ingenieur', 'geologe', 'technokrat');
        $now = time();
        foreach ($qname as $i => $qcmd) {
            $end = GetOfficerLeft($user['player_id'], $qname[$i]);
            $img = "";
            if ($end <= $now) {
                $img = "_un";
                $days = "";
            } else {
                $d = ($end - $now) / (60 * 60 * 24);
                if ($d > 0) {
                    $days = "&lt;font color=lime&gt;Активен&lt;/font&gt; ещё " . ceil($d) . " д.";
                }
            }
            echo "    <td align='center' width='35' class='header'>\n";
            echo "\t<img border='0' src='img/" . $imgname[$i] . "_ikon" . $img . ".gif' width='32' height='32' alt='" . $oname[$i] . "'\n";
            echo "\tonmouseover=\"return overlib('<center><font size=1 color=white><b>" . $days . "<br>" . $oname[$i] . "</font><br>" . $odesc[$i] . "<br></b></center>', LEFT, WIDTH, 150);\" onmouseout='return nd();'>\n";
            echo "    </td> <td><input type=\"text\" name=\"" . $qname[$i] . "\" size=\"3\" /></td>\n\n";
        }
        ?>
        </tr></table></th></tr>

            <tr><th colspan=2><i>Чтобы продлить офицера укажите необходимое количество дней в полях ввода</i></th></tr>

        </table></th>

        <th valign=top><table>
<?php 
        foreach ($resmap as $i => $gid) {
            echo "<tr><th>" . loca("NAME_{$gid}") . "</th><th><input type=\"text\" size=3 name=\"r{$gid}\" value=\"" . $user["r{$gid}"] . "\" /></th></tr>\n";
        }
        ?>
        <tr><th>Найденная Тёмная Материя</th><th><input type="text" size=5 name="dmfree" value="<?php 
        echo $user['dmfree'];
        ?>
" /></th></tr>
        <tr><th>Покупная Тёмная Материя</th><th><input type="text" size=5 name="dm" value="<?php 
        echo $user['dm'];
        ?>
" /></th></tr>
        </table></th>
    <tr><th colspan=3><input type="submit" value="Сохранить" /></th></tr>
    </form>
    </table>

    <br>
    <table> 
    <form action="index.php?page=admin&session=<?php 
        echo $session;
        ?>
&mode=Users&action=create_planet&player_id=<?php 
        echo $user['player_id'];
        ?>
" method="POST" >
    <tr><td class=c colspan=20>Список планет</td></tr>
    <tr>
<?php 
        $query = "SELECT * FROM " . $db_prefix . "planets WHERE owner_id = '" . intval($_GET['player_id']) . "' ORDER BY g ASC, s ASC, p ASC, type DESC";
        $result = dbquery($query);
        $rows = dbrows($result);
        $counter = 0;
        while ($rows--) {
            $p = dbarray($result);
            ?>
    <td> <img src="<?php 
            echo GetPlanetSmallImage("../evolution/", $p);
            ?>
" width="32px" height="32px"></td>
    <td> <a href="index.php?page=admin&session=<?php 
            echo $session;
            ?>
&mode=Planets&cp=<?php 
            echo $p['planet_id'];
            ?>
"> <?php 
            echo $p['name'];
            ?>
 </a>
            [<a href="index.php?page=galaxy&session=<?php 
            echo $session;
            ?>
&galaxy=<?php 
            echo $p['g'];
            ?>
&system=<?php 
            echo $p['s'];
            ?>
"><?php 
            echo $p['g'];
            ?>
:<?php 
            echo $p['s'];
            ?>
:<?php 
            echo $p['p'];
            ?>
</a>] </td>
<?php 
            $counter++;
            if ($counter > 9) {
                $counter = 0;
                echo "</tr>\n<tr>\n";
            }
        }
        ?>
    </tr>
    <tr><td colspan=20> Координаты: <input name="g" size=2> <input name="s" size=2> <input name="p" size=2> <input type="submit" value="Создать планету"></td></tr>
    </form>
    </table>

    <br>
    <table>

<?php 
        if ($_GET['action'] === 'fleetlogs') {
            echo "<tr><td class=c colspan=12>Логи полётов</td></tr>\n";
            if ($_GET['from'] == 1) {
                $result = FleetlogsFromPlayer($user['player_id'], $FleetMissionList[$_GET['mission']]);
            } else {
                $result = FleetlogsToPlayer($user['player_id'], $FleetMissionList[$_GET['mission']]);
            }
            $anz = $rows = dbrows($result);
            echo "<tr><td class=c>N</td> <td class=c>Таймер</td> <td class=c>Задание</td> <td class=c>Отправлен</td> <td class=c>Прибывает</td><td class=c>Время полёта</td> <td class=c>Старт</td> <td class=c>Цель</td> <td class=c>Флот</td> <td class=c>Ресурсы на планете</td> <td class=c>Груз</td> <td class=c>САБ</td> </tr>\n";
            $bxx = 1;
            while ($rows--) {
                $fleet_obj = dbarray($result);
                $fleet_price = FleetPrice($fleet_obj);
                $points = $fleet_price['points'];
                $fpoints = $fleet_price['fpoints'];
                $style = "";
                if ($points >= 100000000) {
                    if ($fleet_obj['mission'] <= 2) {
                        $style = " style=\"background-color: FireBrick;\" ";
                    } else {
                        $style = " style=\"background-color: DarkGreen;\" ";
                    }
                }
                ?>
        <tr <?php 
                echo $style;
                ?>
 >

        <th <?php 
                echo $style;
                ?>
 > <?php 
                echo $bxx;
                ?>
 </th>

        <th <?php 
                echo $style;
                ?>
 >
<?php 
                echo "<table><tr {$style} ><th {$style} ><div id='bxx" . $bxx . "' title='" . ($fleet_obj['end'] - $now) . "' star='" . $fleet_obj['start'] . "'> </th>";
                echo "<tr><th {$style} >" . date("d.m.Y H:i:s", $fleet_obj['end']) . "</th></tr></table>";
                ?>
        </th>
        <th <?php 
                echo $style;
                ?>
 >
<?php 
                echo FleetlogsMissionText($fleet_obj['mission']);
                ?>
        </th>
        <th <?php 
                echo $style;
                ?>
 ><?php 
                echo date("d.m.Y", $fleet_obj['start']);
                ?>
 <br> <?php 
                echo date("H:i:s", $fleet_obj['start']);
                ?>
</th>
        <th <?php 
                echo $style;
                ?>
 ><?php 
                echo date("d.m.Y", $fleet_obj['end']);
                ?>
 <br> <?php 
                echo date("H:i:s", $fleet_obj['end']);
                ?>
</th>
        <th <?php 
                echo $style;
                ?>
 >
<?php 
                echo "<nobr>" . BuildDurationFormat($fleet_obj['flight_time']) . "</nobr><br>";
                echo "<nobr>" . $fleet_obj['flight_time'] . " сек.</nobr>";
                ?>
        </th>
        <th <?php 
                echo $style;
                ?>
 >
<?php 
                echo "[" . $fleet_obj['origin_g'] . ":" . $fleet_obj['origin_s'] . ":" . $fleet_obj['origin_p'] . "]";
                $u = LoadUser($fleet_obj['owner_id']);
                echo " <br>" . AdminUserName($u);
                ?>
        </th>
        <th <?php 
                echo $style;
                ?>
 >
<?php 
                echo "[" . $fleet_obj['target_g'] . ":" . $fleet_obj['target_s'] . ":" . $fleet_obj['target_p'] . "]";
                $u = LoadUser($fleet_obj['target_id']);
                echo " <br>" . AdminUserName($u);
                ?>
        </th>
        <th <?php 
                echo $style;
                ?>
 >
<?php 
                $fleetmap = array(202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215);
                foreach ($fleetmap as $i => $gid) {
                    $amount = $fleet_obj["ship" . $gid];
                    if ($amount > 0) {
                        echo loca("NAME_{$gid}") . ":" . nicenum($amount) . " ";
                    }
                }
                ?>
        </th>
        <th <?php 
                echo $style;
                ?>
 >
<?php 
                $total = $fleet_obj['pm'] + $fleet_obj['pk'] + $fleet_obj['pd'];
                if ($total > 0) {
                    echo "М: " . nicenum($fleet_obj['pm']) . "<br>";
                    echo "К: " . nicenum($fleet_obj['pk']) . "<br>";
                    echo "Д: " . nicenum($fleet_obj['pd']);
                } else {
                    echo "-";
                }
                ?>
        </th>
        <th <?php 
                echo $style;
                ?>
 >
<?php 
                $total = $fleet_obj['m'] + $fleet_obj['k'] + $fleet_obj['d'];
                if ($total > 0) {
                    echo "М: " . nicenum($fleet_obj['m']) . "<br>";
                    echo "К: " . nicenum($fleet_obj['k']) . "<br>";
                    echo "Д: " . nicenum($fleet_obj['d']);
                } else {
                    echo "-";
                }
                ?>
        </th>
        <th <?php 
                echo $style;
                ?>
 >
<?php 
                if ($fleet_obj['union_id']) {
                    echo $fleet_obj['union_id'];
                } else {
                    echo "-";
                }
                ?>
        </th>

        </tr>
<?php 
                $bxx++;
            }
            echo "<script language=javascript>anz={$anz};t();</script>\n";
        } else {
            ?>

    <tr><td class=c colspan=3>Логи полётов</td></tr>
    <tr><td>Задание</td><td>от <?php 
            echo $user['oname'];
            ?>
</td><td>на <?php 
            echo $user['oname'];
            ?>
</td></tr>
    <tr><td>Все</td><td><?php 
            echo LinkFleetsFrom($user, 0);
            ?>
</td><td><?php 
            echo LinkFleetsTo($user, 0);
            ?>
</td></tr>
    <tr><td>Атака</td><td><?php 
            echo LinkFleetsFrom($user, 1);
            ?>
</td><td><?php 
            echo LinkFleetsTo($user, 1);
            ?>
</td></tr>
    <tr><td>Совместная атака</td><td><?php 
            echo LinkFleetsFrom($user, 2);
            ?>
</td><td><?php 
            echo LinkFleetsTo($user, 2);
            ?>
</td></tr>
    <tr><td>Транспорт</td><td><?php 
            echo LinkFleetsFrom($user, 3);
            ?>
</td><td><?php 
            echo LinkFleetsTo($user, 3);
            ?>
</td></tr>
    <tr><td>Оставить</td><td><?php 
            echo LinkFleetsFrom($user, 4);
            ?>
</td><td><?php 
            echo LinkFleetsTo($user, 4);
            ?>
</td></tr>
    <tr><td>Держаться</td><td><?php 
            echo LinkFleetsFrom($user, 5);
            ?>
</td><td><?php 
            echo LinkFleetsTo($user, 5);
            ?>
</td></tr>
    <tr><td>Шпионаж</td><td><?php 
            echo LinkFleetsFrom($user, 6);
            ?>
</td><td><?php 
            echo LinkFleetsTo($user, 6);
            ?>
</td></tr>
    <tr><td>Колонизировать</td><td><?php 
            echo LinkFleetsFrom($user, 7);
            ?>
</td><td><?php 
            echo LinkFleetsTo($user, 7);
            ?>
</td></tr>
    <tr><td>Переработать</td><td><?php 
            echo LinkFleetsFrom($user, 8);
            ?>
</td><td><?php 
            echo LinkFleetsTo($user, 8);
            ?>
</td></tr>
    <tr><td>Уничтожить</td><td><?php 
            echo LinkFleetsFrom($user, 9);
            ?>
</td><td><?php 
            echo LinkFleetsTo($user, 9);
            ?>
</td></tr>
    <tr><td>Экспедиция</td><td><?php 
            echo LinkFleetsFrom($user, 15);
            ?>
</td><td><?php 
            echo LinkFleetsTo($user, 15);
            ?>
</td></tr>
    <tr><td>Ракетная атака</td><td><?php 
            echo LinkFleetsFrom($user, 20);
            ?>
</td><td><?php 
            echo LinkFleetsTo($user, 20);
            ?>
</td></tr>
    <tr><td>Атака (САБ)</td><td><?php 
            echo LinkFleetsFrom($user, 21);
            ?>
</td><td><?php 
            echo LinkFleetsTo($user, 21);
            ?>
</td></tr>
    </table>

<?php 
        }
        ?>

<?php 
    } else {
        $query = "SELECT * FROM " . $db_prefix . "users ORDER BY regdate DESC LIMIT 25";
        $result = dbquery($query);
        AdminPanel();
        echo "    </th> \n";
        echo "   </tr> \n";
        echo "</table> \n";
        echo "Новые пользователи:<br>\n";
        echo "<table>\n";
        echo "<tr><td class=c>Дата регистрации</td><td class=c>Главная планета</td><td class=c>Имя игрока</td></tr>\n";
        $rows = dbrows($result);
        while ($rows--) {
            $user = dbarray($result);
            $hplanet = GetPlanet($user['hplanetid']);
            echo "<tr><th>" . date("Y-m-d H:i:s", $user['regdate']) . "</th>";
            echo "<th>[" . $hplanet['g'] . ":" . $hplanet['s'] . ":" . $hplanet['p'] . "] <a href=\"index.php?page=admin&session={$session}&mode=Planets&cp=" . $hplanet['planet_id'] . "\">" . $hplanet['name'] . "</a></th>";
            echo "<th>" . AdminUserName($user) . "</th></tr>\n";
        }
        echo "</table>\n";
        ?>

    <br>
    <table>
<?php 
        $when = time() - 24 * 60 * 60;
        $query = "SELECT * FROM " . $db_prefix . "users WHERE lastclick >= {$when} ORDER BY oname ASC";
        $result = dbquery($query);
        $rows = dbrows($result);
        ?>
    <tr><td class=c>Активные за последние 24 часа (<?php 
        echo $rows;
        ?>
)</td></tr>
    <tr><td>
<?php 
        $first = true;
        while ($rows--) {
            $user = dbarray($result);
            if ($first) {
                $first = false;
            } else {
                echo ", ";
            }
            echo AdminUserName($user);
        }
        ?>
    </td></tr>
    </table>

<?php 
    }
    // Поиск пользователей
}
Example #17
0
            deleteCustomer($delsql, $connection);
        }
    }
}
function deleteCustomer($deleteCommand, $conn)
{
    if (mysqli_query($conn, $deleteCommand)) {
        echo "<h3>Customer deleted successfully</h3>";
    } else {
        echo "<p>Problem with deleting Customer: " . mysqli_error($conn) . "</p>";
    }
}
//end of deleteMovie function
include 'connectdb.php';
if (isset($_POST['thecustomers'])) {
    IsChecked('thecustomers', $connection);
} else {
    echo "<h3>" . "Please make sure to select an option. Click the button to go back." . "</h3>";
}
mysqli_close($connection);
?>

  <br>
        <hr>
         <form action="staff.php">
          <input type="submit" value="Back to Management Summary">
         </form>
        <hr>
        <footer>
            &copy; Jieni and Jaisen
        </footer>