Labels

Wednesday, 12 October 2016

15 Tested and Proven Ways to Build Your Subscriber List

A list of engaged subscribers is one of the most effective and reliable marketing resources. A good list so valuable that it can’t be bought. Why? Because when subscribers sign up for your list, they’re signing up to hear from you and your company. Subscribers have to be earned. What are the best ways to build a list? We’ve collected the top 15 to share with you today.
The permission model allows you to fill your audience with people who are genuinely interested in your brand and what you have to say
With information collected during sign-up (or later), you can precisely segment your list and design your email communication to suit your reader's preferences.
As you attract qualified leads, you’ll be able to guide them through the decision-making process by aligning content to specific buying cycle stages.
Take a look at the 15 tips we’ve collected to help you build your email marketing list:
  1. Offer quality content. Nobody gives up their email address for free. If you want to build a valuable relationship and engage your audience, you need to provide content that is worthwhile and interesting.
  2. Put sign-up forms on every web page. Your sign-up form should be everywhere your potential subscribers are. Make sure it’s visible and easy to fill out.
  3. Use social media to collect email addresses. Integrate your sign-up forms with social media platforms. Driving traffic from multiple sources allows you to build a strong email marketing list much faster.
  4. Design your sign-up form carefully. Ask only for information you plan to use. A good rule of thumb is that less is more — the shorter the sign-up form, the higher the conversion rate.
  5. Show your privacy policy. Inform your readers that you will not share their personal information with third parties. A clear privacy policy helps you build trust and convince visitors that it’s safe to subscribe.
  6. Show samples of your content. Let your subscribers know what they are signing up for. Use your older content samples to “sell” the email sign-up.
  7. Include a call to action. Put a call to action in your submit button, e.g. Sign me up! This makes the sign-up process more engaging and improves the conversion ratio.
  8. Give away freebies. Think of a relevant incentive for your audience (e-book, infographic, whitepaper) and provide it for free.
  9. Ask subscribers to share. Take the time to prepare valuable, shareable content. Remember that putting the social share buttons is not enough; you still need to ask your subscribers to use them.
  10. Build a content distribution strategy. Producing great content is only half the battle. Make sure it’s visible to the right audience. Define who your ideal audience is and find out where they like to congregate online. Then choose communication channels accordingly.
  11. Publish landing pages. Create a squeeze page where visitors can download premium content in exchange for their email address. A dedicated web page helps users focus on the call to action and increases conversions.
  12. Include testimonials on your landing page. Social proof helps build trust toward a brand and its products. Use testimonials from satisfied customers to help visitors make a decision.
  13. Blog regularly. Great content brings more traffic. Develop a realistic content publishing schedule and stick to it.
  14. Guest post on popular blogs. Publishing your content on other blogs is a great way to build relationships with other bloggers in your industry and introduce yourself to new people. Include a backlink to your blog, and your blog’s search rankings will go up.
  15. Collect email addresses at offline events. Be ready to collect email addresses at trade shows and conferences. Ask for business cards or use the Forms on the Go app to instantly add people to your list.
It’s time to get started.
Now you know a handful of great ways to build one of the most effective marketing assets — your email marketing list.
Want more? Check out the new GetResponse List Building Program, available free to anyone with a GetResponse account — even a 30-Day Free Trial account. To sign up for our free course, log into your GetResponse account 

Sunday, 31 July 2016

Images sliders in html

This is simple image slider with alternate mode . Just copy and paste this code and use.

<p><marquee behavior="alternate"> <a href="http://sakhihosting.in"><img src="http://india.sakhihosting.in/images/logo.png" alt="sakhihosting" /></a>
<a href="http://sakhihosting.in"><img src="http://india.sakhihosting.in/images/logo.png" alt="sakhihosting" /></a></marquee></p>




This is simple image slider with onmouse stop image . Just copy and paste this code and use.


<p><marquee onmouseover="this.stop();" onmouseout="this.start();"> <a href="http://sakhihosting.in"><img src="http://india.sakhihosting.in/images/logo.png" alt="sakhihosting" /></a>
<a href="http://sakhihosting.in"><img src="http://india.sakhihosting.in/images/logo.png" alt="sakhihosting" /></a></marquee></p>

