Error in php script

Status
Niet open voor verdere reacties.

gast0450

Gebruiker
Lid geworden
8 jul 2006
Berichten
188
Hoi allemaal,

Ik heb hier een script wat ongeveer 2 jaar geleden is geschreven, ik wil deze nu gebruiken op mijn lokale php server maar ik blijf een foutmelding krijgen.

Deprecated: Function ereg() is deprecated in C:\Program Files\EasyPHP5.3.0\www\acm\setup.php on line 122

Dit is het stukje code waar de fout in zit

PHP:
if (!ereg("index.php$",$_SERVER['PHP_SELF'])) {
	if (!isset($_SESSION['acm_isLogin']) or !$_SESSION['acm_isLogin']) {
		header("Location: index.php");
		exit;
	}
}
Weet iemand wat ik daar moet aanpassen om het werkend te krijgen?

Alvast bedankt
 
Laatst bewerkt door een moderator:
Ereg vervangen door preg_match.

PHP:
if (!preg_match("index.php$",$_SERVER['PHP_SELF'])) {
if (!isset($_SESSION['acm_isLogin']) or !$_SESSION['acm_isLogin']) {
header("Location: index.php");
exit;
}
}

De ereg functie wordt met de volgende versie van PHP afgeschaft en zou dus vervangen moeten worden :)
 
Dat heeft inderdaad de foutmelding opgelost.

Jammer genoeg werkt hij alleen nog niet.

Dit is het volledige script;

PHP:
<?php
// ݒ肱‚±‚©‚ç

//ƒRƒƒ“ƒg‚ðŠO‚·‚ƃ[ƒJƒ‹‚Å‚µ‚©ƒAƒJƒEƒ“ƒgƒ}ƒl[ƒWƒƒ‚ðŽg—p‚Å‚«‚È‚*‚È‚è‚Ü‚·B
//ƒf[ƒ^ƒx[ƒX‚̃ƒ“ƒeƒiƒ“ƒX‚âƒeƒXƒgŽž‚ɂ̓Rƒƒ“ƒg‚ðŠO‚µ‚ĉº‚³‚¢B
//if (!ereg("^192.168.",$_SERVER['REMOTE_ADDR'])) {die("’²®’†");}

//AM3Žž`AM4Žž‚̓AƒJƒEƒ“ƒgƒ}ƒl[ƒWƒƒ[‚ɃAƒNƒZƒXo—ˆ‚È‚*‚È‚é—á
//if (date("H:i:s") >= "03:00:00" and date("H:i:s") <= "04:00:00") {die("’²®’†");}

// ƒf[ƒ^ƒx[ƒXÚ‘±Ý’è
$hostname_l1jdb = "81.82.78.35";
$database_l1jdb = "l1jdb";
$username_l1jdb = "xxxx";
$password_l1jdb = "xxxxx";

//TelnetÝ’è(server.properties‚ÅTelnet‚ð—LŒø‚É‚µ‚ĉº‚³‚¢B)
//Telnetƒc[ƒ‹—LŒø/–³Œø
$telnet = true;
//Telnetƒ|[ƒg
$telnet_port = 23;
// ƒƒOƒCƒ“o—ˆ‚éaccess_level
// 0‚Åaccounts.access_level‚ª0‚̈ê”ʃ†[ƒU[‚àƒƒOƒCƒ“‰Â”\
// ˆê”ʃ†[ƒU[‚©‚ç‚̃AƒNƒZƒX‚ª‘å—ʂɂ*‚邯“®ì‚ªd‚½‚*‚Ȃ邩‚à‚µ‚ê‚Ü‚¹‚ñB
$login_access_level = 200;
// ƒ`ƒƒƒbƒgŠÄŽ‹‚ð—LŒø‚É‚·‚é
$chat_watch = true;
// ƒ`ƒƒƒbƒgŠÄŽ‹—LŒøŽžAƒ`ƒƒƒbƒgƒƒO‚ðXV‚·‚éŠÔŠui•bj
$renewal_time = 2;
// •\ަ‚·‚éƒ`ƒƒƒbƒgƒƒO‚ÌŽí—Þ
// []“à‚Íaccounts.access_level
//  ()“à‚͈ȉºŽQÆ
// 0:’Êíƒ`ƒƒƒbƒg 1:Whisper 2:‹©‚Ñ 3:‘S‘̃`ƒƒƒbƒg 4:ŒŒ–¿ƒ`ƒƒƒbƒg
// 11:ƒp[ƒeƒBƒ`ƒƒƒbƒg 13:˜A‡ƒ`ƒƒƒbƒg 14:ƒ`ƒƒƒbƒgƒp[ƒeƒB
$type[0] = array(3);
$type[200] = array(0,1,2,3,4,11,13,14);


