Advertisement
Guest User

Untitled

a guest
Mar 29th, 2018
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.83 KB | None | 0 0
  1.  
  2. <?PHP
  3. //CREATE ACCOUNT FORM PAGE
  4. if($action == "")
  5. {
  6. $main_content .= '<script type="text/javascript">
  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 = \'<image src="../images/false.gif"> <font color="red">Prosze wprowadĹş numer konta.</font>\';
  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 = \'<image src="../images/false.gif"> <font color="red">Please enter e-mail.</font>\';
  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 (accountcustom==1) {
  94. if (validate_required(account_number,"Please enter number of new account!")==false)
  95. {account_number.focus();return false;}
  96. }
  97. if (validate_required(email,"Please enter your e-mail!")==false)
  98. {email.focus();return false;}
  99. if (validate_email(email,"Invalid e-mail format!")==false)
  100. {email.focus();return false;}
  101. if (verifpass==1)
  102. {
  103. if (validate_required(passor,"Please enter password!")==false)
  104. {passor.focus();return false;}
  105. if (validate_required(passor2,"Please repeat password!")==false)
  106. {passor2.focus();return false;}
  107. if (passor2.value!=passor.value)
  108. {alert(\'Repeated password is not equal to password!\');return false;}
  109. }
  110. if (verifya==1)
  111. {
  112. if (validate_required(verify,"Please enter verification code!")==false)
  113. {verify.focus();return false;}
  114. }
  115. if(rulesServer.checked==false)
  116. {alert(\'To create account you must accept server rules!\');return false;}
  117. }
  118. }
  119. </script>';
  120. $referrers = $_REQUEST['ref'];
  121. $main_content .= '
  122. <FORM ACTION="index.php?subtopic=createaccount&action=saveaccount" onsubmit="return validate_form(this)" METHOD=post>
  123. <TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
  124. <TR>
  125. <TD colspan="2" BGCOLOR="'.$config['site']['vdarkborder'].'" CLASS=white><B>Create a '.$config['site']['serverName'].' Account</B></TD>
  126. </TR>
  127. <script type="text/javascript">var accountcustom=0;</script>
  128. <TR BGCOLOR="'.$config['site']['darkborder'].'">
  129. <TD align="center" width="30%"><B>Email adress: </B></TD>
  130. <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>
  131. </TR>';
  132. if($config['site']['choose_countr'])
  133. {
  134. $main_content .= '<TR BGCOLOR="'.$config['site']['darkborder'].'">
  135. <TD align="center" width="30%"><b>Select Country:</b></TD>
  136. <TD colspan="2"><b>
  137. <select name="reg_country">
  138. <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>
  139. <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>
  140. <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>
  141. <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>
  142. <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>
  143. <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>
  144. <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>
  145. <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>
  146. <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>
  147. <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>
  148. <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>
  149. </select>
  150. </td>
  151. </tr>';
  152. }
  153. if(!$config['site']['create_account_verify_mail'])
  154. $main_content .= '<script type="text/javascript">var verifpass=1;</script>
  155. <TR BGCOLOR="'.$config['site']['darkborder'].'">
  156. <TD align="center" width="30%"><B>Password: </B></TD>
  157. <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>
  158. </TR>
  159. <TR BGCOLOR="'.$config['site']['darkborder'].'">
  160. <TD align="center" width="30%"><B>Repeat password: </B></TD>
  161. <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>
  162. </TR>';
  163. else
  164. $main_content .= '<script type="text/javascript">var verifpass=0;</script>';
  165. if($config['site']['referrer'])
  166. $main_content .= '<TR BGCOLOR="'.$config['site']['darkborder'].'">
  167. <TD align="center" width="30%"><B>Referrer: </B></TD>
  168. <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>
  169. </TR>';
  170. if($config['site']['verify_code'])
  171. {
  172. require_once('recaptchalib.php');
  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">'.recaptcha_get_html($config['site']['publickey']).'</TD>
  181.  
  182. </TR>';
  183. }
  184. else
  185. $main_content .= '<script type="text/javascript">var verifya=0;</script>';
  186.  
  187. $main_content .= '
  188. <TR BGCOLOR="'.$config['site']['darkborder'].'">
  189. <TD colspan="2">Please review the following terms and state your agreement below.</TD>
  190. </TR>
  191. <TR BGCOLOR="'.$config['site']['darkborder'].'">
  192. <TD colspan="2">
  193. <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>
  194. </TD>
  195. </TR>
  196. <TR BGCOLOR="'.$config['site']['darkborder'].'">
  197. <TD colspan="2">
  198. If you fully agree to these terms, click on the "I Agree" button in order to create a '.$config['site']['serverName'].'.<BR>
  199. If you do not agree to these terms or do not want to create a '.$config['site']['serverName'].' please click on the "Cancel" button.
  200. </TD>
  201. </TR>
  202. </TABLE><BR>
  203. <TABLE BORDER=0 WIDTH=100%>
  204. <TR>
  205. <TD ALIGN=center><IMG SRC="'.$layout_name.'/images/news/blank.gif" WIDTH=120 HEIGHT=1 BORDER=0><BR></TD>
  206. <TD ALIGN=center VALIGN=top>
  207. <INPUT TYPE=image NAME="I Agree" SRC="'.$layout_name.'/images/buttons/sbutton_iagree.gif" BORDER=0 WIDTH=120 HEIGHT=18>
  208. </FORM> </TD>
  209. <TD ALIGN=center>
  210. <FORM ACTION="index.php?subtopic=latestnews" METHOD=post>
  211. <INPUT TYPE=image NAME="Cancel" SRC="'.$layout_name.'/images/buttons/sbutton_cancel.gif" BORDER=0 WIDTH=120 HEIGHT=18>
  212. </FORM>
  213. </TD>
  214. <TD ALIGN=center><IMG SRC="/images/news/blank.gif" WIDTH=120 HEIGHT=1 BORDER=0><BR></TD>
  215. </TR>
  216. </TABLE>
  217. </TD>
  218. <TD><IMG SRC="'.$layout_name.'/images/news/blank.gif" WIDTH=10 HEIGHT=1 BORDER=0></TD>
  219. </TR>
  220. </TABLE>';
  221. }
  222. //CREATE ACCOUNT PAGE (save account in database)
  223. if($action == "saveaccount")
  224. {
  225. $posted_reg_account = (int) trim($_POST['reg_account']);
  226. $reg_name = trim($_POST['reg_name']);
  227. $reg_email = trim($_POST['reg_email']);
  228. if($config['site']['choose_countr'])
  229. {
  230. $reg_country = trim($_POST['reg_country']);
  231. }
  232. if($config['site']['referrer'])
  233. {
  234. $reg_referrer = (int) $_POST['reg_referrer'];
  235. }
  236. $reg_password = trim($_POST['reg_password']);
  237. $reg_code = trim($_POST['reg_code']);
  238. //FIRST check
  239. ## check email
  240. if(empty($reg_email))
  241. $reg_form_errors[] = "Please enter your email address.";
  242. else
  243. {
  244. if(!check_mail($reg_email))
  245. $reg_form_errors[] = "E-mail address is not correct.";
  246. }
  247. ## check verification code
  248. if($config['site']['verify_code'])
  249. {
  250. require_once('recaptchalib.php');
  251. $resp = recaptcha_check_answer ($config['site']['privkey'], $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
  252. if (!$resp->is_valid)
  253. {
  254. $reg_form_errors[] = "The reCAPTCHA wasn't entered correctly. Go back and try it again.";
  255. }
  256. }
  257. ## check password
  258. if(empty($reg_password) && !$config['site']['create_account_verify_mail'])
  259. $reg_form_errors[] = "Please enter password to your new account.";
  260. elseif(!$config['site']['create_account_verify_mail'])
  261. {
  262. if(!check_password($reg_password))
  263. $reg_form_errors[] = "Password contains illegal chars (a-z, A-Z and 0-9 only!) or lenght.";
  264. }
  265. //SECOND check
  266. ## check e-mail address in database
  267. if(empty($reg_form_errors))
  268. {
  269. if($config['site']['one_email'])
  270. {
  271. $test_email_account = $ots->createObject('Account');
  272. $test_email_account->findByEmail($reg_email);
  273. if($test_email_account->isLoaded())
  274. $reg_form_errors[] = "Account with this e-mail address already exist in database.";
  275. }
  276. $account_db = new OTS_Account();
  277. $account_db->find($reg_name);
  278. if($account_db->isLoaded())
  279. $reg_form_errors[] = 'Account with this name already exist.';
  280. }
  281. // ----------creates account-------------(save in database)
  282. if(empty($reg_form_errors))
  283. {
  284. //create object 'account' and generate new acc. number
  285. if($config['site']['create_account_verify_mail'])
  286. {
  287. $reg_password = '';
  288. for ($i = 1; $i <= 6; $i++)
  289. $reg_password .= mt_rand(0,9);
  290. }
  291. $reg_account = $ots->createObject('Account');
  292. $id = $reg_account->create(0, 999999, $reg_name);
  293.  
  294. // saves account information in database
  295. $reg_account->setEMail($reg_email);
  296. if($config['site']['choose_countr'])
  297. {
  298. $reg_account->setCustomField("flag", $reg_country);
  299. }
  300. if($config['site']['referrer'])
  301. {
  302. $reg_account->setCustomField("ref", $reg_referrer);
  303. $SQL->query('INSERT INTO z_referers (account_id, ref_account_id) VALUES ('.$number.', '.$reg_referrer.')');
  304. }
  305. $reg_account->setPassword($reg_password);
  306. $reg_account->unblock();
  307. $reg_account->save();
  308. $reg_account->setCustomField("created", time());
  309. if($config['site']['newaccount_premdays'])
  310. {
  311. $reg_account->setCustomField("premdays", $config['site']['newaccount_premdays']);
  312. $reg_account->setCustomField("lastpremdays", time() + ($config['site']['newaccount_premdays'] * 24 * 60 * 60));
  313. }
  314. //show information about registration
  315. $main_content .= 'Your account has been created.<BR>See you in Tibia!<BR><BR>
  316. <TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
  317. <TR>
  318. <TD BGCOLOR="'.$config['site']['vdarkborder'].'" CLASS=white><B>Account Created</B></TD>
  319. </TR>
  320. <TR>
  321. <TD BGCOLOR="'.$config['site']['darkborder'].'">
  322. <TABLE BORDER=0 CELLPADDING=1>
  323. <TR>
  324. <TD>
  325. <FONT SIZE=5>Your account number: <B>'.$id.'</B></FONT><BR><BR>Your password is <b>'.trim($_POST['reg_password']).'</b>.
  326. You will need the account number and your password to play on '.$config['site']['serverName'].'.
  327. Please keep your account name and password in a safe place and never give your account name or password to anybody.<BR><BR>';
  328. if($config['site']['send_emails'] && $config['site']['create_account_verify_mail'])
  329. {
  330. $mailBody = '<html>
  331. <body>
  332. <h3>Your account name and password!</h3>
  333. <p>You or someone else registred on server <a href="'.$config['server']['url'].'"><b>'.$config['site']['serverName'].'</b></a> with this e-mail.</p>
  334. <p>Account name: <b>'.$reg_name.'</b></p>
  335. <p>Password: <b>'.trim($reg_password).'</b></p>
  336. <br />
  337. <p>After login you can:</p>
  338. <li>Create new characters
  339. <li>Change your current password
  340. <li>Change your current e-mail
  341. </body>
  342. </html>';
  343. require("phpmailer/class.phpmailer.php");
  344. $mail = new PHPMailer();
  345. if ($config['site']['smtp_enabled'] == "yes")
  346. {
  347. $mail->IsSMTP();
  348. $mail->Host = $config['site']['smtp_host'];
  349. $mail->Port = (int)$config['site']['smtp_port'];
  350. $mail->SMTPAuth = ($config['site']['smtp_auth'] ? true : false);
  351. $mail->Username = $config['site']['smtp_user'];
  352. $mail->Password = $config['site']['smtp_pass'];
  353. }
  354. else
  355. $mail->IsMail();
  356. $mail->IsHTML(true);
  357. $mail->From = $config['site']['mail_address'];
  358. $mail->AddAddress($reg_email);
  359. $mail->Subject = $config['site']['serverName']." - Registration";
  360. $mail->Body = $mailBody;
  361. if($mail->Send())
  362. {
  363. $main_content .= 'Your account has been created. Check your e-mail. See you in Tibia!';
  364. }
  365. else
  366. {
  367. $main_content .= '<br /><small>An error occorred while sending email! Account not created. Try again.</small>';
  368. $reg_account->delete();
  369. }
  370. }
  371. elseif($config['site']['send_emails'] && $config['site']['send_register_email'])
  372. {
  373. $mailBody = '<html>
  374. <body>
  375. <h3>Your account name and password!</h3>
  376. <p>You or someone else registred on server <a href="'.$config['server']['url'].'"><b>'.$config['site']['serverName'].'</b></a> with this e-mail.</p>
  377. <p>Account name: <b>'.$reg_name.'</b></p>
  378. <p>Password: <b>'.trim($_POST['reg_password']).'</b></p>
  379. <br />
  380. <p>After login you can:</p>
  381. <li>Create new characters
  382. <li>Change your current password
  383. <li>Change your current e-mail
  384. </body>
  385. </html>';
  386. require("phpmailer/class.phpmailer.php");
  387. $mail = new PHPMailer();
  388. if ($config['site']['smtp_enabled'] == "yes")
  389. {
  390. $mail->IsSMTP();
  391. $mail->Host = $config['site']['smtp_host'];
  392. $mail->Port = (int)$config['site']['smtp_port'];
  393. $mail->SMTPAuth = ($config['site']['smtp_auth'] ? true : false);
  394. $mail->Username = $config['site']['smtp_user'];
  395. $mail->Password = $config['site']['smtp_pass'];
  396.  
  397. }
  398. else
  399. $mail->IsMail();
  400. $mail->IsHTML(true);
  401. $mail->From = $config['site']['mail_address'];
  402. $mail->AddAddress($reg_email);
  403. $mail->Subject = $config['site']['serverName']." - Registration";
  404. $mail->Body = $mailBody;
  405. if($mail->Send())
  406. $main_content .= '<br /><small>These informations were send on email address <b>'.$reg_email.'</b>. Please check your inbox.';
  407. else
  408. $main_content .= '<br /><small>An error occorred while sending email!';
  409. }
  410. $main_content .= '
  411. </TD>
  412. </TR>
  413. </TABLE>
  414. </TD>
  415. </TR>
  416. </TABLE>';
  417. }
  418. else
  419. {
  420. //SHOW ERRORs if data from form is wrong
  421. $main_content .= '
  422. <div class="SmallBox" >
  423. <div class="MessageContainer" >
  424. <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>
  425. <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>
  426. <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>
  427. <div class="ErrorMessage" >
  428. <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>
  429. <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>
  430. <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div>
  431. <b>The Following Errors Have Occurred:</b><br/>';
  432. foreach($reg_form_errors as $show_msg)
  433. {
  434. $main_content .= '<li>'.$show_msg;
  435. }
  436. $main_content .= '
  437. </div>
  438. <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>
  439. <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>
  440. <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>
  441. </div>
  442. </div><BR><BR>
  443. <CENTER>
  444. <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>
  445. <FORM ACTION=index.php?subtopic=createaccount METHOD=post>
  446. <TR>
  447. <TD>
  448. <INPUT TYPE=image NAME="Back" ALT="Back" SRC="'.$layout_name.'/images/buttons/sbutton_back.gif" BORDER=0 WIDTH=120 HEIGHT=18>
  449. </TD>
  450. </TR>
  451. </FORM>
  452. </TABLE>
  453. </CENTER>';
  454. }
  455. }
  456. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement