ms313
September 7th, 2014, 11:17
سلام دوستان
دوستان یه مشکل کاملا گیجم کرده اینم اینکه این کد تو لوکال درست اجرا میشه تو هاست نه
login.php
<?php
include("./includes/config1.php");
$db->open();
session_start();
$uname=$_POST['uname'];
$pass=$_POST["pass"];
$check_security=$db->query("select * from users where userid='$uname' and password='$pass'");
if ($check_security=$db->fetchRow($check_security)){
$_SESSION['test_user']=$uname;
header("Refresh:0;index.php");
}else{
echo('<script>alert("نام کاربری یا گذرواژه شما اشتباه هست.");</script>');
header("Refresh:0;index.php");
}
?>
index.php
<?php
################################################## #####################
/************************************************** *************************
* ===========================
* COPYRIGHT
*
* License: GNU General Public License V.3
* Author: Mehrdad Abdollahyan
* Copyright (c) 2014, Mehrdad Abdollahyan
* Contatct : mrmehrdad@rocketmail.com
*
************************************************** *************************/
################################################## ####################
include('./includes/config1.php');
include('./language/farsi.php');
include('./includes/index_fun.php');
include('./includes/exam_section.php');
//include('./includes/rss.php');
ini_set("display_errors", "1");
session_start();
$home_message="";
date_default_timezone_set("Asia/Tehran");
$d1 = explode(":",date('Y:m:d'));
$t1 = explode(":",date('H:i:s'));
if(!$db->open()){
echo(die($db->error()));
}
$all_or_default=$db->query("select * from settings where id = '1'");
if (!$all_or_default){
include('main.php');
die();
}
if(isset($_SESSION['test_user']) or isset($_SESSION['teacher_set'])){
if(isset($_SESSION['teacher_set'])){
$table = 'teachers';
$uname = $_SESSION['teacher_set'];
$flag = './teacher/index.php';
}else{
$table = 'users';
$uname = $_SESSION['testa_user'] ;
$flag = './user/index.php';
}
if(!$db->query("select * from $table where userid='$uname'")){
echo($db->error());
}
if($result = $db->fetchObject()){
//$avatar = $result->avatar;
$name = $result->FName;
$lname = $result->LName;
$persenl = $result->persenl;
$flag = './user/index.php';
}else{
die($db->error());
}
usermeno($name,$lname,$persenl,$flag);
}else{
meno();
login();
register();
$result=$db->query("select * setting where id='1'");
$db->fetchArray($result);
if(isset($check_all_tests['home_message'])){
home_page_message($check_all_tests['home_message']);
}else{
echo('
<p align="center">شما می توانید متنی را در این قسمت از تظیمات اضافه کنید .</p>
');
}
section_2();
//section_1();
echo ('
<section style="background: none repeat scroll 0 0 #f7f7f7;">
<div>
<div id="fixed" class="fix1">
<p style="font:32px BNazanin;text-align:center;padding-top:2px;">ما و آزمون هایمان را دنبال کنید!</p>
</div>
<div style="margin:0 auto;width:50%;direction:rtl;padding-right:5%;">
');
exam_section();
none_exam_section($d1,$t1);
echo('</div></div></div><div style="clear:both;width:100%;height:150px;"></div></section>');
}
function none_exam_section($d1,$t1){
include('./includes/config1.php');
$db->open();
$result=$db->query("select * from tests where section_id='0' AND active = '1'");
if($db->numRows()>0){
while($row=$db->fetchRow($result)){
if(empty($row[18])||empty($row[17])||empty($row[16])){
echo('
<li>
<a style="background-color:#f49d20;" href="index.php?test_id=' . $row[0] . '">' . $row[1].'</a>
</li>
');
}else{
$t2 = explode(":",$row[18]);
$t3 = explode(":",$row[17]);
$d2 = explode("-",$row[16]);
if(my_fun($d1,$d2,$t1,$t2,$t3)){
echo('
<a style="background-color:#f49d20;" href="index.php?test_id=' . $row[0] . '">' . $row[1].'</a>
');
}
}
}
}
}
function my_fun($d1,$d2,$t1,$t2,$t3){
if((($d1[0]==$d2[0])&&($d1[1]==$d2[1])&&($d1[2]==$d2[2]))){
if($t1[0]>$t2[0]){//// اگر تایم سیستم از تایم شروع امتحان بزرگتر بود که درسته و به بررسی به مابین انتها می رسیم
if($t1[0]<$t3[0]){
return true ;
}if($t1[0]==$t3[0]){
if($t1[1]<$t3[1]){
return true ;
}if($t1[1]==$t3[1]){
if($t1[2]<$t3[2]){
return true;
}else{return false;}
}else{return false;}
}else{return false;}
}if($t1[0]==$t2[0]){
if($t1[1]>$t2[1]){
if($t1[0]<$t3[0]){
return true ;
}if($t1[0]==$t3[0]){
if($t1[1]<$t3[1]){
return true ;
}if($t1[1]==$t3[1]){
if($t1[2]<$t3[2]){
return true;
}else{return false;}
}else{return false;}
}else{return false;}
}elseif($t1[1]==$t2[1]){
if($t1[2]>$t2[2]){
if($t1[0]<$t3[0]){
return true ;
}if($t1[0]==$t3[0]){
if($t1[1]<$t3[1]){
return true ;
}if($t1[1]==$t3[1]){
if($t1[2]<$t3[2]){
return true;
}else{return false;}
}else{return false;}
}else{return false;}
}else{return false;}
}elseif($t1[1]<$t2[1]){return false;}
}elseif($t1[0]<$t2[0]){return false;}
}else{
return false;
}
}
تو اررو لاگ این ایراد رو می گیره
function.session-start</a>]: Cannot send session cache limiter - headers already sent (output started at /home/examonli/public_html/index.php:141) in /home/examonli/public_html/index.php on line 161
دوستان یه مشکل کاملا گیجم کرده اینم اینکه این کد تو لوکال درست اجرا میشه تو هاست نه
login.php
<?php
include("./includes/config1.php");
$db->open();
session_start();
$uname=$_POST['uname'];
$pass=$_POST["pass"];
$check_security=$db->query("select * from users where userid='$uname' and password='$pass'");
if ($check_security=$db->fetchRow($check_security)){
$_SESSION['test_user']=$uname;
header("Refresh:0;index.php");
}else{
echo('<script>alert("نام کاربری یا گذرواژه شما اشتباه هست.");</script>');
header("Refresh:0;index.php");
}
?>
index.php
<?php
################################################## #####################
/************************************************** *************************
* ===========================
* COPYRIGHT
*
* License: GNU General Public License V.3
* Author: Mehrdad Abdollahyan
* Copyright (c) 2014, Mehrdad Abdollahyan
* Contatct : mrmehrdad@rocketmail.com
*
************************************************** *************************/
################################################## ####################
include('./includes/config1.php');
include('./language/farsi.php');
include('./includes/index_fun.php');
include('./includes/exam_section.php');
//include('./includes/rss.php');
ini_set("display_errors", "1");
session_start();
$home_message="";
date_default_timezone_set("Asia/Tehran");
$d1 = explode(":",date('Y:m:d'));
$t1 = explode(":",date('H:i:s'));
if(!$db->open()){
echo(die($db->error()));
}
$all_or_default=$db->query("select * from settings where id = '1'");
if (!$all_or_default){
include('main.php');
die();
}
if(isset($_SESSION['test_user']) or isset($_SESSION['teacher_set'])){
if(isset($_SESSION['teacher_set'])){
$table = 'teachers';
$uname = $_SESSION['teacher_set'];
$flag = './teacher/index.php';
}else{
$table = 'users';
$uname = $_SESSION['testa_user'] ;
$flag = './user/index.php';
}
if(!$db->query("select * from $table where userid='$uname'")){
echo($db->error());
}
if($result = $db->fetchObject()){
//$avatar = $result->avatar;
$name = $result->FName;
$lname = $result->LName;
$persenl = $result->persenl;
$flag = './user/index.php';
}else{
die($db->error());
}
usermeno($name,$lname,$persenl,$flag);
}else{
meno();
login();
register();
$result=$db->query("select * setting where id='1'");
$db->fetchArray($result);
if(isset($check_all_tests['home_message'])){
home_page_message($check_all_tests['home_message']);
}else{
echo('
<p align="center">شما می توانید متنی را در این قسمت از تظیمات اضافه کنید .</p>
');
}
section_2();
//section_1();
echo ('
<section style="background: none repeat scroll 0 0 #f7f7f7;">
<div>
<div id="fixed" class="fix1">
<p style="font:32px BNazanin;text-align:center;padding-top:2px;">ما و آزمون هایمان را دنبال کنید!</p>
</div>
<div style="margin:0 auto;width:50%;direction:rtl;padding-right:5%;">
');
exam_section();
none_exam_section($d1,$t1);
echo('</div></div></div><div style="clear:both;width:100%;height:150px;"></div></section>');
}
function none_exam_section($d1,$t1){
include('./includes/config1.php');
$db->open();
$result=$db->query("select * from tests where section_id='0' AND active = '1'");
if($db->numRows()>0){
while($row=$db->fetchRow($result)){
if(empty($row[18])||empty($row[17])||empty($row[16])){
echo('
<li>
<a style="background-color:#f49d20;" href="index.php?test_id=' . $row[0] . '">' . $row[1].'</a>
</li>
');
}else{
$t2 = explode(":",$row[18]);
$t3 = explode(":",$row[17]);
$d2 = explode("-",$row[16]);
if(my_fun($d1,$d2,$t1,$t2,$t3)){
echo('
<a style="background-color:#f49d20;" href="index.php?test_id=' . $row[0] . '">' . $row[1].'</a>
');
}
}
}
}
}
function my_fun($d1,$d2,$t1,$t2,$t3){
if((($d1[0]==$d2[0])&&($d1[1]==$d2[1])&&($d1[2]==$d2[2]))){
if($t1[0]>$t2[0]){//// اگر تایم سیستم از تایم شروع امتحان بزرگتر بود که درسته و به بررسی به مابین انتها می رسیم
if($t1[0]<$t3[0]){
return true ;
}if($t1[0]==$t3[0]){
if($t1[1]<$t3[1]){
return true ;
}if($t1[1]==$t3[1]){
if($t1[2]<$t3[2]){
return true;
}else{return false;}
}else{return false;}
}else{return false;}
}if($t1[0]==$t2[0]){
if($t1[1]>$t2[1]){
if($t1[0]<$t3[0]){
return true ;
}if($t1[0]==$t3[0]){
if($t1[1]<$t3[1]){
return true ;
}if($t1[1]==$t3[1]){
if($t1[2]<$t3[2]){
return true;
}else{return false;}
}else{return false;}
}else{return false;}
}elseif($t1[1]==$t2[1]){
if($t1[2]>$t2[2]){
if($t1[0]<$t3[0]){
return true ;
}if($t1[0]==$t3[0]){
if($t1[1]<$t3[1]){
return true ;
}if($t1[1]==$t3[1]){
if($t1[2]<$t3[2]){
return true;
}else{return false;}
}else{return false;}
}else{return false;}
}else{return false;}
}elseif($t1[1]<$t2[1]){return false;}
}elseif($t1[0]<$t2[0]){return false;}
}else{
return false;
}
}
تو اررو لاگ این ایراد رو می گیره
function.session-start</a>]: Cannot send session cache limiter - headers already sent (output started at /home/examonli/public_html/index.php:141) in /home/examonli/public_html/index.php on line 161