Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I am trying to use this file manager called "Php Win2K File Manager"
But I am receiving these errors below
Deprecated: Call-time pass-by-reference has been deprecated in C:\xampp\htdocs\test\explorer.php on line 166
Deprecated: Call-time pass-by-reference has been deprecated in C:\xampp\htdocs\test\explorer.php on line 214
Warning: opendir(c:/inetpub/wwwroot/,c:/inetpub/wwwroot/) [function.opendir]: The system cannot find the path specified. (code: 3) in C:\xampp\htdocs\test\explorer.php on line 91
Warning: opendir(c:/inetpub/wwwroot/) [function.opendir]: failed to open dir: No such file or directory in C:\xampp\htdocs\test\explorer.php on line 91
Why is this? Is it because Im running this on a Linux Server instead of Win2K?
My page
Call-time pass-by-reference means that a variable is being passed into a function using the & operator in front of it. e.g. (someFunction(&$var);).
PHP 5.4 deprecated call-time pass-by-reference which means you cannot pass a variable by reference in the function call, the correct way is to define the function so the variable is always passed by reference. The function definition for the above call would look like:
function someFunction(&$iAmByReference) {
$iAmByReference = 42;
}
When you call it, you don't need to precede the variable with the &, the call just looks like:
$x = 32;
someFunction($x);
echo $x; // 42
You will have to modify the code so that the function definitions declare the variable as a reference variable, and remove the & from any function calls.
You say you are running on Linux, but given the PHP error messages it appears you are still on Windows. PHP says your script is C:\xampp\htdocs\test\explorer.php which is a Windows path.
Most likely $_GET['dir'] is incorrect, or the script is determining paths wrong. Not sure what's going on there, I'd have to see how you were accessing the script. In the first case, it looks like its trying to open a path that is actually 2 paths separated by commas.
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
So, on my website I'm getting this error:
Fatal error: Uncaught Error: Call to undefined function set_magic_quotes_runtime() in /homepages/4/d661770438/htdocs/awptical/initdata.php:382 Stack trace: #0 /homepages/4/d661770438/htdocs/awptical/index.php(21): require_once() #1 {main} thrown in /homepages/4/d661770438/htdocs/awptical/initdata.php on line 382
Does anybody know what this means?
The function no longer exists in PHP 7, nor the setting it works with, so you will need to remove its usages. You will need to save the current state of your code and try to remove all the instances of this function call and see whether the site is working and if so, whether it is working as you expect it to work. Alternatively, you can implement a dummy version of the function and make it available everywhere:
if (!function_exists('set_magic_quotes_runtime')) {
function set_magic_quotes_runtime($new_setting) {
return true;
}
}
You are using PHP version 7.x.x, at which set_magic_quotes_runtime() was removed.
This function was DEPRECATED in PHP 5.3.0, and REMOVED as of PHP 7.0.0.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
Catchable fatal error: Argument 3 passed to Account::updateUser() must
be an instance of , string given, called in
/Applications/XAMPP/xamppfiles/htdocs/myPage/beta/Includes/includes.php
on line 27 and defined in
/Applications/XAMPP/xamppfiles/htdocs/myPage/beta/classes/Account.php
on line 214
Line 27:
$Account->updateUser($_SESSION["username"], $_POST["password_check"], $_POST["pw1"], $_POST["pw2"]);
Line 214:
public function updateUser($session, $password_check, $pw, $pw2){
How may I fix this? I've tried to rewrite the code multiple times, and tried to change everything on line 214 and below. Also tried to change some of line 27, cannot find the problem and have googled for a long time.
I think there is an invisible character (something like an unbreakable space, or some other invisible utf8 char) in your function declaration and php think it's type hint. You could delete the line and rewrite it. I thnik the probleme is here because must be an instance of , means php want a variable of type "".
Delete and rewrite the function declaration (no copy/paste)
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
My script is returning the following error...
Fatal error: Cannot redeclare connecttodatabase() (previously declared in /var/www/api/connecttodatabase.php:4) in /var/www/api/connecttodatabase.php on line 6
And the following is the connecttodatabase.php file...
<?php
function connecttodatabase()
{
$con = #mysqli_connect("localhost", "name", "password", "database");
return $con;
}
?>
I don't really understand this error because line 6 is just the closed curly bracket (})
I think the error means that it thinks I declared the function connecttodatabase() in to different spots but clearly I didn't.
As others have said in the comments, this is most likely because you have included connecttodatabase.php twice in your code, and you are certainly defining the function twice. Don't get hung up why it's line 6; line 2 would be more helpful, but line 6 is where the function definition ends, and so arguably is when the function is defined. You could have a "one a day" whole year calendar on the idiosyncrasies of PHP and have enough left over for a sequel. As others have also hinted, some basic debugging would confirm whether you are including the file more than once and also from where.
Make sure that your code uses include_once or require_once.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Suppose we have the following PHP scripts
if(isset($_GET['adr'])) {
$adr = $_GET['adr'];
include $adr.".txt";
}
I want to load a non text file, For this purpose I use mysite.com/?adr=g:/file.asd%00 URL, in the other side we all know all strings in PHP must terminated by NULL byte (i.e. %00). But when I request this URL the Apache server tells me:
Warning: include(): Failed opening 'g:/file.asd' for inclusion (include_path='.;C:\php\pear') in G:\Program Files\EasyPHP-12.1\www\index.php on line 16
Can anyone please tell me why this does not work?
Thanks
Leaving aside the massive security implications of includeing a file based on user input without validation, here's what I'd do:
if( strpos($adr,".") === false) $adr .= ".txt";
Basically, this appends .txt only if there is not already a file extension (or at least, something that looks like it might be a file extension)
I don't know anything about using NULL byte in urls.
When creating URL and passing parameter you should use urlencode function as below:
$x = 'ysite.com/?adr='.urlencode('g:/file.asd');
and you should make sure that file g:/file.asd.txt exists
Extra question - are you sure you have your file saved? In warning there is Failed opening 'g:/file.asd' for inclusion and in your code you include g:/file.asd.txt file.
Of course you can do this only on your localhost. IF you do it on live server, simple don't because anyone can quick reveal all filesystem data and do anything they want.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
Update: I have fixed it!
This is a php script to ping a minecraft server.
You can find the code here: http://snippi.com/s/o2awm6x
I am getting the error:
Fatal error: Class 'MinecraftPing' not found in /var/www/html/multicraft/MinecraftServerPing.php on line 21
How do I resolve this issue? I have been trying to fix this, nothing seems to work!
In the beginning I was getting this:
Notice: Constant MQ_SERVER_ADDR already defined in /var/www/html/multicraft/MinecraftServerPing.php on line 3 Notice: Constant MQ_SERVER_PORT already defined in /var/www/html/multicraft/MinecraftServerPing.php on line 4 Notice: Constant MQ_TIMEOUT already defined in /var/www/html/multicraft/MinecraftServerPing.php on line 5 Notice: Constant MQ_SERVER_ADDR already defined in /var/www/html/multicraft/MinecraftServerPing.php on line 3 Notice: Constant MQ_SERVER_PORT already defined in /var/www/html/multicraft/MinecraftServerPing.php on line 4 Notice: Constant MQ_TIMEOUT
I fixed this by replacing the
require
with
require_once
Try using
include(__DIR__ . '/MinecraftServerPing.php');
instead of
require_once DIR . '/MinecraftServerPing.php';
13.
Either MinecraftPing does not exist (as a class), either you are including the wrong files.
It seems you have a inconsistency here. Let me try to explain in a simple way:
You have a file named MinecraftServerPing.php (the one you have posted here), but you also try to include a file with the same name on line 12:
require_once __DIR__ . '/MinecraftServerPing.php';
Either you have the class declared in another file or you have accidentally replaced the file named MinecraftServerPing.php in which MinecraftPing class was declared, with the code you posted.