php - functions and if statements -


does know how echo rconresults , if not rconresults call rconresults1 or rconresults2? 1 works @ moment echo rconresults(); function @ bottom, new :p

<?php define('include_check',true); include("../classes/functions2.php"); include("../classes/functions.php"); require '../classes/q3status.php'; require '../classes/q3rcon.php'; include("rconform.php"); include("rconresults.php"); include("rconresults1.php"); include("rconresults2.php"); $theme = $_cookie['currenttheme'];?> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">  <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <?php echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../templates/$theme/style.css\" media=\"screen\" />"; ?> </head> <body> <?php echo "<div align='center'>"; echo rconform(); echo '<br><a href="javascript:self.close()">close window</a>'; echo "</div>"; echo rconresults();  ?> </body> </html> 

rconresults calls file , have 3 different requests

   <?php     function rconresults() { include "../classes/config_inc.php"; $server3 = mysql_real_escape_string($_request['rconserver']); $say = mysql_real_escape_string($_request['say']); echo "<div align='center'>"; if ($server3 != "") { $server3 = addslashes($server3); mysql_connect("$db_host", "$db_user", "$db_pass") or die(mysql_error()); mysql_select_db("$db_database") or die(mysql_error()); $result = mysql_query("select * {$db_prefix}_servers `id`='{$server3}'"); if (!$result) {     die("no server available id {$server3}"); }  $fields_num = mysql_num_fields($result);  // store record of "example" table $row $row = mysql_fetch_array( $result ); // print out contents of entry   $r = new q3rcon($row['ip'], $row['port'], $row['rconpass']); $data = explode(" ", $say); if ($data[0] == "clientkick" && count($data) > 2) {     $data = explode(" ", $say, 3);     $r->send_command("".$data[0]." ".$data[1]." \"".$data[2]."\""); } else {     $r->send_command("say " . $say); } $out = $r->get_response();  $out2 = explode("\n", $out); echo "<table class='container9'><tr><td>"; if ($out == '') {     echo "command sent!"; } foreach($out2 $line) {     if ($line != '') {         echo "".strip_gtlt(strip_colors($line))."<br>";     } } echo "</td></tr></table>"; } echo "</div>";     }     ?> 

i think mean this? when click button restarts map?

<?php function rconform() { include("../classes/config_inc.php"); echo "<form method='post' action=''><table class='container8'><tr><td><table width='300'>"; echo "<tr><td colspan='2'><div align='center'><font size='4'><strong>run rcon command</strong></font></div></td></tr><tr><td><div align='right'>server:</div></td><td><div align='left'>"; echo "<select name='rconserver'><option selected='selected'>select</option>"; mysql_connect("$db_host", "$db_user", "$db_pass") or die(mysql_error()); mysql_select_db("$db_database") or die(mysql_error()); $sql="select * `".$db_prefix."_servers` `status`='online' order `order` asc"; $result =mysql_query($sql); while ($data=mysql_fetch_assoc($result)){ $svname = $data['name']; $svname = stripslashes($svname); $svid = $data['id']; if ($svname == $server3) { $selected = "selected=\"$svname\""; } else { $selected = ""; } echo "<option value =\"$svid\" $selected>$svname</option>"; }  echo "</select></div></td></tr><tr><td><div align='right'>console:</div></td><td><div align='left'><input type='text' placeholder='say something..' name='say'></div></td></tr><tr><td colspan='2'><div align='center'><input type='submit' value='execute'></div></td></tr></td></tr></form>"; echo "</select></div></td></tr><tr><td><div align='right'>change map:</div></td><td><div align='left'><input type='text' placeholder='mp_harbor' name='map'></div></td></tr><tr><td colspan='2'><div align='center'><input type='submit' value='execute'></div></td></tr></table></td></tr></form>"; echo "</select></div></td></tr><tr><td><div align='right'><input type='submit' value='restart map' name='map_restart'></div></td></tr>   </tr> </table></td></tr></table> </form>";  }  ?> 

it depends rconresults returning.

if it's boolean condition, code below run rconresults if it's true, , run rconresults2 if it's false.

it depend on condition.

if ( $_request['option'] == "rconresults2" ) {     echo rconresults2(); } else {     echo rconresults(); } 

update.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -