Search

Rss Posts

Rss Comments

Login

 

charset .htaccess

Aug 27

Open .htaccess
read all »

how to Scroll by javascript to footer of page ?

Aug 09

to Scroll to footer of page on javascript
write
read all »

CURL Big files download

Jul 07

It is not so trivial task but i do not know till now how to make this!
read all »

How to Clear Debian cache on webserver ?

Jun 10

rm -r /var/log/apache2
rm -r /var/cache/eaccelerator
rm -r /root/Maildir
rm -r /home/internetfastnews/Maildir
rm -r /home/zxnews/Maildir
rm -r /home/seoch/Maildir
rm -r /home/otvetish/Maildir
rm -r /home/teaseo/Maildir
rm -r /home/school/Maildir

vBulletin Chmod – fast install

Mar 21

vBulletin Chmod – fast install forum

1
2
3
find ./ -type f -exec chmod 777 {} \;
THEN After install 
find ./ -type f -exec chmod 644 {} \;

IPB 3.x.x text replace in all posts

Jan 26


Run this queries in phpmyadmin to replace text1 to text2 read all »

Secure server backup (ftp + openssh+encode) !

Jan 12

Secure server backup logic
1) find all buckup files *.gz
2) encode them to *.gz.out
3) remove gz file
4) upload to ftp
5) remove encoded file

Secure server backup script

1
2
3
4
5
6
7
8
9
10
11
#!/bin/sh
BACKUPDATE=`date +%Y-%m-%d`;
find . -type f -name "*.gz" -print|while read myfile
do
    openssl enc -aes-256-cbc -salt -in "$myfile" -out "$myfile".out -pass pass:PaSSwordThere;
    rm "$myfile" ;
    curl -v -T "$myfile".out ftp://login:"FTppassThere"@ftpserveraddres.com/${BACKUPDATE}/"$myfile" -Q "MKD ${BACKUPDATE}";
   curl -v -T "$myfile".out ftp://login:"FTppassThere"@ftpserveraddres.com/${BACKUPDATE}/"$myfile" ;
    rm "$myfile".out ;
    echo "$myfile" "\n" ;
done

This is my first backup script!

Also decode example
openssl enc -d -aes-256-cbc -in zzzz.gz.out -out zzzz.gz -pass pass:PaSSwordThere;

RewriteRule – host redirect

Dec 03

Will redirect all request from _ld/ folder to another website
(.htaccess!!)

1
2
RewriteRule ^_ld/(.*)$ http://fantasy-worlds.ru/_ld/$1 [L]
RewriteRule ^_nw/(.*)$ http://fantasy-worlds.ru/_nw/$1 [L]

Mysql: How to repair all mysql tables in MySQL?

Nov 06

How to repair in MYSQL all tables ?

Just run in console

1
mysqlcheck -u root -p --auto-repair --check --optimize --all-databases -p[password]

Where password – this is admin password!

Leave first image in text and cat length(howto)

Oct 28

This simple script makes good things!
1) leave first img tag
2) remove all another img tags
3) cut text by length
So you get simple text short text with one image on it.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
function cut_text($x) {
    $alli = catch_that_image($x);
    if ($alli) {
        $x= substr($x, 0, $alli[2]+$alli[3]).
        substr(strip_only($x, '<img>'), $alli[2]);
    }
 
    if(strlen($x) > 700) {
        $x = substr($x, 0, 700);
        $y = strrpos($x, '>');
 
        $x = substr($x, 0, $y). '>...';
    }
    return $x;
}
 
function catch_that_image($x) {
  $first_img = '';
  $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $x, $matches);
  @$first_img = $matches [1][0];
 
  $imglen = strlen($matches [0][0]);
 
  if (strlen($matches [1][0]) AND $imglen){
      $imgpos = stripos($x, $matches [0][0]);
      $tx = substr($x, 0, $imgpos).substr($x, $imgpos+$imglen); //Vsio krome<img>
  }else{
    $tx = false;
  }
  return array($tx,$matches [0][0], $imgpos, $imglen );
}
 
function strip_only($str, $tags) {
    if(!is_array($tags)) {
        $tags = (strpos($str, '>') !== false ? explode('>', str_replace('<', '', $tags)) : array($tags));
        if(end($tags) == '') array_pop($tags);
    }
    foreach($tags as $tag) $str = preg_replace('#</?'.$tag.'[^>]*>#is', '', $str);
    return $str;
}
 
 
echo cut_text('<div class="content" style="min-height: 202px;">
<img width="200" height="200" alt="Post Pic" src="http://www.wprecipes.com/wp-content/uploads/2009/02/php2.jpg"/>
<div class="pic fl">
<img width="200" height="200" alt="Post Pic" src="http://www.wprecipes.com/wp-content/uploads/2009/02/php2.jpg"/>
</div>
<div class="post-title">
</div>
<img width="200" height="200" alt="Post Pic" src="http://www.wprecipes.com/wp-content/uploads/2009/02/php2.jpg"/>
<div class="post-excerpt">');
 
Get Adobe Flash playerPlugin by wpburn.com wordpress themes
25 queries. 0.793 seconds.