Tuesday, 5 April 2016

Random product display on featured page in prestashop

If you want Random product display on featured page in prestashop then just 
add 
shuffle($products);

in your modules/homefeatured/tdhomefeatured.php file at line 100 which should make it look something like.


$category = new Category(Context::getContext()->shop->getCategory(), (int)Context::getContext()->language->id);
$nb = (int)(Configuration::get('HOME_FEATURED_NBR'));
$products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 10));
shuffle($products);

$this->smarty->assign(array(
'products' => $products,
'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
'homeSize' => Image::getSize(ImageType::getFormatedName('home')),
));

return $this->display(__FILE__, 'homefeatured.tpl');
}

}

Saturday, 5 March 2016

Building a Simple Affiliate System in PHP/MySQL

Affiliate Systems are useful for people who want to have affiliates on their sites to help boost sales.
Affiliates sign up and are given a link that they can use to redirect visitors to your site. The script will track clicks from each affiliate and also record any sales that come out of those clicks.
What am I going to show you? Here’s a brief overview.

We’re going to build a simple affiliate system that can be used on sites. You add a script to your site then allows people to sign up as affiliates and sell your products.

{mospagebreak title=Building The Database}
First, we want to build the database. This is a pretty basic database designed to keep track of affiliates and their traffic/sales to your website. We’ll need two tables.
CREATE TABLE affiliates (
 ID int(10) NOT NULL auto_increment,
 username varchar(50) NOT NULL default ”,
 password varchar(32) NOT NULL default ”,
 site varchar(255) NOT NULL default ”,
 email varchar(255) NOT NULL default ”,
 akey varchar(32) NOT NULL default ”,
 ptype varchar(32) NOT NULL default ‘0’,
 pemail varchar(255) NOT NULL default ”,
 address text NOT NULL,
 PRIMARY KEY  (ID),
 UNIQUE KEY akey (akey)
) TYPE=MyISAM AUTO_INCREMENT=1;

CREATE TABLE affstats (
 ID int(10) NOT NULL auto_increment,
 akey varchar(32) NOT NULL default ”,
 type tinyint(4) NOT NULL default ‘0’,
 status tinyint(4) NOT NULL default ‘0’,
 ip varchar(150) NOT NULL default ”,
 date datetime NOT NULL,
 OrderID varchar(32) NOT NULL default ”,
 price varchar(32) NOT NULL default ”,
 PRIMARY KEY  (ID)
) TYPE=MyISAM AUTO_INCREMENT=1;
Setting Your Settings
Your settings will be stored in a file called “config.php.” We’ll keep this simple.
<?
 $sitename    = “”; // site name
 $siteurl     = “”; // site url
 $redirecturl = “”; // redirect url
 $affpay      = “”; // affiliate payout amount
 $aduser      = “”; // admin username
 $adpass      = “”; // admin password
 $dbhost      = “”; // database hostname
 $dbuser      = “”; // database username
 $dbpassword  = “”; // database password
 $dbname      = “”; // database name
?>
These settings are important and should be set before we start. The variables are broken down as follows:
  $sitename    = The name of your website 
  $siteurl     = The URL to the affiliate script as it is
                 installed on your site
  $redirecturl = The URL where visitors are redirected to after
                 coming to your site using an affiliate link.
  $affpay      = The amount affiliates are paid for each sale. 
                 If you set it to 5.00, then affiliates
                 will get paid 5.00 for each sale.
  $aduser      = Your management login username
  $adpass      = Your management login password
  $dbhost      = Your database host (usually localhost)
  $dbuser      = Your database username
  $dbpassword  = Your database password
  $dbname      = The name of your database
{mospagebreak title=Being Common}
Now, we’re also going to create a file called “common.php.” This file is very important as it contains functions used by the script.

