Ispisvanje poruke

Započeo bc-cod2, Jul 15, 2018, 01:00:26 PRE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Eh ovako

Pravim UCP za SA-MP server u SMFu i imam jedan problem sa ispsivanjem poruka putem variajable nece da je prikaze

<?php$con = mysqli_connect("localhost","root","","sa-mp");if (mysqli_connect_errno()){	echo "Greska sa SA-MP databazom: " . mysqli_connect_error();}  session_start();if(isset($_POST['pname']) && isset($_POST['ppass'])){	if(!isset($_SESSION['playername']))	{		$username = stripslashes($_REQUEST['pname']);		$username = mysqli_real_escape_string($con,$username);		$password = stripslashes($_REQUEST['ppass']);		$password = mysqli_real_escape_string($con,$password);		$query = "SELECT * FROM `igraci` WHERE ime='$username' and lozinka='$password'";		$result = mysqli_query($con,$query) or die(mysql_error());		$rows = mysqli_num_rows($result);		if($rows==1) // uspesan login		{			 $_SESSION['playername'] = $username;		}		else		{			$poruka = 'GreskaAAAAAAA';		}	}}function template_manual(){	global $context, $scripturl, $txt;	if(!isset($_SESSION['playername']))	{			echo '					<div class="tborder login">			<div class="cat_bar">				<h3 class="catbg">					<span class="ie6_header floatleft"><img src="http://localhost/boris/Themes/gearbox/images/icons/login_sm.gif" alt="" class="icon">Unesite korisničko ime i lozinku sa DM servera</span>				</h3>			</div>			<span class="upperframe"><span></span></span>			<div class="roundframe"><br class="clear">						<form action="index.php?action=ucp" method="POST">				<dl>					',$poruka,'					<dt>Korisničko ime:</dt>					<dd><input name="pname" size="20" value="" class="input_text" type="text"></dd>					<dt>Lozinka:</dt>					<dd><input name="ppass" value="" size="20" class="input_password" type="password"></dd>				</dl>				<p><input value="Prijava" class="button_submit" type="submit"></p>			</div>			</form>			<span class="lowerframe"><span></span></span>		</div>';	}	else	{		//unset($_SESSION['playername']);	}}


zelim da mi $poruka = 'GreskaAAAAAAA'; ispise...

Da li ti se uopce prikaze ostatak iz ovoga sto radis u echo? (Login HTML struktura)
Software Developer


Na samom vrhu skripte deklariraj $poruka = '';
Zatim u metodi template_manual dodaj 'poruka' u listu globalnih varijabli tako ce $poruka biti dostupna u globalnom scopeu

global $context, $scripturl, $txt, $poruka;
Software Developer

Citat: Ino42O poslato Jul 15, 2018, 09:21:00 PRE PODNE
Na samom vrhu skripte deklariraj $poruka = '';
Zatim u metodi template_manual dodaj 'poruka' u listu globalnih varijabli tako ce $poruka biti dostupna u globalnom scopeu

global $context, $scripturl, $txt, $poruka;

Rješio sam, ali ni tako nije htjelo dok preko

$poruka = '<p class="error">Unjeli ste pogrešnu lozinku.</p><br>';
$_SESSION['poruka_za_korisnika'] = $poruka;


<div class="tborder login">
<div class="cat_bar">
<h3 class="catbg">
<span class="ie6_header floatleft"><img src="http://localhost/boris/Themes/gearbox/images/icons/login_sm.gif" alt="" class="icon">Unesite korisničko ime i lozinku sa DM servera</span>
</h3>
</div>
<span class="upperframe"><span></span></span>
<div class="roundframe"><br class="clear">

<form action="index.php?action=ucp" method="POST">
';if (isset($_SESSION['poruka_za_korisnika'])) {
echo $_SESSION['poruka_za_korisnika'];
$_SESSION['poruka_za_korisnika'] = '';
$poruka = '';
unset($_SESSION['poruka_za_korisnika']);
}
echo'
<dl>

<dt>Korisničko ime:</dt>
<dd><input name="pname" size="20" value="" class="input_text" type="text"></dd>
<dt>Lozinka:</dt>
<dd><input name="ppass" value="" size="20" class="input_password" type="password"></dd>
</dl>
<p><input value="Prijava" class="button_submit" type="submit"></p>
</div>
</form>
<span class="lowerframe"><span></span></span>
</div>';


radi savršeno