Sunday Feb 5

Archive for July, 2010

Jul
24/10
Hidden Images in Email to Confirm Receipt
Last Updated on Saturday, 21 August 2010 04:14
Written by Cody Snider
Saturday, July 24th, 2010

It’s a little rude to ask someone to confirm they read an email, isn’t it? Well, there’s a way to get a confirmation without them knowing it using PHP and htaccess.

First, create a directory in your images folder called ‘email’ (/images/email/ for this tutorial). Inside that folder, create an .htaccess file. Be sure that your Apache directive for AllowOverride is set to All.

In this .htaccess file, add the following:

View Code HTACCESS
RewriteEngine On
ReWriteRule ^image(.*?)\-\d{4}\.png$ track.php?x=$1 [L]

Next, create a 1x1px PNG image in the same folder and name it track.png. This will be the image loaded in the email.

Finally, in the same folder create a file named track.php and add the following:

<?php
 
$trackingNumber = $_REQUEST['x'];
// logic here for updating your database tables
 
header('Content-Type:image/png');
echo file_get_contents('track.png');
 
?>

Inside the email you are sending, include the following line. This will allow the system to track the ID ’1234′ when that image is loaded. Additionally, as we are using htaccess to mask the script being used, the image will appear to be a regular PNG without any extra parameters.

<img src="http://www.yoursite.com/images/email/image1234.png" />

In part 2 of this tutorial, we’ll discuss where the ID is generated and how it is used.

Posted under PHP  |  Comments  10 Comments
Jul
21/10
Stopping Non-Essential Services on CentOS
Last Updated on Wednesday, 21 July 2010 08:55
Written by Cody Snider
Wednesday, July 21st, 2010

Under an out-of-the-box installation of CentOS, many services are running that are non-essential for a LAMP stack to run effectively. Running the following (either individually or as a script) will remove these services from the boot.

Original post from VPS.net

#Shut down non essential services:
 
# 1. sendmail
# Purpose: sending mail, most use another
/etc/init.d/sendmail stop
chkconfig sendmail off
 
# 2. nfs
# Purpose: mount a disk from another machine
/etc/init.d/portmap stop
/etc/init.d/nfs stop
chkconfig portmap off
chkconfig nfs off
 
# 3. chargen
# Purpose: testing char generation
/etc/init.d/chargen stop
chkconfig chargen off
 
# 4. ypbind
# Purpose: stores info on NIS domains
/etc/init.d/ypbind stop
chkconfig ypbind off
 
# 5. anacron
# Purpose: cron for systems that shut down a lot
/etc/init.d/anacron stop
chkconfig anacron off
 
# 6. atd
# Purpose: at cmd daemon
/etc/init.d/atd stop
chkconfig atd off
 
# 7. routed
# Purpose: Route packets, log tables
/etc/init.d/routed stop
chkconfig routed off
 
# 8. snmpd
# Purpose: network monitoring
/etc/init.d/snmpd stop
chkconfig snmpd off
 
# 9. gpm
# Purpose: mouse
/etc/init.d/gpm stop
chkconfig gpm off
 
# 10. smartd
# Purpose: disk health monitor
/etc/init.d/smartd stop
chkconfig smartd stop
 
# 11. hidd
# Purpose: bluetooth
/etc/init.d/hidd stop
chkconfig hidd off
 
# 12. pcscf
# Purpose: smart card reader
/etc/init.d/pcscd stop
chkconfig pcscf off
 
# 13. isdn
# Purpose: digital network
/etc/init.d/isdn stop
chkconfig isdn off
 
# 14. kudzu
# Purpose: watches for new hardware
/etc/init.d/kudzu stop
chkconfig kudzu off
 
# 15. cups
# Purpose: printing
/etc/init.d/cups stop
chkconfig cups off
 
# 16. xfs
# Purpose: serves x# 1# 1 fonts
/etc/init.d/xfs stop
chkconfig xfs off
 
# 17. nfslock
# Purpose: file sys lock
/etc/init.d/nfslock stop
chkconfig nfslock off
 
# 18. canna
# Purpose: Chinese chars
/etc/init.d/canna stop
chkconfig canna off
 
# 19. freeWnn
# Purpose: Japanese chars
/etc/init.d/FreeWnn stop
chkconfig FreeWnn off
 
# 20. cups-config-daemon
# Purpose: print config
/etc/init.d/cups-config-daemon stop
chkconfig cups-config-daemon off
 
# 21. iiim
# Purpose: internet language input
/etc/init.d/iiim stop
chkconfig iiim off
 
# 22. mDNSResponder
# Purpose: dns service discovery
/etc/init.d/mDNSResponder stop
chkconfig mDNSResponder off
 
# 23. nifd
# Purpose: monitors net interfaces
/etc/init.d/nifd stop
chkconfig nifd off
 
# 24. rpcimpad
# Purpose: used for nfs server
/etc/init.d/rpcimpad stop
chkconfig rpcimpad off
 
# 25. bluetooth
# Purpose: bluetooth devices
/etc/init.d/bluetooth stop
chkconfig bluetooth off
 
# 26. saslauthd
# Purpose: handles plaintext authentication requests
/etc/init.d/saslauthd stop
chkconfig saslauthd off
Notes: some systems use this for email auth!
 
# 27. avahi-daemon
# Purpose: instant network recognition
/etc/init.d/avahi-daemon stop
chkconfig avahi-daemon off
 
# 28. avahi-dnsconfd
# Purpose: instant network recognition
/etc/init.d/avahi-dnsconfd stop
chkconfig avahi-dnsconfd off
 
# 29. sbadm
# Purpose: rapid reboot
/etc/init.d/sbadm stop
chkconfig sbadm off
 
# 30. haldaemon
# Purpose: monitors for hardware changes
/etc/init.d/haldaemon stop
chkconfig haldaemon off
 
# 31. acpi
# Purpose: sleep/hibernate control
/etc/init.d/acpi stop
chkconfig acpi off
 
# 99. gamin
# Purpose: monitors file/dir changes
/etc/init.d/gamin stop
yum -y remove gamin
Posted under Servers  |  Comments  1 Comment