Advertisement
Guest User

Untitled

a guest
Mar 29th, 2018
884
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 27.01 KB | None | 0 0
  1.  
  2. <?PHP
  3. //CREATE ACCOUNT FORM PAGE
  4.  
  5. if($action == "")
  6. {
  7. $main_content .= '<script type="text/javascript">
  8. var accountHttp;
  9.  
  10. //sprawdza czy dane konto istnieje czy nie
  11. function checkAccount()
  12. {
  13. if(document.getElementById("account_name").value=="")
  14. {
  15. document.getElementById("acc_name_check").innerHTML = \'<image src="../images/false.gif"> <font color="red">Prosze wprowadĹş numer konta.</font>\';
  16. return;
  17. }
  18. accountHttp=GetXmlHttpObject();
  19. if (accountHttp==null)
  20. {
  21. return;
  22. }
  23. var account = document.getElementById("account_name").value;
  24. var url="ajax/check_account.php?account=" + account + "&uid="+Math.random();
  25. accountHttp.onreadystatechange=AccountStateChanged;
  26. accountHttp.open("GET",url,true);
  27. accountHttp.send(null);
  28. }
  29.  
  30. function AccountStateChanged()
  31. {
  32. if (accountHttp.readyState==4)
  33. {
  34. document.getElementById("acc_name_check").innerHTML=accountHttp.responseText;
  35. }
  36. }
  37.  
  38. var emailHttp;
  39.  
  40. //sprawdza czy dane konto istnieje czy nie
  41. function checkEmail()
  42. {
  43. if(document.getElementById("email").value=="")
  44. {
  45. document.getElementById("email_check").innerHTML = \'<image src="../images/false.gif"> <font color="red">Please enter e-mail.</font>\';
  46. return;
  47. }
  48. emailHttp=GetXmlHttpObject();
  49. if (emailHttp==null)
  50. {
  51. return;
  52. }
  53. var email = document.getElementById("email").value;
  54. var url="ajax/check_email.php?email=" + email + "&uid="+Math.random();
  55. emailHttp.onreadystatechange=EmailStateChanged;
  56. emailHttp.open("GET",url,true);
  57. emailHttp.send(null);
  58. }
  59.  
  60. function EmailStateChanged()
  61. {
  62. if (emailHttp.readyState==4)
  63. {
  64. document.getElementById("email_check").innerHTML=emailHttp.responseText;
  65. }
  66. }
  67.  
  68. function validate_required(field,alerttxt)
  69. {
  70. with (field)
  71. {
  72. if (value==null||value==""||value==" ")
  73. {alert(alerttxt);return false;}
  74. else {return true}
  75. }
  76. }
  77.  
  78. function validate_email(field,alerttxt)
  79. {
  80. with (field)
  81. {
  82. apos=value.indexOf("@");
  83. dotpos=value.lastIndexOf(".");
  84. if (apos<1||dotpos-apos<2)
  85. {alert(alerttxt);return false;}
  86. else {return true;}
  87. }
  88. }
  89.  
  90. function validate_form(thisform)
  91. {
  92. with (thisform)
  93. {
  94. if (accountcustom==1) {
  95. if (validate_required(account_number,"Please enter number of new account!")==false)
  96. {account_number.focus();return false;}
  97. }
  98. if (validate_required(email,"Please enter your e-mail!")==false)
  99. {email.focus();return false;}
  100. if (validate_email(email,"Invalid e-mail format!")==false)
  101. {email.focus();return false;}
  102. if (verifpass==1)
  103. {
  104. if (validate_required(passor,"Please enter password!")==false)
  105. {passor.focus();return false;}
  106. if (validate_required(passor2,"Please repeat password!")==false)
  107. {passor2.focus();return false;}
  108. if (passor2.value!=passor.value)
  109. {alert(\'Repeated password is not equal to password!\');return false;}
  110. }
  111. if (verifya==1)
  112. {
  113. if (validate_required(verify,"Please enter verification code!")==false)
  114. {verify.focus();return false;}
  115. }
  116. if(rulesServer.checked==false)
  117. {alert(\'To create account you must accept server rules!\');return false;}
  118. }
  119. }
  120. </script>';
  121. $referrers = $_REQUEST['ref'];
  122. $main_content .= '
  123. <FORM ACTION="index.php?subtopic=createaccount&action=saveaccount" onsubmit="return validate_form(this)" METHOD=post>
  124. <TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
  125. <TR>
  126. <TD colspan="2" BGCOLOR="'.$config['site']['vdarkborder'].'" CLASS=white><B>Create a '.$config['site']['serverName'].' Account</B></TD>
  127. </TR>
  128. <script type="text/javascript">var accountcustom=0;</script>
  129. <TR BGCOLOR="'.$config['site']['darkborder'].'">
  130. <TD align="center" width="30%"><B>Email adress: </B></TD>
  131. <TD><INPUT id="email" NAME="reg_email" onkeyup="checkEmail();" VALUE="" SIZE=31 MAXLENGTH=250><font size="1" face="verdana,arial,helvetica"><div id="email_check">(Your email address is required to recovery a '.$config['site']['serverName'].' account)</div></font></TD>
  132. </TR>';
  133. if($config['site']['choose_countr'])
  134. {
  135. $main_content .= '<TR BGCOLOR="'.$config['site']['darkborder'].'">
  136. <TD align="center" width="30%"><b>Select Country:</b></TD>
  137. <TD colspan="2"><b>
  138. <select name="reg_country">
  139. <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>
  140. <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>
  141. <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>
  142. <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>
  143. <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>
  144. <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>
  145. <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>
  146. <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>
  147. <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>
  148. <option value="th"> Thailand </option><option value="tg"> Togo </option><option value="tk"> Tokelau </option><option value="to"> Tonga </option><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. <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>
  150. </select>
  151. </td>
  152. </tr>';
  153. }
  154. if(!$config['site']['create_account_verify_mail'])
  155. $main_content .= '<script type="text/javascript">var verifpass=1;</script>
  156. <TR BGCOLOR="'.$config['site']['darkborder'].'">
  157. <TD align="center" width="30%"><B>Password: </B></TD>
  158. <TD><INPUT TYPE="password" id="passor" NAME="reg_password" VALUE="" SIZE=31 MAXLENGTH=50><BR><font size="1" face="verdana,arial,helvetica">(Your password on '.$config['site']['serverName'].')</font></TD>
  159. </TR>
  160. <TR BGCOLOR="'.$config['site']['darkborder'].'">
  161. <TD align="center" width="30%"><B>Repeat password: </B></TD>
  162. <TD><INPUT TYPE="password" id="passor2" NAME="reg_password2" VALUE="" SIZE=31 MAXLENGTH=50><BR><font size="1" face="verdana,arial,helvetica">(Repeat your password)</font></TD>
  163. </TR>';
  164. else
  165. $main_content .= '<script type="text/javascript">var verifpass=0;</script>';
  166. if($config['site']['referrer'])
  167. $main_content .= '<TR BGCOLOR="'.$config['site']['darkborder'].'">
  168. <TD align="center" width="30%"><B>Referrer: </B></TD>
  169. <TD><INPUT TYPE="test" NAME="reg_referrer" VALUE="'.$referrers.'" SIZE=31 MAXLENGTH=50><BR><font size="1" face="verdana,arial,helvetica">(Here write your password to new account on '.$config['site']['serverName'].')</font></TD>
  170. </TR>';
  171. if($config['site']['verify_code'])
  172. {
  173. $main_content .= '
  174.  
  175. <script type="text/javascript">var verifya=1;</script>
  176. <TR BGCOLOR="'.$config['site']['darkborder'].'">
  177. <TD align="center" colspan="2"><B>Code:</B></TD>
  178. </TR>
  179. <TR BGCOLOR="'.$config['site']['darkborder'].'" class="white_form">
  180. <TD align="center" colspan="2"><div id="RecaptchaField"></div></TD>
  181. </TR>';
  182. }
  183. else
  184. $main_content .= '<script type="text/javascript">var verifya=0;</script>';
  185.  
  186. $main_content .= '
  187. <TR BGCOLOR="'.$config['site']['darkborder'].'">
  188. <TD colspan="2">Please review the following terms and state your agreement below.</TD>
  189. </TR>
  190. <TR BGCOLOR="'.$config['site']['darkborder'].'">
  191. <TD colspan="2">
  192. <INPUT TYPE="checkbox" NAME="rulesServer" id="rulesServer" value="true" /><label for="rulesServer"> <u>I agree to the <a href="index.php?subtopic=tibiarules">'.$config['site']['serverName'].' Rules</a>.</u></lable><BR>
  193. </TD>
  194. </TR>
  195. <TR BGCOLOR="'.$config['site']['darkborder'].'">
  196. <TD colspan="2">
  197. If you fully agree to these terms, click on the "I Agree" button in order to create a '.$config['site']['serverName'].'.<BR>
  198. If you do not agree to these terms or do not want to create a '.$config['site']['serverName'].' please click on the "Cancel" button.
  199. </TD>
  200. </TR>
  201. </TABLE><BR>
  202. <TABLE BORDER=0 WIDTH=100%>
  203. <TR>
  204. <TD ALIGN=center><IMG SRC="'.$layout_name.'/images/news/blank.gif" WIDTH=120 HEIGHT=1 BORDER=0><BR></TD>
  205. <TD ALIGN=center VALIGN=top>
  206. <INPUT TYPE=image NAME="I Agree" SRC="'.$layout_name.'/images/buttons/sbutton_iagree.gif" BORDER=0 WIDTH=120 HEIGHT=18>
  207. </FORM> </TD>
  208. <TD ALIGN=center>
  209. <FORM ACTION="index.php?subtopic=latestnews" METHOD=post>
  210. <INPUT TYPE=image NAME="Cancel" SRC="'.$layout_name.'/images/buttons/sbutton_cancel.gif" BORDER=0 WIDTH=120 HEIGHT=18>
  211. </FORM>
  212. </TD>
  213. <TD ALIGN=center><IMG SRC="/images/news/blank.gif" WIDTH=120 HEIGHT=1 BORDER=0><BR></TD>
  214. </TR>
  215. </TABLE>
  216. </TD>
  217. <TD><IMG SRC="'.$layout_name.'/images/news/blank.gif" WIDTH=10 HEIGHT=1 BORDER=0></TD>
  218. </TR>
  219. </TABLE>';
  220. }
  221. //CREATE ACCOUNT PAGE (save account in database)
  222. if($action == "saveaccount")
  223. {
  224. $posted_reg_account = (int) trim($_POST['reg_account']);
  225. $reg_name = trim($_POST['reg_name']);
  226. $reg_email = trim($_POST['reg_email']);
  227. if($config['site']['choose_countr'])
  228. {
  229. $reg_country = trim($_POST['reg_country']);
  230. }
  231. if($config['site']['referrer'])
  232. {
  233. $reg_referrer = (int) $_POST['reg_referrer'];
  234. }
  235. $reg_password = trim($_POST['reg_password']);
  236. $reg_code = trim($_POST['reg_code']);
  237. //FIRST check
  238. ## check email
  239. if(empty($reg_email))
  240. $reg_form_errors[] = "Please enter your email address.";
  241. else
  242. {
  243. if(!check_mail($reg_email))
  244. $reg_form_errors[] = "E-mail address is not correct.";
  245. }
  246. ## check verification code
  247. if($config['site']['verify_code'])
  248. {
  249. $response = $_POST["g-recaptcha-response"];
  250. $url = 'https://www.google.com/recaptcha/api/siteverify';
  251. $data = array(
  252. 'secret' => '__SECRET__',
  253. 'response' => $_POST["g-recaptcha-response"]
  254. );
  255. $options = array(
  256. 'http' => array (
  257. 'method' => 'POST',
  258. 'content' => http_build_query($data)
  259. )
  260. );
  261.  
  262. $context = stream_context_create($options);
  263. $verify = file_get_contents($url, false, $context);
  264. $captcha_success=json_decode($verify);
  265.  
  266. if($captcha_success->success == false)
  267. $reg_form_errors[] = "Captcha is not correct.";
  268. }
  269. ## check password
  270. if(empty($reg_password) && !$config['site']['create_account_verify_mail'])
  271. $reg_form_errors[] = "Please enter password to your new account.";
  272. elseif(!$config['site']['create_account_verify_mail'])
  273. {
  274. if(!check_password($reg_password))
  275. $reg_form_errors[] = "Password contains illegal chars (a-z, A-Z and 0-9 only!) or lenght.";
  276. }
  277. //SECOND check
  278. ## check e-mail address in database
  279. if(empty($reg_form_errors))
  280. {
  281. if($config['site']['one_email'])
  282. {
  283. $test_email_account = $ots->createObject('Account');
  284. $test_email_account->findByEmail($reg_email);
  285. if($test_email_account->isLoaded())
  286. $reg_form_errors[] = "Account with this e-mail address already exist in database.";
  287. }
  288. $account_db = new OTS_Account();
  289. $account_db->find($reg_name);
  290. if($account_db->isLoaded())
  291. $reg_form_errors[] = 'Account with this name already exist.';
  292. }
  293. // ----------creates account-------------(save in database)
  294. if(empty($reg_form_errors))
  295. {
  296. //create object 'account' and generate new acc. number
  297. if($config['site']['create_account_verify_mail'])
  298. {
  299. $reg_password = '';
  300. for ($i = 1; $i <= 6; $i++)
  301. $reg_password .= mt_rand(0,9);
  302. }
  303. $reg_account = $ots->createObject('Account');
  304. $id = $reg_account->create(0, 999999, $reg_name);
  305.  
  306. // saves account information in database
  307. $reg_account->setEMail($reg_email);
  308. if($config['site']['choose_countr'])
  309. {
  310. $reg_account->setCustomField("flag", $reg_country);
  311. }
  312. if($config['site']['referrer'])
  313. {
  314. $reg_account->setCustomField("ref", $reg_referrer);
  315. $SQL->query('INSERT INTO z_referers (account_id, ref_account_id) VALUES ('.$number.', '.$reg_referrer.')');
  316. }
  317. $reg_account->setPassword($reg_password);
  318. $reg_account->unblock();
  319. $reg_account->save();
  320. $reg_account->setCustomField("created", time());
  321. if($config['site']['newaccount_premdays'])
  322. {
  323. $reg_account->setCustomField("premdays", $config['site']['newaccount_premdays']);
  324. $reg_account->setCustomField("lastpremdays", time() + ($config['site']['newaccount_premdays'] * 24 * 60 * 60));
  325. }
  326. //show information about registration
  327. $main_content .= 'Your account has been created.<BR>See you in Tibia!<BR><BR>
  328. <TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
  329. <TR>
  330. <TD BGCOLOR="'.$config['site']['vdarkborder'].'" CLASS=white><B>Account Created</B></TD>
  331. </TR>
  332. <TR>
  333. <TD BGCOLOR="'.$config['site']['darkborder'].'">
  334. <TABLE BORDER=0 CELLPADDING=1>
  335. <TR>
  336. <TD>
  337. <FONT SIZE=5>Your account number: <B>'.$id.'</B></FONT><BR><BR>Your password is <b>'.trim($_POST['reg_password']).'</b>.
  338. You will need the account number and your password to play on '.$config['site']['serverName'].'.
  339. Please keep your account name and password in a safe place and never give your account name or password to anybody.<BR><BR>';
  340. if($config['site']['send_emails'] && $config['site']['create_account_verify_mail'])
  341. {
  342. $mailBody = '<html>
  343. <body>
  344. <h3>Your account name and password!</h3>
  345. <p>You or someone else registred on server <a href="'.$config['server']['url'].'"><b>'.$config['site']['serverName'].'</b></a> with this e-mail.</p>
  346. <p>Account name: <b>'.$reg_name.'</b></p>
  347. <p>Password: <b>'.trim($reg_password).'</b></p>
  348. <br />
  349. <p>After login you can:</p>
  350. <li>Create new characters
  351. <li>Change your current password
  352. <li>Change your current e-mail
  353. </body>
  354. </html>';
  355. require("phpmailer/class.phpmailer.php");
  356. $mail = new PHPMailer();
  357. if ($config['site']['smtp_enabled'] == "yes")
  358. {
  359. $mail->IsSMTP();
  360. $mail->Host = $config['site']['smtp_host'];
  361. $mail->Port = (int)$config['site']['smtp_port'];
  362. $mail->SMTPAuth = ($config['site']['smtp_auth'] ? true : false);
  363. $mail->Username = $config['site']['smtp_user'];
  364. $mail->Password = $config['site']['smtp_pass'];
  365. }
  366. else
  367. $mail->IsMail();
  368. $mail->IsHTML(true);
  369. $mail->From = $config['site']['mail_address'];
  370. $mail->AddAddress($reg_email);
  371. $mail->Subject = $config['site']['serverName']." - Registration";
  372. $mail->Body = $mailBody;
  373. if($mail->Send())
  374. {
  375. $main_content .= 'Your account has been created. Check your e-mail. See you in Tibia!';
  376. }
  377. else
  378. {
  379. $main_content .= '<br /><small>An error occorred while sending email! Account not created. Try again.</small>';
  380. $reg_account->delete();
  381. }
  382. }
  383. elseif($config['site']['send_emails'] && $config['site']['send_register_email'])
  384. {
  385. $mailBody = '<html>
  386. <body>
  387. <h3>Your account name and password!</h3>
  388. <p>You or someone else registred on server <a href="'.$config['server']['url'].'"><b>'.$config['site']['serverName'].'</b></a> with this e-mail.</p>
  389. <p>Account name: <b>'.$reg_name.'</b></p>
  390. <p>Password: <b>'.trim($_POST['reg_password']).'</b></p>
  391. <br />
  392. <p>After login you can:</p>
  393. <li>Create new characters
  394. <li>Change your current password
  395. <li>Change your current e-mail
  396. </body>
  397. </html>';
  398. require("phpmailer/class.phpmailer.php");
  399. $mail = new PHPMailer();
  400. if ($config['site']['smtp_enabled'] == "yes")
  401. {
  402. $mail->IsSMTP();
  403. $mail->Host = $config['site']['smtp_host'];
  404. $mail->Port = (int)$config['site']['smtp_port'];
  405. $mail->SMTPAuth = ($config['site']['smtp_auth'] ? true : false);
  406. $mail->Username = $config['site']['smtp_user'];
  407. $mail->Password = $config['site']['smtp_pass'];
  408.  
  409. }
  410. else
  411. $mail->IsMail();
  412. $mail->IsHTML(true);
  413. $mail->From = $config['site']['mail_address'];
  414. $mail->AddAddress($reg_email);
  415. $mail->Subject = $config['site']['serverName']." - Registration";
  416. $mail->Body = $mailBody;
  417. if($mail->Send())
  418. $main_content .= '<br /><small>These informations were send on email address <b>'.$reg_email.'</b>. Please check your inbox.';
  419. else
  420. $main_content .= '<br /><small>An error occorred while sending email!';
  421. }
  422. $main_content .= '
  423. </TD>
  424. </TR>
  425. </TABLE>
  426. </TD>
  427. </TR>
  428. </TABLE>';
  429. }
  430. else
  431. {
  432. //SHOW ERRORs if data from form is wrong
  433. $main_content .= '
  434. <div class="SmallBox" >
  435. <div class="MessageContainer" >
  436. <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>
  437. <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>
  438. <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>
  439. <div class="ErrorMessage" >
  440. <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>
  441. <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>
  442. <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div>
  443. <b>The Following Errors Have Occurred:</b><br/>';
  444. foreach($reg_form_errors as $show_msg)
  445. {
  446. $main_content .= '<li>'.$show_msg;
  447. }
  448. $main_content .= '
  449. </div>
  450. <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>
  451. <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>
  452. <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>
  453. </div>
  454. </div><BR><BR>
  455. <CENTER>
  456. <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>
  457. <FORM ACTION=index.php?subtopic=createaccount METHOD=post>
  458. <TR>
  459. <TD>
  460. <INPUT TYPE=image NAME="Back" ALT="Back" SRC="'.$layout_name.'/images/buttons/sbutton_back.gif" BORDER=0 WIDTH=120 HEIGHT=18>
  461. </TD>
  462. </TR>
  463. </FORM>
  464. </TABLE>
  465. </CENTER>';
  466. }
  467. }
  468. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement