Jump to content
php.lv forumi

paliidziet


drinkits

Recommended Posts

nu luudzu paskaidrojiet kas pakluudu, petiiju mekleeju visu ko par register_globals bet nesapratu kas vainas

 

Warning: session_register() [function.session-register]: Cannot send session cache limiter - headers already sent (output started at D:\WebServer\xampp\htdocs\inc\config.php:18) in D:\WebServer\xampp\htdocs\admin\checklogin.php on line 16

Warning: Cannot modify header information - headers already sent by (output started at D:\WebServer\xampp\htdocs\inc\config.php:18) in D:\WebServer\xampp\htdocs\admin\checklogin.php on line 18

 

 

un php shaads

 

<?php
include($_SERVER['DOCUMENT_ROOT'] . '/inc/config.php');
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];

$sql="SELECT * FROM members WHERE username='$myusername' and password='$mypassword'";
$result=mysql_query($sql);

$count=mysql_num_rows($result);
if($count==1){
session_register("myusername");
session_register("mypassword");
header("location:index.php");
}
else {
echo "Diemzeel nepareizi";
}
?>

Link to comment
Share on other sites

Tas vispār nav saistībā ar register_globals.

 

Pirms session_register nedrīkst būt outputs, bet tev config.php faila 18 rindiņa kautko outputo (nosūta browserim). Tas arī viss.

 

PS. Un vispār iesaku tev lietot $_SESSION masīvu. Kā arī izsaukt session_start() skripta sākumā (Visu skriptu sākumā, kurā gribēsi piekļūt $_SESSION datiem).

Edited by andrisp
Link to comment
Share on other sites

Tas vispār nav saistībā ar register_globals.

 

Pirms session_register nedrīkst būt outputs, bet tev config.php faila 18 rindiņa kautko outputo (nosūta browserim). Tas arī viss.

 

PS. Un vispār iesaku tev lietot $_SESSION masīvu. Kā arī izsaukt session_start() skripta sākumā (Visu skriptu sākumā, kurā gribēsi piekļūt $_SESSION datiem).

paldies tef, nezinaaju ka tukshumus ar nosuuta browserim =] vnk man bija 4 reizes enter uzsists peec ?>

 

un veelviens jautaajums, veelejos lai php paarbauda apmekleetaaja IP un ja sakriit ar manis noradiito tad tad dara to ja ne tad dara to bet kaukka nesanaak

 

<?php 

$ip = $_SERVER['REMOTE_ADDR'];

if ($ip = "87.110.146.69")
{
// Include our header:
	include($_SERVER['DOCUMENT_ROOT'] . '/inc/header.php');

// Define our array of allowed $_GET values
	$pass = array('sakums','rip','bildes','forums', 'faili', 'serveri', 'speles', 'linki', 'ziedo');

// If the page is allowed, include it:
	if (in_array($_GET['rip'], $pass)) {
		include ($_SERVER['DOCUMENT_ROOT'] . '/sadalas/' . $_GET['rip'] . '.php'); 
	} 

// If there is no $_GET['id'] defined, then serve the homepage:
	elseif (!isset($_GET['rip'])) {
		include ($_SERVER['DOCUMENT_ROOT'] . '/sadalas/sakums.php'); 
	}

// If the page is not allowed, send them to an error page:
	else {
				include ($_SERVER['DOCUMENT_ROOT'] . 'error.php');
	}

include($_SERVER['DOCUMENT_ROOT'] . '/inc/footer.php');
echo $ip;
}
else 
{
header("location: :forum/index.php");	
}
?>

Link to comment
Share on other sites

×
×
  • Create New...