Проблем с код

lorddemon

Registered
Warning: Unexpected character in input: ' in /home/lorddemo/public_html/game/b.php on line 1

Parse error: syntax error, unexpected T_INCLUDE in /home/lorddemo/public_html/game/b.php on line 2


<?
session_start();
include 'inc/statistic.php';
if (!isset($_SESSION['id']))
{
header ("location: logout.php");
exit('incorrect');
}

include 'inc/config.system.php';
include 'inc/config.game.php';

$to = def($_GET['to']);
$ataker = b($_SESSION['id']);
$defer = b($to);

if (abs(lvl($ataker['exp'])-lvl($defer['exp']))>=10
OR $ataker['hp']<=25
OR $defer['hp']<=25
OR $ataker['race']==$defer['race']

това е от 1 ви до 20 ти ред :)
 
Я пробвай така

<?
session_start();
ob_start();
include 'inc/statistic.php';
if (!isset($_SESSION['id']))
{
header ("location: logout.php");
exit('incorrect');
}

include 'inc/config.system.php';
include 'inc/config.game.php';

$to = def($_GET['to']);
$ataker = b($_SESSION['id']);
$defer = b($to);

if (abs(lvl($ataker['exp'])-lvl($defer['exp']))>=10
OR $ataker['hp']<=25
OR $defer['hp']<=25
OR $ataker['race']==$defer['race']
 
Код:
<?php
session_start();
include('inc/statistic.php');
if (!isset($_SESSION['id']))
{
header('Location: logout.php');
exit('incorrect');
}

include('inc/config.system.php');
include('inc/config.game.php');

$to = def($_GET['to']);
$ataker = b($_SESSION['id']);
$defer = b($to);

if (abs(lvl($ataker['exp'])-lvl($defer['exp']))>=10
OR $ataker['hp']<=25
OR $defer['hp']<=25
OR $ataker['race']==$defer['race']
 
Warning: Unexpected character in input: ' in /home/lorddemo/public_html/game/b.php on line 1

Parse error: syntax error, unexpected T_STRING in /home/lorddemo/public_html/game/b.php on line 2

и с 2 та кода нестава

Код:
<?
session_start();
ob_start();
include 'inc/statistic.php';
if (!isset($_SESSION['id']))
{
header ("location: logout.php");
exit('incorrect');
}

include 'inc/config.system.php';
include 'inc/config.game.php';

$to = def($_GET['to']);
$ataker = b($_SESSION['id']);
$defer = b($to);

if (abs(lvl($ataker['exp'])-lvl($defer['exp']))>=10
OR $ataker['hp']<=25
OR $defer['hp']<=25
OR $ataker['race']==$defer['race']
		OR $defer['timer']>time())
	{
		Header("Location: z_main.php");
		exit;
	}

	$sila_a = ($ataker['pow']*$ataker['agi']*8+$ataker['stam']*$ataker['chr']+$ataker['s_double']*100+$ataker['s_chance_kick']*7+$ataker['s_dam']*10)*($ataker['hp']/$ataker['hp_max']);
	$sila_d = ($defer['def']*$defer['agi']*9+$defer['stam']*$defer['chr']+$defer['s_block']*100+$defer['s_chance_blow']*6+$defer['s_dam']*8)*($defer['hp']/$defer['hp_max']);

	$timer=time()+3600; //òàéìåğ çàùèòû íà ÷àñ
	if ($sila_a > $sila_d)
	{
		$gold=ceil(($defer['gold']*0.1)/$defer['chest']);
		$exp=rand(2,6);
		// ïîáåäèòåëü ataker
		
		if (lvl($ataker['exp'])< lvl($ataker['exp']+$exp)){$hp_up=25;}else{$hp_up=0;}

		count_query("UPDATE user
					 SET  gold=gold+'$gold', exp=exp+'$exp', stat_battle=stat_battle+1, stat_win=stat_win+1, stat_prey=stat_prey+3, hp_max=hp_max+'$hp_up',stat_gold_p=stat_gold_p+'$gold', stat_dam_p=stat_dam_p+ '".$defer['hp']."'
					 WHERE id = '".$ataker['id']."'");
		count_query("INSERT
					 INTO mail (to_id, msg)
					 VALUES ('".$ataker['id']."',
					 		 'Girdiğiniz savaştan ".$gold."<img src=img/res2.gif alt=altın align=absmiddle border=0> Altın, ".$exp." deneyim puanı kazandınız.')");
		// ïğîèãğàâøèé defer
		count_query("UPDATE user
					 SET  gold=gold-'$gold', stat_battle=stat_battle+1, stat_loss=stat_loss+1, stat_gold_m=stat_gold_m+'$gold', stat_dam_m=stat_dam_m+'".$defer['hp']."', hp_now = 1,timer='$timer'
					 WHERE id = '".$defer['id']."'");
		count_query("INSERT
					 INTO mail (to_id, msg)
					 VALUES ('".$defer['id']."',
					 		 'Savaş Raporu')");

		Header("Location: z_msgshow.php?box=in"); exit;
	}
	else
	{
		$gold=ceil(($ataker['gold']*0.1)/$ataker['chest']);
		$exp=rand(2,6);

		// ïîáåäèòåëü defer
		if (lvl($defer['exp'])< lvl($defer['exp']+$exp)){$hp_up=25;}else{$hp_up=0;}

		count_query("UPDATE user
					 SET  gold=gold+'$gold', exp=exp+'$exp', stat_battle=stat_battle+1, stat_win=stat_win+1, stat_prey=stat_prey+3, hp_max=hp_max+'$hp_up', stat_gold_p=stat_gold_p+'$gold', stat_dam_p=stat_dam_p+ '".$ataker['hp']."'
					 WHERE id = '".$defer['id']."'");
		count_query("INSERT
					 INTO mail (to_id, msg)
					 VALUES ('".$defer['id']."',
							 'Kazandınız.')");
		// ïğîèãğàâøèé ataker
		count_query("UPDATE user
					 SET  gold=gold-'$gold', stat_battle=stat_battle+1, stat_loss=stat_loss+1, stat_gold_m=stat_gold_m+'$gold', stat_dam_m=stat_dam_m+'".$ataker['hp']."', hp_now = 1, timer='$timer'
					 WHERE id = '".$ataker['id']."'");
		count_query("INSERT
					 INTO mail (to_id, msg)
					 VALUES ('".$ataker['id']."',
					 		 'Savaşı kaybettiniz')");
		
		Header("Location: z_msgshow.php?box=in"); exit;

	};
?>


<?include 'tpl/top.php';?>



ddsdsdsds

<?include 'tpl/footer.php';?>
 
<?php include('tpl/footer.php');?>

Както съм ти написал по-горе направи функциите така.
И таговете вместо <? така -> <?php
 
Код:
<?php
session_start();
include "inc/statistic.php";
if (!isset($_SESSION['id']))
{
header('Location: logout.php');
exit('incorrect');
}

include "inc/config.system.php";
include "inc/config.game.php";

$to = def($_GET['to']);
$ataker = b($_SESSION['id']);
$defer = b($to);

if (abs(lvl($ataker['exp'])-lvl($defer['exp']))>=10
OR $ataker['hp']<=25
OR $defer['hp']<=25
OR $ataker['race']==$defer['race']

Я пробвай така... Може би си запаметил файла като UTF-8 После си го отворил променял си го и си го запаметил като ANSII и за това може да ти прави проблеми.... Отвори го с Notepad и направо го запамети като ansii, понеже виждам, че има различни символи от Latin и Cyrillic
 
Сигурен ли си, че тоя код дето си дал е b.php ?

Пробвай в Include-тата да сложиш двойни кавички
 
PHPclown каза:
Сигурен ли си, че тоя код дето си дал е b.php ?

Пробвай в Include-тата да сложиш двойни кавички

Както виждаш аз съм му сложил на момчето ама проблема е явно от кодировката на файла.......
 
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/lorddemo/public_html/game/b.php:1) in /home/lorddemo/public_html/game/b.php on line 2

Warning: Cannot modify header information - headers already sent by (output started at /home/lorddemo/public_html/game/b.php:1) in /home/lorddemo/public_html/game/b.php on line 23
 
lorddemon каза:
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/lorddemo/public_html/game/b.php:1) in /home/lorddemo/public_html/game/b.php on line 2

Warning: Cannot modify header information - headers already sent by (output started at /home/lorddemo/public_html/game/b.php:1) in /home/lorddemo/public_html/game/b.php on line 23

В останалите файлове които Include имаш някъде пак сложени header и session_start();.... щом ги include няма нужда да слагаш отново тези работи.
 
100% работа


Код:
<?php
session_start();
ob_start();
include('inc/statistic.php');
if (!isset($_SESSION['id']))
{
echo "<META HTTP-EQUIV='Refresh' CONTENT='0;URL=logout.php'>";
exit('incorrect');
}

include('inc/config.system.php');
include('inc/config.game.php');

$to = def($_GET['to']);
$ataker = b($_SESSION['id']);
$defer = b($to);

if (abs(lvl($ataker['exp'])-lvl($defer['exp']))>=10
OR $ataker['hp']<=25
OR $defer['hp']<=25
OR $ataker['race']==$defer['race']
      OR $defer['timer']>time())
   {
   echo "<META HTTP-EQUIV='Refresh' CONTENT='0;URL=z_main.php'>";
      exit;
   }

   $sila_a = ($ataker['pow']*$ataker['agi']*8+$ataker['stam']*$ataker['chr']+$ataker['s_double']*100+$ataker['s_chance_kick']*7+$ataker['s_dam']*10)*($ataker['hp']/$ataker['hp_max']);
   $sila_d = ($defer['def']*$defer['agi']*9+$defer['stam']*$defer['chr']+$defer['s_block']*100+$defer['s_chance_blow']*6+$defer['s_dam']*8)*($defer['hp']/$defer['hp_max']);

   $timer=time()+3600; //oaeiag caueou ia ?an
   if ($sila_a > $sila_d)
   {
      $gold=ceil(($defer['gold']*0.1)/$defer['chest']);
      $exp=rand(2,6);
      // iiaaaeoaeu ataker
      
      if (lvl($ataker['exp'])< lvl($ataker['exp']+$exp)){$hp_up=25;}else{$hp_up=0;}

      count_query("UPDATE user
                SET  gold=gold+'$gold', exp=exp+'$exp', stat_battle=stat_battle+1, stat_win=stat_win+1, stat_prey=stat_prey+3, hp_max=hp_max+'$hp_up',stat_gold_p=stat_gold_p+'$gold', stat_dam_p=stat_dam_p+ '".$defer['hp']."'
                WHERE id = '".$ataker['id']."'");
      count_query("INSERT
                INTO mail (to_id, msg)
                VALUES ('".$ataker['id']."',
                       'Girdiginiz savastan ".$gold."<img src=img/res2.gif alt=alt?n align=absmiddle border=0> Alt?n, ".$exp." deneyim puan? kazand?n?z.')");
      // igieagaaoee defer
      count_query("UPDATE user
                SET  gold=gold-'$gold', stat_battle=stat_battle+1, stat_loss=stat_loss+1, stat_gold_m=stat_gold_m+'$gold', stat_dam_m=stat_dam_m+'".$defer['hp']."', hp_now = 1,timer='$timer'
                WHERE id = '".$defer['id']."'");
      count_query("INSERT
                INTO mail (to_id, msg)
                VALUES ('".$defer['id']."',
                       'Savas Raporu')");
echo "<META HTTP-EQUIV='Refresh' CONTENT='0;URL=z_msgshow.php?box=in'>";
   }
   else
   {
      $gold=ceil(($ataker['gold']*0.1)/$ataker['chest']);
      $exp=rand(2,6);

      // iiaaaeoaeu defer
      if (lvl($defer['exp'])< lvl($defer['exp']+$exp)){$hp_up=25;}else{$hp_up=0;}

      count_query("UPDATE user
                SET  gold=gold+'$gold', exp=exp+'$exp', stat_battle=stat_battle+1, stat_win=stat_win+1, stat_prey=stat_prey+3, hp_max=hp_max+'$hp_up', stat_gold_p=stat_gold_p+'$gold', stat_dam_p=stat_dam_p+ '".$ataker['hp']."'
                WHERE id = '".$defer['id']."'");
      count_query("INSERT
                INTO mail (to_id, msg)
                VALUES ('".$defer['id']."',
                      'Kazand?n?z.')");
      // igieagaaoee ataker
      count_query("UPDATE user
                SET  gold=gold-'$gold', stat_battle=stat_battle+1, stat_loss=stat_loss+1, stat_gold_m=stat_gold_m+'$gold', stat_dam_m=stat_dam_m+'".$ataker['hp']."', hp_now = 1, timer='$timer'
                WHERE id = '".$ataker['id']."'");
      count_query("INSERT
                INTO mail (to_id, msg)
                VALUES ('".$ataker['id']."',
                       'Savas? kaybettiniz')");
      echo "<META HTTP-EQUIV='Refresh' CONTENT='0;URL=z_msgshow.php?box=in'>";

   };
?>


<?php include('tpl/top.php');?>



ddsdsdsds

<?php include('tpl/footer.php');?>
 

Back
Горе