Drug preguntas

PHP form mail

PHP No Comments »

First, make the form page mail.html (you may call it whatever you like)…

mail.html
======

<html>
<head><title>Mail sender</title></head>
<body>
<form action=”mail.php” method=”POST”>
<b>Email</b><br>
<input type=”text” name=”email” size=40>
<p><b>Subject</b><br>
<input type=”text” name=”subject” size=40>
<p><b>Message</b><br>
<textarea cols=40 rows=10 name=”message”></textarea>
<p><input type=”submit” value=” Send “>
</form>
</body>
</html>

The form contains the necessary text fields Email, Subject, Message, and the Send button. The line
<form action=”mail.php” method=”POST”>
tells the browser which PHP file will process the form and what method to use for sending data.

When the user fills in the form and hits the Send button, the mail.php file is called…

mail.php
======

<html>
<head><title>PHP Mail Sender</title></head>
<body>
<?php

/* All form fields are automatically passed to the PHP script through the array $HTTP_POST_VARS. */
$email = $HTTP_POST_VARS['email'];
$subject = $HTTP_POST_VARS['subject'];
$message = $HTTP_POST_VARS['message'];

/* PHP form validation: the script checks that the Email field contains a valid email address and the Subject field isn’t empty. preg_match performs a regular expression match. It’s a very powerful PHP function to validate form fields and other strings - see PHP manual for details. */
if (!preg_match(”/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/”, $email)) {
echo “<h4>Invalid email address</h4>”;
echo “<a href=’javascript:history.back(1);’>Back</a>”;
} elseif ($subject == “”) {
echo “<h4>No subject</h4>”;
echo “<a href=’javascript:history.back(1);’>Back</a>”;
}

/* Sends the mail and outputs the “Thank you” string if the mail is successfully sent, or the error string otherwise. */
elseif (mail($email,$subject,$message)) {
echo “<h4>Thank you for sending email</h4>”;
} else {
echo “<h4>Can’t send email to $email</h4>”;
}
?>
</body>
</html>

AdSense and Display Banner Ads Rotation in WordPress Blog or Websites

Wordpress 1 Comment »

Websites or blogs can use ads rotation to reduce or control the effect of ad blindness. The ad blindness is the common term that describes regular or repeat visitors to the blog or website that start to ignore the very same display advertisements on the website. Ad blindness will inevitable lead to lower CTR (click-through rate) due to no longer interested on the ads or become a behavior to ignore the ads, and subsequently decrease the ads revenue or affiliate income.

One effective way to counter ad blindness is by rotating the ads display on the blog or website, distributing the ads impressions between various providers and thus providing variety to users. If you’re using WordPress blog, there is a simple plugin that allow you to do the rotation easily and automatically. The WordPress plug-in is AdRotator, which allows bloggers to easily rotate the ads in a very convinent way. The AdRotator plugin will randomly select from a list of ads code of Google AdSense, Yahoo! Publisher Network (YPN), Commision Junction, Clicksor, Chitika, AuctionAds and etc specified in a text file at your chosen location. It can also be used to randomly include any other code or even to randomly display images, text messages etc.

If you’re not using WordPress, the AdRotator plugin won’t work out of the box, but you can always use and modify the PHP code to implement on your website.

Else, for both WordPress or other PHP powered websites, webmasters can also use an ad server with banner rotation support such as the free open source

OpenAds (previously known as phpAdsNew) to rotate Google Adsense, Valueclick, Tribal Fusion, and other advertising programs. You will need to install OpenAds on your web server though.

Another alternative to rotate ads is by using display ads management system or default management system of an existing advertising network to rotate the ads. One popular option is Commission Junction SmartZones. The Smart Zones allows users to add several different banner advertisements from different advertisers and trigger the banner rotation on each page load with just a single set of code on website. Other possible ads network that support this feature include ValueClick and TribalFusion, though they more designed towards serving default. But that opens up the possibility of control by using eCPM, impressions and etc.

One last but least convenient option for those who rely on Google Adsense, is by rotating the colors of AdSense ad blocks. Google Adsense allows rotation of up to 4 Adsense color groups, and this feature is also useful to make it as if the ads have changed to the viewers.

how-to-move-wordpress-blog-to-new-domain-or-location

Wordpress No Comments »

For blogger who self-hosts the WordPress blog publishing system

on a web hosting server with own registered domain name, sometimes, you may decide to reorganize the blog link URL to make it tidier or to reflect new focus or theme of the blog. If you decide to change the URL or link location of your WordPress blog due to changing of domain name (such as from http://www.old-domain.com/ to http://www.new-domain.com/) or the blog to another directory location (such as from http://www.domain.com/ to http://www.domain.com/blog/), there are some steps that should be done to ensure the proper migration and no breaking links.

The tricky part when moving WordPress blog to another location is that WordPress is using absolute path in URL link instead of relative path in URL link location when stores some parameters in database. Within blog posts’ contents itself, users may also use the old URLs when creating reference backlinks. All these values in the database will need to be changed when WordPress is moved. The following guide will show you which database fields that has references or values related to blog’s URLs that you want to modify. Note that this guide is not about how to move WordPress blog from one server or host to another new hosting service.

Once the blog has been moved (all files copy over in case of moving location or server or new domain name properly propagated across Internet for new domain name), the first thing to change is to tell WordPress the new blog location (wp-config.php should be no changes, and .htaccess file should be also no changes. If for some reason mod_rewrite rules for friendly URLs no longer works, you can always regenerate the .htaccess file via WP Administration’s Update Permalinks page). This value can be changed via WordPress Options page, but if you no longer able to access to old blog URL, you have to modify the value via MySQL database.

Note: The guide uses SQL statements based on MySQL replace() function to modify the database. To run SQL queries, login to MySQL database that houses WordPress tables via phpMyAdmin or login to the DB server and run MySQL client as root.

To update WordPress options with the new blog location, use the following SQL command:

UPDATE wp_options SET option_value = replace(option_value, ‘http://www.old-domain.com’, ‘http://www.new-domain.com’) WHERE option_name = ‘home’ OR option_name = ’siteurl’;

After that you will need to fix URLs of the WordPress posts and pages, which translated from post slug, and stored in database wp_posts table as guid field. The URL values in this field are stored as absolute URLs instead of relative URLs, so it needs to be changed with the following SQL query:

UPDATE wp_posts SET guid = replace(guid, ‘http://www.old-domain.com’,'http://www.new-domain.com’);

If you have linked internally within blog posts or pages with absolute URLs, these links will point to wrong locations after you move the blog location. Use the following SQL commands to fix all internal links to own blog in all WordPress posts and pages:

UPDATE wp_posts SET post_content = replace(post_content, ‘http://www.old-domain.com’, ‘http://www.new-domain.com’);

Browse through WordPress blog to check if everything is okay. You also need to re-login to WP Administration as authentication cookie has now became invalid due to different domain.

start: buagent could not be started

Cpanel No Comments »

Error:

# /etc/init.d/buagent start
/etc/init.d/buagent start: buagent could not be started

Solution

If you upgraded the kernel, you need to date the agent.

Try

r1soft-cki

Then

service buagent restart. It should be working.

Wordpress Themes by Natty WP. Web Hosting
Images by our golf tips desEXign.