פורסם 2008 במרץ 317 שנים ucp.php: <?php require_once("includes/connection.php"); ?><?php require_once("includes/functions.php"); ?><?php include_once("includes/form_functions.php"); include_once("includes/check.php"); if (verify() <= 0) { $bad = "You are either banned or not logged in."; setcookie($_COOKIE("badlogin",$bad,time()+3600)); header ("Location: index.php?id=bad"); } else { switch($user) { case 1: echo "<a href=index.php?id=ucp&page=settings>User Settings<p>"; echo "<a href=index.php?id=ucp&page=info>Character Info<p>"; echo "<a href=index.php?id=ucp&page=property>Owned Property</a>"; echo "<a href=index.php?id=ucp&page=Bank>Bank</a>"; echo "<a href=index.php?id=logout>Logout</a>"; break; case 2: echo "<a href=index.php?id=ucp&page=settings>User Settings<p>"; echo "<a href=index.php?id=ucp&page=info>Character Info<p>"; echo "<a href=index.php?id=ucp&page=property>Owned Property</a>"; echo "<a href=index.php?id=ucp&page=Bank>Bank</a>"; echo "<a href=index.php?id=logout>Logout</a>"; echo "<a href=index.php?id=ucp?page=paa>Personal Administrative actions</a>"; echo "<a href=index.php?id=ucp?page=special>Special Settings</a>"; break; case 2: echo "<a href=index.php?id=ucp&page=settings>User Settings<p>"; echo "<a href=index.php?id=ucp&page=info>Character Info<p>"; echo "<a href=index.php?id=ucp&page=property>Owned Property</a>"; echo "<a href=index.php?id=ucp&page=Bank>Bank</a>"; echo "<a href=index.php?id=logout>Logout</a>"; echo "<a href=index.php?id=ucp?page=paa>Personal Administrative actions</a>"; echo "<a href=index.php?id=ucp?page=special>Special Settings</a>"; echo "<a href=index.php?id=ucp?page=teambans>Team Management</a>"; break; case 3: echo "<a href=index.php?id=ucp&page=settings>User Settings<p>"; echo "<a href=index.php?id=ucp&page=info>Character Info<p>"; echo "<a href=index.php?id=ucp&page=property>Owned Property</a>"; echo "<a href=index.php?id=ucp&page=Bank>Bank</a>"; echo "<a href=index.php?id=logout>Logout</a>"; echo "<a href=index.php?id=ucp?page=paa>Personal Administrative actions</a>"; echo "<a href=index.php?id=ucp?page=special>Special Settings</a>"; echo "<a href=index.php?id=ucp?page=teambans>Team Management</a>"; break;}}?> check.php: <?php function verify(){require_once("includes/connection.php");require_once("includes/functions.php");include_once("includes/form_functions.php");//Checks if there is a login cookieif(isset($_COOKIE['mtarp']) && isset($_COOKIE['mtarps'])) {//if there is, it logs you in and directes you to the members page$user = 0;$username = $_COOKIE['mtarp'];$pass = $_COOKIE['mtarps'];$check = mysql_query("SELECT * FROM players WHERE username = '$username'")or die(mysql_error());while($info = mysql_fetch_array( $check )){if ($pass != $info['password']) {$user = 0;return 0;die();} else {$user = $info['user'];return $user;}}} }$test = verify(); ?> Fatal error: Function name must be a string in E:\WAMP\www\MATA\ucp.php on line 8 אני אובד עצות, השגיאה כנראה ממש ממש פשוטה וקלה לתיקון אבל אני לא יכול למצוא את הבעיה.
פורסם 2008 במרץ 317 שנים נראה לי שהטעות היא ב $_COOKIE. זה משתנה ולא פונקציה, ככה שאם אתה רוצה את הערך של מפתח מסוים זה$_COOKIE["name"]
פורסם 2008 במרץ 317 שנים מחבר עריכה: אה, דווקא נראלי שבאמת טעיתי שם אני אבדוק ואערוך. עריכה: :yelclap:
פורסם 2008 במרץ 317 שנים זה גם נראה לי קצת דבילי לעשות כל פעם בדיקה מול המסד נתונים וגם לשמור את השם משתמש / סיסמא ב COOKIE, עדיף להשתמש ב php sessions אם אין מניעה. (וגם זה לא יפה לשמור את הסיסמאות ב plaintext )
ארכיון
דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.