//HPŽsêÝ’è
//w“üƒy[ƒW‚Å1ƒy[ƒW‚*‚½‚è‚É•\ަ‚·‚éƒAƒCƒeƒ€”
$page_item_count = 50;
//HPŽsêƒAƒiƒEƒ“ƒXÝ’è(Config‚ÅTelnet‚ð—LŒø‚É‚µ‚ĉº‚³‚¢B)
//ƒAƒCƒeƒ€‚ª”„‚è‚Éo‚³‚ê‚½Žž‚̃AƒiƒEƒ“ƒX
$market_announce = true;
//Žw’肵‚½‹àŠzˆÈã‚ðƒAƒiƒEƒ“ƒX‚·‚éB(ƒfƒtƒHƒ‹ƒg0A)
$market_announce_price = 0;
//ƒAƒiƒEƒ“ƒX‚·‚鎞‚Ì–¼‘O
//GM‚̃AƒJƒEƒ“ƒg‚É‚±‚Ì–¼‘O‚̃Lƒƒƒ‰ƒNƒ^[‚ð쬂µ‚ĉº‚³‚¢BGMŒ*ŒÀ‚Í•K—v‚È‚µB
$market_announce_name = "HPŽsê";


//ƒz[ƒ€ƒy[ƒWƒ^ƒCƒgƒ‹
$hp_title = "Account Manager for L1J";


//ƒLƒƒƒbƒVƒ…‚·‚éŠÔŠu(•b)
$cache_time = 60;


//index.php‚©‚çƒ^ƒCƒgƒ‹‰æ‘œ‚Ö‚Ì‘Š‘ÎƒpƒX
//“ü—Í‚µ‚È‚¢ê‡‚̓z[ƒ€ƒy[ƒWƒ^ƒCƒgƒ‹‚ªƒeƒLƒXƒg‚Å•\ަ‚³‚ê‚Ü‚·
$hp_title_image = "images/logo1.gif";


//ƒLƒƒƒ‰ƒNƒ^[ƒAƒCƒRƒ“i¬j‚ðŽg—p‚·‚鎞‚Ìindex.php‚©‚ç‰æ‘œ‚Ö‚Ì‘Š‘ÎƒpƒX
//http://soracafe.biz/ [sora-cafe*]‚³‚ñ‚̉摜‚ª‚¨Š©‚ß
$chagfx_small[0] = "images/characters_icon/small/01_prim.gif";		//ƒvƒŠƒ“ƒX
$chagfx_small[1] = "images/characters_icon/small/01_prif.gif";		//ƒvƒŠƒ“ƒZƒX
$chagfx_small[61] = "images/characters_icon/small/01_knim.gif";		//ƒiƒCƒg’j
$chagfx_small[48] = "images/characters_icon/small/01_knif.gif";		//ƒiƒCƒg—
$chagfx_small[138] = "images/characters_icon/small/01_elfm.gif";	//ƒGƒ‹ƒt’j
$chagfx_small[37] = "images/characters_icon/small/01_elff.gif";		//ƒGƒ‹ƒt—
$chagfx_small[734] = "images/characters_icon/small/01_wizm.gif";	//ƒEƒBƒU[ƒh’j
$chagfx_small[1186] = "images/characters_icon/small/01_wizf.gif";	//ƒEƒBƒU[ƒh—
$chagfx_small[2786] = "images/characters_icon/small/01_dem.gif";	//ƒ_[ƒNƒGƒ‹ƒt’j
$chagfx_small[2796] = "images/characters_icon/small/01_def.gif";	//ƒ_[ƒNƒGƒ‹ƒt—

