Kann man sich doch selbst programmieren.
Kategorie: Hacking
Conditional tags in WordPress
You would like to know what type of page you are on? A list view or single view? Conditional Tags
<?php if (!empty($post->post_excerpt) &! is_single()) : ?> <?php the_excerpt(); ?> <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">Read the full post »</a></p> <?php else : ?> <?php the_content(__('(more...)')); ?> <?php endif; ?>
Weblinks
- blog.websitestyle.com Using WordPress Excerpts
Bug in mod_php: DNS cached after change
After a change of Domain Name Server (in /etc/resolv.conf) it seems to be necessary to stop and start the Apache server. A simple restart will not do. I have not done any tests on which versions of Apache and mod_php are affected.
This weblog encountered the problem which showed in Wordpress plugin Akismet. Nice job that the programmers of Akismet have done. Not only do they show an error message but they provide you with first step diagnostic tools and with a page of further reading. The best hint I got from the latter was that php methods/functions fsockopen and gethostbynamel must work flawlessly. So I created a file with the following code on my server:
<?php echo '<h1>fsockopen(rest.akismet.com, 80, $errno, $errstr);</h1>'; $r = fsockopen('rest.akismet.com', 80, $errno, $errstr); var_dump($r); var_dump($errno); var_dump($errstr); echo '<h1>fsockopen(google.com, 80, $errno, $errstr);</h1>'; $r = fsockopen('google.com', 80, $errno, $errstr); var_dump($r); var_dump($errno); var_dump($errstr); echo '<h1>gethostbynamel(rest.akismet.com);</h1>'; $t = gethostbynamel('rest.akismet.com'); var_dump($t); echo '<h1>gethostbynamel(google.com);</h1>'; $t = gethostbynamel('google.com'); var_dump($t); ?>
Executing it from shell will work fine. But you must execute it in the Apache Webserver context meaning you need to call the script in your browser calling the server URI via http://YOUR_HOST/YOUR_PATH_TO_SCRIPT/YOUR_SCRIPTNAME.php
Further reading:
- bytes.com php_network_getaddresses: getaddrinfo failed
Hacked computers spamming apache server log
If you find the following in the error.log of an apache webserver:
… [error] [client XXX.XXX.XXX.XXX] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): …
You can be sure that in most cases it is a computer, largely even running a webserver and many other services, with no firewall, lacking security precautions, xampp and phpmyadmin open to everybody, empty passwords, etc. sometimes they have all of these features at once. I have not checked for viruses but I expect most of them to even be infected or at least hacked and working for someone else than they ought to.
It is most likely that they send the request to your web server without the owner knowing about this. But one thing is for certain:
- It causes traffic
- Costs energy
- Spams your logs
- Etc. etc.
And all this because the computer administrator/owner has not made an effort to secure the computer at a minimum.
Go to your apache log directory an check if the same is happening to you using the following commands:
less error.log | grep RFC2616 | awk ‚{print $8}‘ | sort | uniq
less error.log | grep RFC2616 | awk ‚{printf(„%s %s %s\n“, $3, $4, $8)}‘
Further reading:
- w3.org RFC2616 section 14.23
- it.toolbox.com The first day in the life of a webserver
- isc.sans.org The first day in the life of a website
mod_mime_magic: invalid type 0 in mconvert().
If the error „mod_mime_magic: invalid type 0 in mconvert()“ appears in your HTTP-Server e.g. apache log, it’s most probably a faulty mime-magic configuration. Do the following:
tail -f /var/log/apache2/error.log
Go to another console
sudo apache2ctl restart
Look at the errors uncomment the lines causing the Problems in
/usr/share/file/magic.mime
with your favorite editor. Repeat »apache2ctl restart« and watch the log again until tail does not show any more errors of this kind.
google go
The installation is quit as easy as they describe it on the Installing Go page. At the point when it comes to Mercurial installation the page states „works on most systems“. Well true but after you have done this:
sudo apt-get install python-setuptools
I also tried to install the sources in /user/local/go and the binaries in /user/local/bin which somehow failed. So I wrote the following in my ~/.bashrc:
export GOROOT=$HOME/go export GOOS=linux export GOARCH=386 export GOBIN=$HOME/bin export PATH=$PATH:$GOBIN
NB.: Do not forget to exec bash afterwards.
Weblinks
- golang.org the project page
- code.google.com discussion about the name (I have already used the name for *MY* programming language).
- t3n.de article with video.