Nart Posted July 13, 2015 Share Posted July 13, 2015 hey guys , first of all excuse me for my bad English i found online a realesed script of the game Travian by it is owner i uploaded it to my website and i am having 2 problems : 1- Error : Warning: Cannot modify header information - headers already sent by (output started at /home/traviansy/public_html/s00100/s1/index.php:19) in /home/traviansy/public_html/s00100/s1/app/boot.php on line 16Warning: Cannot modify header information - headers already sent by (output started at /home/traviansy/public_html/s00100/s1/index.php:19) in /home/traviansy/public_html/s00100/s1/app/boot.php on line 17 boot.php : <?php define( "ROOT_PATH", realpath( dirname( dirname( __FILE__ ) ) ).DIRECTORY_SEPARATOR ); define( "APP_PATH", ROOT_PATH."app".DIRECTORY_SEPARATOR ); define( "LIB_PATH", ROOT_PATH."lib".DIRECTORY_SEPARATOR ); define( "MODEL_PATH", APP_PATH."model".DIRECTORY_SEPARATOR ); define( "VIEW_PATH", APP_PATH."view".DIRECTORY_SEPARATOR ); @set_magic_quotes_runtime( FALSE ); if ( isset( $_SERVER['HTTP_ACCEPT_ENCODING'] ) && substr_count( $_SERVER['HTTP_ACCEPT_ENCODING'], "gzip" ) ) { ob_implicit_flush( 0 ); if ( @ob_start( array( "ob_gzhandler", 9 ) ) ) { header( "Content-Encoding: gzip" ); } } header( "Date: ".gmdate( "D, d M Y H:i:s" )." GMT" ); header( "Last-Modified: ".gmdate( "D, d M Y H:i:s" )." GMT" ); if (isset($_GET["showerr"])) error_reporting (E_ALL); require LIB_PATH.'incube.php'; require( APP_PATH."config.php" ); require( LIB_PATH."webservice.php" ); require( LIB_PATH."widget.php" ); require( LIB_PATH."webhelper.php" ); require( APP_PATH."metadata.php" ); require( MODEL_PATH."base.php" ); require( APP_PATH."components.php" ); require( APP_PATH."mywidgets.php" ); $cookie = ClientData::getinstance( ); $AppConfig["system"]["lang"] = "en";//$cookie->uiLang; define( "LANG_PATH", APP_PATH."lang".DIRECTORY_SEPARATOR.$AppConfig["system"]["lang"].DIRECTORY_SEPARATOR ); define( "LANG_UI_PATH", LANG_PATH."ui".DIRECTORY_SEPARATOR ); require( LANG_PATH."lang.php" ); $tempdata = explode( " ", microtime( ) ); $data1 = $tempdata[0]; $data2 = $tempdata[1]; $__scriptStart = ( double )$data1 + ( double )$data2; ?> 2- can't log in : when i press log in , the script wont redirect me from 'index.php' to 'village1.php' index.php : <?php require ("app/boot.php"); if (isset ($_POST["gdp"]) && isset ($_GET["img"])) { } class GPage extends DefaultPage { public function GPage () { parent::defaultpage (); $this->viewFile = "index.phtml"; $this->layoutViewFile = NULL; } public function load () { $DB = $GLOBALS["AppConfig"]["db"]; $err = ""; $win = ""; $link = mysql_connect ($DB["host"], $DB["user"], $DB["password"]); mysql_select_db ($DB["database"], $link); $this->link = $link; if ($_POST) { if (!isset ($_POST["namee"]) || trim ($_POST["namee"]) == "") $err .= ($err == "" ? "" : "\n") . "No username"; if (!isset ($_POST["pass"]) || trim ($_POST["pass"]) == "") $err .= ($err == "" ? "" : "\n") . "No password"; //if (!isset ($_POST["serv"]) || trim ($_POST["serv"]) == "") // $err .= ($err == "" ? "" : "\n") . "No server"; if ($err == "") { $name = mysql_real_escape_string (strtolower (trim ($_POST["namee"]))); if($name == "Natar" || $name=="Natars" || $name == "natars") { echo "fk u nub"; exit; } switch ($name) { case "mh": case "m": $name = "multihunter"; break; } $pass = hash ("sha512", $_POST["pass"]); $q = mysql_query ("SELECT * FROM p_players WHERE name = '$name'", $link); $r = mysql_num_rows ($q); if ($r > 0) { if ($r < 2) { $r = mysql_fetch_assoc ($q); $agent = 0; if ($r["pwd"] != $pass) { $a = explode (",", $r['my_agent_players'].",1 Multihunter"); for ($i = 0; $i < sizeof ($a); $i++) { $b = explode (" ", $a[$i]); $b = $b[0]; $c = mysql_query ("SELECT * FROM p_players WHERE id = $b AND pwd = '$pass'", $link); if (mysql_num_rows ($c) == 1) { $agent = $b; break; } } } if ($r["pwd"] == $pass || ($agent > 0)) { if ($r["is_blocked"] == 0 || $agent == 1) { if ($r["is_active"] > 0 || $agent == 1) { $this->player = new Player (); $this->player->playerId = $r["id"]; if ($agent > 1) $this->player->isAgent = 1; else if ($agent == 1) $this->player->isSpy = TRUE; mysql_query ("UPDATE p_players SET last_ip='" . WebHelper::getclientip() . "', last_login_date=NOW() WHERE id=" . $r["id"], $link) or die ("NO"); $this->player->gameStatus = intval (mysql_result (mysql_query ("SELECT (game_over || game_transient_stopped) FROM g_settings"), 0, 0)); $this->player->save(); //$cookie->uname = $r["name"]; //$cookie->upwd = $pass; //$cookie->save(); $this->redirect("village1.php"); } else $err = "Account inactive <br/> <a href='reemail.php'>Click here if you dont recive email</a>"; } else $err = "Account banned <a href='banreport.php'>Report!</a><?php"; } else $err = "Wrong username or password"; } else $err = "Error 100 (contact administrator)"; } else $err = "Wrong username or password"; } } $this->err = $err; } } $p = new GPage(); $p->run (); ?> i wish you can help me thank you Quote Link to comment Share on other sites More sharing options...
ginerjm Posted July 13, 2015 Share Posted July 13, 2015 That's the problem when one chooses to download someone else's script. You have bugs in them and have to figure them out. As for forum help - we usually try to help those who help themselves by writing their own code. In your case you are taking the easy way out here. First you copy someone's code. Then you want someone else to fix it for you. Not my intent when reading the forums. I will say this tho - when you get the "header already sent" message it means you are trying to send a header to the client but that something has already been sent and a header must one of the first things to be sent. You have to find where you are sending some output - anything at all - and stop it from being sent first. It could be as simple as a blank line outside of php mode, or a space character that shouldn't be there. Have to go thru all the code to find it. Try exiting your script just prior to the line that is triggering the error message and then go view the source code sent to your client and see what it there. Quote Link to comment Share on other sites More sharing options...
Nart Posted July 13, 2015 Author Share Posted July 13, 2015 That's the problem when one chooses to download someone else's script. You have bugs in them and have to figure them out. As for forum help - we usually try to help those who help themselves by writing their own code. In your case you are taking the easy way out here. First you copy someone's code. Then you want someone else to fix it for you. Not my intent when reading the forums. I will say this tho - when you get the "header already sent" message it means you are trying to send a header to the client but that something has already been sent and a header must one of the first things to be sent. You have to find where you are sending some output - anything at all - and stop it from being sent first. It could be as simple as a blank line outside of php mode, or a space character that shouldn't be there. Have to go thru all the code to find it. Try exiting your script just prior to the line that is triggering the error message and then go view the source code sent to your client and see what it there. i am taking the easy way because i am not a programmer , anyways thank you for your help Quote Link to comment Share on other sites More sharing options...
scootstah Posted July 13, 2015 Share Posted July 13, 2015 http://forums.phpfreaks.com/topic/273121-readme-php-resources-faqs/?do=findComment&comment=1405508 Read this and see if it applies. Quote Link to comment Share on other sites More sharing options...
Nart Posted July 13, 2015 Author Share Posted July 13, 2015 http://forums.phpfreaks.com/topic/273121-readme-php-resources-faqs/?do=findComment&comment=1405508 Read this and see if it applies. thank you i think it is very helpful , but i know nothing about php ,i think i need and expert to do it for me Quote Link to comment Share on other sites More sharing options...
scootstah Posted July 13, 2015 Share Posted July 13, 2015 You can spend your money over here. Otherwise, we're not going to "do it for you". You have to put forth some effort on your part. Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted July 13, 2015 Share Posted July 13, 2015 Or why not contact the author of the script for support? 1 Quote Link to comment Share on other sites More sharing options...
Nart Posted July 13, 2015 Author Share Posted July 13, 2015 Or why not contact the author of the script for support? the author released the script because someone hacked his website and stole the script i don't think he will be glad if i asked for help Quote Link to comment Share on other sites More sharing options...
jcbones Posted July 13, 2015 Share Posted July 13, 2015 The problem is in index.php BEFORE the "require()" that includes boot.php. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.