Jump to content
php.lv forumi

session_start


Solitary

Recommended Posts

Īsti neko nesaprotu no php :D

Man vajadzēja php lapai salikt ka rada garum zīmes , provēju vairak kārt!

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
<meta http-equiv="Content-Type" content="text/html; charset=windows-1257" />
mysql_query("SET NAMES UTF-8");

Izmēgināju visas kombinācijas nesanāca ,bet lapa strādāja login.php

tad nu es pie php lapas Save As nomainiju no ANSI uz UTF-8 un login.php norādiju

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
mysql_query("SET NAMES UTF-8");

Darbojās garumzīmes ,BET nestrādā session_start

A ja uzliek apakal ANSI tad session_start strādā , a garumzīmes nē , vai man vajaga savādāk panākt , ka iet garum zīmes?

Error rāda tādu

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/netarena/public_html/cup/test/login.php:1) in /home/netarena/public_html/cup/test/login.php on line 19

Warning: Cannot modify header information - headers already sent by (output started at /home/netarena/public_html/cup/test/login.php:1) in /home/netarena/public_html/cup/test/login.php on line 22

login.php

<?php
require_once('db.php');
include('functions.php');
include('settings.php');
mysql_query("SET NAMES UTF-8");
if (array_key_exists('_submit_check', $_POST))
{
	if ( $_POST['username'] != '' && $_POST['password'] != '' )
	{
		$query = mysql_query ( 'SELECT ID, Username, Active FROM users WHERE Username = "' . mysql_real_escape_string ( $_POST['username'] ) . '" AND Password = "' . mysql_real_escape_string ( md5($_POST['password'] ) ) . '"' );

		if ( mysql_num_rows($query) == 1 )
		{
			$row = mysql_fetch_assoc ( $query );
			if ( $row['Active'] == 1 )
			{
				session_start();
				$_SESSION['user_id'] = $row['ID'];
				$_SESSION['logged_in'] = TRUE;
				header ("Location: members.php");
			}
			elseif ( $row['Active'] == 0 ) {
				$error = 'Your membership was not activated. Please open the email that we sent and click on the activation link';
			}
			elseif ( $row['Active'] == 2 ) {
				$error = 'You are suspended!';
			}
		}
		else {
			$error = 'Login failed!';
		}
	}
	else {
		$error = 'Please use both your username and password to access your account';
	}
}
?>
<!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>
<title>-=MGL LAN CUP v2=-</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="css/styles.css" rel="stylesheet" type="text/css" />
</head>

<body>

<div id="log">
<?php if(isset($error)){ echo '			<p class="error">' . $error . '</p>' . "\n";}?>
</div>
<div id="container">

	<form class="form" action="<?=$_SERVER['PHP_SELF']?>" method="post">

		<input type="hidden" name="_submit_check" value="1"/>
					  <center><font face="Lucida Console" size="4"><b>-=MGL LAN CUP v2=-</b></font></center>
		<div style="margin-top:12px; margin-bottom:10px">
			<img src="images/username.gif" alt="username" border="0" />
			<input class="input" type="text" name="username" id="username" size="25" maxlength="40" value="" />
		</div>
		<div style="margin-bottom:6px">
			<img src="images/password.gif" alt="password" border="0" />
			<input class="input" type="password" name="password" id="password" size="25" maxlength="32" />
		</div>
		<input type="image" name="Login" value="Login"  class="submit-btn" src="images/btn.gif" alt="submit" title="submit" />
		<br class="clear" />
		<br class="clear" />
		Nēsi vēl biedrs? <a href="register.php"><font color="#FF99FF">Spied šeit</font></a> lai reģistrētos.
		<br class="clear" />
		Aizmirsi savu paroli? Pieprasi jaunu <a href="forgot_password.php"><font color="#FF99FF">šeit</font></a>.

	</form>

</div>

</body>

</html>

login: test

pass: test

Rāda error saglabas ar HTMLPad 2008 ar save as UFT-8 http://cup.netarena.lv/test

šeit viss tik bez garumzīmēm un ar ANSI http://cup.netarena.lv/

 

Lūdzu kāds palīdz un pastāsta kas man būtu jāmaina jālabo ,lai strādatu session_start un Garumzīmes!!

neizpratu citu foruma postus tapec uzrakstiju jaunu ...

Link to comment
Share on other sites

Grey_Wolf: uzskatu, ka arī programmētājiem būtu jāzin sava dzimtā valoda, tāpēc ierosināju kļūdainu tekstu "Nēsi" labot uz korektu "Neesi". lai pasūtītājam nav jāsarkst kodera vietā, kad šo sistēmu rādīs apmeklētājiem :>

Edited by usver
Link to comment
Share on other sites

×
×
  • Create New...