Advertisement
Guest User

Untitled

a guest
Oct 30th, 2017
400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 26.24 KB | None | 0 0
  1. <?PHP
  2. //CREATE ACCOUNT FORM PAGE
  3. if($action == "")
  4. {
  5.     $main_content .= '<script type="text/javascript">
  6.  
  7. var accountHttp;
  8.  
  9. //sprawdza czy dane konto istnieje czy nie
  10. function checkAccount()
  11. {
  12.     if(document.getElementById("account_name").value=="")
  13.     {
  14.         document.getElementById("acc_name_check").innerHTML = \'<b><font color="red">Please enter account name.</font></b>\';
  15.         return;
  16.     }
  17.     accountHttp=GetXmlHttpObject();
  18.     if (accountHttp==null)
  19.     {
  20.         return;
  21.     }
  22.     var account = document.getElementById("account_name").value;
  23.     var url="ajax/check_account.php?account=" + account + "&uid="+Math.random();
  24.     accountHttp.onreadystatechange=AccountStateChanged;
  25.     accountHttp.open("GET",url,true);
  26.     accountHttp.send(null);
  27. }
  28.  
  29. function AccountStateChanged()
  30. {
  31.     if (accountHttp.readyState==4)
  32.     {
  33.         document.getElementById("acc_name_check").innerHTML=accountHttp.responseText;
  34.     }
  35. }
  36.  
  37. var emailHttp;
  38.  
  39. //sprawdza czy dane konto istnieje czy nie
  40. function checkEmail()
  41. {
  42.     if(document.getElementById("email").value=="")
  43.     {
  44.         document.getElementById("email_check").innerHTML = \'<b><font color="red">Please enter e-mail.</font></b>\';
  45.         return;
  46.     }
  47.     emailHttp=GetXmlHttpObject();
  48.     if (emailHttp==null)
  49.     {
  50.         return;
  51.     }
  52.     var email = document.getElementById("email").value;
  53.     var url="ajax/check_email.php?email=" + email + "&uid="+Math.random();
  54.     emailHttp.onreadystatechange=EmailStateChanged;
  55.     emailHttp.open("GET",url,true);
  56.     emailHttp.send(null);
  57. }
  58.  
  59. function EmailStateChanged()
  60. {
  61.     if (emailHttp.readyState==4)
  62.     {
  63.         document.getElementById("email_check").innerHTML=emailHttp.responseText;
  64.     }
  65. }
  66.  
  67.     function validate_required(field,alerttxt)
  68.     {
  69.     with (field)
  70.     {
  71.     if (value==null||value==""||value==" ")
  72.       {alert(alerttxt);return false;}
  73.     else {return true}
  74.     }
  75.     }
  76.  
  77.     function validate_email(field,alerttxt)
  78.     {
  79.     with (field)
  80.     {
  81.     apos=value.indexOf("@");
  82.     dotpos=value.lastIndexOf(".");
  83.     if (apos<1||dotpos-apos<2)
  84.       {alert(alerttxt);return false;}
  85.     else {return true;}
  86.     }
  87.     }
  88.  
  89.     function validate_form(thisform)
  90.     {
  91.     with (thisform)
  92.     {
  93.     if (validate_required(account_name,"Please enter name of new account!")==false)
  94.       {account_name.focus();return false;}
  95.     if (validate_required(email,"Please enter your e-mail!")==false)
  96.       {email.focus();return false;}
  97.     if (validate_email(email,"Invalid e-mail format!")==false)
  98.       {email.focus();return false;}
  99.     if (verifpass==1) {
  100.     if (validate_required(passor,"Please enter password!")==false)
  101.       {passor.focus();return false;}
  102.     if (validate_required(passor2,"Please repeat password!")==false)
  103.       {passor2.focus();return false;}
  104.     if (passor2.value!=passor.value)
  105.       {alert(\'Repeated password is not equal to password!\');return false;}
  106.     }
  107.     if (verifya==1) {
  108.     if (validate_required(verify,"Please enter verification code!")==false)
  109.       {verify.focus();return false;}
  110.     }
  111.     if(rules.checked==false)
  112.       {alert(\'To create account you must accept server rules!\');return false;}
  113.     }
  114.     }
  115.     </script>';
  116.     $main_content .= 'To play on '.$config['server']['serverName'].' you need an account.
  117.                         All you have to do to create your new account is to enter your email address, password to new account, verification code from picture and to agree to the terms presented below.
  118.                         If you have done so, your account name, password and e-mail address will be shown on the following page and your account and password will be sent
  119.                         to your email address along with further instructions.<BR><BR>
  120.                         <FORM ACTION="?subtopic=createaccount&action=saveaccount" onsubmit="return validate_form(this)" METHOD=post>
  121.                         <TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
  122.                         <TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" CLASS=white><B>Create a '.$config['server']['serverName'].' Account</B></TD></TR>
  123.                         <TR><TD BGCOLOR="'.$config['site']['darkborder'].'"><TABLE BORDER=0 CELLSPACING=8 CELLPADDING=0>
  124.                           <TR><TD>
  125.                             <TABLE BORDER=0 CELLSPACING=5 CELLPADDING=0>';
  126.     $main_content .= '<TR><TD width="150" valign="top"><B>Account name: </B></TD><TD colspan="2"><INPUT id="account_name" NAME="reg_name" onkeyup="checkAccount();" VALUE="" SIZE=30 MAXLENGTH=50><BR><font size="1" face="verdana,arial,helvetica">(Please enter your new account name)</font></TD></TR>
  127.                       <TR><TD width="150"><b>Name status:</b></TD><TD colspan="2"><b><div id="acc_name_check">Please enter your account name.</div></b></TD></TR>
  128.                     <TR><TD width="150" valign="top"><B>Email address: </B></TD><TD colspan="2"><INPUT id="email" NAME="reg_email" onkeyup="checkEmail();" VALUE="" SIZE=30 MAXLENGTH=50><BR><font size="1" face="verdana,arial,helvetica">(Your email address is required to recovery a '.$config['server']['serverName'].' account)</font></TD></TR>
  129.                       <TR><TD width="150"><b>Email status:</b></TD><TD colspan="2"><b><div id="email_check">Please enter your e-mail.</div></b></TD></TR>';
  130.                                $main_content .= '<TR><TD width="150"><b>Select Country:</b></TD><TD colspan="2"><b><select name="country">
  131.                    <option value="">Please choose</option><option value="af"> Afghanistan </option><option value="al"> Albania </option><option value="dz"> Algeria </option><option value="as"> American Samoa </option><option value="ad"> Andorra </option><option value="ao"> Angola </option><option value="ai"> Anguilla </option><option value="aq"> Antarctica </option><option value="ag"> Antigua and Barbuda </option><option value="ar"> Argentina </option>
  132.  
  133.                    <option value="am"> Armenia </option><option value="aw"> Aruba </option><option value="au"> Australia </option><option value="at"> Austria </option><option value="az"> Azerbaijan </option><option value="bs"> Bahamas </option><option value="bh"> Bahrain </option><option value="bd"> Bangladesh </option><option value="bb"> Barbados </option><option value="by"> Belarus </option><option value="be"> Belgium </option><option value="bz"> Belize </option><option value="bj"> Benin </option><option value="bm"> Bermuda </option><option value="bt"> Bhutan </option><option value="bo"> Bolivia </option><option value="ba"> Bosnia and Herzegowina </option><option value="bw"> Botswana </option><option value="bv"> Bouvet Island </option><option value="br"> Brazil </option><option value="io"> British Indian Ocean Territory </option><option value="bn"> Brunei Darussalam </option><option value="bg"> Bulgaria </option><option value="bf"> Burkina Faso </option><option value="bi"> Burundi </option>                                     <option value="kh"> Cambodia </option><option value="cm"> Cameroon </option><option value="ca"> Canada </option><option value="cv"> Cape Verde </option><option value="ky"> Cayman Islands </option><option value="cf"> Central African Republic </option><option value="td"> Chad </option><option value="cl"> Chile </option><option value="cn"> China </option><option value="cx"> Christmas Island </option><option value="cc"> Cocos Islands </option><option value="co"> Colombia </option><option value="km"> Comoros </option><option value="cd"> Congo </option><option value="cg"> Congo </option><option value="ck"> Cook Islands </option><option value="cr"> Costa Rica </option><option value="ci"> Cote DIvoire </option><option value="hr"> Croatia </option><option value="cu"> Cuba </option><option value="cy"> Cyprus </option><option value="cz"> Czech Republic </option><option value="dk"> Denmark </option><option value="dj"> Djibouti </option><option value="dm"> Dominica </option>
  134.  
  135.                    <option value="do"> Dominican Republic </option><option value="tp"> East Timor </option><option value="ec"> Ecuador </option><option value="eg"> Egypt </option><option value="sv"> El Salvador </option><option value="gq"> Equatorial Guinea </option><option value="er"> Eritrea </option><option value="ee"> Estonia </option><option value="et"> Ethiopia </option><option value="fk"> Falkland Islands </option><option value="fo"> Faroe Islands </option><option value="fj"> Fiji </option><option value="fi"> Finland </option><option value="fr"> France </option><option value="gf"> French Guiana </option><option value="pf"> French Polynesia </option><option value="tf"> French Southern Territories </option><option value="ga"> Gabon </option><option value="gm"> Gambia </option><option value="ge"> Georgia </option><option value="de"> Germany </option><option value="gh"> Ghana </option><option value="gi"> Gibraltar </option><option value="gr"> Greece </option>
  136.  
  137.                    <option value="gl"> Greenland </option><option value="gd"> Grenada </option><option value="gp"> Guadeloupe </option><option value="gu"> Guam </option><option value="gt"> Guatemala </option><option value="gn"> Guinea </option><option value="gw"> Guinea-Bissau </option><option value="gy"> Guyana </option><option value="ht"> Haiti </option><option value="hm"> Heard and Mc Donald Islands </option><option value="hn"> Honduras </option><option value="hk"> Hong Kong </option><option value="hu"> Hungary </option><option value="is"> Iceland </option><option value="in"> India </option><option value="id"> Indonesia </option><option value="ir"> Iran </option><option value="iq"> Iraq </option><option value="ie"> Ireland </option><option value="il"> Israel </option><option value="it"> Italy </option><option value="jm"> Jamaica </option><option value="jp"> Japan </option><option value="jo"> Jordan </option><option value="kz"> Kazakhstan </option><option value="ke"> Kenya </option>
  138.  
  139.                    <option value="ki"> Kiribati </option><option value="kr"> Korea </option><option value="kp"> Korea </option><option value="kw"> Kuwait </option><option value="kg"> Kyrgyzstan </option><option value="la"> Lao Peoples Democratic Republic </option><option value="lv"> Latvia </option><option value="lb"> Lebanon </option><option value="ls"> Lesotho </option><option value="lr"> Liberia </option><option value="ly"> Libyan Arab Jamahiriya </option><option value="li"> Liechtenstein </option><option value="lt"> Lithuania </option><option value="lu"> Luxembourg </option><option value="mo"> Macau </option><option value="mk"> Macedonia </option><option value="mg"> Madagascar </option><option value="mw"> Malawi </option><option value="my"> Malaysia </option><option value="mv"> Maldives </option><option value="ml"> Mali </option><option value="mt"> Malta </option><option value="mh"> Marshall Islands </option><option value="mq"> Martinique </option>
  140.  
  141.                    <option value="mr"> Mauritania </option><option value="mu"> Mauritius </option><option value="yt"> Mayotte </option><option value="mx"> Mexico </option><option value="fm"> Micronesia </option><option value="md"> Moldova </option><option value="mc"> Monaco </option><option value="mn"> Mongolia </option><option value="ms"> Montserrat </option><option value="ma"> Morocco </option><option value="mz"> Mozambique </option><option value="mm"> Myanmar </option><option value="na"> Namibia </option><option value="nr"> Nauru </option><option value="np"> Nepal </option><option value="nl"> Netherlands </option><option value="an"> Netherlands Antilles </option><option value="nc"> New Caledonia </option><option value="nz"> New Zealand </option><option value="ni"> Nicaragua </option><option value="ne"> Niger </option><option value="ng"> Nigeria </option><option value="nu"> Niue </option><option value="nf"> Norfolk Island </option><option value="mp"> Northern Mariana Islands </option>
  142.  
  143.                    <option value="no"> Norway </option><option value="om"> Oman </option><option value="pk"> Pakistan </option><option value="pw"> Palau </option><option value="pa"> Panama </option><option value="pg"> Papua New Guinea </option><option value="py"> Paraguay </option><option value="pe"> Peru </option><option value="ph"> Philippines </option><option value="pn"> Pitcairn </option><option value="pl"> Poland </option><option value="pt"> Portugal </option><option value="pr"> Puerto Rico </option><option value="qa"> Qatar </option><option value="re"> Reunion </option><option value="ro"> Romania </option><option value="ru"> Russian Federation </option><option value="rw"> Rwanda </option><option value="kn"> Saint Kitts and Nevis </option><option value="lc"> Saint Lucia </option><option value="ws"> Samoa </option><option value="sm"> San Marino </option><option value="st"> Sao Tome and Principe </option><option value="sa"> Saudi Arabia </option><option value="sn"> Senegal </option>
  144.  
  145.                    <option value="sc"> Seychelles </option><option value="sl"> Sierra Leone </option><option value="sg"> Singapore </option><option value="sk"> Slovakia </option><option value="si"> Slovenia </option><option value="sb"> Solomon Islands </option><option value="so"> Somalia </option><option value="za"> South Africa </option><option value="es"> Spain </option><option value="lk"> Sri Lanka </option><option value="sh"> St. Helena </option><option value="pm"> St. Pierre and Miquelon </option><option value="sd"> Sudan </option><option value="sr"> Suriname </option><option value="sj"> Svalbard and Jan Mayen Islands </option><option value="sz"> Swaziland </option><option value="se"> Sweden </option><option value="ch"> Switzerland </option><option value="sy"> Syrian Arab Republic </option><option value="tw"> Taiwan </option><option value="tj"> Tajikistan </option><option value="tz"> Tanzania </option>
  146.  
  147.                    <option value="th"> Thailand </option><option value="tg"> Togo </option><option value="tk"> Tokelau </option><option value="to"> Tonga </option>
  148.                    <option value="tt"> Trinidad and Tobago </option><option value="tn"> Tunisia </option><option value="tr"> Turkey </option><option value="tm"> Turkmenistan </option><option value="tc"> Turks and Caicos Islands </option><option value="tv"> Tuvalu </option><option value="ug"> Uganda </option><option value="ua"> Ukraine </option><option value="ae"> United Arab Emirates </option><option value="gb"> United Kingdom </option><option value="us"> United States </option><option value="uy"> Uruguay </option><option value="uz"> Uzbekistan </option><option value="vu"> Vanuatu </option><option value="va"> Vatican </option><option value="ve"> Venezuela </option><option value="vn"> Viet Nam </option><option value="vg"> Virgin Islands (British) </option><option value="vi"> Virgin Islands (US) </option>
  149.  
  150.                    <option value="wf"> Wallis and Futuna Islands </option><option value="eh"> Western Sahara </option><option value="ye"> Yemen </option><option value="yu"> Yugoslavia </option><option value="zm"> Zambia </option><option value="zw"> Zimbabwe </option>
  151.                  </select>';
  152.  
  153.     if(!$config['site']['create_account_verify_mail'])
  154.     $main_content .= '<script type="text/javascript">var verifpass=1;</script>
  155.                         <TR><TD width="150" valign="top"><B>Password: </B></TD><TD colspan="2"><INPUT TYPE="password" id="passor" NAME="reg_password" VALUE="" SIZE=30 MAXLENGTH=50><BR><font size="1" face="verdana,arial,helvetica">(Here write your password to new account on '.$config['server']['serverName'].')</font></TD></TR>
  156.                       <TR><TD width="150" valign="top"><B>Repeat password: </B></TD><TD colspan="2"><INPUT TYPE="password" id="passor2" NAME="reg_password2" VALUE="" SIZE=30 MAXLENGTH=50><BR><font size="1" face="verdana,arial,helvetica">(Repeat your password)</font></TD></TR>';
  157.     else
  158. {
  159. }
  160.     $main_content .= '</TABLE>
  161.                       </TD></TR>
  162.                       <TR><TD>
  163.                         <TABLE BORDER=0 CELLSPACING=5 CELLPADDING=0><TR><TD>
  164.                            Please review the following terms and state your agreement below.
  165.                         </TD></TR>
  166.                         <TR><TD>
  167.                           <B>'.$config['server']['serverName'].' Rules</B><BR>
  168.                           <TEXTAREA ROWS="16" WRAP="physical" COLS="75" READONLY="true">';
  169.     //load server rules from file
  170.     include("tibiarules.php");
  171.     $main_content .= '</TEXTAREA>
  172.                         </TD></TR></TABLE>
  173.                       </TD></TR>
  174.                       <TR><TD>
  175.                         <TABLE BORDER=0 CELLSPACING=5 CELLPADDING=0>
  176.                         <TR><TD>
  177.                           <INPUT TYPE="checkbox" NAME="rules" id="rules" value="true" /><label for="rules"><u> I agree to the '.$config['server']['serverName'].' Rules.</u></lable><BR>
  178.                         </TD></TR>
  179.                         <TR><TD>
  180.                           If you fully agree to these terms, click on the "I Agree" button in order to create a '.$config['server']['serverName'].' account.<BR>
  181.                           If you do not agree to these terms or do not want to create a '.$config['server']['serverName'].' account, please click on the "Cancel" button.
  182.                         </TD></TR></TABLE>
  183.                       </TD></TR>
  184.                     </TABLE></TD></TR>
  185.                     </TABLE>
  186.                     <BR>
  187.                     <TABLE BORDER=0 WIDTH=100%>
  188.                       <TR><TD ALIGN=center>
  189.                         <IMG SRC="'.$layout_name.'/images/general/blank.gif" WIDTH=120 HEIGHT=1 BORDER=0><BR>
  190.                       </TD><TD ALIGN=center VALIGN=top>
  191.                         <INPUT TYPE=image NAME="I Agree" SRC="'.$layout_name.'/images/buttons/sbutton_iagree.gif" BORDER=0 WIDTH=120 HEIGHT=18>
  192.                         </FORM>
  193.                       </TD><TD ALIGN=center>
  194.                         <FORM  ACTION="?subtopic=latestnews" METHOD=post>
  195.                         <INPUT TYPE=image NAME="Cancel" SRC="'.$layout_name.'/images/buttons/sbutton_cancel.gif" BORDER=0 WIDTH=120 HEIGHT=18>
  196.                         </FORM>
  197.                       </TD><TD ALIGN=center>
  198.                         <IMG SRC="/images/general/blank.gif" WIDTH=120 HEIGHT=1 BORDER=0><BR>
  199.                       </TD></TR>
  200.                     </TABLE>
  201.                     </TD>
  202.                     <TD><IMG SRC="'.$layout_name.'/images/general/blank.gif" WIDTH=10 HEIGHT=1 BORDER=0></TD>
  203.                     </TR>
  204.                     </TABLE>';
  205. }
  206. //CREATE ACCOUNT PAGE (save account in database)
  207. if($action == "saveaccount") {
  208.       $reg_country = trim($_POST['country']);
  209.     $reg_name = strtoupper(trim($_POST['reg_name']));
  210.     $reg_email = trim($_POST['reg_email']);
  211.     $reg_password = trim($_POST['reg_password']);
  212.     $reg_code = trim($_POST['reg_code']);
  213.     //FIRST check
  214.     //check e-mail
  215.     if(empty($reg_name))
  216.         $reg_form_errors[] = "Please enter account name.";
  217.     elseif(!check_account_name($reg_name))
  218.         $reg_form_errors[] = "Invalid account name format. Use only A-Z and numbers 0-9.";
  219.     if(empty($reg_email))
  220.         $reg_form_errors[] = "Please enter your email address.";
  221.     else
  222.     {
  223.         if(!check_mail($reg_email))
  224.             $reg_form_errors[] = "E-mail address is not correct.";
  225.     }
  226.     if($config['site']['verify_code'])
  227.     {
  228.  
  229.      }
  230.     //check password
  231.     if(empty($reg_password) && !$config['site']['create_account_verify_mail'])
  232.         $reg_form_errors[] = "Please enter password to your new account.";
  233.     elseif(!$config['site']['create_account_verify_mail'])
  234.     {
  235.         if(!check_password($reg_password))
  236.             $reg_form_errors[] = "Password contains illegal chars (a-z, A-Z and 0-9 only!) or lenght.";
  237.     }
  238.     //SECOND check
  239.     //check e-mail address in database
  240.     if(empty($reg_form_errors))
  241.     {
  242.         if($config['site']['one_email'])
  243.         {
  244.             $test_email_account = $ots->createObject('Account');
  245.             //load account with this e-mail
  246.             $test_email_account->findByEmail($reg_email);
  247.             if($test_email_account->isLoaded())
  248.                 $reg_form_errors[] = "Account with this e-mail address already exist in database.";
  249.         }
  250.         $account_db = new OTS_Account();
  251.         $account_db->find($reg_name);
  252.         if($account_db->isLoaded())
  253.             $reg_form_errors[] = 'Account with this name already exist.';
  254.     }
  255.     // ----------creates account-------------(save in database)
  256.     if(empty($reg_form_errors))
  257.     {
  258.         //create object 'account' and generate new acc. number
  259.         if($config['site']['create_account_verify_mail'])
  260.         {
  261.             $reg_password = '';
  262.             for ($i = 1; $i <= 6; $i++)
  263.                 $reg_password .= mt_rand(0,9);
  264.         }
  265.         $reg_account = $ots->createObject('Account');
  266.         $number = $reg_account->create(0, 9999999, $reg_name);
  267.         // saves account information in database
  268.         $reg_account->setPassword(password_ency($reg_password));
  269.         $reg_account->setEMail($reg_email);
  270.         $reg_account->setCustomField("flag", $reg_country);
  271.         $reg_account->unblock();
  272.         $reg_account->save();
  273.         if($config['site']['newaccount_premdays'])
  274.         {
  275.             $reg_account->setCustomField("premdays", $config['site']['newaccount_premdays']);
  276.             $reg_account->setCustomField("lastday", time());
  277.         }
  278.         //show information about registration
  279.         if($config['site']['send_emails'] && $config['site']['create_account_verify_mail'])
  280.         {
  281.             $mailBody = '<html>
  282.             <body>
  283.             <h3>Your account name and password!</h3>
  284.             <p>You or someone else registred on server <a href="'.$config['server']['url'].'"><b>'.$config['server']['serverName'].'</b></a> with this e-mail.</p>
  285.             <p>Account name: <b>'.$reg_name.'</b></p>
  286.             <p>Password: <b>'.trim($reg_password).'</b></p>
  287.             <br />
  288.             <p>After login you can:</p>
  289.             <li>Create new characters
  290.             <li>Change your current password
  291.             <li>Change your current e-mail
  292.             </body>
  293.             </html>';
  294.             require("phpmailer/class.phpmailer.php");
  295.             $mail = new PHPMailer();
  296.             if ($config['site']['smtp_enabled'] == "yes")
  297.             {
  298.                 $mail->IsSMTP();
  299.                 $mail->Host = $config['site']['smtp_host'];
  300.                 $mail->Port = (int)$config['site']['smtp_port'];
  301.                 $mail->SMTPAuth = ($config['site']['smtp_auth'] ? true : false);
  302.                 $mail->Username = $config['site']['smtp_user'];
  303.                 $mail->Password = $config['site']['smtp_pass'];
  304.             }
  305.             else
  306.                 $mail->IsMail();
  307.             $mail->IsHTML(true);
  308.             $mail->From = $config['site']['mail_address'];
  309.             $mail->AddAddress($reg_email);
  310.             $mail->Subject = $config['server']['serverName']." - Registration";
  311.             $mail->Body = $mailBody;
  312.             if($mail->Send())
  313.             {
  314.                 $main_content .= 'Your account has been created. Check your e-mail. See you in Tibia!<BR><BR>';
  315.                 $main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
  316.                 <TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" CLASS=white><B>Account Created</B></TD></TR>
  317.                 <TR><TD BGCOLOR="'.$config['site']['darkborder'].'">
  318.                   <TABLE BORDER=0 CELLPADDING=1><TR><TD>
  319.                     <BR>Your account name is <b>'.$reg_name.'</b>.
  320.                     <BR><b><i>You will receive e-mail (<b>'.$reg_email.'</b>) with your password.</b></i><br>';
  321.                 $main_content .= 'You will need the account name and your password to play on '.$config['server']['serverName'].'.
  322.                     Please keep your account name and password in a safe place and
  323.                     never give your account name or password to anybody.<BR><BR>';
  324.                 $main_content .= '<br /><small>These informations were send on email address <b>'.$reg_email.'</b>. Please check your inbox/spam folder.';
  325.             }
  326.             else
  327.             {
  328.                 $main_content .= '<br /><small>An error occorred while sending email! Account not created. Try again.</small>';
  329.                 $reg_account->delete();
  330.             }
  331.         }
  332.         else
  333.         {
  334.             $main_content .= 'Your account has been created. Now you can login and create your first character. See you in Tibia!<BR><BR>';
  335.             $main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
  336.             <TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" CLASS=white><B>Account Created</B></TD></TR>
  337.             <TR><TD BGCOLOR="'.$config['site']['darkborder'].'">
  338.               <TABLE BORDER=0 CELLPADDING=1><TR><TD>
  339.                 <BR>Your account name is <b>'.$reg_name.'</b><br>You will need the account name and your password to play on '.$config['server']['serverName'].'.
  340.                 Please keep your account name and password in a safe place and
  341.                 never give your account name or password to anybody.<BR><BR>';
  342.             if($config['site']['send_emails'] && $config['site']['send_register_email'])
  343.             {
  344.                 $mailBody = '<html>
  345.                 <body>
  346.                 <h3>Your account name and password!</h3>
  347.                 <p>You or someone else registred on server <a href="'.$config['server']['url'].'"><b>'.$config['server']['serverName'].'</b></a> with this e-mail.</p>
  348.                 <p>Account name: <b>'.$reg_name.'</b></p>
  349.                 <p>Password: <b>'.trim($reg_password).'</b></p>
  350.                 <br />
  351.                 <p>After login you can:</p>
  352.                 <li>Create new characters
  353.                 <li>Change your current password
  354.                 <li>Change your current e-mail
  355.                 </body>
  356.                 </html>';
  357.                 require("phpmailer/class.phpmailer.php");
  358.                 $mail = new PHPMailer();
  359.                 if ($config['site']['smtp_enabled'] == "yes")
  360.                 {
  361.                     $mail->IsSMTP();
  362.                     $mail->Host = $config['site']['smtp_host'];
  363.                     $mail->Port = (int)$config['site']['smtp_port'];
  364.                     $mail->SMTPAuth = ($config['site']['smtp_auth'] ? true : false);
  365.                     $mail->Username = $config['site']['smtp_user'];
  366.                     $mail->Password = $config['site']['smtp_pass'];
  367.                 }
  368.                 else
  369.                     $mail->IsMail();
  370.                 $mail->IsHTML(true);
  371.                 $mail->From = $config['site']['mail_address'];
  372.                 $mail->AddAddress($reg_email);
  373.                 $mail->Subject = $config['server']['serverName']." - Registration";
  374.                 $mail->Body = $mailBody;
  375.                 if($mail->Send())
  376.                     $main_content .= '<br /><small>These informations were send on email address <b>'.$reg_email.'</b>.';
  377.                 else
  378.                     $main_content .= '<br /><small>An error occorred while sending email (<b>'.$reg_email.'</b>)!</small>';
  379.             }
  380.         }
  381.         $main_content .= '</TD></TR></TABLE></TD></TR></TABLE><BR><BR>';
  382.     }
  383.     else
  384.     {
  385.         //SHOW ERRORs if data from form is wrong
  386.         $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
  387.         foreach($reg_form_errors as $show_msg)
  388.         {
  389.                     $main_content .= '<li>'.$show_msg;
  390.         }
  391.         $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br/>
  392.         <BR>
  393.         <CENTER>
  394.         <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION=?subtopic=createaccount METHOD=post><TR><TD>
  395.         <INPUT TYPE=hidden NAME=email VALUE="">
  396.  
  397.         <INPUT TYPE=image NAME="Back" ALT="Back" SRC="'.$layout_name.'/images/buttons/sbutton_back.gif" BORDER=0 WIDTH=120 HEIGHT=18>
  398.         </TD></TR></FORM></TABLE>
  399.         </CENTER>';
  400.     }
  401. }
  402. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement