Search

Rss Posts

Rss Comments

Login

 

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">');

How to block backup in admin side of IPB?

Oct 27

To block backups for admin in IPB,
You need to open FTP read all »

How to get all spam comets from WordPress blog ?

Sep 25

Run this code from phpmyadmin

1
2
3
 SELECT *
FROM `wp_comments`
WHERE `comment_approved` LIKE 'spam'

How to – MySQL tuning in debian.

Sep 24

Results of compiling this scripts was recommendations how to change mysql params.
note. For best result please run MYSQL before testing – 48 hours!

1
2
3
wget http://mysqltuner.com/mysqltuner.pl
chmod +x mysqltuner.pl
./mysqltuner.pl

OR (also) try this script

1
2
wget http://www.day32.com/MySQL/tuning-primer.sh
sh tuning-primer.sh

How to allow ftp clients to list .htaccess in proftpd?

Sep 21

So how to allow ftp clients to list .htaccess in proftpd?

We need to open
/etc/proftpd/proftpd.conf

1
ListOptions                <--->"-l"

to

1
ListOptions                <--->"-a"

and then restart proftpd!

How to speed-up ProFTPd?

Aug 26

It is really ease!
1) edit /etc/proftpd/proftpd.conf read all »

How to cat text in PHP with HTML?

Jun 02

How to cat text in PHP?

function cut($x) {
    if(strlen($x) > 40) {
        $x = substr($x, 0, 40);
        $y = strrpos($x, ' ');
        $x = substr($x, 0, $y);
    }
    return $x;
}

How to code url text (links) in PHP and run on JavaScript?

May 22

How to code url text (links) in PHP and run on JavaScript? read all »

apachectl configtest -bash: apachectl: command not found

May 14

apachectl configtest -bash: apachectl: command not found

HOW TO FIX apachectl on debian

Just run some commands read all »

 
Get Adobe Flash playerPlugin by wpburn.com wordpress themes
26 queries. 0.627 seconds.