Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 9.26 KB | None | 0 0
  1. <?php
  2.  
  3.   include 'config.php';
  4.   if ($referrer)
  5.   {
  6.     session_register ('referrer');
  7.     $_SESSION[referrer] = $referrer;
  8.     $s_ip = $_SERVER['REMOTE_ADDR'];
  9.     $l_referrer = get_uid ($referrer);
  10.     clickcnt ($l_referrer, $s_ip);
  11.     verirefid ($referrenceid, $l_referrer, 'CLK');
  12.   }
  13.  
  14.   if ($referrenceid)
  15.   {
  16.     session_register ('referrenceid');
  17.     $_SESSION[referrenceid] = $referrenceid;
  18.   }
  19.  
  20.   header_g ();
  21.   $country_list = country_list ('' . $f_country_id);
  22.   if (!$act)
  23.   {
  24.     $setctrlfocus = 'f_emailaddress';
  25.     $template->set_filenames (array ('index' => '' . $template_path . '/signup.tpl'));
  26.     $template->assign_vars (array ('SITETITLE' => $site_title, 'SETCTRLFOCUS' => $setctrlfocus, 'COUNTRY_LIST' => $country_list));
  27.     $template->pparse ('index');
  28.   }
  29.   else
  30.   {
  31.     if ($act == 'reg')
  32.     {
  33.       $f_emailaddress = trim ($f_emailaddress);
  34.       $setctrlfocus = '';
  35.       if ($f_emailaddress == '')
  36.       {
  37.         $error .= '<li>Please enter a valid Email!</li>';
  38.         if (!$setctrlfocus)
  39.         {
  40.           $setctrlfocus = 'f_emailaddress';
  41.         }
  42.       }
  43.       else
  44.       {
  45.         if (check_useremail ($f_emailaddress))
  46.         {
  47.           $error .= '<li>Email already used by other user</li>';
  48.           if (!$setctrlfocus)
  49.           {
  50.             $setctrlfocus = 'f_emailaddress';
  51.           }
  52.         }
  53.  
  54.         if (((!$f_emailaddress OR $f_emailaddress == '') OR !eregi ('' . '^[_\\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\\.)+[a-z]{2,6}$', $f_emailaddress)))
  55.         {
  56.           $error .= '<li>Please enter a valid Email</li>';
  57.           if (!$setctrlfocus)
  58.           {
  59.             $setctrlfocus = 'f_emailaddress';
  60.           }
  61.         }
  62.       }
  63.  
  64.       if ($f_emailaddress != $f_reemailaddress)
  65.       {
  66.         $error .= '<li>Verify Email Address Mismatched! </li>';
  67.         if (!$setctrlfocus)
  68.         {
  69.           $setctrlfocus = 'f_reemailaddress';
  70.         }
  71.       }
  72.  
  73.       $f_password = trim ($f_password);
  74.       if ($f_password == '')
  75.       {
  76.         $error .= '<li>Please enter a valid Password!</li>';
  77.         if (!$setctrlfocus)
  78.         {
  79.           $setctrlfocus = 'f_password';
  80.         }
  81.       }
  82.       else
  83.       {
  84.         if ((strlen ($f_password) < 5 OR 20 < strlen ($f_password)))
  85.         {
  86.           $error .= '<li>Password  must be between 5 and 20 characters long</li>';
  87.           if (!$setctrlfocus)
  88.           {
  89.             $setctrlfocus = 'f_password';
  90.           }
  91.         }
  92.       }
  93.  
  94.       if ($f_password != $f_repassword)
  95.       {
  96.         $error .= '<li>Verify password Mismatched! </li>';
  97.         if (!$setctrlfocus)
  98.         {
  99.           $setctrlfocus = 'f_repassword';
  100.         }
  101.       }
  102.  
  103.       if (($f_emailaddress AND $f_emailaddress == $f_password))
  104.       {
  105.         $error .= '<li>Email Address & password should not be same </li>';
  106.         if (!$setctrlfocus)
  107.         {
  108.           $setctrlfocus = 'f_password';
  109.         }
  110.       }
  111.  
  112.       $f_fname = trim ($f_fname);
  113.       if ($f_fname == '')
  114.       {
  115.         $error .= '<li>Enter the First Name</li>';
  116.         if (!$setctrlfocus)
  117.         {
  118.           $setctrlfocus = 'f_fname';
  119.         }
  120.       }
  121.  
  122.       $f_lname = trim ($f_lname);
  123.       if ($f_lname == '')
  124.       {
  125.         $error .= '<li>Enter the Last Name</li>';
  126.         if (!$setctrlfocus)
  127.         {
  128.           $setctrlfocus = 'f_lname';
  129.         }
  130.       }
  131.  
  132.       $f_address1 = trim ($f_address1);
  133.       if ($f_address1 == '')
  134.       {
  135.         $error .= '<li>Enter the Address</li>';
  136.         if (!$setctrlfocus)
  137.         {
  138.           $setctrlfocus = 'f_address1';
  139.         }
  140.       }
  141.  
  142.       $f_zip = trim ($f_zip);
  143.       if ($f_state == '')
  144.       {
  145.         $error .= '<li>Enter Zip/Postal code</li>';
  146.         if (!$setctrlfocus)
  147.         {
  148.           $setctrlfocus = 'f_zip';
  149.         }
  150.       }
  151.  
  152.       $f_city = trim ($f_city);
  153.       if ($f_city == '')
  154.       {
  155.         $error .= '<li>Enter the City</li>';
  156.         if (!$setctrlfocus)
  157.         {
  158.           $setctrlfocus = 'f_city';
  159.         }
  160.       }
  161.  
  162.       $f_state = trim ($f_state);
  163.       if ($f_state == '')
  164.       {
  165.         $error .= '<li>Enter the State</li>';
  166.         if (!$setctrlfocus)
  167.         {
  168.           $setctrlfocus = 'f_state';
  169.         }
  170.       }
  171.  
  172.       if (!$f_terms)
  173.       {
  174.         $error .= '<li>You must agree our terms & Conditions for membership </li>';
  175.         if (!$setctrlfocus)
  176.         {
  177.           $setctrlfocus = 'f_terms';
  178.         }
  179.       }
  180.  
  181.       if (!$error)
  182.       {
  183.         $s_referrer = $_SESSION[referrer];
  184.         if ($s_referrer)
  185.         {
  186.           $s_referrer = get_uid ($s_referrer);
  187.         }
  188.  
  189.         $s_referrenceid = $_SESSION[referrenceid];
  190.         if ($s_referrenceid)
  191.         {
  192.           if (verirefid ($s_referrenceid, $s_referrer))
  193.           {
  194.             $s_referrertype = 'p';
  195.           }
  196.           else
  197.           {
  198.             $s_referrertype = 'g';
  199.           }
  200.         }
  201.  
  202.         $s_ip = $_SERVER['REMOTE_ADDR'];
  203.         mt_srand ((double)microtime () * 1000000);
  204.         $maxran = 1000000;
  205.         $check_num = mt_rand (0, $maxran);
  206.         $l_confirm_code = md5 ($check_num);
  207.         $sql = '' . '
  208.                insert into ' . $tb_users . '
  209.                (
  210.                    password,
  211.                    email,
  212.                    fname,
  213.                    lname,
  214.                    address1,
  215.                    address2,
  216.                    zip,
  217.                    city,
  218.                    state,
  219.                    country_id,
  220.                    phone,
  221.                    fax,
  222.                    signup_date,
  223.                    referrer_id,
  224.                    referrer_type,
  225.                    ip,
  226.                    confirmcode
  227.                )
  228.                values
  229.                (
  230.                    \'' . addslashes ($f_password) . '\',
  231.                    \'' . addslashes ($f_emailaddress) . '\' ,
  232.                    \'' . addslashes ($f_fname) . '\',
  233.                    \'' . addslashes ($f_lname) . '\',
  234.                    \'' . addslashes ($f_address1) . '\',
  235.                    \'' . addslashes ($f_address2) . '\',
  236.                    \'' . addslashes ($f_zip) . '\',
  237.                    \'' . addslashes ($f_city) . '\',
  238.                    \'' . addslashes ($f_state) . ('' . '\',
  239.                    \'' . $f_country_id . '\',
  240.                    \'') . addslashes ($f_phone) . '\',
  241.                    \'' . addslashes ($f_fax) . '\',
  242.                    now(),
  243.                    \'' . addslashes ($s_referrer) . '\',
  244.                    \'' . addslashes ($s_referrertype) . ('' . '\',
  245.                    \'' . $s_ip . '\',
  246.                    \'' . $l_confirm_code . '\'
  247.                )');
  248.         if (!($res = mysql_query ($sql)))
  249.         {
  250.           exit (mysql_error ());
  251.           (bool)true;
  252.         }
  253.  
  254.         $finishlink = '' . 'Before login you must activate your registration.
  255.             ' . $base_url . '/activation.php?op=reg&username=' . $f_emailaddress . '&check_num=' . $l_confirm_code;
  256.         $mailbody = readfilecontent ('' . $emailtpl_path . '/tpl_userjoinconfirmation.tpl');
  257.         $mailsubject = '' . 'User Activation Link From ' . $site_title;
  258.         $mail = new Mail ();
  259.         $mail->To ($f_emailaddress);
  260.         $mail->From ('' . $admin_name . ' <' . $admin_mail . '>');
  261.         $mail->ContentType (($settings['mail_format'] == 'h' ? 'text/html' : 'text/plain'));
  262.         $mail->Subject ($mailsubject);
  263.         $mail->Template ($mailbody);
  264.         $mail->Vars (array ('HOME_URL' => $base_url, 'SITE_TITLE' => $site_title, 'FNAME' => $f_fname, 'USERNAME' => $f_emailaddress, 'PASSWORD' => $f_password, 'FINISHLINK' => $finishlink));
  265.         $mail->Send ();
  266.         $msg = 'Confirmation request email was sent to your email address.
  267.            Please click on confirmation link in the email  in order to be able
  268.            to use your account';
  269.         $errortemplates = readfilecontent ('' . $template_path . '/error.tpl');
  270.         $errortemplates = str_replace ('{ERROR_MESSAGES}', $msg, $errortemplates);
  271.         $errortemplates = str_replace ('{BASE_URL}', $base_url, $errortemplates);
  272.         $template->set_filenames (array ('helplog' => '' . $template_path . '/blank.tpl'));
  273.         $template->assign_vars (array ('ERROR_MESSAGES' => $errortemplates));
  274.         $template->pparse ('helplog');
  275.       }
  276.       else
  277.       {
  278.         $errortemplates = readfilecontent ('' . $template_path . '/error.tpl');
  279.         $errortemplates = str_replace ('{BASE_URL}', $base_url, $errortemplates);
  280.         $errortemplates = str_replace ('{ERROR_MESSAGES}', $error, $errortemplates);
  281.         $template->set_filenames (array ('index' => '' . $template_path . '/signup.tpl'));
  282.         $template->assign_vars (array ('ERROR_MESSAGES' => $errortemplates, 'SETCTRLFOCUS' => $setctrlfocus, 'SITETITLE' => $site_title, 'F_EMAILADDRESS' => $f_emailaddress, 'F_REEMAILADDRESS' => $f_reemailaddress, 'F_PASSWORD' => $f_password, 'F_REPASSWORD' => $f_repassword, 'F_FNAME' => $f_fname, 'F_LNAME' => $f_lname, 'F_ADDRESS1' => $f_address1, 'F_ADDRESS2' => $f_address2, 'F_ZIP' => $f_zip, 'F_CITY' => $f_city, 'F_STATE' => $f_state, 'COUNTRY_LIST' => $country_list, 'F_FAX' => $f_fax, 'F_PHONE' => $f_phone));
  283.         $template->pparse ('index');
  284.       }
  285.     }
  286.   }
  287.  
  288.   inter_g ();
  289.   footer ();
  290.  
  291. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement