עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Function name must be a string - PHP issue

Featured Replies

פורסם

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 cookie
if(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

אני אובד עצות, השגיאה כנראה ממש ממש פשוטה וקלה לתיקון אבל אני לא יכול למצוא את הבעיה. :kopfpatsch:

פורסם

נראה לי שהטעות היא ב $_COOKIE. זה משתנה ולא פונקציה, ככה שאם אתה רוצה את הערך של מפתח מסוים זה

$_COOKIE["name"]

פורסם
  • מחבר

עריכה: אה, דווקא נראלי שבאמת טעיתי שם :silly:

אני אבדוק ואערוך.

עריכה: :yelclap: :yelclap: :yelclap:

פורסם

זה גם נראה לי קצת דבילי לעשות כל פעם בדיקה מול המסד נתונים וגם לשמור את השם משתמש / סיסמא ב COOKIE, עדיף להשתמש ב php sessions אם אין מניעה. (וגם זה לא יפה לשמור את הסיסמאות ב plaintext )

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.