Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
I apologise in advance, I have googled & stackoverflow'd this and cannot get to the correct answer I need.
I have the following;
if ($radiobutton == "1"){
require ("/test/_testpage1.php");
}
radiobutton 2 also doing the same but going to testpage2.php instead. Neither of this is working. But if i move testpage1.php OUT of the /test/ folder it works perfectly fine just in public_html.
if ($radiobutton == "1"){
require ("_testpage1.php");
}
The above works fine, but in the interest in keeping things tidy & easier for me to manage I wanted to put things in folders.
PLEASE may somebody support on something I am quite clearly missing?
if your html root is /var/www/html (for example) when you try to require('/test/somefile.php') are trying to open in /test/ folder not in /var/www/html/test/
you can try this code?
/* without "/" */
require ("test/_testpage1.php");
I think it's more safe to use fullpath than relative path, maybe something like :
require 'FULLPATH.DS.testpage2.php'
We can debug it more easily rather than relative path
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
EDIT: SOLVED - Thanks to the comment by #Adam
I have my index.php page, which all included functionality, until now, has worked.
I've written a small script (pasted below), using the Simple HTML DOM library to scrape an external webpage for an element value. This value is stored as $newprice inside the script.
However, when I place the script anywhere in the code, it a) doesn't run, and b) breaks all HTML/PHP/JS code preceding it.
<?php
include_once('../simple_html_dom.php');
$html = file_get_html('https://www.affordrentacar.co.uk/');
$traverse = $html->find('span.offer-price', 0);
$newprice = $traverse->plaintext;
?>
I've copied this script to one of my other PHP pages and tested echoing out the $newprice variable and that works fine. What could be causing this?
try to display errors :
error_reporting( E_ALL^E_NOTICE );
ini_set('display_errors', 1);
can be problem with connections, your local settings don't work with https
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I am trying to create an image that changes dependent on the genre grabbed from an icecast server, I am pretty sure I have the base code correct I think I've just incorrectly inputted the PHP variable.
<?php
$stats = $core->radioInfo( "http://http://sc.onlyhabbo.net:8124/status-json.xsl" );
?>
<img src=http://www.habbo.com/habbo-imaging/avatarimage?user=<?php
echo $stats['genre'];
?>&action=std&direction=2&head_direction=2&gesture=sml&size=m&img_format=gif/>
is the full code. Have I inputted the PHP variable incorrectly
Where are the quotes in your Html?
<img src="http://www.habbo.com/habbo-imaging/avatarimage?user=<?php
echo $stats['genre'];
?>&action=std&direction=2&head_direction=2&gesture=sml&size=m&img_format=gif"/>
UPDATE EVERYBODY
This is now resolved, I decided to go down the CURL route for this, and at first it didn't work until my host raised our CloudLinux Process Limit. I am unsure what the actual issue with this code was, but the CURL route works fine. Thank you for any answers
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
After hours of searching here and Google, I decided to ask for help.
I want the code posted to create a subdirectory in directory uploads, named by the variable $userDir. It does not give any errors in php error logs but it also does not create the sub-directory.
Code:
<?php
$userDir = $_POST['user_dir'];
$targetFolder = '/uploads';
if (!file_exists($targetFolder.'/'.$userDir)) {
mkdir($targetFolder.'/'.$userDir, 0700, true);
}
//* Some other code here
?>
Does anyone know why it does not create the folder?
Then the folder may already exist - but not where you think it is.
Try replacing your mkdir line to:
if (!file_exists(getcwd().$targetFolder.'/'.$userDir)) {
mkdir(getcwd().$targetFolder.'/'.$userDir, 0700, true);
}
Correct your target path :
$targetPath = $_SERVER['DOCUMENT_ROOT'].$targetFolder.'/'.$userDir;
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I am in the process of incorporating a Blog Posts section in my website.
However I am receiving an error message on the New Post page which I am unsure of the cause of.
Any help would be greatly appreciated.
I have received the above two Warning Error messages above.
I have also covered parts of the directory because they show names.
This is what the code looks like at the line specified.
<?php
include "cms/posts.php";
?>
Line 155 is the middle line of code.
If there is any more information which is required please let me know.
Thanks!
Reply to comment 1: Hi, I'm not sure why it is trying to open that file as I've never seen or heard of the file "usr/lib/php:/usr/local/lib/php".
Use this code and make sure the file exists:
<?php
include __DIR__ . "/cms/posts.php"; // PHP >= 5.3
include dirname(__FILE__) . "/cms/posts.php"; // PHP < 5.3
?>
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I have this image "Трислоен-паркет.png" and this to check if it exists:
$imgs='../images/pc/'.clear_string($categoryrow[1],$tr).'.png';
if(file_exists($imgs)){ echo 'yes';
}else echo 'no';
It always returns NO.
The strange thing is that if I call the image without check if it is exists - it shows the image but I need to DO check and show that image if exists, otherwise I will show default image..but file_exists does wrong ..
clear_string function only removes white spaces and commas and some other type letters..
how to avoid it?
You can use iconv to set the language format you pass to the functions such as file_exists.
Your code might look something like this:
file_exists(iconv('iso-8859-5', 'utf-8', $imgs));
The problem was that file_exists checks starting from root and in this case the path was wrong.. no encoding was needed.. Sorry guys for taking your time and thanks for your answers !..