This script is being built so that the common file is the brains of the whole system.
<?
  session_start();
  include(“config.php”);
  $dbh=mysql_connect ($dbhost, $dbuser, $dbpassword) or die (‘I cannot connect to the database because: ‘ . mysql_error());
  mysql_select_db ($dbname,$dbh);
  define(“DBH”,$dbh);
  $affiliateForm = array(
      “username”=&gt;array(“User Name”,”text”,””),
      “password”=&gt;array(“Password”,”password”,””),
      “site”=&gt;array(“Your Web Site”,”text”,”http://”),
      “email”=&gt;array(“Your Email”,”text”,”
yourname@yoursite.com“),
      “akey”=&gt;array(“”,”hidden”,””),
      “ptype”=&gt;array(“Payment Method”,”select”,”check|paypal”),
      “pemail”=&gt;array(“Paypal Email”,”text”,””),
      “address”=&gt;array(“Your Address”,”textarea”,””)
  );
  function makeKey($len){
      $chars=
‘ABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuv
        wxyz0123456789′; // characters to use in the password
      mt_srand((double)microtime()*1000000^getmypid());
      while(strlen($password)&lt;$len){
        $password.=substr($chars,(mt_rand()%strlen($chars)),1);
      }
      return $password;
  }
  function AffiliateAdd(){
      $_POST[‘akey’] = makeKey(10);
      unset($_POST[‘ID’]);
      unset($_POST[‘step’]);
      $query = “INSERT INTO affiliates (“.implode(“, “,array_keys($_POST)).”) VALUES (‘”.implode(“‘, ‘”,array_map(“mysql_real_escape_string”,$_POST)).”‘)”;
      mysql_query($query,DBH) or die( mysql_error() );
      return mysql_insert_id();
  }

  function AffiliateUpdate($aid){
      unset($_POST[‘step’]);
      $query = “UPDATE affiliates SET “;
      foreach($_POST as $field =&gt; $value) {
        $query .= “$field = “”.mysql_real_escape_string($value).””, “;
      }
      $query = substr($query, 0, strlen($query)-2).” WHERE ID = ‘{$aid}'”;
      mysql_query($query,DBH) or die( mysql_error() );
  }

  function AffiliateStats($aid=””){
      $sql = “SELECT * FROM affiliates WHERE ID='{$aid}'”;
      $lo = mysql_query( $sql );
      $affi = mysql_fetch_assoc($lo);
      list($clicks) = mysql_fetch_row( mysql_query(“SELECT COUNT(*) FROM affstats WHERE akey= ‘{$affi[‘akey’]}'”) );
      list($orders) = mysql_fetch_row( mysql_query(“SELECT COUNT(*) FROM affstats WHERE akey= ‘{$affi[‘akey’]}’ AND type=2”) );
      list($pending_total) = mysql_fetch_row( mysql_query(“SELECT SUM(price) FROM affstats WHERE akey= ‘{$affi[‘akey’]}’ AND type=2 AND paid=0”) );
      list($paid_total) = mysql_fetch_row( mysql_query(“SELECT SUM(price) FROM affstats WHERE akey= ‘{$affi[‘akey’]}’ AND type=2 AND paid=1”) );
      $total = $clicks+$orders;
      $order_total = $pending_total+$paid_total;
      $return = array(
        “total”=&gt;$total,
        “clicks”=&gt;$clicks,
        “orders”=&gt;$orders,
        “pending_total”=&gt;$pending_total,
        “paid_total”=&gt;$paid_total,
        “order_total”=&gt;$order_total
      );
      return $return;
  }
?>
Most of these functions are pretty straightforward; you can figure them out just from their names.
Look And Feel
There are two files that need to be created to give the site its look and feel.
The first one is “header.php.” This is the header for the site; change it to integrate more with your existing site:
<html>
<head>
  <title><?=$sitename?> Affiliate Center</title>
</head>
<body>
  <h1><?=$sitename?> Affiliate Center</h1>
Finally, we have “footer.php”, this is the other half of the look and feel of your site:

  <hr/>
  copyright 20016, <?=$sitename?>, <?=$siteurl?>
These can be changed quite easily, and changing them changes the whole look of the affiliate script.
{mospagebreak title=Your Index Page}
Create a page called “index.php.” This page serves as your introduction to your affiliate site.

 <?
  include(“common.php”);
  include(“header.php”);
 ?>
  <P>Sign up here to be one of our affiliates. Earn $<?=number_format($affpay,2)?> for each sale you 
  generate.</P>
  <ul>
  <li><a href=’account.php’>Login To Your Account</a>
  <li><a href=’join.php’>Sign Up For An Account</a>
  </ul>
 <?
  include(“footer.php”);
 ?>
Letting Affiliates Join
One of the first things you need to do is let your affiliates sign up.
Create a file called “join.php”:

<?
  include(“common.php”);
  include(“header.php”);
  $step = isset($_POST[‘step’]) ? $_POST[‘step’] : 1;
  switch ($step){
    case ‘2’:
      // add affiliate to the DB
      $aid = AffiliateAdd();
      if( $aid ){
        echo “Thank you for signing up. You can now log in to your account<br>”;
        echo “<a href=’account.php’>Login Here</a><br/>”;
      }
      break;
    default:
?>
      <table>
      <form method=”POST”>
      <input type=’hidden’ name=’step’ value=’2’>
<?
      foreach($affiliateForm as $field=>$info){
        echo “<tr>”;
        if( !empty($info[0]) ){
          echo “<td valign=top>{$info[0]}</td>”;
        }
        echo “<td valign=top>”;
        switch($info[1]){
          case “hidden”:
            echo “<input type=’hidden’ name='{$field}’ value='{$info[2]}’>”;
            break;
          case “password”: 
            echo “<input type=’password’ name='{$field}’ value=”>”;
            break;
          case “text”:
            echo “<input type=’text’ name='{$field}’ value='{$info[2]}’>”;
            break;
          case “textarea”:
            echo “<textarea name='{$field}’ rows=5 cols=25>{$info[2]}</textarea>”;
            break;
          case “select”:
            $info[2] = explode(“|”,$info[2]);
            echo “<select name='{$field}’>”;
            foreach($info[2] as $k=>$v){
              echo “<option>{$v}</option>”;
            }
            echo “</select>”;
            break;
      }
      echo “</td>”;
      echo “</tr>”;
    }
?>
    <tr>
      <td colspan=2><input type=’submit’ value=’Save’></td>
    </tr>
    </form>
    </table>
<?
    break;  
  }
  include(“footer.php”);
?>
{mospagebreak title=Letting Affiliates Log in}
Okay, affiliates are able to sign up. Now, we need to let them log in to their accounts. We’ll now create two files for that.
The first file is called “login.php”:

<?php
  session_start();
  $auid = isset($_POST[‘auid’]) ? $_POST[‘auid’] : $_SESSION[‘auid’];
  $pwd = isset($_POST[‘pwd’]) ? $_POST[‘pwd’] : $_SESSION[‘pwd’];
  if(!isset($auid)) {
    loginform();
    exit;
  }
  $results = mysql_query(“SELECT * FROM affiliates WHERE username='{$auid}’ && password='{$pwd}'”);
  $row = mysql_fetch_assoc($results);
  if($row[‘username’] == $auid && $row[‘password’] == $pwd){
    $_SESSION[‘userId’] = $row[‘ID’];
    $_SESSION[‘username’] = $row[‘username’];
    $_SESSION[’email’] = $row[’email’];
    $_SESSION[‘akey’] = $row[‘akey’];
  }else{
    session_destroy();
    session_start();
    loginform();
    exit;
  }
?>
<?
  function loginform(){
    global $sitename;
?>
    <CENTER>
    <BR>
    <FONT FACE=verdana color=#FFFFFF size=5><B><?=$sitename?> Login</B></FONT>
    <BR>
    <TABLE cellspacing=0>
    <FORM method=post>
    <TR><TD>Username:
      <TD><INPUT type=text name=auid size=16>
    <TR><TD>Pass:
      <TD><INPUT type=pass name=pwd size=16>
    <TR><TD colspan=2><INPUT type=submit value=”Log In >>”></TD>
    </FORM>
    </TABLE>
    <BR>
<?
  }
?>
This file is used to let your affiliates log in to the site.

Next, we create a file called “account.php”:

<?
  include(“common.php”);
  include(“login.php”);
  include(“header.php”);
  $mode = isset($_REQUEST[‘mode’]) ? $_REQUEST[‘mode’] : ”;
?>
 <p>Welcome <?=$_SESSION[‘username’]?><br/>
  <hr/>
    <a href=’account.php’>Your Account</a>
    &nbsp;|&nbsp;
<a href=’account.php?mode=affedit’>Edit Your Profile</a>
<br/>
  <hr/></p>
<?
  if($mode == ‘affedit’){
    include(“affedit.php”);
  }else{
    include(“affstats.php”);
  }
  include(“footer.php”);
?>
This is the main file that your affiliates will use for viewing their stats and updating their account.

We now will create two more files as part of this section.

The first one is “affstats.php.” This file displays the affiliate stats. 

<p>Your Affiliate Link:<br/>
<textarea rows=3 cols=50 wrap=SOFT><?=$siteurl?>/click.php?refid=<?=$_SESSION[‘akey’]?></textarea>
<hr/>
<?
$mystats = AffiliateStats($_SESSION[‘userId’]);
if($mystats[‘clicks’] > 0){
  $ratio = number_format( (($mystats[‘orders’] / $mystats[‘clicks’]) * 100), 2 ).” %”;
}else{
  $ratio = “0 %”;
}
?>
<b>Your Stats</b><br/></p>
<table align=center width=350 border=1>
<tr>
  <td>Total Clicks:</td>
  <td><?=number_format($mystats[‘clicks’],0)?>&nbsp;</td>
</tr>
<tr>
  <td>Total Orders:</td>
  <td><?=number_format($mystats[‘orders’],0)?>&nbsp;</td>
</tr>
<tr>
  <td>Ratio %:</td>
  <td><?=$ratio?>&nbsp;</td>
</tr>
</table>
<br>
<table align=center width=350 border=1>
<tr>
  <td>Amount Earned:</td>
  <td>$<?=number_format($mystats[‘order_total’],2)?></td>
</tr>
<tr>
  <td>Payments Pending:</td>
  <td>$<?=number_format($mystats[‘pending_total’],2)?></td>
</tr>
<tr>
  <td>Amount Paid:</td>
  <td>$<?=number_format($mystats[‘paid_total’],2)?></td>
</tr>
</table>
<hr/>
Next, create a file called “affedit.php.” This file lets your affiliates edit their accounts.

<?
  $step = isset($_POST[‘step’]) ? $_POST[‘step’] : 1;
  switch ($step){
    case ‘2’:
      AffiliateUpdate($_SESSION[‘userId’]);
      echo “Your account has been updated<br>”;
      break;
    default:
      $affinfo = mysql_fetch_assoc( mysql_query(“SELECT * FROM affiliates WHERE ID='{$_SESSION[‘userId’]}'”) );
?>
      <table>
      <form method=”POST” action=”account.php?mode=affedit”>
      <input type=’hidden’ name=’step’ value=’2’>
<?
      foreach($affiliateForm as $field=>$info){
        echo “<tr>”;
        if( !empty($info[0]) ){
          echo “<td valign=top>{$info[0]}</td>”;
        }
        echo “<td valign=top>”;
        switch($info[1]){
          case “hidden”:
            // hidden variables don’t get edited.
            break;
          case “password”:
            echo “<input type=’password’ name='{$field}’ value=’$affinfo[$field]’>”;
            break;
          case “text”:
            echo “<input type=’text’ name='{$field}’ value='{$affinfo[$field]}’>”;
            break;
          case “textarea”:
            echo “<textarea name='{$field}’ rows=5 cols=25>{$affinfo[$field]}</textarea>”;
            break;
          case “select”:
            $info[2] = explode(“|”,$info[2]);
            echo “<select name='{$field}’>”;
            foreach($info[2] as $k=>$v){
              if($v == $affinfo[$field]){
                echo “<option SELECTED>{$v}</option>”;
              }else{
                echo “<option>{$v}</option>”;
              }
            }
            echo “</select>”;
            break;
        }
        echo “</td>”;
        echo “</tr>”;
      }
?>
      <tr>
        <td colspan=2><input type=’submit’ value=’Save’></td>
      </tr>
      </form>
      </table>
<?
      break;  
  }
?>
Okay, this is it for the part of the script that handles affiliates managing their accounts. Now, we need to a way to manage affiliates.

{mospagebreak title=Adding Affiliate Code to Your Site}
There are two types of codes we have to set up for tracking affiliates.
The first is called “click.php.” This file is called when visitors click a link on an affiliate’s website.

<?
  include(“common.php”);
  if( $_REQUEST[‘refid’] ){
    $mykey = makeKey(10);
    SetCookie (“affid”,$mykey); 
    $_SESSION[‘affid’] = $mykey;
    mysql_query(“UPDATE affiliates SET
clicks=clicks+1 WHERE akey='”.$_REQUEST[‘refid’].”‘”,DBH);
    mysql_query(“INSERT INTO affstats SET
akey='”.$_REQUEST[‘refid’].”‘,type=’1’,
OrderID='”.$mykey.”‘”,DBH);
  }
  header(“Location: $redirecturl”);
?>
Now, create a file called “sale.php”:

<?
  include(“common.php”);
  $affid = $_SESSION[‘affid’]; 
  if (!$affid){
    $affid = $HTTP_COOKIE_VARS[‘affid’];
  }
  if (!$affid){
    exit;
  }else{
    mysql_query(“UPDATE affstats SET
type=’2′,price='{$affpay}’,paid=’0′ where OrderID = ‘{$affid}'”,DBH);
  }  
?>
The file sale.php is called by adding it to your site like this:

  <img src=”/affiliates/sale.php”>
Managing Affiliates
Managing affiliates is important. We need to have a way to manage affiliates so we can set them as being paid, and perform other tasks. For the Affiliate management part, we will create five files.

The first file is “accesscontrol.php.” This file is similiar to login.php but works for the management area.

<?php
  session_start();
  $auid = isset($_POST[‘auid’]) ? $_POST[‘auid’] : $_SESSION[‘auid’];
  $pwd = isset($_POST[‘pwd’]) ? $_POST[‘pwd’] :
$_SESSION[‘pwd’];
  if(!isset($auid)) {
    loginform();
    exit;
  }
  if( $auid != $aduser || $pwd != $adpass ){
    unset($_SESSION[‘auid’]);
    unset($_SESSION[‘pwd’]);
    loginform();
    exit;
  }else if( $auid == $aduser && $pwd ==
$adpass ){
    $_SESSION[‘auid’] = $auid;
    $_SESSION[‘pwd’] = $pwd;
  }
?>
<?
  function loginform(){
    global $sitename;
?>
    <CENTER>
    <BR>
    <FONT FACE=verdana color=#FFFFFF
size=5><B><?=$sitename?> Login</B></FONT> 
    <BR>
    <TABLE cellspacing=0>
    <FORM method=post>
    <TR><TD>Username:
      <TD><INPUT type=text name=auid size=16>
    <TR><TD>Pass:
      <TD><INPUT type=pass name=pwd size=16>
    <TR><TD colspan=2><INPUT type=submit
value=”Log In >>”></TD>
    </FORM>
    </TABLE>
    <BR>
<?
  }
?>
Now, we create “manage.php”:
<?
  include(“common.php”);
  include(“accesscontrol.php”);
  include(“header.php”);
  $mode = isset($_REQUEST[‘mode’]) ? $_REQUEST
[‘mode’] : ”;
  switch($mode){
    case “stats”:
      include(“managestats.php”);
      break;
    case “payout”:
      include(“payout.php”);
      break;
    default:
      include(“managemain.php”);
      break;
  }
?>
<?
  include(“footer.php”);
?>
Next, we do “managemain.php”:
<p>Here are your affiliates, click on a username to view their stats.</p>
<table border=1>
<tr>
  <td>Username</td>
  <td>Password</td>
  <td>Email</td>
  <td>Affiliate Key</td>
<?
  $results = mysql_query(“SELECT *  FROM
affiliates ORDER BY username;”,DBH);
  while( $row = mysql_fetch_assoc($results) ){
    echo “<tr>”;
    echo “<td><a href=’manage.php?mode=stats&userId={$row[‘ID’]}’>{$row
[‘username’]}</a></td>”;
    echo “<td>{$row[‘password’]}</td>”;
    echo “<td>{$row[’email’]}</td>”;
    echo “<td>{$row[‘akey’]}</td>”;
    echo “</tr>”;
  }
?>
</table>

The next file will be “managestats.php”:
<?
  $mystats = AffiliateStats($_GET[‘userId’]);
  if($mystats[‘clicks’] > 0){
    $ratio = number_format( (($mystats
[‘orders’] / $mystats[‘clicks’]) * 100), 2 ).” %”;
  }else{
    $ratio = “0 %”;
  }
?>
<b>Stats</b><br/>
<table align=center width=350 border=1>
<tr>
  <td>Total Clicks:</td>
  <td><?=number_format($mystats[‘clicks’],0)?>&nbsp;</td>
</tr>
<tr>
  <td>Total Orders:</td>
  <td><?=number_format($mystats[‘orders’],0)?>&nbsp;</td>
</tr>
<tr>
  <td>Ratio %:</td>
  <td><?=$ratio?>&nbsp;</td>
</tr>
</table>
<br>
<table align=center width=350 border=1>
<tr>
  <td>Amount Earned:</td>
  <td>$<?=number_format($mystats[‘order_total’],2)?></td>
</tr>
<tr>
  <td>Payments Pending:</td>
  <td>$<?=number_format($mystats[‘pending_total’],2)?></td>
</tr>
<tr>
  <td>Amount Paid:</td>
  <td>$<?=number_format($mystats[‘paid_total’],2)?></td>
</tr>
</table>
<?
  echo “<div align=’center’><a
href=’manage.php?mode=payout&userId={$_GET
[‘userId’]}’>Manage Payments</a></div>”;
?>
And finally, we create “payout.php”:
<?
  if($_GET[‘setaspaid’]){
    mysql_query(“UPDATE affstats SET paid=’1′
WHERE ID='{$_GET[‘setaspaid’]}'”,DBH);
  }
  if($_GET[‘setasunpaid’]){
    mysql_query(“UPDATE affstats SET paid=’0′
WHERE ID='{$_GET[‘setasunpaid’]}'”);
  }
  $sql = “SELECT * FROM affiliates WHERE
ID='{$_GET[‘userId’]}'”;
  $lo = mysql_query( $sql );
  $affi = mysql_fetch_assoc($lo);
?>
<?      if($affi[‘ptype’]){       ?>
Requested Payment Method: <?=( strtolower($affi
[‘ptype’]) == “paypal” ? “PayPal” : “Check”)?
><br>
<?      }       ?>
Payment Account: <?=( strtolower($affi
[‘ptype’]) == “paypal” ? $affi[‘pemail’] : 
nl2br($affi[‘address’]) )?><br>
<br>
<table align=center width=350 border=1>
<?
  $q1 = “select * from affstats WHERE akey=
‘{$affi[‘akey’]}’ AND type=2 GROUP BY OrderID”;
  $r1 = mysql_query($q1,DBH) or die(mysql_error());
  while($a1 = mysql_fetch_assoc($r1)){
?>
    <tr>
      <td>Amount Earned:</td>
      <td>$<?=$a1[‘price’]?></td>
<?                      if($a1[paid] == 1){     ?>
      <td><a href=”manage.php?
mode=payout&userId=<?=$_GET[‘userId’]?
>&setasunpaid=<?=$a1[‘ID’]?>”>Set As Not
Paid</a></td>
<?                      }else{  ?>
      <td><a href=”manage.php?
mode=payout&userId=<?=$_GET[‘userId’]?
>&setaspaid=<?=$a1[‘ID’]?>”>Set As
Paid</a></td>
<?                      }       ?>
    </tr>
<?
  }
?>
</table>

Saturday, 27 February 2016

contact form html code

contact form html code
Create two page first contactform.html and second html_form_send.php 
Now copy code below and paste on contactform.html

**** start code ****

<form name="htmlform" method="post" action="html_form_send.php">
<table width="450px">
</tr>
<tr>
<td valign="top">
<label for="first_name">First Name *</label>
</td>
<td valign="top">
<input type="text" name="first_name" maxlength="50" size="30" value="First Name">
</td>
</tr>
<tr>
<td valign="top">
<label for="last_name">Last Name *</label>
</td>
<td valign="top">
<input type="text" name="last_name" maxlength="50" size="30" value="Last Name">
</td>
</tr>
<tr>

<td valign="top">
<label for="email">Email Address *</label>
</td>
<td valign="top">
<input type="text" name="email" maxlength="80" size="30" value="Email Address">
</td>
</tr>
<tr>


<td valign="top">
<label for="telephone">Telephone Number</label>
</td>
<td valign="top">
<input type="text" name="telephone" maxlength="30" size="30" value="Phone No">
</td>
</tr>
<tr>



<td valign="top">
<label for="comments">Message *</label>
</td>
<td valign="top">
<textarea name="comments" maxlength="1000" cols="25" rows="6"> Write your message </textarea>
</td>
</tr>

<tr>
<td colspan="2" style="text-align:center"><input type="submit" value="Submit">
</td>
</tr>
</table>
</form>

**** End Code ****

***********************************************************
Now Create html_form_send.php

create html_form_send.php page and copy code given below and paste on html_form_send.php .
**** code start***

<?php if(isset($_POST['email'])) { // CHANGE THE TWO LINES BELOW $email_to = "yourname@yourcompany.com"; $email_subject = "website html form submissions"; function died($error) { // your error code can go here echo "We are very sorry, but there were error(s) found with the form you submitted. "; echo "These errors appear below.<br /><br />"; echo $error."<br /><br />"; echo "Please go back and fix these errors.<br /><br />"; die(); } // validation expected data exists if(!isset($_POST['first_name']) || !isset($_POST['last_name']) || !isset($_POST['email']) || !isset($_POST['telephone']) || !isset($_POST['comments'])) { died('We are sorry, but there appears to be a problem with the form you submitted.'); } $first_name = $_POST['first_name']; // required $last_name = $_POST['last_name']; // required $email_from = $_POST['email']; // required $telephone = $_POST['telephone']; // not required $comments = $_POST['comments']; // required $error_message = ""; $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/'; if(!preg_match($email_exp,$email_from)) { $error_message .= 'The Email Address you entered does not appear to be valid.<br />'; } $string_exp = "/^[A-Za-z .'-]+$/"; if(!preg_match($string_exp,$first_name)) { $error_message .= 'The First Name you entered does not appear to be valid.<br />'; } if(!preg_match($string_exp,$last_name)) { $error_message .= 'The Last Name you entered does not appear to be valid.<br />'; } if(strlen($comments) < 2) { $error_message .= 'The Comments you entered do not appear to be valid.<br />'; } if(strlen($error_message) > 0) { died($error_message); } $email_message = "Form details below.\n\n"; function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } $email_message .= "First Name: ".clean_string($first_name)."\n"; $email_message .= "Last Name: ".clean_string($last_name)."\n"; $email_message .= "Email: ".clean_string($email_from)."\n"; $email_message .= "Telephone: ".clean_string($telephone)."\n"; $email_message .= "Comments: ".clean_string($comments)."\n"; // create email headers $headers = 'From: '.$email_from."\r\n". 'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); ?> <!-- place your own success html below --> Thank you for contacting us. We will be in touch with you very soon.<br><br> <button><a href="http://sakhihosting.com">Back to Home Page </a></button> <?php } die(); ?>

**** End Code ****