[php] -

_root

Erfahrenes Mitglied
Hi ...
gibt es in PHP eine Funktion wie bei

MSL ( mirc scripting language )
wenn $test auf "0" vorher im Script deklariert wurde

Code:
$test = 0;

Code:
set $test 1

Sprich das man auf Linkdruck eine Variable ändert.

MfG
acid
 
Naja, Du kannst auf Linkdruck eine bestimmtes php-Skript aufrufen, welches dann den Wert Deiner Variablen verändert.

Kommt ja auch n bissel drauf an, wo die Variable steht und wofür Du die brauchst, etc. Vielleicht solltest Du die Aussgangssituation und was Du erreichen willst, doch etwas näher umschreiben.

Möglichkeiten wirds genug geben!
 
Hi ...
Hier ist meine Beschreibung der Situation.

Screenshot mit Beschreibung:
 

Anhänge

  • unbenannt.png
    unbenannt.png
    6,8 KB · Aufrufe: 61
Naja, Du könntest zum Beispiel dem ersten Link "Starten" noch zwei Parameter id=1&action=starten mitgeben. Dann kannst Du in Deinem Skript die Variable für den ersten Server entsprechend setzen (speichern inna Session oder Datenbank oder sowas) und wenn Du dann die Seite wieder aufrufst, fragst Du halt wieder alle relevanten Variablen ab, um dann entpsrechend online oder offline anzuzeigen.

Wäre das vielleicht ne Möglichkeit?
 
Wär vielleicht ne Möglichkeit ...
Wüsste jetzt aber nciht so genau wie du das meinst ... wär nett wenn du mir mal nen Beispiel machen könntest.

Aber einfacher gehts nicht ... oder Irgendwie so ne Sache wie
Code:
set $test 1

Sowas gibt es nicht.. oder ?

MfG Tobi

edit:
Hier ist mal ein Teil vom meinem bisherigem Code
Code:
<?php
$cs15 = 0;
?>

<?php if ($cs15 == 1) { echo "<span class='online'>online</span>"; } elseif ($cs15 == 0) { echo "<span class='offline'>offline</span>"; } else echo "<span class='error'>error</span>"; ?>
			  		</td>
            		<td width="164">
						Counterstrike 1.5 Server
					</td>
            		<td width="81">
						<?php if ($cs15 == 1) { echo '<p><a href="index2.php?target=hlds&cmd=stop"><b style="cursor:crosshair">Stoppen</b></a>'; } elseif ($cs15 == 0) { echo '<p><a href="index2.php?target=hlds&cmd=start"><b style="cursor:crosshair">Starten</b></a>'; } ?>
					</td>
          			<td width="69">
						<?php if ($cs15 == 1) { echo '<p><a href="index2.php?target=hlds&cmd=restart"><b style="cursor:crosshair">Restarten</b></a>'; } ?>
					</td>
					<td width="284">
						<?php

  							if ($target == "hlds")

 							 {

  								echo "<h2>";

							if ($cmd == "start")

							{

								passthru('hlds start'); 
								echo "<span class='Stil3'>Counterstrike 1.5 Server gestartet</span>";
							}

								if ($cmd == "stop")
	
							{

								passthru('/home/controlling/hlds stop'); 
								echo "<span class='Stil3'>Counterstrike 1.5 Server gestoppt</span>";
							}

								if ($cmd == "restart")

							{

								passthru('/home/controlling/hlds restart'); 
								echo "<span class='Stil3'>Counterstrike 1.5 Server restarted</span>";
							}

								if ($cmd == "status")

							{

								passthru('/home/controlling/hlds status'); 

							}

  								echo "</h2>";

 							}

?>
 
Zuletzt bearbeitet:
Ich kenne zwar nicht MSL und was es der Befehl set wirklich tut, aber versuch mal das:


PHP:
<?php
if($_GET[target] == "hlds" && $_GET[cmd] == "start") $cs15 = 1; else $cs15 = 0;

if ($cs15 == 1) { echo "<span class='online'>online</span>"; } elseif ($cs15 == 0) { echo "<span class='offline'>offline</span>"; } else echo "<span class='error'>error</span>"; ?>
			  		</td>
            		<td width="164">
						Counterstrike 1.5 Server
					</td>
            		<td width="81">
						<?php if ($cs15 == 1) { echo '<p><a href="lschen.php?target=hlds&cmd=stop"><b style="cursor:crosshair">Stoppen</b></a>'; } elseif ($cs15 == 0) { echo '<p><a href="lschen.php?target=hlds&cmd=start"><b style="cursor:crosshair">Starten</b></a>'; } ?>
					</td>
          			<td width="69">
						<?php if ($cs15 == 1) { echo '<p><a href="index2.php?target=hlds&cmd=restart"><b style="cursor:crosshair">Restarten</b></a>'; } ?>
					</td>
					<td width="284">
						<?php

  							if ($_GET["target"] == "hlds")

 							 {

  								echo "<h2>";

							if ($_GET["cmd"] == "start")

							{

								passthru('hlds start');
								echo "<span class='Stil3'>Counterstrike 1.5 Server gestartet</span>";
							}

								if ($cmd == "stop")

							{

								passthru('/home/controlling/hlds stop');
								echo "<span class='Stil3'>Counterstrike 1.5 Server gestoppt</span>";
							}

								if ($cmd == "restart")

							{

								passthru('/home/controlling/hlds restart');
								echo "<span class='Stil3'>Counterstrike 1.5 Server restarted</span>";
							}

								if ($cmd == "status")

							{

								passthru('/home/controlling/hlds status');

							}

  								echo "</h2>";

 							}

?>

Gruß,
Stefan
 
Zurück