//ƒLƒƒƒ‰ƒNƒ^[ƒAƒCƒRƒ“i‘åj‚ðŽg—p‚·‚鎞‚Ìindex.php‚©‚ç‰æ‘œ‚Ö‚Ì‘Š‘ÎƒpƒX
$chagfx_big[0] = "images/characters_icon/standing/pri_male.gif";			//ƒvƒŠƒ“ƒX
$chagfx_big[1] = "images/characters_icon/standing/pri_female.gif";			//ƒvƒŠƒ“ƒZƒX
$chagfx_big[61] = "images/characters_icon/standing/kni_male.gif";			//ƒiƒCƒg’j
$chagfx_big[48] = "images/characters_icon/standing/kni_female.gif";			//ƒiƒCƒg—
$chagfx_big[138] = "images/characters_icon/standing/elf_male.gif";		//ƒGƒ‹ƒt’j
$chagfx_big[37] = "images/characters_icon/standing/elf_female.gif";		//ƒGƒ‹ƒt—
$chagfx_big[734] = "images/characters_icon/standing/wiz_male.gif";		//ƒEƒBƒU[ƒh’j
$chagfx_big[1186] = "images/characters_icon/standing/wiz_female.gif";		//ƒEƒBƒU[ƒh—
$chagfx_big[2786] = "images/characters_icon/standing/de_male.gif";		//ƒ_[ƒNƒGƒ‹ƒt’j
$chagfx_big[2796] = "images/characters_icon/standing/de_female.gif";		//ƒ_[ƒNƒGƒ‹ƒt—


//ƒIƒ“ƒ‰ƒCƒ“󋵂̃y[ƒW‚Å•\ަ‚·‚éƒvƒŒƒCƒ„[‚Ì”
$online_prayer_limit = 100;


//ƒAƒCƒeƒ€‰æ‘œiinv_gfxj‚ª‚*‚éƒfƒBƒŒƒNƒgƒŠ‚̃pƒX
$inv_gfx_path = "inv_gfx/";


// ݒ肱‚±‚Ü‚Å

session_start();
if (isset($_SESSION['acm_lastaccess_time']) and $_SESSION['acm_lastaccess_time'] > (time() - 2)) {
	if (isset($_SESSION['acm_lastaccess_time_count'])) {
		$_SESSION['acm_lastaccess_time_count']++;
		if ($_SESSION['acm_lastaccess_time_count'] > 50) {
			die("ŽžŠÔ‚ð‹ó‚¯‚ăAƒNƒZƒX‚·‚é‚©ˆê“xƒuƒ‰ƒEƒU‚ðI—¹‚µ‚ĉº‚³‚¢B");
		}
	} else {
		$_SESSION['acm_lastaccess_time_count'] = 0;
	}
} else {
	$_SESSION['acm_lastaccess_time'] = time();
}

if ($l1jdb = @mysql_pconnect($hostname_l1jdb, $username_l1jdb, $password_l1jdb) or trigger_error(mysql_error(),E_USER_ERROR)) {
	mysql_query("SET NAMES sjis")or die("can not SET NAMES sjis");
	mysql_select_db($database_l1jdb, $l1jdb);
} else {
	die("ƒf[ƒ^ƒx[ƒX‚ÉÚ‘±o—ˆ‚Ü‚¹‚ñ‚Å‚µ‚½B<br />\nsetup.php‚ÌÝ’è‚ðŒ©’¼‚µ‚ĉº‚³‚¢B");
}

if (!preg_match("index.php$",$_SERVER['PHP_SELF'])) {
	if (!isset($_SESSION['acm_isLogin']) or !$_SESSION['acm_isLogin']) {
		header("Location: index.php");
		exit;
	}
}

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
?>

Misschien omdat het oorspronkelijk japans is?

Voordat ik de wijziging had gedaan had ik overigens wel een inlogscherm, die krijg ik nu niet meer.

Iemand een oplossing?
 
Laatst bewerkt door een moderator:
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan