• Home
  • Shell
    • Emacs
    • Perl
    • screen
    • sed
  • Ubuntu
    • VNC
  • Web Development
    • Javascript
    • Joomla
    • MySQL
    • osTicket
  • Windows
    • Gimp

Posts tagged file

BASH> Recursively set file/directory permissions

Jan19
2012
Written by Scott Rowley

Move to the directory you want to start chmodding files in and run the following:

Recursively set FILE permissions.

find . -type f -exec chmod 644 {} \+

Recursively set DIRECTORY permissions.

find . -type d -exec chmod 755 {} \+

*Note, obviously you can change the chmod number to whatever you want, 777, 600, etc.

Posted in BASH - Tagged chmod, chmodding, directory, files, find, permission, recursive, recursively, set, type

PHP> Export simple MySQL query to .csv file

Aug08
2011
Written by Scott Rowley

The following will allow you to export your mysql queries from mysql to a csv file that can be opened in several spreadsheet softwares. You may need to change the , (comma) to a ; (semi-colon) depending on your software.

A note for those of you using my osTicket Reports MOD: This is not what I’m using for that.

<?php
$host = 'localhost';
$user = 'userName';
$pass = 'password';
$db = 'databaseName';
$table = 'tableName';
$file = 'export';
$link = mysql_connect($host, $user, $pass) or die("Can not connect." . mysql_error());
mysql_select_db($db) or die("Can not connect.");
$result = mysql_query("SHOW COLUMNS FROM ".$table."");
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
$csv_output .= $row['Field'].", ";
$i++;
}
}
$csv_output .= "\n";
$values = mysql_query("SELECT * FROM ".$table."");
while ($rowr = mysql_fetch_row($values)) {
for ($j=0;$j<$i;$j++) {
$csv_output .= $rowr[$j].", ";
}
$csv_output .= "\n";
}
$filename = $file."_".date("Y-m-d_H-i",time());
header("Content-type: application/vnd.ms-excel");
header("Content-disposition: csv" . date("Y-m-d") . ".csv");
header("Content-disposition: filename=".$filename.".csv");
print $csv_output;
exit;
?>
Posted in MySQL, PHP, Web Development - Tagged csv, dev, development, excel, export, libre, MySQL, office, open, php, web

Media> Shoutcast ‘No such file or directory’

Jul29
2011
Written by Scott Rowley

You’ve got a 64-bit operating system and you are trying to run the 32-bit variant of Shoutcast.

32-bit Shoutcast on 64-bit OS

# ./sc_serv
-bash: ./sc_serv: No such file or directory

For CentOS, RedHat and Similar:

yum install lib32-glib

For Debian/Ubuntu:

apt-get install ia32-libs
# ./sc_serv
*******************************************************************************
** SHOUTcast Distributed Network Audio Server
** Copyright (C) 1998-2004 Nullsoft, Inc. All Rights Reserved.
** Use "sc_serv filename.ini" to specify an ini file.
*******************************************************************************
Posted in Ubuntu - Tagged apt-get, audio, cast, directory, ia32-libs, install, media, no, shout, shoutcast, such, yum

Joomla> Repair c99madshell hacked site

Jun07
2011
Written by Scott Rowley

This is information on removing the c99madshell hack that can get into some Joomla 1.5 sites. Most of this content is an original article of News Blog. I was only able to find one portion of this myself before finding their article, kudos and thanks go to them.

If you see the following Joomla error appearing on most Joomla pages including admin section

File Not Found The requested URL was not found on this server
OR
If you have a list of spam links

then your installation has likely been compromised. There is a security bug in Joomla 1.5 allowing a hacker to reset your admin password.

You should take the following steps to get rid of the error message and secure your Joomla:
READ MORE »

Posted in Joomla, Web Development - Tagged button.gif, c99madshell, found, hack, Joomla, not, response.php, spam, tw4x

Corrections? Questions? Comments?

Find an error?
Everything work out great for you?
Have some feedback?
Like to see something added to the article?

PLEASE leave us a comment after the article and let us know how we are doing, or if something needs corrected, improved or clarified.

Thank you!
- The Management

Advertisement

Sudo Bash
By Geeks - For Geeks

Back to Top