interesting characters in URL in joomla - php

i have a URL that looks like this
......index.php?option=com_jumi&fileid=8&Itemid=34
i know that i can view the source of the file just by view source from the browser, but since i have FTP permission for the site, i would like to be able to edit the file.
but i dont know which file to edit!
how do i find out which file is this link going to so that i can access it through ftp?

It should be here:
Root Joomla Folder -> Components -> com_jumi
Now inside the com_jumi folder, it depends which file you want to edit, for example there you will find the file for current pages looks (View), a file with database queries (Model) and a main logic file called controller. You have to decide which file you want to edit.
Note: inside the com_jumi folder, the files can be inside other folders too, you will have to find out which file you want to edit.

Related

PHP use full path from root to link to file instead of going from parent

I need to be able to access a file in a folder located in the root directory on each of my pages.
Is there a piece of code I can use to type out the full directory going from the root folder to the specific folder I want and be able to copy onto each page without having to change the code?
For more clarification, it's hard to word, but I want to be able to link top my CSS file in the directory /css on each page without manually having to put ../../ etc.
Or does anyone else know the best way to link one style sheet to each page with ease?
If the root of your website has the path / (in other words, the address you type for the root of your website is something like http://mydomain.com/) then you can simply refer to your CSS files using /my.css or /css/my.css in all pages. The leading / tells the browser to look for these files relative to the root of your website.
You should be able to use a relative path of /folder path that will be accessible from all your pages.
You should also be able to do it the same was Cristian is recommending with:
$folder = $_SERVER['DOCUMENT_ROOT']."/folder path";

Access files outside/below public_html level

How can I access files via a url that are placed in /home/uzair/etc/index.php? Even when I run domain (something.com) it shows me data of (/home/uzair/public_html/index.php) this file.
Anyone please help me that how can I access that placed in (/home/uzair/etc/index.php) on my domain (something.com)
home
uzair
etc
index.php
public_html
admin
index.php
It sounds like you are in something.com which is visible to you on the web so it is located inside of public_html but you want to include a file that is higher up in the file system.
If that is what you are looking to do, use:
include("../etc/index.php");
The .. tells the server that you want to access the files in the next level up.
If you did:
include("../../uzair/etc/index.php");
That would have taken you all the way up to home and from there you would have access to many more files if you wanted to.
Files outside of public_html are protected from being seen on the web. Many people use that feature as a security to their content. If you have a file on there that you want to show contents of though, you have to use the include('file.php'); or include_once('file.php'); or even require_once('file.php') in a public ally visible file. Aka a file you have in public_html has to be the one to call the higher up file. If I am understanding your question right, that is how it is supposed to be done. Let me know if that is answering your question or not:-)
How you can run files not in public_html?
Files outside of public_html are protected from being seen on the web. Many people use that feature as a security to their content. If you have a file on there that you want to show contents of though, you have to use the include('file.php'); or include_once('file.php'); or even require_once('file.php') in a public ally visible file. Aka a file you have in public_html has to be the one to call the higher up file. If I am understanding your question right, that is how it is supposed to be done.

Uploading a file with PHP and moving it

I have a form where users can upload images. I know how to do it with HTML/PHP and I know that I have to move the temp file to the permanent directory. Well this all works well when my file that processes the form, is in the root directory. But, I would like to have it work within another directory, on the same server.
The Structure is this:
ROOT
>images
>mobile
>upload.php
I would like to have the file put inside images, which is outside of the "mobile" directory.
My current upload path that does not work is:
define('UPLOADPATH', 'images/');
So essentially I need to go back one directory and then into images. How can I do this?
You need to add a .. To move to the parent directory. See this resource for more information

cannot directly call the php file inside folders using the directory path

I have one root folder called GASS where I put all my php files and other related folders (templates,images,js,fonts,css)inside. When i try to run my project in localhost, http://localhost/GASS/alarm_A16GSM.php everything went smoothly. I wanted to change the URL to be more specific, http://localhost/GASS/alarmsystem/16zone/A16/overview.php thus i rename the php file and put it inside folders.
GASS
alarm-system
16-zone
A16
overview
However when i try to run the new URL,the page shows error.This is the error message:
Warning: include(templates/header.php): failed to open stream: No such file or directory in .....
Code for the first URL where the page load successfully.
<div class="overview"><a href="alarm_A16GSM.php" id="overview-selected"><span>
Code for the new URL where the page shows error.
<a href="alarm-system/16-zone/A16/overview.php" id="overview-selected">
It seems like i need to configure something which i do not know what it is.
How am i going to load the page successfully using the new URL? How am i going to traverse four levels up to the root directory so that the page load successfully? Why i cannot directly call the php file using the(alarm-system/16-zone/A16/overview.php) path?
p/s: sorry for my bad English.
It looks like there is a line in your Php file, probably like
include 'templates/header.php';
Include can't find the file using that relative path, because you moved the calling file.
Probably you could change that to
include '../../../../templates/header.php';
To get back down to the GASS folder that apparently has a folder called 'templates' with a file 'header.php' that is required.
An absolute path would be good, instead but it refers to the filesystem path, not webserver path - so you'd need to know your web root folder name on the server.
Copying all the folders (templates,images,js,fonts,css) to the folder overview will solve the issue. Now there is no template file on the folder 'overview' so header.php is failed to load. Another option is create a file save all the included file path and call this file.

put config in secure place, can not link the files

Am trying to use a config file for a database and rating script but the problem is the config file is in this directory :
website.com/include/config.php aka websitename/include/config.php
The rating script needs the config and is accessed like this:
include_once("config.php");
I want the config to be in:
"/files/website/"
A directory level up from the website root folder.
I have been trying with:
"../files/website/" and other variations but can not figure out how to link them.
I have managed to put one config file and access it, but with this ajax rating script the only way for it to work is to have the config in the /include/ folder next to:
rating_process.php - has this link : include("inc/config.php");
rating_functions.php - has this link : include_once("config.php");
rating_total_functions.php - has this link : include("inc/config.php");
Hope i've explained myself here
Right, looking at my hosting now:
$_SERVER['DOCUMENT_ROOT']; outputs this: /foldy/homepages/11/username/htdocs/webbysite
My index file is located at: /foldy/homepages/11/username/htdocs/webbysite/index.php
The included rating script is located in: /foldy/homepages/11/username/htdocs/webbysite/include/
I want the config to be in /foldy/homepages/11/username/htdocs/secretfiles/config.php
Am trying to some how go out of: webbysite folder and then into secretfiles (sibling folders)
I have tried adding ../ and so on, but am missing something obviously :(
Try
$configLocation = $_SERVER['DOCUMENT_ROOT'].'../files/website/config.php';
include_once($configLocation)
but the problem is the config file is in this directory
it is not a problem at all.
just keep it as is.
Concerning your particular problem, your problem is that you don't know where you want to put your file. /files/website/ is not likely a right path and it is apparently not one level high from webroot.
So, first of all make your mind about the right path to the directory and it's relative position to the web root
if you are concerned about security ( because your config file contains the db details ) i would place the db config file outside the site root folder and then require_once('../../dbConfig.php') from the script that's creating xml or json for your ajax
more exactly ...
your site folder might be here: /var/www/html
set a virtual host (done differently on Linux and Windows) and point your domain to a sub folder inside /html so that the new path to the site root is /var/www/html/site.
then place your config file in /var/www/html and call it from your scripts inside your /site folder using require_once('../dbConfig.php)`.
your db details are outside the site folder

Categories