Ir para conteúdo

Ryzor

Membro
  • Registro em

  • Última visita

Tudo que Ryzor postou

  1. Opa , pelo que eu vi o erro é na Last News . troque o script da sua por este e veja oque da , qualquer coisa poste. <?PHP if ($logged){ $players_from_account = $SQL->query("SELECT `players`.`name`, `players`.`id` FROM `players` WHERE `players`.`account_id` = ".(int) $account_logged->getId())->fetchAll(); foreach($players_from_account as $player) { $str .= '<option value="'.$player['id'].'"'; if($player['id'] == $char_id) $strt .= ' selected="selected"'; $str .= '>'.$player['name'].'</option>'; } } $time = time(); $main_content .= ' <div class="NewsHeadline"> <div class="NewsHeadlineBackground" style="background-image:url(' . $layout_name . '/images/news/newsheadline_background.gif)"> <table border="0"> </table> </div> </div> <table border="0" cellspacing="3" cellpadding="4" width="100%"> </table>'; ///////////////////////////////////////////////////////////////////////////////////////// //The new edition of my script: Best Player, Last joined and something new Server Motd.// /////////////////////////Everything in the new appearance./////////////////////////////// //////////////////////////////////////by Aleh/////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////// ///Queries /// $query = $SQL->query('SELECT `players`.`name`,`players`.`id`,`players`.`level`, `players`.`experience`, `server_motd`.`id`, `server_motd`.`text` FROM `players`,`server_motd` WHERE `players`.`group_id` < '.$config['site']['players_group_id_block'].' AND `players`.`name` != "Account Manager" ORDER BY `players`.`level` DESC, `players`.`experience` DESC, `server_motd`.`id` DESC LIMIT 1;')->fetch(); $query2 = $SQL->query('SELECT `id`, `name` FROM `players` ORDER BY `id` DESC LIMIT 1;')->fetch(); $housesfree = $SQL->query('SELECT COUNT(*) FROM `houses` WHERE `owner`=0;')->fetch(); $housesrented = $SQL->query('SELECT COUNT(*) FROM `houses` WHERE `owner`=1;')->fetch(); $players = $SQL->query('SELECT COUNT(*) FROM `players` WHERE `id`>0;')->fetch(); $accounts = $SQL->query('SELECT COUNT(*) FROM `accounts` WHERE `id`>0;')->fetch(); $banned = $SQL->query('SELECT COUNT(*) FROM `bans` WHERE `id`>0;')->fetch(); $guilds = $SQL->query('SELECT COUNT(*) FROM `guilds` WHERE `id`>0;')->fetch(); ///End Queries /// $main_content .= '<table bgcolor='.$config['site']['darkborder'].' border=0 cellpadding=4 cellspacing=1 width=100%> </table></td></tr></table>'; $news_content .= '<div id="newsticker" class="Box"> <div class="Corner-tl" style="background-image: url('.$layout_name.'/images/content/corner-tl.gif);"></div> <div class="Corner-tr" style="background-image: url('.$layout_name.'/images/content/corner-tr.gif);"></div> <div class="Border_1" style="background-image: url('.$layout_name.'/images/content/border-1.gif);"></div> <div class="BorderTitleText" style="background-image: url('.$layout_name.'/images/content/title-background-green.gif);"></div> <img class="Title" src="'.$layout_name.'/images/header/headline-newsticker.gif" alt="Contentbox headline" /> <div class="Border_2"> <div class="Border_3"> <div class="BoxContent" style="background-image: url('.$layout_name.'/images/content/scroll.gif);">'; //##################### ADD NEW TICKER ##################### if($action == "newticker") { if($group_id_of_acc_logged >= $config['site']['access_tickers']) { $ticker_text = stripslashes(trim($_POST['new_ticker'])); $ticker_icon = (int) $_POST['icon_id']; if(empty($ticker_text)) { $news_content .= 'You can\'t add empty ticker.'; } else { if(empty($ticker_icon)) { $news_icon = 0; } $SQL->query('INSERT INTO '.$SQL->tableName('z_news_tickers').' (date, author, image_id, text, hide_ticker) VALUES ('.$SQL->quote($time).', '.$account_logged->getId().', '.$ticker_icon.', '.$SQL->quote($ticker_text).', 0)'); $news_content .= '<center><h2><font color="red">Added new ticker:</font></h2></center><hr/><div id="newsticker" class="Box"><div id="TickerEntry-1" class="Row" onclick=\'TickerAction("TickerEntry-1")\'> <div class="Odd"> <div class="NewsTickerIcon" style="background-image: url('.$layout_name.'/images/news/icon_'.$ticker['image_id'].'.gif);"></div> <div id="TickerEntry-1-Button" class="NewsTickerExtend" style="background-image: url('.$layout_name.'/images/general/plus.gif);"></div> <div class="NewsTickerText"> <span class="NewsTickerDate">'.date("j M Y", $time).' -</span> <div id="TickerEntry-1-ShortText" class="NewsTickerShortText">'; $news_content .= '<a href="?subtopic=latestnews&action=deleteticker&id='.$time.'"><img src="'.$layout_name.'/images/news/delete.png" border="0"></a>'; $news_content .= short_text($ticker_text, 60).'</div> <div id="TickerEntry-1-FullText" class="NewsTickerFullText">'; $news_content .= '<a href="?subtopic=latestnews&action=deleteticker&id='.$time.'"><img src="'.$layout_name.'/images/news/delete.png" border="0"></a>'; $news_content .= $ticker_text.'</div> </div> </div> </div></div><hr/>'; } } else { $news_content .= 'You don\'t have admin rights. You can\'t add new ticker.'; } $news_content .= '<form action="?subtopic=latestnews" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form>'; } //#################### DELETE (HIDE only!) TICKER ############################ if($action == "deleteticker") { if($group_id_of_acc_logged >= $config['site']['access_tickers']) { header("Location: "); $date = (int) $_REQUEST['id']; $SQL->query('UPDATE '.$SQL->tableName('z_news_tickers').' SET hide_ticker = 1 WHERE '.$SQL->fieldName('date').' = '.$date.';'); $news_content .= '<center>News tickets with <b>date '.date("j F Y, g:i a", $date).'</b> has been deleted.<form action="?subtopic=latestnews" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>'; } else { $news_content .= '<center>You don\'t have admin rights. You can\'t delete tickers.<form action="?subtopic=latestnews" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>'; } } //show tickers if any in database or not blocked (tickers limit = 0) $tickers = $SQL->query('SELECT * FROM `z_news_tickers` WHERE hide_ticker != 1 ORDER BY date DESC LIMIT 4;'); $number_of_tickers = 0; if(is_object($tickers)) { foreach($tickers as $ticker) { if(is_int($number_of_tickers / 2)) $color = "Odd"; else $color = "Even"; $tickers_to_add .= '<div id="TickerEntry-'.$number_of_tickers.'" class="Row" onclick=\'TickerAction("TickerEntry-'.$number_of_tickers.'")\'> <div class="'.$color.'"> <div class="NewsTickerIcon" style="background-image: url('.$layout_name.'/images/news/icon_'.$ticker['image_id'].'.gif);"></div> <div id="TickerEntry-'.$number_of_tickers.'-Button" class="NewsTickerExtend" style="background-image: url('.$layout_name.'/images/general/plus.gif);"></div> <div class="NewsTickerText"> <span class="NewsTickerDate">'.date("j M Y", $ticker['date']).' -</span> <div id="TickerEntry-'.$number_of_tickers.'-ShortText" class="NewsTickerShortText">'; //if admin show button to delete (hide) ticker if($group_id_of_acc_logged >= $config['site']['access_admin_panel']) { $tickers_to_add .= '<a href="?subtopic=latestnews&action=deleteticker&id='.$ticker['date'].'"><img src="'.$layout_name.'/images/news/delete.png" border="0"></a>'; } $tickers_to_add .= short_text($ticker['text'], 60).'</div> <div id="TickerEntry-'.$number_of_tickers.'-FullText" class="NewsTickerFullText">'; //if admin show button to delete (hide) ticker if($group_id_of_acc_logged >= $config['site']['access_admin_panel']) { $tickers_to_add .= '<a href="?subtopic=latestnews&action=deleteticker&id='.$ticker['date'].'"><img src="'.$layout_name.'/images/news/delete.png" border="0"></a>'; } $tickers_to_add .= $ticker['text'].'</div> </div> </div> </div>'; $number_of_tickers++; } } if(!empty($tickers_to_add)) { //show table with tickers if($group_id_of_acc_logged >= $config['site']['access_admin_panel'] && $action!=newticker) $news_content .= '<script type="text/javascript"> var showednewticker_state = "0"; function showNewTickerForm() { if(showednewticker_state == "0") { document.getElementById("newtickerform").innerHTML = \'<form action="?subtopic=latestnews&action=newticker" method="post" ><table border="0"><tr><td bgcolor="D4C0A1" align="center"><b>Select icon:</b></td><td><table border="0" bgcolor="F1E0C6"><tr><td><img src="images/news/icon_0.gif" width="20"></td><td><img src="images/news/icon_1.gif" width="20"></td><td><img src="images/news/icon_2.gif" width="20"></td><td><img src="images/news/icon_3.gif" width="20"></td><td><img src="images/news/icon_4.gif" width="20"></td></tr><tr><td><input type="radio" name="icon_id" value="0" checked="checked"></td><td><input type="radio" name="icon_id" value="1"></td><td><input type="radio" name="icon_id" value="2"></td><td><input type="radio" name="icon_id" value="3"></td><td><input type="radio" name="icon_id" value="4"></td></tr></table></td></tr><tr><td align="center" bgcolor="D4C0A1"><b>New<br>ticker<br>text:</b></td><td bgcolor="F1E0C6"><textarea name="new_ticker" rows="3" cols="45"></textarea></td></tr><tr><td><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif" ></div></div></form><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><img class="ButtonText" id="AddTicker" src="'.$layout_name.'/images/buttons/_sbutton_cancel.gif" onClick="showNewTickerForm()" alt="AddTicker" /></div></div></td></tr></table>\'; document.getElementById("jajo").innerHTML = \'\'; showednewticker_state = "1"; } else { document.getElementById("newtickerform").innerHTML = \'\'; document.getElementById("jajo").innerHTML = \'<div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><img class="ButtonText" id="AddTicker" src="'.$layout_name.'/images/buttons/addticker.gif" onClick="showNewTickerForm()" alt="AddTicker" /></div></div>\'; showednewticker_state = "0"; } } </script><div id="newtickerform"></div><div id="jajo"><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><img class="ButtonText" id="AddTicker" src="'.$layout_name.'/images/buttons/addticker.gif" onClick="showNewTickerForm()" alt="AddTicker" /></div></div></div><hr/>'; //add tickers list $news_content .= $tickers_to_add; //koniec $news_content .= '</div> </div> </div> <div class="Border_1" style="background-image: url('.$layout_name.'/images/content/border-1.gif);"></div> <div class="CornerWrapper-b"><div class="Corner-bl" style="background-image: url('.$layout_name.'/images/content/corner-bl.gif);"></div></div> <div class="CornerWrapper-b"><div class="Corner-br" style="background-image: url('.$layout_name.'/images/content/corner-br.gif);"></div></div> </div>'; } //end of tickers, news part //featured article $news_content .= ' <div id="news" class="Box"> <div class="Corner-tl" style="background-image:url('.$layout_name.'/images/content/corner-tl.gif);"></div> <div class="Corner-tr" style="background-image:url('.$layout_name.'/images/content/corner-tr.gif);"></div> <div class="Border_1" style="background-image:url('.$layout_name.'/images/content/border-1.gif);"></div> <div class="BorderTitleText" style="background-image:url('.$layout_name.'/images/content/title-background-green.gif);"></div> <img class="Title" src="'.$layout_name.'/images/header/headline-featuredarticle.gif" alt="Contentbox headline" /> <div class="Border_2"> <div class="Border_3"> <div class="BoxContent" style="background-image:url('.$layout_name.'/images/content/scroll.gif);"> <div id=\'TeaserThumbnail\'><img src="'.$layout_name.'/images/news/features2bkp.jpg" width=150 height=100 border=0 alt="" ALIGN=right hspace="10" /></div> <div id=\'TeaserText\'> <div style="position: relative; top: -2px; margin-bottom: 2px;" > <center><i>IP: <u>imperium-ot.no-ip.org</u> - VERSÃO: 8.60 - PORTA: 7171</i></center> </div> <font color="green"/><b>Imperium-OT</b></font> o <u>Servidor mais Completo</u>, traz as seguintes novidades: Coondown System, Magias atuais global, Task System 100%, Raids automaticas, Castle Domain (Woe), Zombie event, Dota Event, Fire Storm (Proprio) ,Respawns próprios e personalizado, entre outros, Confiram!!<br/> <br></br> <b>Ajude o servidor a crescer fazendo sua doação </b><a href="?subtopic=donate">Clicando AQUI</a> </div> </div> </div> </div> <div class="Border_1" style="background-image: url('.$layout_name.'/images/content/border-1.gif);"></div> <div class="CornerWrapper-b"><div class="Corner-bl" style="background-image: url('.$layout_name.'/images/content/corner-bl.gif);"></div></div> <div class="CornerWrapper-b"><div class="Corner-br" style="background-image: url('.$layout_name.'/images/content/corner-br.gif);"></div></div> </div> '; //adding news if($action == "newnews") { if($group_id_of_acc_logged >= $config['site']['access_news']) { $text = ($_REQUEST['text']); $char_id = (int) $_REQUEST['char_id']; $post_topic = stripslashes(trim($_REQUEST['topic'])); $smile = (int) $_REQUEST['smile']; $news_icon = (int) $_REQUEST['icon_id']; if(empty($news_icon)) { $news_icon = 0; } if(empty($post_topic)) { $an_errors[] .= 'You can\'t add news without topic.'; } if(empty($text)) { $an_errors[] .= 'You can\'t add empty news.'; } if(empty($char_id)) { $an_errors[] .= 'Select character.'; } //execute query if(empty($an_errors)) { $SQL->query("INSERT INTO `z_forum` (`id` ,`first_post` ,`last_post` ,`section` ,`replies` ,`views` ,`author_aid` ,`author_guid` ,`post_text` ,`post_topic` ,`post_smile` ,`post_date` ,`last_edit_aid` ,`edit_date`, `post_ip`, `icon_id`) VALUES ('NULL', '0', '".time()."', '1', '0', '0', '".$account_logged->getId()."', '".(int) $char_id."', ".$SQL->quote($text).", ".$SQL->quote($post_topic).", '".(int) $smile."', '".time()."', '0', '0', '".$_SERVER['REMOTE_ADDR']."', '".$news_icon."')"); $thread_id = $SQL->lastInsertId(); $SQL->query("UPDATE `z_forum` SET `first_post`=".(int) $thread_id." WHERE `id` = ".(int) $thread_id);//show added data $main_content .= '<form action="?subtopic=latestnews" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form>'; } else { //show errors $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/>'; foreach($an_errors as $an_error) { $main_content .= '<li>'.$an_error; } $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/>'; //okno edycji newsa z wpisanymi danymi przeslanymi wczesniej $main_content .= '<form action="?subtopic=latestnews&action=newnews" method="post" ><table border="0"><tr><td bgcolor="D4C0A1" align="center"><b>Select icon:</b></td><td><table border="0" bgcolor="F1E0C6"><tr><td><img src="images/news/icon_0.gif" width="20"></td><td><img src="images/news/icon_1.gif" width="20"></td><td><img src="images/news/icon_2.gif" width="20"></td><td><img src="images/news/icon_3.gif" width="20"></td><td><img src="images/news/icon_4.gif" width="20"></td></tr><tr><td><input type="radio" name="icon_id" value="0" checked="checked"></td><td><input type="radio" name="icon_id" value="1"></td><td><input type="radio" name="icon_id" value="2"></td><td><input type="radio" name="icon_id" value="3"></td><td><input type="radio" name="icon_id" value="4"></td></tr></table></td></tr><tr><td align="center" bgcolor="F1E0C6"><b>Topic:</b></td><td><input type="text" name="topic" maxlenght="50" style="width: 300px" value="'.$post_topic.'"></td></tr><tr><td align="center" bgcolor="D4C0A1"><b>News<br>text:</b></td><td bgcolor="F1E0C6"><textarea name="text" rows="6" cols="60">'.$text.'</textarea></td></tr><tr><td width="180"><b>Character:</b></td><td><select name="char_id"><option value="0">(Choose character)</option>'.$str.'</select></td></tr><tr><td><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif" ></div></div></form><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><img class="ButtonText" id="CancelAddNews" src="'.$layout_name.'/images/buttons/_sbutton_cancel.gif" onClick="location.href=\'?subtopic=latestnews\';" alt="CancelAddNews" /></div></div></td></tr></table>'; } } else { $main_content .= 'You don\'t have site-admin rights. You can\'t add news.';} } //####################Show script with new news panel############################ if($group_id_of_acc_logged >= $config['site']['access_news'] && $action != 'newnews') { $main_content .= '<script type="text/javascript"> var showednewnews_state = "0"; function showNewNewsForm() { if(showednewnews_state == "0") { document.getElementById("newnewsform").innerHTML = \'<form action="?subtopic=latestnews&action=newnews" method="post" ><table border="0"><tr><td bgcolor="D4C0A1" align="center"><b>Select icon:</b></td><td><table border="0" bgcolor="F1E0C6"><tr><td><img src="images/news/icon_0.gif" width="20"></td><td><img src="images/news/icon_1.gif" width="20"></td><td><img src="images/news/icon_2.gif" width="20"></td><td><img src="images/news/icon_3.gif" width="20"></td><td><img src="images/news/icon_4.gif" width="20"></td></tr><tr><td><input type="radio" name="icon_id" value="0" checked="checked"></td><td><input type="radio" name="icon_id" value="1"></td><td><input type="radio" name="icon_id" value="2"></td><td><input type="radio" name="icon_id" value="3"></td><td><input type="radio" name="icon_id" value="4"></td></tr></table></td></tr><tr><td align="center" bgcolor="F1E0C6"><b>Topic:</b></td><td><input type="text" name="topic" maxlenght="50" style="width: 300px" ></td></tr><tr><td align="center" bgcolor="D4C0A1"><b>News<br>text:</b></td><td bgcolor="F1E0C6"><textarea name="text" rows="6" cols="60"></textarea></td></tr><tr><td width="180"><b>Character:</b></td><td><select name="char_id"><option value="0">(Choose character)</option>'.$str.'</select></td></tr><tr><td><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif" ></div></div></form><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><img class="ButtonText" id="CancelAddNews" src="'.$layout_name.'/images/buttons/_sbutton_cancel.gif" onClick="showNewNewsForm()" alt="CancelAddNews" /></div></div></td></tr></table>\'; document.getElementById("chicken").innerHTML = \'\'; showednewnews_state = "1"; } else { document.getElementById("newnewsform").innerHTML = \'\'; document.getElementById("chicken").innerHTML = \'<div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><img class="ButtonText" id="AddNews" src="'.$layout_name.'/images/buttons/addnews.gif" onClick="showNewNewsForm()" alt="AddNews" /></div></div>\'; showednewnews_state = "0"; } } </script><div id="newnewsform"></div><div id="chicken"><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><img class="ButtonText" id="AddNews" src="'.$layout_name.'/images/buttons/addnews.gif" onClick="showNewNewsForm()" alt="AddNews" /></div></div></div><hr/>';$zapytanie = $SQL->query("SELECT `z_forum`.`icon_id`,`z_forum`.`post_topic`, `z_forum`.`author_guid`, `z_forum`.`post_date`, `z_forum`.`post_text`, `z_forum`.`id`, `z_forum`.`replies`, `players`.`name` FROM `z_forum`, `players` WHERE `section` = '1' AND `z_forum`.`id` = `first_post` AND `players`.`id` = `z_forum`.`author_guid` ORDER BY `post_date` DESC LIMIT 3;")->fetchAll(); } ///show news $zapytanie = $SQL->query("SELECT `z_forum`.`icon_id`, `z_forum`.`post_topic`, `z_forum`.`author_guid`, `z_forum`.`post_date`, `z_forum`.`post_text`, `z_forum`.`id`, `z_forum`.`replies`, `players`.`name` FROM `z_forum`, `players` WHERE `section` = '1' AND `z_forum`.`id` = `first_post` AND `players`.`id` = `z_forum`.`author_guid` ORDER BY `post_date` DESC LIMIT 3;")->fetchAll(); foreach ($zapytanie as $row) { $BB = array( '/\[youtube\](.*?)\[\/youtube\]/is' => '<center><object width="500" height="405"><param name="movie" value="http://www.youtube.com/watch?v=$1&hl=pt-br&fs=1&rel=0&color1=0x3a3a3a&color2=0x999999&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/watch?v=$1&hl=pt-br&fs=1&rel=0&color1=0x3a3a3a&color2=0x999999&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="500" height="405"></embed></object></center>', '/\[b\](.*?)\[\/b\]/is' => '<strong>$1</strong>', '/\[center\](.*?)\[\/center\]/is' => '<center>$1</center>', '/\[quote\](.*?)\[\/quote\]/is' => '<table cellpadding="0" style="background-color: #c4c4c4; width: 480px; border-style: dotted; border-color: #007900; border-width: 2px"><tr><td>$1</td></tr></table>', '/\[u\](.*?)\[\/u\]/is' => '<u>$1</u>', '/\[i\](.*?)\[\/i\]/is' => '<i>$1</i>', '/\[letter\](.*?)\[\/letter\]/is' => '<img src=images/letters/$1.gif alt=$1 />', '/\[url](.*?)\[\/url\]/is' => '<a href=$1>$1</a>', '/\[color\=(.*?)\](.*?)\[\/color\]/is' => '<span style="color: $1;">$2</span>', '/\[img\](.*?)\[\/img\]/is' => '<img src=$1 alt=$1 />', '/\[player\](.*?)\[\/player\]/is' => '<a href='.$server['ip'].'?subtopic=characters&amp;name=$1>$1</a>', '/\[code\](.*?)\[\/code\]/is' => '<div dir="ltr" style="margin: 0px;padding: 2px;border: 1px inset;width: 500px;height: 290px;text-align: left;overflow: auto"><code style="white-space:nowrap">$1</code></div>' ); $message = preg_replace(array_keys($BB), array_values($BB), nl2br($row['post_text'])); $main_content .= '<div class=\'NewsHeadline\'> <div class=\'NewsHeadlineBackground\' style=\'background-image:url('.$layout_name.'/images/news/newsheadline_background.gif)\'> <table border=0><tr><td><img src="'.$layout_name.'/images/news/icon_'.$row['icon_id'].'.gif" class=\'NewsHeadlineIcon\' alt=\'\' /> </td><td><font color="'.$layout_ini['news_title_color'].'"><font size="-2"/>'.date('d.m.y', $row['post_date']).'</font> - <b>'.$row['post_topic'].'</b></font></td></tr></table> </div> </div> <table style=\'clear:both\' border=0 cellpadding=0 cellspacing=0 width=\'100%\'><tr> <td><img src="'.$layout_name.'/images/global/general/blank.gif" width=10 height=1 border=0 alt=\'\' /></td>'; if($group_id_of_acc_logged >= $config['site']['access_admin_panel']) { $main_content .='<td width="100%">'.$message.'<br><h6><i>Posted by </i><font color="green">Imperium-OT Team</font></h6><p align="right"><a href="?subtopic=forum&action=remove_post&id='.$row['id'].'"><font color="red">[Delete this news]</font></a> <a href="?subtopic=forum&action=edit_post&id='.$row['id'].'"><font color="green">[Edit this news]</font></a> <a href="?subtopic=forum&action=show_thread&id='.$row['id'].'">Comments: '.$row['replies'].'</a></p>'; } else { $main_content .='<td width="100%">'.$message.'<br><h6><i>Posted by </i><font color="green">Imperium-OT Team</font></h6><p align="right"><a href="?subtopic=forum&action=show_thread&id='.$row['id'].'"> >> Comment on this news: '.$row['replies'].'</a></p>'; } $main_content .= '</td> <td><img src="'.$layout_name.'/images/global/general/blank.gif" width=10 height=1 border=0 alt=\'\' /></td> </tr></table>'; } ?>
  2. Ryzor postou uma resposta no tópico em Suporte Tibia OTServer
    Cara se fikar muitos player de 'Exit nos trainer' você toma ban , melhor continuar no 15 Minutos ou 10 minutos mesmo brother.
  3. Ryzor postou uma resposta no tópico em Playground (Off-topic)
  4. Ryzor postou uma resposta no tópico em Playground (Off-topic)
    Um gol 1.6 é top
  5. Ryzor postou uma resposta no tópico em Playground (Off-topic)
  6. Ryzor postou uma resposta no tópico em Suporte & Pedidos
    Ta muito bacana o site do seu servidor , ja ouviu falar em Extreme-Styller ? antigo servidor meu rs
  7. Créditos: Kargen Como Instalar: Abra o arquivo serverinfo.php e substitua o código por esse: <?php $main_content .= '<table border="0" cellspacing="1" cellpadding="4" width="100%"> <tr bgcolor='.$config['site']['vdarkborder'].'> <td colspan="2"><b><center>Server Information</center></b></td> </td align="right"></td></tr>'; $number_of_stages = 0; $stagesLevel = $config['site']['stageLevel']; foreach ($stagesLevel as $stagelevel => $desc) { if(is_int($number_of_stages / 2)) $bgcolor = $config['site']['darkborder']; else $bgcolor = $config['site']['lightborder']; $number_of_stages++; $magic = $config['site']['sInfoMagic']; $skills = $config['site']['sInfoSkill']; $loot = $config['site']['sInfoLoot']; $about = $config['site']['aboutServer']; $main_content .= '<tr bgcolor="'.$bgcolor.'"> <td width="'.$config['site']['serverInfo_width'].'%"><center><b>From Level To Level</b>&nbsp;=&nbsp;'.$stagelevel.'</center></td> </tr><tr><td><center>'.$desc.'</center></td></tr>'; } $main_content .= '<tr bgcolor="'.$config['site']['lightborder'].'"> <td width="100%"><center><b>Magic Rate</b>&nbsp;=&nbsp;'.$magic.'</td></tr> <tr bgcolor="'.$config['site']['darkborder'].'"> <td width="100%"><center><b>Skills Rate</b>&nbsp;=&nbsp;'.$skills.'</td></tr> <tr bgcolor="'.$config['site']['lightborder'].'"> <td width="100%"><center><b>Loot Rate</b>&nbsp;=&nbsp;'.$loot.'</td></tr></table><br> <table border="0" cellspacing="1" cellpadding="4" width="100%"> <tr bgcolor='.$config['site']['vdarkborder'].'> <td colspan="2"><b><center>About Server</center></b></td> </td align="right"></td></tr><tr bgcolor="'.$config['site']['darkborder'].'"> <td width="100%"><center>'.$about.'</center></td>'; $main_content .= '</table><br>'; $main_content .= '<table border="0" cellspacing="1" cellpadding="4" width="100%"> <tr bgcolor='.$config['site']['vdarkborder'].'> <td colspan="2"><b><center>Player Commands</center></b></td> </td align="right"></td></tr>'; $number_of_commands = 0; $commands = $config['site']['commands']; foreach ($commands as $command => $use) { if(is_int($number_of_commands / 2)) $bgcolor = $config['site']['darkborder']; else $bgcolor = $config['site']['lightborder']; $number_of_commands++; $main_content .= '<tr bgcolor="'.$bgcolor.'"><td width="'.$config['site']['serverInfo_width'].'%">'.$command.'</td><td>'.$use.'</td></tr>'; } $main_content .= '</table>'; ?> Depois de substituir o código, abra o arquivo config.php e cole esse código: // Created by GodMarini(ServerInfo/StagesLevel) & Archez (Player Commands and Idea) $config['site']['serverInfo_width'] = '15'; // from 0% to 100% (recommended: 15) $config['site']['aboutServer'] = ' - 24 Hours Fast Dedicated Server<br> - 35+ Quests!<br> - 500+ Houses<br> '; // - New Line<br> (Use if your want make a new line "<br>") $config['site']['commands'] = array( '!save' => 'Save your character so you avoid items or level loss.', '!buypremium' => 'Buy 30 days of premium time.', '!hunt' => 'Spend some cash with a nice amount for a frag.' ); // 'command' => 'description', /* Stage Level */ $config['site']['stageLevel'] = array( /* From Level To Level */ '1-50' => '50x', '50-100' => '35x', '100~' => '15x' );/* 'stages Level' => 'ExpRate', */ $config['site']['sInfoMagic'] = '9x'; $config['site']['sInfoSkill'] = '17x'; $config['site']['sInfoLoot'] ='2.5x'; Imagem:
  8. Ryzor postou uma resposta no tópico em Tutoriais Websites
    Créditos: Xampy Funciona com TFS 0.3.5, 0.3.6 & 0.4. Como Instalar: Cole o seguinte código após a lista de mortes em characters.php: Código PHP: //frags list by GodMarini $frags_limit = 10; // frags limit to show? // default: 10 $player_frags = $SQL->query('SELECT `player_deaths`.*, `players`.`name`, `killers`.`unjustified` FROM `player_deaths` LEFT JOIN `killers` ON `killers`.`death_id` = `player_deaths`.`id` LEFT JOIN `player_killers` ON `player_killers`.`kill_id` = `killers`.`id` LEFT JOIN `players` ON `players`.`id` = `player_deaths`.`player_id` WHERE `player_killers`.`player_id` = '.$player->getId().' ORDER BY `date` DESC LIMIT 0,'.$frags_limit.';'); if(count($player_frags)) { $frags = 0; $frag_add_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><br><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Victims</B></TD></TR>'; foreach($player_frags as $frag) { $frags++; if(is_int($number_of_rows / 2)) $bgcolor = $config['site']['darkborder']; else $bgcolor = $config['site']['lightborder']; $number_of_rows++; $frag_add_content .= "<tr bgcolor=\"".$bgcolor."\"> <td width=\"20%\" align=\"center\">".date("j M Y, H:i", $frag['date'])."</td> <td>".(($player->getSex() == 0) ? 'She' : 'He')." fragged <a href=\"index.php?subtopic=characters&name=".$frag[name]."\">".$frag[name]."</a> at level ".$frag[level].""; $frag_add_content .= ". (".(($frag[unjustified] == 0) ? "<font size=\"1\" color=\"green\">Justified</font>" : "<font size=\"1\" color=\"red\">Unjustified</font>").")</td></tr>"; } if($frags >= 1) $main_content .= $frag_add_content . '</TABLE>'; } // end of frags list by GodMarini Imagem:
  9. Ryzor postou uma resposta no tópico em Suporte Tibia OTServer
    Cara isso e base de codigos , provalvamente você editou seu mapa e mudou o piso, você tem que procurar o script para ver o codigo depois so seguir isso Na minha area vip no caso o codigo do piso e 13500 não sei o seu script você pode tentar esse.. Para editar o piso é o seguinte Clica com botão direito no chão -> properties -> Action ID -> numero do codigo , no meu no caso 13500 , -> OK , salva e reinicia o sv... Você tem que procurar o script Das area , de VIP e as outras , se achar me manda ai que eu fexo o numero do codigo.
  10. Seu servidor tem o sistema de Raids ou Tasks, ou até mesmo somente algum sistema que summone bosses? Se sim esse script será muito útil para você. Então, esse script faz com que toda vez que algum dos Bosses que poderam ser configurados no script forem mortos, aparecer uma mensagem em Broadcast, para quem não sabe broadcast é aquela mensagem vermelha igual a que quando o GOD fala, ela aparace para todo mundo. Um exemplo da mensagem: O jogador GodMarini conseguiu matar o tao poderoso BOSS Morgaroth! Vá para data/creaturescripts/scripts e crie ou copie um arquivo .lua e o nomeie para bosses.lua ou para o nome que você quiser e cole isso dentro dele, -- by GodMarini for TibiaKing Fórum. -- local bosses = {"Demodras","The Horned Fox","Necropharus","The Old Window", "Morgaroth","Zulazza The Corruptor", "Ghazbaran", "Orshabaal","Ferumbras"} function onKill(cid, target, lastHit) if isInArray(bosses,getCreatureName(target)) then doBroadcastMessage("O jogador "..getCreatureName(cid).." conseguiu matar o tao poderoso BOSS "..getCreatureName(target).."!") end return true end Agora, abra o arquivo login.lua na mesma pasta e pressione CRTL + F e procure por está linha, registerCreatureEvent(cid, "AdvanceSave") e logo abaixo cole isso, registerCreatureEvent(cid, "bosses") Pronto a parte mais "difícil" já está feita, agora vamos para a ultima parte e mais simples da instalação do script; volta uma pasta e abra o arquivo creaturescripts.xml e adicione está linha, <event type="kill" name="bosses" event="script" value="bosses.lua"/> Autor: Shoeei
  11. Ryzor postou uma resposta no tópico em Suporte Tibia OTServer
    Cara é boa , mais dependendo do attack cara , lamento :S
  12. Ryzor postou uma resposta no tópico em Portal
    Voz do edson sexy d+ pqp.
  13. Ryzor postou uma resposta no tópico em Suporte Tibia OTServer
    Isso tem um nome 'Nuker' inveja , estão provalvamente atacando seu servidor , ou algum evento está bugado que começa atacar da o lag . pode ser WoE,War Castle ou coisa do tipo.
  14. rs , Aqui está o ShopAdmin.php sem erros. <?PHP if($group_id_of_acc_logged >= $config['site']['access_admin_panel']) { $offertype = $_REQUEST['offer_type']; if((empty($action)) AND (empty($offertype))) { $main_content .= '<br><h2><center><a href="?subtopic=shopadmin&action=addoffer">ADD SHOP OFFER</a><br><br><a href="?subtopic=shopadmin&action=viewoffer"> VIEW SHOP OFFER <i>(EDIT/DELETE)</i></a><br><br><a href="?subtopic=shopadmin&action=points">ADD POINTS</a></center>'; } if($action == "addoffer"){ $shop_points = stripslashes(ucwords(strtolower(trim($_REQUEST['shop_points'])))); $shop_offer_type = stripslashes(trim($_REQUEST['offer_type'])); if(empty($shop_points)) { $main_content .= '<table border="0"><tr><td align="center"><b>Select offer type:</b></td><td><table border="0" ><tr bgcolor="#505050"> <td><font color="white">Item</td><td><font color="white">Item VIP</td><td><font color="white">Container</td><td><font color="white">Pacc</td><td><font color="white">VIP Days</td><td><font color="white">Redskull</td> <td><font color="white">Unban</td><td><font color="white">Changename</td></tr><tr bgcolor="#D4C0A1"><form action="" method="post"> <td align="center"><input type="radio" name="5 reais" value="item" onClick="this.form.submit()"></td></lable> <td align="center"><input type="radio" name="offer_type" value="itemvip" onClick="this.form.submit()"></td></lable> <td align="center"><input type="radio" name="offer_type" value="container" onClick="this.form.submit()"></td> <td align="center"><input type="radio" name="offer_type" value="pacc" onClick="this.form.submit()"></td> <td align="center"><input type="radio" name="offer_type" value="vipdays" onClick="this.form.submit()"></td> <td align="center"><input type="radio" name="offer_type" value="redskull" onClick="this.form.submit()"></td> <td align="center"><input type="radio" name="offer_type" value="unban" onClick="this.form.submit()"></td> <td align="center"><input type="radio" name="offer_type" value="changename" onClick="this.form.submit()"></td> </form></tr></table></td></tr>'; $main_content .= '<form action="?subtopic=shopadmin&action=addoffer&offer_type='.$shop_offer_type.'" method="post" ><table border="0"><tr> <td align="center" ><b>Points:</b></td><td><input type="textbox" name="shop_points" maxlenght="7" style="width: 70px"></td></tr>'; if($_REQUEST['offer_type'] == 'container'){ $main_content .= '<tr><td align="center" ><b>Container ID:</b></td> <td><input type="text" name="shop_itemid1" maxlenght="7" style="width: 70px" ></td></tr> <tr><td align="center" ><b>Count Container:</b></td> <td><input type="text" name="shop_count1" maxlenght="7" style="width: 70px" ></td></tr> <tr><td align="center" ><b>Item ID:</b></td> <td><input type="text" name="shop_itemid2" maxlenght="7" style="width: 70px" ></td></tr> <tr><td align="center" ><b>Count Item:</b></td> <td><input type="text" name="shop_count2" maxlenght="7" style="width: 70px" ></td></tr>'; } if($_REQUEST['offer_type'] == 'item'){ $main_content .= '<tr><td align="center"><b>Item ID:</b></td> <td><input type="text" name="shop_itemid1" maxlenght="7" style="width: 70px" ></td></tr> <tr><td align="center"><b>Item Count:</b></td> <td><input type="text" name="shop_count1" maxlenght="7" style="width: 70px" ></td></tr>'; } if($_REQUEST['offer_type'] == 'itemvip'){ $main_content .= '<tr><td align="center"><b>Item ID:</b></td> <td><input type="text" name="shop_itemid1" maxlenght="7" style="width: 70px" ></td></tr> <tr><td align="center"><b>Item Count:</b></td> <td><input type="text" name="shop_count1" maxlenght="7" style="width: 70px" ></td></tr>'; } if($_REQUEST['offer_type'] == 'pacc'){ $main_content .= '<tr><td align="center" ><b>Days:</b></td> <td><input type="text" name="shop_count1" maxlenght="7" style="width: 70px" ></td></tr>'; } if($_REQUEST['offer_type'] == 'vipdays'){ $main_content .= '<tr><td align="center" ><b>Days:</b></td> <td><input type="text" name="shop_count1" maxlenght="7" style="width: 70px" ></td></tr>'; } $main_content .= '<tr><td align="center" ><b>Offer Description:</b></td> <td ><textarea name="shop_offer_description" rows="2" cols="35"></textarea></td></tr> <tr><td align="center" ><b>Offer Name:</b></td> <td><input type="text" name="shop_offer_name" maxlenght="40" style="width: 200px" ></td></tr></table> <input name="submit" type="submit" value="Submit" /></form> <form action="?subtopic=shopadmin&action=addoffer" method="post" > <input name="submit" type="submit" value="Reset" /></form>'; $main_content .= '<form action="?subtopic=shopadmin" method="post" ><input name="submit" type="submit" value="Back" title="Back"/></form>'; } else { $shop_points = stripslashes(trim($_POST['shop_points'])); $shop_offer_type = stripslashes(trim($_REQUEST['offer_type'])); $shop_itemid1 = stripslashes(trim($_POST['shop_itemid1'])); $shop_count1 = stripslashes(trim($_POST['shop_count1'])); $shop_itemid2 = stripslashes(trim($_POST['shop_itemid2'])); $shop_count2 = stripslashes(trim($_POST['shop_count2'])); $shop_offer_description = stripslashes(trim($_POST['shop_offer_description'])); $shop_offer_name = stripslashes(trim($_POST['shop_offer_name'])); $SQL->query('INSERT INTO `z_shop_offer` (id, points, itemid1, count1, itemid2, count2, offer_type, offer_description, offer_name, pid) VALUES (NULL, '.$SQL->quote($shop_points).', '.$SQL->quote($shop_itemid1).', '.$SQL->quote($shop_count1).', '.$SQL->quote($shop_itemid2).', '.$SQL->quote($shop_count2).', '.$SQL->quote($shop_offer_type).', '.$SQL->quote($shop_offer_description).', '.$SQL->quote($shop_offer_name).', 0)'); $main_content .= '<center><h2><font color="red">Added to Shop:</font></h2></center><hr/> <tr><td align="center" ><b>Points:</b></td> <td>'.$shop_points.'</td></tr><br>'; if($shop_offer_type == 'container'){ $main_content .= '<tr><td align="center" ><b>Container ID:</b></td> <td>'.$shop_itemid1.'</td></tr><br> <tr><td align="center" ><b>Count Container:</b></td> <td>'.$shop_count1.'</td></tr><br> <tr><td align="center" ><b> Item ID (in Container):</b></td> <td>'.$shop_itemid2.'</td></tr><br> <tr><td align="center" ><b>Count Item (in Container):</b></td> <td>'.$shop_count2.'</td></tr><br>'; } if ($shop_offer_type == 'item'){ $main_content .= '<tr><td align="center" ><b>Item ID:</b></td> <td>'.$shop_itemid1.'</td></tr><br> <tr><td align="center" ><b>Count Item:</b></td> <td>'.$shop_count1.'</td></tr><br>'; } if ($shop_offer_type == 'itemvip'){ $main_content .= '<tr><td align="center" ><b>Item ID:</b></td> <td>'.$shop_itemid1.'</td></tr><br> <tr><td align="center" ><b>Count Item:</b></td> <td>'.$shop_count1.'</td></tr><br>'; } if ($shop_offer_type == 'pacc'){ $main_content .= '<tr><td align="center" ><b>Days:</b></td> <td>'.$shop_count1.'</td></tr><br>'; } if ($shop_offer_type == 'vipdays'){ $main_content .= '<tr><td align="center" ><b>Days:</b></td> <td>'.$shop_count1.'</td></tr><br>'; } $main_content .= '<tr><td align="center" ><b>Offer Type:</b></td> <td>'.$shop_offer_type.'</td></tr><br> <tr><td align="center" ><b>Offer Description:</b></td> <td>'.$shop_offer_description.'</td></tr><br> <tr><td align="center" ><b>Offer Name:</b></td> <td>'.$shop_offer_name.'</td></tr> <br><form action="?subtopic=shopadmin&action=addoffer" method="post" ><input name="submit" type="submit" value="Back" title="Back"/></form>'; } } if($action == "viewoffer") { $items = simplexml_load_file($config['site']['server_path'].'/data/items/items.xml') or die('<b>Could not load items!</b>'); foreach($items->item as $v) $itemList[(int)$v['id']] = $v['name']; $order = array("id" => "id", "points" => "points", "offer_type" => "offer_type", "itemid1" => "itemid1", "itemid2" => "itemid2"); $main_content .= '<center><table width="550"><tr BGCOLOR="#505050"><td width="5"><font color="white"><a href="index.php?subtopic=shopadmin&action=viewoffer&order=' . getOrder($order, 'order', 'id') . '" class=white>ID:</td><td width="5"><font color="white"><a href="index.php?subtopic=shopadmin&action=viewoffer&order=' . getOrder($order, 'order', 'points') . '" class=white>Points:</td><td width="7"> <font color="white"><a href="index.php?subtopic=shopadmin&action=viewoffer&order=' . getOrder($order, 'order', 'itemid1') . '" class=white>Item ID:</td><td width="5"><font color="white">Count:</td><td width="7"><center><font color="white"><a href="index.php?subtopic=shopadmin&action=viewoffer&order=' . getOrder($order, 'order', 'itemid2') . '" class=white>Container ID:</center></td><td width="5"><font color="white">Count:</td><td width="7"><font color="white"><a href="index.php?subtopic=shopadmin&action=viewoffer&order=' . getOrder($order, 'order', 'offer_type') . '" class=white>Offer Type:</td> <td width="85"><font color="white">Offer Description:</td><td width="30"><font color="white">Offer Name:</td><td width="30"></td></tr>'; $shopoffers = $SQL->query('SELECT id, points, itemid1, count1, itemid2, count2, offer_type, offer_description, offer_name, pid FROM z_shop_offer ' . makeOrder($order, 'order', 'id')); foreach($shopoffers as $shop) { $main_content .= '</B><tr BGCOLOR="#D4C0A1"><td align="center">'.$shop['id'].'<td align="center">'.$shop['points'].'</td>'; if($shop['itemid1'] == "0") { $main_content .= '<td align="center">'.$shop['itemid1'].'<br></td>'; } else { $main_content .= '<td align="center">'.$shop['itemid1'].'<br>(' . $itemList[(int)$shop['itemid1']] . ')</td>'; } $main_content .= '<td align="center">'.$shop['count1'].'</td>'; if($shop['itemid2'] == "0") { $main_content .= '<td align="center">'.$shop['itemid2'].'</td>'; } else { $main_content .= '<td align="center">'.$shop['itemid2'].'<br>(' . $itemList[(int)$shop['itemid2']] . ')</td>'; } $main_content .= '<td align="center">'.$shop['count2'].'</td><td align="center">'.$shop['offer_type'].'</td><td align="left">'.$shop['offer_description'].'</td><td align="left">'.$shop['offer_name'].'</td>'; $main_content .= '<td align="center"><a href="?subtopic=shopadmin&action=editoffer&id='.$shop['id'].'"><img src="'.$layout_name.'/images/news/edit_news.png" border="0"></a><br><br><a href="?subtopic=shopadmin&action=deleteoffer&id='.$shop['id'].'"><img src="'.$layout_name.'/images/news/delete_news.png" border="0"></a></td>'; } $main_content .= '</td></tr></TABLE><br><form action="?subtopic=shopadmin" method="post" ><input name="submit" type="submit" value="Back" title="Back"/></form>'; } if($action == "deleteoffer") { $id = (int) $_REQUEST['id']; $SQL->query('DELETE FROM z_shop_offer WHERE id = '.$id.' LIMIT 1;'); $main_content .= '<center>Shop offer has been deleted.</center><br><center><form action="?subtopic=shopadmin&action=viewoffer" method="post" ><input name="submit" type="submit" value="Back" title="Back"/></form></center>'; } if($action == "editoffer") { $id = (int) $_REQUEST['id']; $shopoffers = $SQL->query('SELECT * FROM z_shop_offer WHERE id = '.$id.' LIMIT 1;'); foreach($shopoffers as $shop) { $main_content .= '<form action="?subtopic=shopadmin&action=edited&id='.$id.'" method="post" ><table border="0"><tr><td align="center" ><b>Points:</b></td> <td><input type="textbox" name="shop_points" maxlenght="7" value="'.$shop['points'].'" style="width: 70px"></td></tr>'; if($shop['offer_type'] == 'container'){ $main_content .= '<tr><td align="center" ><b>Container ID:</b></td> <td><input type="text" name="shop_itemid1" maxlenght="7" value="'.$shop['itemid1'].'" style="width: 70px" ></td></tr> <tr><td align="center" ><b>Count Container:</b></td> <td><input type="text" name="shop_count1" maxlenght="7" value="'.$shop['count1'].'" style="width: 70px" ></td></tr> <tr><td align="center" ><b>Item ID:</b></td> <td><input type="text" name="shop_itemid2" maxlenght="7" value="'.$shop['itemid2'].'" style="width: 70px" ></td></tr> <tr><td align="center" ><b>Count Item:</b></td> <td><input type="text" name="shop_count2" maxlenght="7" value="'.$shop['count2'].'" style="width: 70px" ></td></tr>'; } if($shop['offer_type'] == 'item'){ $main_content .= '<tr><td align="center"><b>Item ID:</b></td> <td><input type="text" name="shop_itemid1" maxlenght="7" value="'.$shop['itemid1'].'" style="width: 70px" ></td></tr> <tr><td align="center"><b>Item Count:</b></td> <td><input type="text" name="shop_count1" maxlenght="7" value="'.$shop['count1'].'" style="width: 70px" ></td></tr>'; } if($shop['offer_type'] == 'itemvip'){ $main_content .= '<tr><td align="center"><b>Item ID:</b></td> <td><input type="text" name="shop_itemid1" maxlenght="7" value="'.$shop['itemid1'].'" style="width: 70px" ></td></tr> <tr><td align="center"><b>Item Count:</b></td> <td><input type="text" name="shop_count1" maxlenght="7" value="'.$shop['count1'].'" style="width: 70px" ></td></tr>'; } if($shop['offer_type'] == 'pacc'){ $main_content .= '<tr><td align="center" ><b>Days:</b></td> <td><input type="text" name="shop_count1" maxlenght="7" style="width: 70px" ></td></tr>'; } if($shop['offer_type'] == 'vipdays'){ $main_content .= '<tr><td align="center" ><b>Days:</b></td> <td><input type="text" name="shop_count1" maxlenght="7" style="width: 70px" ></td></tr>'; } $main_content .= '<tr><td align="center" ><b>Offer Type:</b></td> <td><input type="text" name="shop_offer_type" value="'.$shop['offer_type'].'" maxlenght="40" style="width: 200px" ></td></tr> <tr><td align="center" ><b>Offer Description:</b></td> <td ><textarea name="shop_offer_description" rows="2" cols="35">'.$shop['offer_description'].'</textarea></td></tr> <tr><td align="center" ><b>Offer Name:</b></td> <td><input type="text" name="shop_offer_name" value="'.$shop['offer_name'].'" maxlenght="40" style="width: 200px" ></td></tr> <tr><td><input name="submit" type="submit" value="Submit" /></form></td><td></td></tr></table>'; $main_content .= '<form action="?subtopic=shopadmin&action=viewoffer" method="post" ><input name="submit" type="submit" value="Back" title="Back"/></form>'; } } if($action == "edited") { $id = (int) $_REQUEST['id']; $shop_points = stripslashes(trim($_POST['shop_points'])); $shop_offer_type = stripslashes(trim($_POST['shop_offer_type'])); $shop_itemid1 = stripslashes(trim($_POST['shop_itemid1'])); $shop_count1 = stripslashes(trim($_POST['shop_count1'])); $shop_itemid2 = stripslashes(trim($_POST['shop_itemid2'])); $shop_count2 = stripslashes(trim($_POST['shop_count2'])); $shop_offer_description = stripslashes(trim($_POST['shop_offer_description'])); $shop_offer_name = stripslashes(trim($_POST['shop_offer_name'])); $SQL->query('UPDATE `z_shop_offer` SET `points` = '.$shop_points.', `itemid1` = '.$SQL->quote($shop_itemid1).', `count1` = '.$SQL->quote($shop_count1).', `itemid2` = '.$SQL->quote($shop_itemid2).', `count2` = '.$SQL->quote($shop_count2).', `offer_type` = '.$SQL->quote($shop_offer_type).', `offer_description` = '.$SQL->quote($shop_offer_description).', `offer_name` = '.$SQL->quote($shop_offer_name).' WHERE `id` = '.$id.';'); $main_content .= '<b><center>Shop offer successfully edited.</b><br><br><form action="?subtopic=shopadmin&action=viewoffer" method="post" ><input name="submit" type="submit" value="Back" title="Back"/></form><meta http-equiv="refresh" content="1;url=/?subtopic=shopadmin&action=viewoffer" />'; } if($action == "points") { $player = stripslashes(ucwords(strtolower(trim($_REQUEST['character'])))); $points = $_POST['points']; if(empty($player)) { $main_content .= '<form action="" method="post"><B>Enter Character Name:</B><input type="textbox" name="character"><br> <B>Enter Points Amount:</B><input type="textbox" name="points"><br><br><input type="submit" value="Submit"> </form></center><form action="?subtopic=shopadmin" method="post" ><input name="submit" type="submit" value="Back" title="Back"/></form>'; } else { $player_data = $SQL->query("SELECT * FROM `players` WHERE `name` = '".$player."';")->fetch(); $SQL->query("UPDATE `accounts` SET `premium_points` = `premium_points` + '".$points."' WHERE `id` = '".$player_data['account_id']."'"); $main_content .= '<b><center>'.$points.' Premium Points added to the account of <i>'.$player.'</i> !</b></center><br> <form action="?subtopic=shopadmin" method="post" ><input name="submit" type="submit" value="Back" title="Back"/></form>'; } } } else { $main_content .= 'Sorry, you have not the rights to access this page.'; } ?> Se ajudei por favor de um REP + , não gosta nada rs ATT : Marini!
  15. Opa , Aqui está o poblema resolvido pelo menos aqui não ta dando esse poblema / vai na pasta -> xampp\htdocs\pot\OTS_Player.php Deleta o Script todo e poe esse . <?php /**#@+ * @version 0.0.1 */ /** * @package POT * @version 0.1.5 * @author Wrzasq <[email protected]> * @copyright 2007 - 2008 (C) by Wrzasq * @license http://www.gnu.org/licenses/lgpl-3.0.txt GNU Lesser General Public License, Version 3 */ /** * OTServ character abstraction. * * @package POT * @version 0.1.5 * @property string $name Character name. * @property OTS_Account $account Account to which character belongs. * @property OTS_Group $group Group of which character is member. * @property int $sex Gender. * @property int $vocation Vocation. * @property int $experience Experience points. * @property int $level Experience level. * @property int $magLevel Magic level. * @property int $health Hit points. * @property int $healthMax Maximum hit points. * @property int $mana Mana. * @property int $manaMax Maximum mana. * @property int $manaSpent Spent mana. * @property int $soul Soul points. * @property int $direction Looking direction. * @property int $lookBody Body color. * @property int $lookFeet Feet color. * @property int $lookHead Hairs color. * @property int $lookLegs Legs color. * @property int $lookType Outfit type. * @property int $lookAddons Addons. * @property int $posX Spawn X coord. * @property int $posY Spawn Y coord. * @property int $posZ Spawn Z coord. * @property int $cap Capacity. * @property int $lastLogin Last login timestamp. * @property int $lastIP Last login IP number. * @property string $conditions Binary conditions. * @property int $redSkullTime Timestamp for which red skull will last. * @property string $guildNick * @property OTS_GuildRank $rank * @property int $townId * @property int $lossExperience * @property int $lossMana * @property int $lossSkills * @property int $lossItems * @property int $balance Bank balance. * @property bool $save Player save flag. * @property bool $redSkull Player red skull flag. * @property bool $banned Player banned state. * @property-read int $id Player ID. * @property-read bool $loaded Loaded state. * @property-read string $townName Name of town in which player residents. * @property-read OTS_House $house House which player rents. * @property-read OTS_Players_List $vipsList List of VIPs of player. * @property-read string $vocationName String vocation representation. * @property-read array $spellsList List of known spells. * @tutorial POT/Players.pkg */ class OTS_Player extends OTS_Row_DAO { /** * Player data. * * @version 0.1.2 * @var array */ private $data = array('sex' => POT::SEX_FEMALE, 'vocation' => 0, 'experience' => 0, 'level' => 1, 'maglevel' => 0, 'health' => 100, 'healthmax' => 100, 'mana' => 100, 'manamax' => 100, 'manaspent' => 0, 'soul' => 0, 'direction' => POT::DIRECTION_NORTH, 'lookbody' => 10, 'lookfeet' => 10, 'lookhead' => 10, 'looklegs' => 10, 'looktype' => 136, 'lookaddons' => 0, 'posx' => 0, 'posy' => 0, 'posz' => 0, 'cap' => 0, 'lastlogin' => 0, 'lastip' => 0, 'save' => true, 'skulltime' => 0, 'skull' => false, 'guildnick' => '', 'loss_experience' => 10, 'loss_mana' => 10, 'loss_skills' => 10, 'loss_items' => 10, 'balance' => 0, 'deleted' => 0, 'promotion' => 0, 'online' => 0, 'marriage' => 0, 'comment' => '', 'created' => 0, 'hide_char' => 0, 'old_name' => '', 'world_id' => 0); /** * Player skills. * * @version 0.0.2 * @since 0.0.2 * @var array */ private $skills = array(); /** * Magic PHP5 method. * * Allows object serialisation. * * @return array List of properties that should be saved. * @version 0.0.4 * @since 0.0.4 */ public function __sleep() { return array('data', 'skills'); } /** * Loads player with given id. * * @version 0.1.2 * @param int $id Player's ID. * @throws PDOException On PDO operation error. */ public function load($id) { // SELECT query on database $this->data = $this->db->query('SELECT ' . $this->db->fieldName('id') . ', ' . $this->db->fieldName('name') . ', ' . $this->db->fieldName('account_id') . ', ' . $this->db->fieldName('group_id') . ', ' . $this->db->fieldName('sex') . ', ' . $this->db->fieldName('vocation') . ', ' . $this->db->fieldName('experience') . ', ' . $this->db->fieldName('level') . ', ' . $this->db->fieldName('maglevel') . ', ' . $this->db->fieldName('health') . ', ' . $this->db->fieldName('healthmax') . ', ' . $this->db->fieldName('mana') . ', ' . $this->db->fieldName('manamax') . ', ' . $this->db->fieldName('manaspent') . ', ' . $this->db->fieldName('soul') . ', ' . $this->db->fieldName('direction') . ', ' . $this->db->fieldName('lookbody') . ', ' . $this->db->fieldName('lookfeet') . ', ' . $this->db->fieldName('lookhead') . ', ' . $this->db->fieldName('looklegs') . ', ' . $this->db->fieldName('looktype') . ', ' . $this->db->fieldName('lookaddons') . ', ' . $this->db->fieldName('posx') . ', ' . $this->db->fieldName('posy') . ', ' . $this->db->fieldName('posz') . ', ' . $this->db->fieldName('cap') . ', ' . $this->db->fieldName('lastlogin') . ', ' . $this->db->fieldName('lastip') . ', ' . $this->db->fieldName('save') . ', ' . $this->db->fieldName('conditions') . ', ' . $this->db->fieldName('skulltime') . ', ' . $this->db->fieldName('skull') . ', ' . $this->db->fieldName('guildnick') . ', ' . $this->db->fieldName('rank_id') . ', ' . $this->db->fieldName('town_id') . ', ' . $this->db->fieldName('loss_experience') . ', ' . $this->db->fieldName('loss_mana') . ', ' . $this->db->fieldName('loss_skills') . ', ' . $this->db->fieldName('loss_items') . ', ' . $this->db->fieldName('balance') . ', ' . $this->db->fieldName('online') . ', ' . $this->db->fieldName('deleted') . ', ' . $this->db->fieldName('promotion') . ', ' . $this->db->fieldName('marriage') . ', ' . $this->db->fieldName('comment') . ', ' . $this->db->fieldName('created') . ', ' . $this->db->fieldName('hide_char') . ', ' . $this->db->fieldName('old_name') . ', ' . $this->db->fieldName('world_id') . ' FROM ' . $this->db->tableName('players') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . (int) $id)->fetch(); // loads skills if( $this->isLoaded() ) { foreach( $this->db->query('SELECT ' . $this->db->fieldName('skillid') . ', ' . $this->db->fieldName('value') . ', ' . $this->db->fieldName('count') . ' FROM ' . $this->db->tableName('player_skills') . ' WHERE ' . $this->db->fieldName('player_id') . ' = ' . $this->data['id'])->fetchAll() as $skill) { $this->skills[ $skill['skillid'] ] = array('value' => $skill['value'], 'tries' => $skill['count']); } } } /** * Loads player by it's name. * * @version 0.0.5 * @since 0.0.2 * @param string $name Player's name. * @throws PDOException On PDO operation error. */ public function find($name) { // finds player's ID $id = $this->db->query('SELECT ' . $this->db->fieldName('id') . ' FROM ' . $this->db->tableName('players') . ' WHERE ' . $this->db->fieldName('name') . ' = ' . $this->db->quote($name) )->fetch(); // if anything was found if( isset($id['id']) ) { $this->load($id['id']); } else { // finds player's ID $id = $this->db->query('SELECT ' . $this->db->fieldName('id') . ' FROM ' . $this->db->tableName('players') . ' WHERE ' . $this->db->fieldName('old_name') . ' = ' . $this->db->quote($name) . ' AND ' . $this->db->fieldName('nick_verify') .' = 1')->fetch(); // if anything was found if( isset($id['id']) ) { $this->load($id['id']); } } } /** * Checks if object is loaded. * * @return bool Load state. */ public function isLoaded() { return isset($this->data['id']); } /** * Saves player in database. * * <p> * If player is not loaded to represent any existing group it will create new row for it. * </p> * * @version 0.1.2 * @throws PDOException On PDO operation error. */ public function save() { // updates existing player if( isset($this->data['id']) ) { // UPDATE query on database $this->db->query('UPDATE ' . $this->db->tableName('players') . ' SET ' . $this->db->fieldName('name') . ' = ' . $this->db->quote($this->data['name']) . ', ' . $this->db->fieldName('account_id') . ' = ' . $this->data['account_id'] . ', ' . $this->db->fieldName('group_id') . ' = ' . $this->data['group_id'] . ', ' . $this->db->fieldName('sex') . ' = ' . $this->data['sex'] . ', ' . $this->db->fieldName('vocation') . ' = ' . $this->data['vocation'] . ', ' . $this->db->fieldName('experience') . ' = ' . $this->data['experience'] . ', ' . $this->db->fieldName('level') . ' = ' . $this->data['level'] . ', ' . $this->db->fieldName('maglevel') . ' = ' . $this->data['maglevel'] . ', ' . $this->db->fieldName('health') . ' = ' . $this->data['health'] . ', ' . $this->db->fieldName('healthmax') . ' = ' . $this->data['healthmax'] . ', ' . $this->db->fieldName('mana') . ' = ' . $this->data['mana'] . ', ' . $this->db->fieldName('manamax') . ' = ' . $this->data['manamax'] . ', ' . $this->db->fieldName('manaspent') . ' = ' . $this->data['manaspent'] . ', ' . $this->db->fieldName('soul') . ' = ' . $this->data['soul'] . ', ' . $this->db->fieldName('direction') . ' = ' . $this->data['direction'] . ', ' . $this->db->fieldName('lookbody') . ' = ' . $this->data['lookbody'] . ', ' . $this->db->fieldName('lookfeet') . ' = ' . $this->data['lookfeet'] . ', ' . $this->db->fieldName('lookhead') . ' = ' . $this->data['lookhead'] . ', ' . $this->db->fieldName('looklegs') . ' = ' . $this->data['looklegs'] . ', ' . $this->db->fieldName('looktype') . ' = ' . $this->data['looktype'] . ', ' . $this->db->fieldName('lookaddons') . ' = ' . $this->data['lookaddons'] . ', ' . $this->db->fieldName('posx') . ' = ' . $this->data['posx'] . ', ' . $this->db->fieldName('posy') . ' = ' . $this->data['posy'] . ', ' . $this->db->fieldName('posz') . ' = ' . $this->data['posz'] . ', ' . $this->db->fieldName('cap') . ' = ' . $this->data['cap'] . ', ' . $this->db->fieldName('lastlogin') . ' = ' . $this->data['lastlogin'] . ', ' . $this->db->fieldName('lastip') . ' = ' . $this->data['lastip'] . ', ' . $this->db->fieldName('save') . ' = ' . (int) $this->data['save'] . ', ' . $this->db->fieldName('conditions') . ' = ' . $this->db->quote($this->data['conditions']) . ', ' . $this->db->fieldName('skulltime') . ' = ' . $this->data['skulltime'] . ', ' . $this->db->fieldName('skull') . ' = ' . (int) $this->data['skull'] . ', ' . $this->db->fieldName('guildnick') . ' = ' . $this->db->quote($this->data['guildnick']) . ', ' . $this->db->fieldName('rank_id') . ' = ' . $this->data['rank_id'] . ', ' . $this->db->fieldName('town_id') . ' = ' . $this->data['town_id'] . ', ' . $this->db->fieldName('loss_experience') . ' = ' . $this->data['loss_experience'] . ', ' . $this->db->fieldName('loss_mana') . ' = ' . $this->data['loss_mana'] . ', ' . $this->db->fieldName('loss_skills') . ' = ' . $this->data['loss_skills'] . ', ' . $this->db->fieldName('loss_items') . ' = ' . $this->data['loss_items'] . ', ' . $this->db->fieldName('balance') . ' = ' . $this->data['balance'] . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']); } // creates new player else { // INSERT query on database $this->db->query('INSERT INTO ' . $this->db->tableName('players') . ' (' . $this->db->fieldName('name') . ', ' . $this->db->fieldName('account_id') . ', ' . $this->db->fieldName('group_id') . ', ' . $this->db->fieldName('sex') . ', ' . $this->db->fieldName('vocation') . ', ' . $this->db->fieldName('experience') . ', ' . $this->db->fieldName('level') . ', ' . $this->db->fieldName('maglevel') . ', ' . $this->db->fieldName('health') . ', ' . $this->db->fieldName('healthmax') . ', ' . $this->db->fieldName('mana') . ', ' . $this->db->fieldName('manamax') . ', ' . $this->db->fieldName('manaspent') . ', ' . $this->db->fieldName('soul') . ', ' . $this->db->fieldName('direction') . ', ' . $this->db->fieldName('lookbody') . ', ' . $this->db->fieldName('lookfeet') . ', ' . $this->db->fieldName('lookhead') . ', ' . $this->db->fieldName('looklegs') . ', ' . $this->db->fieldName('looktype') . ', ' . $this->db->fieldName('lookaddons') . ', ' . $this->db->fieldName('posx') . ', ' . $this->db->fieldName('posy') . ', ' . $this->db->fieldName('posz') . ', ' . $this->db->fieldName('cap') . ', ' . $this->db->fieldName('lastlogin') . ', ' . $this->db->fieldName('lastip') . ', ' . $this->db->fieldName('save') . ', ' . $this->db->fieldName('conditions') . ', ' . $this->db->fieldName('skulltime') . ', ' . $this->db->fieldName('skull') . ', ' . $this->db->fieldName('guildnick') . ', ' . $this->db->fieldName('rank_id') . ', ' . $this->db->fieldName('town_id') . ', ' . $this->db->fieldName('loss_experience') . ', ' . $this->db->fieldName('loss_mana') . ', ' . $this->db->fieldName('loss_skills') . ', ' . $this->db->fieldName('loss_items') . ', ' . $this->db->fieldName('balance') . ', ' . $this->db->fieldName('created') . ', ' . $this->db->fieldName('promotion') . ') VALUES (' . $this->db->quote($this->data['name']) . ', ' . $this->data['account_id'] . ', ' . $this->data['group_id'] . ', ' . $this->data['sex'] . ', ' . $this->data['vocation'] . ', ' . $this->data['experience'] . ', ' . $this->data['level'] . ', ' . $this->data['maglevel'] . ', ' . $this->data['health'] . ', ' . $this->data['healthmax'] . ', ' . $this->data['mana'] . ', ' . $this->data['manamax'] . ', ' . $this->data['manaspent'] . ', ' . $this->data['soul'] . ', ' . $this->data['direction'] . ', ' . $this->data['lookbody'] . ', ' . $this->data['lookfeet'] . ', ' . $this->data['lookhead'] . ', ' . $this->data['looklegs'] . ', ' . $this->data['looktype'] . ', ' . $this->data['lookaddons'] . ', ' . $this->data['posx'] . ', ' . $this->data['posy'] . ', ' . $this->data['posz'] . ', ' . $this->data['cap'] . ', ' . $this->data['lastlogin'] . ', ' . $this->data['lastip'] . ', ' . (int) $this->data['save'] . ', ' . $this->db->quote($this->data['conditions']) . ', ' . $this->data['skulltime'] . ', ' . (int) $this->data['skull'] . ', ' . $this->db->quote($this->data['guildnick']) . ', ' . $this->data['rank_id'] . ', ' . $this->data['town_id'] . ', ' . $this->data['loss_experience'] . ', ' . $this->data['loss_mana'] . ', ' . $this->data['loss_skills'] . ', ' . $this->data['loss_items'] . ', ' . $this->data['balance'] . ', ' . time() . ', ' . $this->data['promotion'] . ')'); // ID of new group $this->data['id'] = $this->db->lastInsertId(); } // updates skills - doesn't matter if we have just created character - trigger inserts new skills foreach($this->skills as $id => $skill) { $this->db->query('UPDATE ' . $this->db->tableName('player_skills') . ' SET ' . $this->db->fieldName('value') . ' = ' . $skill['value'] . ', ' . $this->db->fieldName('count') . ' = ' . $skill['tries'] . ' WHERE ' . $this->db->fieldName('player_id') . ' = ' . $this->data['id'] . ' AND ' . $this->db->fieldName('skillid') . ' = ' . $id); } } /** * Player ID. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return int Player ID. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getId() { if( !isset($this->data['id']) ) { throw new E_OTS_NotLoaded(); } return $this->data['id']; } public function getWorld() { if( !isset($this->data['world_id']) ) { throw new E_OTS_NotLoaded(); } return $this->data['world_id']; } public function getHideChar() { if( !isset($this->data['hide_char']) ) { throw new E_OTS_NotLoaded(); } return $this->data['hide_char']; } public function getMarriage() { if( !isset($this->data['marriage']) ) { throw new E_OTS_NotLoaded(); } return $this->data['marriage']; } /** * Player name. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return string Player's name. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getName() { if( !isset($this->data['name']) ) { throw new E_OTS_NotLoaded(); } return $this->data['name']; } public function getOldName() { if( !isset($this->data['old_name']) ) { throw new E_OTS_NotLoaded(); } return $this->data['old_name']; } /** * Sets players's name. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param string $name Name. */ public function setName($name) { $this->data['name'] = (string) $name; } public function setWorld($id) { $this->data['world_id'] = (int) $id; } /** * Returns account of this player. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.1.0 * @return OTS_Account Owning account. * @throws E_OTS_NotLoaded If player is not loaded. * @throws PDOException On PDO operation error. */ public function getAccount() { if( !isset($this->data['account_id']) ) { throw new E_OTS_NotLoaded(); } $account = new OTS_Account(); $account->load($this->data['account_id']); return $account; } /** * Assigns character to account. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param OTS_Account $account Owning account. * @throws E_OTS_NotLoaded If passed <var>$account</var> parameter is not loaded. */ public function setAccount(OTS_Account $account) { $this->data['account_id'] = $account->getId(); } /** * Returns group of this player. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.1.0 * @return OTS_Group Group of which current character is member. * @throws E_OTS_NotLoaded If player is not loaded. * @throws PDOException On PDO operation error. */ public function getGroup() { if( !isset($this->data['group_id']) ) { throw new E_OTS_NotLoaded(); } return $this->data['group_id']; } /** * Assigns character to group. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param OTS_Group $group Group to be a member. * @throws E_OTS_NotLoaded If passed <var>$group</var> parameter is not loaded. */ public function setGroup($group) { $this->data['group_id'] = $group; } /** * Player's Premium Account expiration timestamp. * * @version 0.1.5 * @since 0.0.3 * @return int Player PACC expiration timestamp. * @throws E_OTS_NotLoaded If player is not loaded. * @deprecated 0.1.5 Use OTS_Account->getPremiumEnd(). */ public function getPremiumEnd() { if( !isset($this->data['id']) ) { throw new E_OTS_NotLoaded(); } return $this->getAccount()->getPremiumEnd(); } public function getPlayerVipDays() { if( !isset($this->data['id']) ) { throw new E_OTS_NotLoaded(); } return $this->getAccount()->getPlayerVipDays(); } /** * Player gender. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return int Player gender. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getSex() { if( !isset($this->data['sex']) ) { throw new E_OTS_NotLoaded(); } return $this->data['sex']; } public function isDeleted() { if( !isset($this->data['deleted']) ) { throw new E_OTS_NotLoaded(); } return $this->data['deleted'] > 0; } public function isOnline() { if( !isset($this->data['online']) ) { throw new E_OTS_NotLoaded(); } return $this->data['online'] == 1; } public function getCreated() { if( !isset($this->data['created']) ) { throw new E_OTS_NotLoaded(); } return $this->data['created']; } public function getComment() { if( !isset($this->data['comment']) ) { throw new E_OTS_NotLoaded(); } return $this->data['comment']; } /** * Sets player gender. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param int $sex Player gender. */ public function setSex($sex) { $this->data['sex'] = (int) $sex; } /** * Player proffesion. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return int Player proffesion. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getVocation() { if( !isset($this->data['vocation']) ) { throw new E_OTS_NotLoaded(); } return $this->data['vocation']; } public function getPromotion() { if( !isset($this->data['promotion']) ) { throw new E_OTS_NotLoaded(); } return $this->data['promotion']; } /** * Sets player proffesion. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param int $vocation Player proffesion. */ public function setVocation($vocation) { $this->data['vocation'] = (int) $vocation; } public function setPromotion($promotion) { $this->data['promotion'] = (int) $promotion; } /** * Experience points. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return int Experience points. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getExperience() { if( !isset($this->data['experience']) ) { throw new E_OTS_NotLoaded(); } return $this->data['experience']; } /** * Sets experience points. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param int $experience Experience points. */ public function setExperience($experience) { $this->data['experience'] = (int) $experience; } /** * Experience level. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return int Experience level. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getLevel() { if( !isset($this->data['level']) ) { throw new E_OTS_NotLoaded(); } return $this->data['level']; } /** * Sets experience level. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param int $level Experience level. */ public function setLevel($level) { $this->data['level'] = (int) $level; } /** * Magic level. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return int Magic level. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getMagLevel() { if( !isset($this->data['maglevel']) ) { throw new E_OTS_NotLoaded(); } return $this->data['maglevel']; } /** * Sets magic level. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param int $maglevel Magic level. */ public function setMagLevel($maglevel) { $this->data['maglevel'] = (int) $maglevel; } /** * Current HP. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return int Current HP. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getHealth() { if( !isset($this->data['health']) ) { throw new E_OTS_NotLoaded(); } return $this->data['health']; } /** * Sets current HP. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param int $health Current HP. */ public function setHealth($health) { $this->data['health'] = (int) $health; } /** * Maximum HP. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return int Maximum HP. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getHealthMax() { if( !isset($this->data['healthmax']) ) { throw new E_OTS_NotLoaded(); } return $this->data['healthmax']; } /** * Sets maximum HP. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param int $healthmax Maximum HP. */ public function setHealthMax($healthmax) { $this->data['healthmax'] = (int) $healthmax; } /** * Current mana. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return int Current mana. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getMana() { if( !isset($this->data['mana']) ) { throw new E_OTS_NotLoaded(); } return $this->data['mana']; } /** * Sets current mana. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param int $mana Current mana. */ public function setMana($mana) { $this->data['mana'] = (int) $mana; } /** * Maximum mana. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return int Maximum mana. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getManaMax() { if( !isset($this->data['manamax']) ) { throw new E_OTS_NotLoaded(); } return $this->data['manamax']; } /** * Sets maximum mana. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param int $manamax Maximum mana. */ public function setManaMax($manamax) { $this->data['manamax'] = (int) $manamax; } /** * Mana spent. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return int Mana spent. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getManaSpent() { if( !isset($this->data['manaspent']) ) { throw new E_OTS_NotLoaded(); } return $this->data['manaspent']; } /** * Sets mana spent. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param int $manaspent Mana spent. */ public function setManaSpent($manaspent) { $this->data['manaspent'] = (int) $manaspent; } /** * Soul points. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return int Soul points. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getSoul() { if( !isset($this->data['soul']) ) { throw new E_OTS_NotLoaded(); } return $this->data['soul']; } /** * Sets soul points. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param int $soul Soul points. */ public function setSoul($soul) { $this->data['soul'] = (int) $soul; } /** * Looking direction. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return int Looking direction. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getDirection() { if( !isset($this->data['direction']) ) { throw new E_OTS_NotLoaded(); } return $this->data['direction']; } /** * Sets looking direction. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param int $direction Looking direction. */ public function setDirection($direction) { $this->data['direction'] = (int) $direction; } /** * Body color. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return int Body color. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getLookBody() { if( !isset($this->data['lookbody']) ) { throw new E_OTS_NotLoaded(); } return $this->data['lookbody']; } /** * Sets body color. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param int $lookbody Body color. */ public function setLookBody($lookbody) { $this->data['lookbody'] = (int) $lookbody; } /** * Boots color. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return int Boots color. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getLookFeet() { if( !isset($this->data['lookfeet']) ) { throw new E_OTS_NotLoaded(); } return $this->data['lookfeet']; } /** * Sets boots color. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param int $lookfeet Boots color. */ public function setLookFeet($lookfeet) { $this->data['lookfeet'] = (int) $lookfeet; } /** * Hair color. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return int Hair color. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getLookHead() { if( !isset($this->data['lookhead']) ) { throw new E_OTS_NotLoaded(); } return $this->data['lookhead']; } /** * Sets hair color. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param int $lookhead Hair color. */ public function setLookHead($lookhead) { $this->data['lookhead'] = (int) $lookhead; } /** * Legs color. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return int Legs color. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getLookLegs() { if( !isset($this->data['looklegs']) ) { throw new E_OTS_NotLoaded(); } return $this->data['looklegs']; } /** * Sets legs color. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param int $looklegs Legs color. */ public function setLookLegs($looklegs) { $this->data['looklegs'] = (int) $looklegs; } /** * Outfit. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return int Outfit. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getLookType() { if( !isset($this->data['looktype']) ) { throw new E_OTS_NotLoaded(); } return $this->data['looktype']; } /** * Sets outfit. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param int $looktype Outfit. */ public function setLookType($looktype) { $this->data['looktype'] = (int) $looktype; } /** * Addons. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return int Addons. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getLookAddons() { if( !isset($this->data['lookaddons']) ) { throw new E_OTS_NotLoaded(); } return $this->data['lookaddons']; } /** * Sets addons. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param int $lookaddons Addons. */ public function setLookAddons($lookaddons) { $this->data['lookaddons'] = (int) $lookaddons; } /** * X map coordinate. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return int X map coordinate. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getPosX() { if( !isset($this->data['posx']) ) { throw new E_OTS_NotLoaded(); } return $this->data['posx']; } /** * Sets X map coordinate. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param int $posx X map coordinate. */ public function setPosX($posx) { $this->data['posx'] = (int) $posx; } /** * Y map coordinate. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return int Y map coordinate. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getPosY() { if( !isset($this->data['posy']) ) { throw new E_OTS_NotLoaded(); } return $this->data['posy']; } /** * Sets Y map coordinate. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param int $posy Y map coordinate. */ public function setPosY($posy) { $this->data['posy'] = (int) $posy; } /** * Z map coordinate. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return int Z map coordinate. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getPosZ() { if( !isset($this->data['posz']) ) { throw new E_OTS_NotLoaded(); } return $this->data['posz']; } /** * Sets Z map coordinate. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param int $posz Z map coordinate. */ public function setPosZ($posz) { $this->data['posz'] = (int) $posz; } /** * Capacity. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return int Capacity. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getCap() { if( !isset($this->data['cap']) ) { throw new E_OTS_NotLoaded(); } return $this->data['cap']; } /** * Sets capacity. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param int $cap Capacity. */ public function setCap($cap) { $this->data['cap'] = (int) $cap; } /** * Last login timestamp. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return int Last login timestamp. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getLastLogin() { if( !isset($this->data['lastlogin']) ) { throw new E_OTS_NotLoaded(); } return $this->data['lastlogin']; } /** * Sets last login timestamp. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param int $lastlogin Last login timestamp. */ public function setLastLogin($lastlogin) { $this->data['lastlogin'] = (int) $lastlogin; } /** * Last login IP. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return int Last login IP. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getLastIP() { if( !isset($this->data['lastip']) ) { throw new E_OTS_NotLoaded(); } return $this->data['lastip']; } /** * Sets last login IP. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param int $lastip Last login IP. */ public function setLastIP($lastip) { $this->data['lastip'] = (int) $lastip; } /** * Checks if save flag is set. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.7 * @return bool PACC days. * @throws E_OTS_NotLoaded If player is not loaded. */ public function isSaveSet() { if( !isset($this->data['save']) ) { throw new E_OTS_NotLoaded(); } return $this->data['save']; } /** * Unsets save flag. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @version 0.0.7 */ public function unsetSave() { $this->data['save'] = false; } /** * @version 0.0.7 * @since 0.0.6 * @return int Save counter. * @throws E_OTS_NotLoaded If player is not loaded. * @deprecated 0.0.7 Save field is back as flag not a counter. */ public function getSave() { if( !isset($this->data['save']) ) { throw new E_OTS_NotLoaded(); } return $this->data['save']; } /** * Sets save flag. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @version 0.0.7 * @param int $save Deprecated, unused, optional. */ public function setSave($save = 1) { $this->data['save'] = true; } /** * Conditions. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return string Conditions binary string. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getConditions() { if( !isset($this->data['conditions']) ) { throw new E_OTS_NotLoaded(); } return $this->data['conditions']; } /** * Sets conditions. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param string $conditions Condition binary string. */ public function setConditions($conditions) { $this->data['conditions'] = $conditions; } /** * Red skulled time remained. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return int Red skulled time remained. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getRedSkullTime() { if( !isset($this->data['redskulltime']) ) { throw new E_OTS_NotLoaded(); } return $this->data['redskulltime']; } /** * Sets red skulled time remained. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param int $redskulltime Red skulled time remained. */ public function setRedSkullTime($redskulltime) { $this->data['redskulltime'] = (int) $redskulltime; } /** * Checks if player has red skull. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return bool Red skull state. * @throws E_OTS_NotLoaded If player is not loaded. */ public function hasRedSkull() { if( !isset($this->data['redskull']) ) { throw new E_OTS_NotLoaded(); } return $this->data['redskull']; } /** * Unsets red skull flag. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> */ public function unsetRedSkull() { $this->data['redskull'] = false; } /** * Sets red skull flag. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> */ public function setRedSkull() { $this->data['redskull'] = true; } /** * Guild nick. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return string Guild title. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getGuildNick() { if( !isset($this->data['guildnick']) ) { throw new E_OTS_NotLoaded(); } return $this->data['guildnick']; } /** * Sets guild nick. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param string $guildnick Name. */ public function setGuildNick($guildnick) { $this->data['guildnick'] = (string) $guildnick; } /** * @version 0.0.3 * @return int Guild rank ID. * @throws E_OTS_NotLoaded If player is not loaded. * @deprecated 0.0.4 Use getRank(). */ public function getRankId() { if( !isset($this->data['rank_id']) ) { throw new E_OTS_NotLoaded(); } return $this->data['rank_id']; } /** * Assigned guild rank. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.1.0 * @return OTS_GuildRank|null Guild rank (null if not member of any). * @throws E_OTS_NotLoaded If player is not loaded. * @throws PDOException On PDO operation error. */ public function getRank() { if( !isset($this->data['rank_id']) ) { throw new E_OTS_NotLoaded(); } if($this->data['rank_id'] == 0) { return null; } $guildRank = new OTS_GuildRank(); $guildRank->load($this->data['rank_id']); return $guildRank; } /** * @param int $rank_id Guild rank ID. * @deprecated 0.0.4 Use setRank(). */ public function setRankId($rank_id) { $this->data['rank_id'] = (int) $rank_id; } /** * Assigns guild rank. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param OTS_GuildRank|null Guild rank (null to clear assign). * @throws E_OTS_NotLoaded If passed <var>$guildRank</var> parameter is not loaded. */ public function setRank(OTS_GuildRank $guildRank = null) { if( isset($guildRank) ) { $this->data['rank_id'] = $guildRank->getId(); } else { $this->data['rank_id'] = 0; } } /** * Residence town's ID. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return int Residence town's ID. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getTownId() { if( !isset($this->data['town_id']) ) { throw new E_OTS_NotLoaded(); } return $this->data['town_id']; } /** * Sets residence town's ID. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param int $town_id Residence town's ID. */ public function setTownId($town_id) { $this->data['town_id'] = (int) $town_id; } /** * Percentage of experience lost after dead. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return int Percentage of experience lost after dead. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getLossExperience() { if( !isset($this->data['loss_experience']) ) { throw new E_OTS_NotLoaded(); } return $this->data['loss_experience']; } /** * Sets percentage of experience lost after dead. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param int $loss_experience Percentage of experience lost after dead. */ public function setLossExperience($loss_experience) { $this->data['loss_experience'] = (int) $loss_experience; } /** * Percentage of used mana lost after dead. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return int Percentage of used mana lost after dead. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getLossMana() { if( !isset($this->data['loss_mana']) ) { throw new E_OTS_NotLoaded(); } return $this->data['loss_mana']; } /** * Sets percentage of used mana lost after dead. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param int $loss_mana Percentage of used mana lost after dead. */ public function setLossMana($loss_mana) { $this->data['loss_mana'] = (int) $loss_mana; } /** * Percentage of skills lost after dead. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.0.3 * @return int Percentage of skills lost after dead. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getLossSkills() { if( !isset($this->data['loss_skills']) ) { throw new E_OTS_NotLoaded(); } return $this->data['loss_skills']; } /** * Sets percentage of skills lost after dead. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @param int $loss_skills Percentage of skills lost after dead. */ public function setLossSkills($loss_skills) { $this->data['loss_skills'] = (int) $loss_skills; } /** * Percentage of items lost after dead. * * @version 0.1.4 * @since 0.1.4 * @return int Percentage of items lost after dead. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getLossItems() { if( !isset($this->data['loss_items']) ) { throw new E_OTS_NotLoaded(); } return $this->data['loss_items']; } /** * Sets percentage of items lost after dead. * * @version 0.1.4 * @since 0.1.4 * @param int $loss_items Percentage of items lost after dead. */ public function setLossItems($loss_items) { $this->data['loss_items'] = (int) $loss_items; } /** * Bank balance. * * @version 0.1.2 * @since 0.1.2 * @return int Amount of money stored in bank. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getBalance() { if( !isset($this->data['balance']) ) { throw new E_OTS_NotLoaded(); } return $this->data['balance']; } /** * Sets bank balance value. * * <p> * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database. * </p> * * @version 0.1.2 * @since 0.1.2 * @param int $balance Amount of money to be set in bank. */ public function setBalance($balance) { $this->data['balance'] = (int) $balance; } /** * Reads custom field. * * <p> * Reads field by it's name. Can read any field of given record that exists in database. * </p> * * <p> * Note: You should use this method only for fields that are not provided in standard setters/getters (SVN fields). This method runs SQL query each time you call it so it highly overloads used resources. * </p> * * @version 0.0.5 * @since 0.0.3 * @param string $field Field name. * @return string Field value. * @throws E_OTS_NotLoaded If player is not loaded. * @throws PDOException On PDO operation error. */ public function getCustomField($field) { if( !isset($this->data['id']) ) { throw new E_OTS_NotLoaded(); } $value = $this->db->query('SELECT ' . $this->db->fieldName($field) . ' FROM ' . $this->db->tableName('players') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id'])->fetch(); return $value[$field]; } /** * Writes custom field. * * <p> * Write field by it's name. Can write any field of given record that exists in database. * </p> * * <p> * Note: You should use this method only for fields that are not provided in standard setters/getters (SVN fields). This method runs SQL query each time you call it so it highly overloads used resources. * </p> * * <p> * Note: Make sure that you pass $value argument of correct type. This method determinates whether to quote field value. It is safe - it makes you sure that no unproper queries that could lead to SQL injection will be executed, but it can make your code working wrong way. For example: $object->setCustomField('foo', '1'); will quote 1 as as string ('1') instead of passing it as a integer. * </p> * * @version 0.0.5 * @since 0.0.3 * @param string $field Field name. * @param mixed $value Field value. * @throws E_OTS_NotLoaded If player is not loaded. * @throws PDOException On PDO operation error. */ public function setCustomField($field, $value) { if( !isset($this->data['id']) ) { throw new E_OTS_NotLoaded(); } // quotes value for SQL query if(!( is_int($value) || is_float($value) )) { $value = $this->db->quote($value); } $this->db->query('UPDATE ' . $this->db->tableName('players') . ' SET ' . $this->db->fieldName($field) . ' = ' . $value . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']); } /** * Returns player's skill. * * @version 0.0.2 * @since 0.0.2 * @param int $skill Skill ID. * @return int Skill value. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getSkill($skill) { if( !isset($this->skills[$skill]) ) { throw new E_OTS_NotLoaded(); } return $this->skills[$skill]['value']; } /** * Sets skill value. * * @version 0.0.2 * @since 0.0.2 * @param int $skill Skill ID. * @param int $value Skill value. */ public function setSkill($skill, $value) { $this->skills[ (int) $skill]['value'] = (int) $value; } /** * Returns player's skill's tries for next level. * * @version 0.0.2 * @since 0.0.2 * @param int $skill Skill ID. * @return int Skill tries. * @throws E_OTS_NotLoaded If player is not loaded. */ public function getSkillTries($skill) { if( !isset($this->skills[$skill]) ) { throw new E_OTS_NotLoaded(); } return $this->skills[$skill]['tries']; } /** * Sets skill's tries for next level. * * @version 0.0.2 * @since 0.0.2 * @param int $skill Skill ID. * @param int $tries Skill tries. */ public function setSkillTries($skill, $tries) { $this->skills[ (int) $skill]['tries'] = (int) $tries; } /** * Returns value of storage record. * * @version 0.1.3 * @since 0.1.2 * @param int $key Storage key. * @return int|null Stored value (null if not set). * @throws E_OTS_NotLoaded If player is not loaded. * @throws PDOException On PDO operation error. */ public function getStorage($key) { if( !isset($this->data['id']) ) { throw new E_OTS_NotLoaded(); } $value = $this->db->query('SELECT ' . $this->db->fieldName('value') . ' FROM ' . $this->db->tableName('player_storage') . ' WHERE ' . $this->db->fieldName('key') . ' = ' . (int) $key . ' AND ' . $this->db->fieldName('player_id') . ' = ' . $this->data['id'])->fetch(); if($value !== false) { return null; } return $value['value']; } /** * Sets value of storage record. * * @version 0.1.2 * @since 0.1.2 * @param int $key Storage key. * @param int $value Stored value. * @throws E_OTS_NotLoaded If player is not loaded. * @throws PDOException On PDO operation error. */ public function setStorage($key, $value) { if( !isset($this->data['id']) ) { throw new E_OTS_NotLoaded(); } $current = $this->getStorage($key); // checks if there is any row to be updates if( isset($current) ) { $this->db->query('UPDATE ' . $this->db->tableName('player_storage') . ' SET ' . $this->db->fieldName('value') . ' = ' . (int) $value . ' WHERE ' . $this->db->fieldName('player_id') . ' = ' . $this->data['id'] . ' AND ' . $this->db->fieldName('key') . ' = ' . (int) $key); } // inserts new storage record else { $this->db->query('INSERT INTO ' . $this->db->tableName('player_storage') . ' (' . $this->db->fieldName('player_id') . ', ' . $this->db->fieldName('key') . ', ' . $this->db->fieldName('value') . ') VALUES (' . $this->data['id'] . ', ' . (int) $key . ', ' . (int) $value . ')'); } } /** * Deletes item with contained items. * * @version 0.0.5 * @since 0.0.3 * @param int $sid Item unique player's ID. * @throws PDOException On PDO operation error. */ private function deleteItem($sid) { // deletes all sub-items foreach( $this->db->query('SELECT ' . $this->db->fieldName('sid') . ' FROM ' . $this->db->tableName('player_items') . ' WHERE ' . $this->db->fieldName('player_id') . ' = ' . $this->data['id'] . ' AND ' . $this->db->fieldName('pid') . ' = ' . $sid)->fetchAll() as $item) { $this->deleteItem($item['sid']); } // deletes item $this->db->query('DELETE FROM ' . $this->db->tableName('player_items') . ' WHERE ' . $this->db->fieldName('player_id') . ' = ' . $this->data['id'] . ' AND ' . $this->db->fieldName('sid') . ' = ' . $sid); } /** * Returns items tree from given slot. * * <p> * You need global items list resources loaded in order to use this method. * </p> * * @version 0.1.2 * @since 0.0.3 * @param int $slot Slot to get items. * @return OTS_Item|null Item in given slot (items tree if in given slot there is a container). If there is no item in slot then null value will be returned. * @throws E_OTS_NotLoaded If player is not loaded or there is no global items list resource loaded. * @throws E_OTS_NotAContainer If item which is not of type container contains sub items. * @throws PDOException On PDO operation error. */ public function getSlot($slot) { if( !isset($this->data['id']) ) { throw new E_OTS_NotLoaded(); } // loads current item $item = $this->db->query('SELECT ' . $this->db->fieldName('itemtype') . ', ' . $this->db->fieldName('sid') . ', ' . $this->db->fieldName('count') . ', ' . $this->db->fieldName('attributes') . ' FROM ' . $this->db->tableName('player_items') . ' WHERE ' . $this->db->fieldName('player_id') . ' = ' . $this->data['id'] . ' AND ' . $this->db->fieldName($slot > POT::SLOT_AMMO ? 'sid' : 'pid') . ' = ' . (int) $slot)->fetch(); if( empty($item) ) { return null; } // checks if there are any items under current one $items = array(); foreach( $this->db->query('SELECT ' . $this->db->fieldName('sid') . ' FROM ' . $this->db->tableName('player_items') . ' WHERE ' . $this->db->fieldName('player_id') . ' = ' . $this->data['id'] . ' AND ' . $this->db->fieldName('pid') . ' = ' . $item['sid'])->fetchAll() as $sub) { $items[] = $this->getSlot($sub['sid']); } // item type $slot = POT::getInstance()->getItemsList()->getItemType($item['itemtype'])->createItem(); $slot->setCount($item['count']); $slot->setAttributes($item['attributes']); // checks if current item has any contained items if( !empty($items) ) { // checks if item is realy a container if(!$slot instanceof OTS_Container) { throw new E_OTS_NotAContainer(); } // puts items into container foreach($items as $sub) { $slot->addItem($sub); } } return $slot; } /** * Sets slot content. * * @version 0.1.2 * @since 0.0.3 * @param int $slot Slot to save items. * @param OTS_Item $item Item (can be a container with content) for given slot. Leave this parameter blank to clear slot. * @param int $pid Deprecated, not used anymore. * @throws E_OTS_NotLoaded If player is not loaded. * @throws PDOException On PDO operation error. */ public function setSlot($slot, OTS_Item $item = null, $pid = 0) { static $sid; if( !isset($this->data['id']) ) { throw new E_OTS_NotLoaded(); } // clears current slot if($slot <= POT::SLOT_AMMO) { $id = $this->db->query('SELECT ' . $this->db->fieldName('sid') . ' FROM ' . $this->db->tableName('player_items') . ' WHERE ' . $this->db->fieldName('player_id') . ' = ' . $this->data['id'] . ' AND ' . $this->db->fieldName('pid') . ' = ' . (int) $slot)->fetch(); $this->deleteItem( (int) $id['sid']); } // checks if there is any item to insert if( isset($item) ) { // current maximum sid (over slot sids) if( !isset($sid) ) { $sid = $this->db->query('SELECT MAX(' . $this->db->fieldName('sid') . ') AS `sid` FROM ' . $this->db->tableName('player_items') . ' WHERE ' . $this->db->fieldName('player_id') . ' = ' . $this->data['id'])->fetch(); $sid = $sid['sid'] > POT::SLOT_AMMO ? $sid['sid'] : POT::SLOT_AMMO; } $sid++; // inserts given item $this->db->query('INSERT INTO ' . $this->db->tableName('player_items') . ' (' . $this->db->fieldName('player_id') . ', ' . $this->db->fieldName('sid') . ', ' . $this->db->fieldName('pid') . ', ' . $this->db->fieldName('itemtype') . ', ' . $this->db->fieldName('count') . ', ' . $this->db->fieldName('attributes') . ') VALUES (' . $this->data['id'] . ', ' . $sid . ', ' . (int) $slot . ', ' . $item->getId() . ', ' . $item->getCount() . ', ' . $this->db->quote( $item->getAttributes() ) . ')'); // checks if this is container if($item instanceof OTS_Container) { $pid = $sid; // inserts all contained items foreach($item as $sub) { $this->setSlot($pid, $sub); } } } // clears $sid for next public call if($slot <= POT::SLOT_AMMO) { $sid = null; } } /** * Deletes depot item with contained items. * * @version 0.0.5 * @since 0.0.3 * @param int $sid Depot item unique player's ID. * @throws PDOException On PDO operation error. */ private function deleteDepot($sid) { // deletes all sub-items foreach( $this->db->query('SELECT ' . $this->db->fieldName('sid') . ' FROM ' . $this->db->tableName('player_depotitems') . ' WHERE ' . $this->db->fieldName('player_id') . ' = ' . $this->data['id'] . ' AND ' . $this->db->fieldName('pid') . ' = ' . $sid)->fetchAll() as $item) { $this->deleteDepot($item['sid']); } // deletes item $this->db->query('DELETE FROM ' . $this->db->tableName('player_depotitems') . ' WHERE ' . $this->db->fieldName('player_id') . ' = ' . $this->data['id'] . ' AND ' . $this->db->fieldName('sid') . ' = ' . $sid); } /** * Returns items tree from given depot. * * <p> * You need global items list resources loaded in order to use this method. * </p> * * @version 0.1.2 * @since 0.0.3 * @param int $depot Depot ID to get items. * @return OTS_Item|null Item in given depot (items tree if in given depot there is a container). If there is no item in depot then null value will be returned. * @throws E_OTS_NotLoaded If player is not loaded or there is no global items list resource loaded. * @throws E_OTS_NotAContainer If item which is not of type container contains sub items. * @throws PDOException On PDO operation error. */ public function getDepot($depot) { if( !isset($this->data['id']) ) { throw new E_OTS_NotLoaded(); } // loads current item $item = $this->db->query('SELECT ' . $this->db->fieldName('itemtype') . ', ' . $this->db->fieldName('sid') . ', ' . $this->db->fieldName('count') . ', ' . $this->db->fieldName('attributes') . ' FROM ' . $this->db->tableName('player_depotitems') . ' WHERE ' . $this->db->fieldName('player_id') . ' = ' . $this->data['id'] . ' AND ' . $this->db->fieldName($depot > POT::DEPOT_SID_FIRST ? 'sid' : 'pid') . ' = ' . (int) $depot)->fetch(); if( empty($item) ) { return null; } // checks if there are any items under current one $items = array(); foreach( $this->db->query('SELECT ' . $this->db->fieldName('sid') . ' FROM ' . $this->db->tableName('player_depotitems') . ' WHERE ' . $this->db->fieldName('player_id') . ' = ' . $this->data['id'] . ' AND ' . $this->db->fieldName('pid') . ' = ' . $item['sid'])->fetchAll() as $sub) { $items[] = $this->getDepot($sub['sid']); } // item type $depot = POT::getInstance()->getItemsList()->getItemType($item['itemtype'])->createItem(); $depot->setCount($item['count']); $depot->setAttributes($item['attributes']); // checks if current item has any contained items if( !empty($items) ) { // checks if item is realy a container if(!$depot instanceof OTS_Container) { throw new E_OTS_NotAContainer(); } // puts items into container foreach($items as $sub) { $depot->addItem($sub); } } return $depot; } /** * Sets depot content. * * @version 0.1.2 * @since 0.0.3 * @param int $depot Depot ID to save items. * @param OTS_Item $item Item (can be a container with content) for given depot. Leave this parameter blank to clear depot. * @param int $pid Deprecated, not used anymore. * @param int $depot_id Internal, for further use. * @throws E_OTS_NotLoaded If player is not loaded. * @throws PDOException On PDO operation error. */ public function setDepot($depot, OTS_Item $item = null, $pid = 0, $depot_id = 0) { static $sid; // if no depot_id is specified then it is same as depot slot if($depot_id == 0) { $depot_id = $depot; } if( !isset($this->data['id']) ) { throw new E_OTS_NotLoaded(); } // clears current depot if($depot <= POT::DEPOT_SID_FIRST) { $id = $this->db->query('SELECT ' . $this->db->fieldName('sid') . ' FROM ' . $this->db->tableName('player_depotitems') . ' WHERE ' . $this->db->fieldName('player_id') . ' = ' . $this->data['id'] . ' AND ' . $this->db->fieldName('pid') . ' = ' . (int) $depot)->fetch(); $this->deleteDepot( (int) $id['sid']); } // checks if there is any item to insert if( isset($item) ) { // current maximum sid (over depot sids) if( !isset($sid) ) { $sid = $this->db->query('SELECT MAX(' . $this->db->fieldName('sid') . ') AS `sid` FROM ' . $this->db->tableName('player_depotitems') . ' WHERE ' . $this->db->fieldName('player_id') . ' = ' . $this->data['id'])->fetch(); $sid = $sid['sid'] > POT::DEPOT_SID_FIRST ? $sid['sid'] : POT::DEPOT_SID_FIRST; } $sid++; // inserts given item $this->db->query('INSERT INTO ' . $this->db->tableName('player_depotitems') . ' (' . $this->db->fieldName('player_id') . ', ' . $this->db->fieldName('depot_id') . ', ' . $this->db->fieldName('sid') . ', ' . $this->db->fieldName('pid') . ', ' . $this->db->fieldName('itemtype') . ', ' . $this->db->fieldName('count') . ', ' . $this->db->fieldName('attributes') . ') VALUES (' . $this->data['id'] . ', ' . $depot_id . ', ' . $sid . ', ' . (int) $depot . ', ' . $item->getId() . ', ' . $item->getCount() . ', ' . $this->db->quote( $item->getAttributes() ) . ')'); // checks if this is container if($item instanceof OTS_Container) { $pid = $sid; // inserts all contained items foreach($item as $sub) { $this->setDepot($pid, $sub, 0, $depot_id); } } } // clears $sid for next public call if($depot <= POT::DEPOT_SID_FIRST) { $sid = null; } } /** * @version 0.1.5 * @since 0.0.5 * @param int $time Time for time until expires (0 - forever). * @throws PDOException On PDO operation error. * @deprecated 0.1.5 Use OTS_PlayerBan class. */ public function ban($time = 0) { // can't ban nothing if( !$this->isLoaded() ) { throw new E_OTS_NotLoaded(); } // creates ban entry $ban = new OTS_PlayerBan(); $ban->setValue($this->data['id']); $ban->setExpires($time); $ban->setAdded( time() ); $ban->activate(); $ban->save(); } /** * @version 0.1.5 * @since 0.0.5 * @throws PDOException On PDO operation error. * @deprecated 0.1.5 Use OTS_PlayerBan class. */ public function unban() { // can't unban nothing if( !$this->isLoaded() ) { throw new E_OTS_NotLoaded(); } // deletes ban entry $ban = new OTS_PlayerBan(); $ban->find($this->data['id']); $ban->delete(); } /** * @version 0.1.5 * @since 0.0.5 * @return bool True if player is banned, false otherwise. * @throws PDOException On PDO operation error. * @deprecated 0.1.5 Use OTS_PlayerBan class. */ public function isBanned() { // nothing can't be banned if( !$this->isLoaded() ) { throw new E_OTS_NotLoaded(); } if( !isset($this->data['banned']) ) $this->loadBan(); return ($this->data['banned'] == 1); } public function getBanTime() { // nothing can't be banned if( !$this->isLoaded() ) { throw new E_OTS_NotLoaded(); } if( !isset($this->data['banned_time']) ) $this->loadBan(); return $this->data['banned_time']; } public function loadBan() { // nothing can't be banned if( !$this->isLoaded() ) { throw new E_OTS_NotLoaded(); } $ban = $this->db->query('SELECT ' . $this->db->fieldName('active') . ', ' . $this->db->fieldName('expires') . ' FROM ' . $this->db->tableName('bans') . ' WHERE (' . $this->db->fieldName('type') . ' = 3 OR ' . $this->db->fieldName('type') . ' = 5) AND ' . $this->db->fieldName('active') . ' = 1 AND ' . $this->db->fieldName('value') . ' = ' . $this->data['account_id'] . ' AND (' . $this->db->fieldName('expires') . ' > ' . time() .' OR ' . $this->db->fieldName('expires') . ' = -1)')->fetch(); $this->data['banned'] = $ban['active']; $this->data['banned_time'] = $ban['expires']; } public function loadNameLock() { // nothing can't be namelocked if( !$this->isLoaded() ) { throw new E_OTS_NotLoaded(); } $ban = $this->db->query('SELECT ' . $this->db->fieldName('active') . ' FROM ' . $this->db->tableName('bans') . ' WHERE ' . $this->db->fieldName('type') . ' = 2 AND ' . $this->db->fieldName('active') . ' = 1 AND ' . $this->db->fieldName('value') . ' = ' . $this->data['id'])->fetch(); $this->data['namelock'] = $ban['active']; } public function addNameLock() { //nothing can't be namelocked if( !$this->isLoaded() ) { throw new E_OTS_NotLoaded(); } $this->db->query('INSERT INTO ' . $this->db->tableName('bans') . ' (' . $this->db->fieldName('type') . ', ' . $this->db->fieldName('value') . ', ' . $this->db->fieldName('param') . ', ' . $this->db->fieldName('active') . ', ' . $this->db->fieldName('expires') . ', ' . $this->db->fieldName('added') . ', ' . $this->db->fieldName('admin_id') . ', ' . $this->db->fieldName('comment') . ', ' . $this->db->fieldName('') . ', ' . $this->db->fieldName('reason') . ', ' . $this->db->fieldName('action') . ') VALUES (2, ' . (int) $this->data['id']. ', 4294967295, 1, -1, ' . time() . ', 0, ' . $this->db->quote('Name lock from site') . ', 1, 1)'); } public function removeNameLock() { //nothing can't be namelocked if( !$this->isLoaded() ) { throw new E_OTS_NotLoaded(); } $this->db->query('UPDATE ' . $this->db->tableName('bans') . ' SET ' . $this->db->fieldName('active') .' = 0 WHERE ' . $this->db->fieldName('value') . ' = ' . (int) $this->data['id'] . ' AND ' . $this->db->fieldName('type') . ' = 2'); } public function isNameLocked() { //nothing can't be namelocked if( !$this->isLoaded() ) { throw new E_OTS_NotLoaded(); } if( !isset($this->data['namelock']) ) $this->loadNameLock(); return ($this->data['namelock'] == 1); } /** * Deletes player. * * @version 0.0.5 * @since 0.0.5 * @throws E_OTS_NotLoaded If player is not loaded. * @throws PDOException On PDO operation error. */ public function delete() { if( !isset($this->data['id']) ) { throw new E_OTS_NotLoaded(); } // deletes row from database $this->db->query('UPDATE ' . $this->db->tableName('players') . ' SET ' . $this->db->fieldName('deleted') . ' = 1 WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']); // resets object handle unset($this->data['id']); } /** * Player proffesion name. * * <p> * You need global vocations list resource loaded in order to use this method. * </p> * * @version 0.1.0 * @since 0.0.6 * @return string Player proffesion name. * @throws E_OTS_NotLoaded If player is not loaded or global vocations list is not loaded. */ public function getVocationName() { if( !isset($this->data['vocation']) ) { throw new E_OTS_NotLoaded(); } return POT::getInstance()->getVocationsList()->getVocationName($this->data['vocation']); } /** * Player residence town name. * * <p> * You need global map resource loaded in order to use this method. * </p> * * @version 0.1.0 * @since 0.1.0 * @return string Player town name. * @throws E_OTS_NotLoaded If player is not loaded or global map is not loaded. */ public function getTownName() { if( !isset($this->data['town_id']) ) { throw new E_OTS_NotLoaded(); } return POT::getInstance()->getMap()->getTownName($this->data['town_id']); } /** * Returns house rented by this player. * * <p> * You need global houses list resource loaded in order to use this method. * </p> * * @version 0.1.0 * @since 0.1.0 * @return OTS_House|null House rented by player. * @throws E_OTS_NotLoaded If player is not loaded or global houses list is not loaded. * @throws PDOException On PDO operation error. */ public function getHouse() { if( !isset($this->data['id']) ) { throw new E_OTS_NotLoaded(); } // SELECT query on database $house = $this->db->query('SELECT ' . $this->db->fieldName('id') . ' FROM ' . $this->db->tableName('houses') . ' WHERE ' . $this->db->fieldName('owner') . ' = ' . $this->data['id'])->fetch(); if( !empty($house) ) { return POT::getInstance()->getHousesList()->getHouse($house['id']); } return null; } /** * Returns list of VIPs. * * <p> * It means list of players which this player have on his/her list. * </p> * * @version 0.1.3 * @since 0.1.3 * @return OTS_Players_List List of VIPs. * @throws E_OTS_NotLoaded If player is not loaded. * @throws PDOException On PDO operation error. */ public function getVIPsList() { if( !isset($this->data['id']) ) { throw new E_OTS_NotLoaded(); } $list = new OTS_Players_List(); // foreign table fields identifiers $field1 = new OTS_SQLField('player_id', 'player_viplist'); $field2 = new OTS_SQLField('vip_id', 'player_viplist'); // creates filter $filter = new OTS_SQLFilter(); $filter->addFilter($field1, $this->data['id']); $filter->compareField('id', $field2); // puts filter onto list $list->setFilter($filter); return $list; } /** * Adds player to VIP list. * * @version 0.1.4 * @since 0.1.3 * @param OTS_Player $player Player to be added. * @throws E_OTS_NotLoaded If player is not loaded. * @throws PDOException On PDO operation error. */ public function addVIP(OTS_Player $player) { if( !isset($this->data['id']) ) { throw new E_OTS_NotLoaded(); } $this->db->query('INSERT INTO ' . $this->db->tableName('player_viplist') . ' (' . $this->db->fieldName('player_id') . ', ' . $this->db->fieldName('vip_id') . ') VALUES (' . $this->data['id'] . ', ' . $player->getId() . ')'); } /** * Checks if given player is a VIP for current one. * * @version 0.1.5 * @since 0.1.3 * @param OTS_Player $player Player to check. * @return bool True, if given player is on VIP list. * @throws E_OTS_NotLoaded If player is not loaded. * @throws PDOException On PDO operation error. */ public function isVIP(OTS_Player $player) { if( !isset($this->data['id']) ) { throw new E_OTS_NotLoaded(); } return $this->db->query('SELECT COUNT(' . $this->db->fieldName('vip_id') . ') FROM ' . $this->db->tableName('player_viplist') . ' WHERE ' . $this->db->fieldName('player_id') . ' = ' . $this->data['id'] . ' AND ' . $this->db->fieldName('vip_id') . ' = ' . $player->getId() )->fetchColumn() > 0; } /** * Deletes player from VIP list. * * @version 0.1.4 * @since 0.1.3 * @param OTS_Player $player Player to be deleted. * @throws E_OTS_NotLoaded If player is not loaded. * @throws PDOException On PDO operation error. */ public function deleteVIP(OTS_Player $player) { if( !isset($this->data['id']) ) { throw new E_OTS_NotLoaded(); } $this->db->query('DELETE FROM ' . $this->db->tableName('player_viplist') . ' WHERE ' . $this->db->fieldName('player_id') . ' = ' . $this->data['id'] . ' AND ' . $this->db->fieldName('vip_id') . ' = ' . $player->getId() ); } /** * Returns list of known spells. * * <p> * You need global spells list resource loaded in order to use this method. * </p> * * @version 0.1.4 * @since 0.1.4 * @return array List of known spells. * @throws E_OTS_NotLoaded If player is not loaded. * @throws PDOException On PDO operation error. */ public function getSpellsList() { if( !isset($this->data['id']) ) { throw new E_OTS_NotLoaded(); } $spells = array(); $list = POT::getInstance()->getSpellsList(); // reads all known spells foreach( $this->db->query('SELECT ' . $this->db->fieldName('name') . ' FROM ' . $this->db->tableName('player_spells') . ' WHERE ' . $this->db->fieldName('player_id') . ' = ' . $this->data['id']) as $spell) { // checks if there is rune, instant or conjure spell with given name if( $list->hasRune($spell['name']) ) { $spells[] = $list->getRune($spell['name']); } if( $list->hasInstance($spell['name']) ) { $spells[] = $list->getInstance($spell['name']); } if( $list->hasConjure($spell['name']) ) { $spells[] = $list->getConjure($spell['name']); } } return $spells; } /** * Checks if player knows given spell. * * @version 0.1.5 * @since 0.1.4 * @param OTS_Spell $spell Spell to be checked. * @return bool True if player knows given spell, false otherwise. * @throws E_OTS_NotLoaded If player is not loaded. * @throws PDOException On PDO operation error. */ public function hasSpell(OTS_Spell $spell) { if( !isset($this->data['id']) ) { throw new E_OTS_NotLoaded(); } return $this->db->query('SELECT COUNT(' . $this->db->fieldName('name') . ') FROM ' . $this->db->tableName('player_spells') . ' WHERE ' . $this->db->fieldName('player_id') . ' = ' . $this->data['id'] . ' AND ' . $this->db->fieldName('name') . ' = ' . $this->db->quote( $spell->getName() ) )->fetchColumn() > 0; } /** * Adds given spell to player's spell book (makes him knowing it). * * @version 0.1.4 * @since 0.1.4 * @param OTS_Spell $spell Spell to be learned. * @throws E_OTS_NotLoaded If player is not loaded. * @throws PDOException On PDO operation error. */ public function addSpell(OTS_Spell $spell) { if( !isset($this->data['id']) ) { throw new E_OTS_NotLoaded(); } $this->db->query('INSERT INTO ' . $this->db->tableName('player_spells') . ' (' . $this->db->fieldName('player_id') . ', ' . $this->db->fieldName('name') . ') VALUES (' . $this->data['id'] . ', ' . $this->db->quote( $spell->getName() ) . ')'); } /** * Removes given spell from player's spell book. * * @version 0.1.4 * @since 0.1.4 * @param OTS_Spell $spell Spell to be removed. * @throws E_OTS_NotLoaded If player is not loaded. * @throws PDOException On PDO operation error. */ public function deleteSpell(OTS_Spell $spell) { if( !isset($this->data['id']) ) { throw new E_OTS_NotLoaded(); } $this->db->query('DELETE FROM ' . $this->db->tableName('player_spells') . ' WHERE ' . $this->db->fieldName('player_id') . ' = ' . $this->data['id'] . ' AND ' . $this->db->fieldName('name') . ' = ' . $this->db->quote( $spell->getName() ) ); } /** * Magic PHP5 method. * * @version 0.1.5 * @since 0.1.0 * @param string $name Property name. * @return mixed Property value. * @throws E_OTS_NotLoaded When player is not loaded. * @throws OutOfBoundsException For non-supported properties. * @throws PDOException On PDO operation error. */ public function __get($name) { switch($name) { case 'id': return $this->getId(); case 'name': return $this->getName(); case 'account': return $this->getAccount(); case 'group': return $this->getGroup(); case 'sex': return $this->getSex(); case 'vocation': return $this->getVocation(); case 'experience': return $this->getExperience(); case 'level': return $this->getLevel(); case 'magLevel': return $this->getMagLevel(); case 'health': return $this->getHealth(); case 'healthMax': return $this->getHealthMax(); case 'mana': return $this->getMana(); case 'manaMax': return $this->getManaMax(); case 'manaSpent': return $this->getManaSpent(); case 'soul': return $this->getSoul(); case 'direction': return $this->getDirection(); case 'lookBody': return $this->getLookBody(); case 'lookFeet': return $this->getLookFeet(); case 'lookHead': return $this->getLookHead(); case 'lookLegs': return $this->getLookLegs(); case 'lookType': return $this->getLookType(); case 'lookAddons': return $this->getLookAddons(); case 'posX': return $this->getPosX(); case 'posY': return $this->getPosY(); case 'posZ': return $this->getPosZ(); case 'cap': return $this->getCap(); case 'lastLogin': return $this->getLastLogin(); case 'lastIP': return $this->getLastIP(); case 'save': return $this->isSaveSet(); case 'conditions': return $this->getConditions(); case 'redSkullTime': return $this->getRedSkullTime(); case 'redSkull': return $this->hasRedSkull(); case 'guildNick': return $this->getGuildNick(); case 'rank': return $this->getRank(); case 'townId': return $this->getTownId(); case 'townName': return $this->getTownName(); case 'house': return $this->getHouse(); case 'lossExperience': return $this->getLossExperience(); case 'lossMana': return $this->getLossMana(); case 'lossSkills': return $this->getLossSkills(); case 'lossItems': return $this->getLossItems(); case 'balance': return $this->getBalance(); case 'loaded': return $this->isLoaded(); case 'banned': return $this->isBanned(); case 'vipsList': return $this->getVIPsList(); case 'vocationName': return $this->getVocationName(); case 'spellsList': return $this->getSpellsList(); default: throw new OutOfBoundsException(); } } /** * Magic PHP5 method. * * @version 0.1.5 * @since 0.1.0 * @param string $name Property name. * @param mixed $value Property value. * @throws E_OTS_NotLoaded When passing object value which represents not-initialised instance. * @throws OutOfBoundsException For non-supported properties. */ public function __set($name, $value) { switch($name) { case 'name': $this->setName($value); break; case 'account': $this->setAccount($value); break; case 'group': $this->setGroup($value); break; case 'sex': $this->setSex($value); break; case 'vocation': $this->setVocation($value); break; case 'experience': $this->setExperience($value); break; case 'level': $this->setLevel($value); break; case 'magLevel': $this->setMagLevel($value); break; case 'health': $this->setHealth($value); break; case 'healthMax': $this->setHealthMax($value); break; case 'mana': $this->setMana($value); break; case 'manaMax': $this->setManaMax($value); break; case 'manaSpent': $this->setManaSpent($value); break; case 'soul': $this->setSoul($value); break; case 'direction': $this->setDirection($value); break; case 'lookBody': $this->setLookBody($value); break; case 'lookFeet': $this->setLookFeet($value); break; case 'lookHead': $this->setLookHead($value); break; case 'lookLegs': $this->setLookLegs($value); break; case 'lookType': $this->setLookType($value); break; case 'lookAddons': $this->setLookAddons($value); break; case 'posX': $this->setPosX($value); break; case 'posY': $this->setPosY($value); break; case 'posZ': $this->setPosZ($value); break; case 'cap': $this->setCap($value); break; case 'lastLogin': $this->setLastLogin($value); break; case 'lastIP': $this->setLastIP($value); break; case 'conditions': $this->setConditions($value); break; case 'redSkullTime': $this->setRedSkullTime($value); break; case 'guildNick': $this->setGuildNick($value); break; case 'rank': $this->setRank($value); break; case 'townId': $this->setTownId($value); break; case 'lossExperience': $this->setLossExperience($value); break; case 'lossMana': $this->setLossMana($value); break; case 'lossSkills': $this->setLossSkills($value); break; case 'lossItems': $this->setLossItems($value); break; case 'balance': $this->setBalance($value); break; case 'redSkull': if($value) { $this->setRedSkull(); } else { $this->unsetRedSkull(); } break; case 'save': if($value) { $this->setSave(); } else { $this->unsetSave(); } break; case 'banned': if($value) { $this->ban(); } else { $this->unban(); } break; default: throw new OutOfBoundsException(); } } /** * Returns string representation of object. * * <p> * If any display driver is currently loaded then it uses it's method. Else it returns character name. * </p> * * @version 0.1.3 * @since 0.1.0 * @return string String representation of object. */ public function __toString() { $ots = POT::getInstance(); // checks if display driver is loaded if( $ots->isDisplayDriverLoaded() ) { return $ots->getDisplayDriver()->displayPlayer($this); } return $this->getName(); } } /**#@-*/ ?> Se ajudei por favor de um REP + , não gosta nada rs Qualquer poblemas So avisar.. ATT : Marini!
  16. Muito bom , ajuda muita pessoas que ainda não sabe , Reputado!
  17. Na sua config.lua coloque isso sqlKeepAlive = 0 mysqlReadTimeout = 30 mysqlWriteTimeout = 30 encryptionType = "sha1"
  18. Tire uma print do seu banco de dados e me manda para ve se ta faltando alguma coisa.
  19. Servidor está sem site ? se for sem e sqlite , mysql e apenas com site . No caso se for sem site assim -- sqlType = "sqlite" sqlHost = "localhost" sqlPort = 3306 sqlUser = "root" sqlPass = "Senha DataBase" sqlDatabase = "NomeDataBase" sqlFile = "NomeDataBase.s3db" sqlKeepAlive = 0 mysqlReadTimeout = 5000 mysqlWriteTimeout = 5000 encryptionType = "plain10" -------------------- Se for com site -- sqlType = "mysql" sqlHost = "localhost" sqlPort = 3306 sqlUser = "root" sqlPass = "Senha DataBase" sqlDatabase = "NomeDataBase" sqlFile = "NomeDataBase.s3db" sqlKeepAlive = 0 mysqlReadTimeout = 30 mysqlWriteTimeout = 30 encryptionType = "sha1" Continuar com poblemas me manda novas prints.
  20. Ryzor postou uma resposta no tópico em Suporte & Pedidos
    Quantos é o peso do seu mapa ? no meu styller quando eu abri ele pesava 35 MB , abri em um VPS de 1 gb aguentou 200 players sem lag .
  21. PHP e OTServ Glossário de Fundamentos Básicos Olá! No intuito de expansão do conhecimento da linguagem de programação PHP, tive a idéia de montar um guia prático de iniciação e de manipulação em PHP. Inicialmente, irei abordar os vários conceitos básicos do PHP e, posteriormente, a interação entre PHP e OTServ. Para isso, Boleta(eu) e Lancer irão, ao longo dos dias, atualizar o tópico com novos assuntos, funcionalidades, tutoriais... Portanto, não é um tópico "finito", inicialmente, pois estaremos sempre trazendo novidades. - O Funcionamento do Tópico Para uma boa organização e visualização do tópico, ao final de cada atualização iremos adicionar um "log" com todas as modificações feitas. Esse "log" ficará no fim da página. Também editaremos o título do tópico para que fiquem bem visíveis as mudanças. Teremos, também, um índice, onde ficará muito fácil localizar os conteúdos do tópico. -Observações Importantes Não haverá tolerância em relação aos engraçadinhos que entram no tópico para falar "não entendi nada", "nossa você é bom mesmo", "legal o tópico" ou comentários do gênero. Caso seja visto, encaminharei o caso aos moderadores. O tópico está totalmente aberto à qualquer tipo de dúvidas relacionadas à PHP . Pedidos, dúvidas sobre OTServ ou coisas parecidas estão completamente dispensados. Nós não temos a obrigação de te ajudar. Criamos esse tópico para auxílio e não somos obrigados a tolerar qualquer tipo de indolência, desrespeito e inveja. Entenda que ajudaremos quando possível. Não envie mensagens particulares com perguntas. Caso tenha dúvidas, faça um post aqui . Não faça plagio do tópico. Ele foi criado para a OTServ Networks. Caso retire qualquer conteúdo do mesmo, deixe explícito os devidos créditos. Caso a regra acima não seja respeitada, iremos tomar providências muito severas com os responsáveis. Índice 1 - Introdução 1.1 - O que é PHP 1.2 - Como usar o PHP 1.3 - XAMPP 1.4 - Banco de Dados MySql 2 - Iniciando 2.1 - Página 2.2 - Tag PHP 2.3 – Rotinas ---------------------------------- 1 - Introdução 1.1 - O que é PHP PHP é uma Linguagem de Programação em ambiente WEB onde se idealiza e cria websites. É uma das linguagens mais usadas para esse fim e é muito flexível. Para os programadores com experiência em outras linguagens de programação, PHP se torna uma linguagem simples e de fácil uso. Seu website oficial é o www.php.net, onde se econtra tudo sobre PHP. A versão atual do PHP é a versão 5, e nosso curso é baseado nela. 1.2 - Como usar o PHP O PHP é uma ferramenta que nescessita de um servidor para que funcione. Junto a esse servidor é nescessário, também, um Web Servidor, que faz com que eu, você e qualquer outro possamos acessar páginas na Web. Atualmente, existem Kits práticos que integram ambas as funcionalidades em um único softwares. Nesse mini-curso, usaremos o Xampp, que é um dos melhores que existem no mercado atualmente. 1.3 - XAMPP Site Oficial: http://www.xampp.org/ Download Link (Windows): http://www.apachefriends.org/download.php?xampp-win32-1.6.6a-installer.exe Download Link (Linux): http://www.apachefriends.org/download.php?xampp-linux-1.6.6.tar.gz Faça o download do XAMPP e instale-o em seu computador. Após instalá-lo, inicie o Xampp Control Panel. Em frente à Apache e Mysql, veremos 2 botões, chamados "Start". Clique nos dois e assim iniciaremos ao mesmo tempo o WebServidor + Servidor PHP (Apache) e o Servidor MySQL (Banco de Dados). Ficará mais ou menos assim: Só isso? Sim, só isso. Agora temos um servidor web rodando e um servidor mysql rodando. Para ver a página inicial criada pelo XAMPP, acesse http://localhost/. 1.4 - Banco de Dados MySql Acredito, eu, que a maioria de vocês já ouviu falar em banco de dados. Pois bem, para aqueles que não sabem o que é, um banco de dados serve para guardar informações, desde pequenos números até longos textos. Podemos usar o Banco de dados MySql em qualquer plataforma e de maneira fácil. De acesso de longa distância a acesso local. Será nele que trabalharemos nosso curso. Só para exemplificar, os grandes OTServs (a maioria deles) usam o MySql para guardarem as informações do seu servidor. Contas, guilds, casas, etc. 2 - Iniciando 2.1 - Página Em PHP não possuímos um compilador, como na maioria das linguagens de programação para ambiente windows. Todas as páginas são criadas a partir de arquivos, onde a extensão pode variar. Normalmente, usa-se a extensão .php, que indica que a página exibida está sendo "nutrida" por um servidor PHP. No Xampp, colocamos todos os arquivos dentro da pasta "htdocs" (C:\Xampp\htdocs [o diretório vai depender de onde você instalou o Xampp]) que é a pasta raiz. Aconselho a você que se quiser montar vários sites, crie pastas para cada um. Estes serão acessíveis no link http://localhost/pasta/ . Quando acessamos um link sem especificar o arquivo (como no exemplo acima), o webserver procura o arquivo index (.php, .html, .htm, etc) e exibe seu conteúdo no navegador. Páginas específicas são acessadas assim: http://localhost/pasta/pagina2.php . Além disso, pode-se acessar arquivos em subspastas:http://localhost/pasta/pasta2/pasta3/arquivo5.php . Por questão de segurança, é importante que você mantenha uma página index.php em todas as subpastas do seu site, para que ninguém possa acessar seus arquivos e obtê-los. Por enquanto não abordaremos HTML, mas aconselho a vocês que deem uma olhada nos tópicos referente ao assunto, ainda nessa seção do fórum. 2.2 - Tag PHP O PHP é uma linguagem onde não se executa nenhum código no browser do usuário, ou seja, todas as informações são processadas e executadas no servidor e em seguida são enviados, ou não, dados ao navegador. Para exemplificar bem, imagine que sua professora peça a você um trabalho sobre literatura. Você o faz e entrega para ela apenas o trabalho pronto. Em PHP, temos uma situação parecida: o navegador requisita, ao servidor, uma página (função da professora) e o aluno, após fazer as pesquisas e rascunhos (função do programador), monta o trabalho completo e entrega à professora apenas o resultado de tudo que ele pesquisou, processou, executou (função do servidor). Nosso trabalho, como programadores, é montar os rascunhos e entregá-los de presente ao servidor. Para isso, usamos as páginas, como vimos no tópico acima. O Servidor PHP funcionará da seguinte maneira: Abrirá o arquivo indicado, procurará por todos os códigos PHP que possam existir dentro desse arquivo, processará e, caso haja nescessidade de retorno de informações, "escreverá" na página. É importante ressaltar que o navegador não entra em contado com os códigos feitos pelo programador em nenhum momento, pois esse já terá sido "eliminado" pelo servidor PHP. Uma página Web, em 99,9% das vezes, não é feita só de códigos PHP. Sendo assim, devemos indicar, no arquivo, o espaço reservado à execução dos códigos PHP. Isso é feito da seguinte maneira: Código PHP: <?php ?> Chamada de Tag PHP, esse espaço delimitado criado por nós faz com que todo o código que esteja depois de <?php e antes de ?> seja depurado pelo servidor. É importante resaltar que podemos ter quantas Tags PHP quizermos dentro de nossa página. 2.3 - Rotinas Em PHP, como toda linguagem de programação, temos como base o uso de Rotinas. Em programação, usar uma Rotina quer dizer ordenar ao servidor que execute algo. Para exemplificar, imagine que você esteja com sede e ordena à sua mãe que busque para você um copo d'água. Esse "ordenar" exerce a mesma função da Rotina. Para ser mais claro, vamos ao nosso primeiro exemplo prático. Quando programamos, passamos por 3 fases: a fase onde se escolhe o que vai fazer, a fase em que se cria a ideologia do código, ou seja cria-se, mentalmente, um código falado (algorítimo), e a fase em que se monta o código que executará aquilo que você deseja. Vamos em partes: 1ª Fase: Quero que o programa escreva na tela: "Ser ou não ser, eis a questão". (É o que eu quero fazer) 2ª Fase: Escreve na tela: "Ser ou não ser, eis a questão". (Ordem: Diz que quer escrever na tela um texto, em língua portuguesa) 3ª Fase: Código PHP: <?php echo 'Ser ou não ser, eis a questão'; ?> (Código) E pronto! Temos montada nossa primeira linha de código: Usamos a rotina Echo, que faz com que o servidor insira, à página, certo texto. Logo em seguida, informo ao echo o que quero que ele escreva na tela. Esse complemento, que auxilia a rotina, é chamado de parâmetro (podemos ter vários em uma só rotina). Logo depois, inserimos o ponto e virgula ( ; ) para informarmos que chegamos ao fim daquela rotina. Para testar, cole o código acima em um arquivo qualquer (dentro da pasta htdocs, claro), salve-o e acesse o arquivo (pelo navegador da internet). Creditos: Boleta GodMarini
  22. Ryzor postou uma resposta no tópico em Suporte & Pedidos
    Cara depende , Se consiqui bastante players sempre vai ter alguem que vai quere derrubar e acabar com seu servidor , se consiqui se proteger bem e nao cair da para ter um bom lucro sim melhor do que vender ele para qualquer um ai,
  23. Ryzor postou uma resposta no tópico em Suporte & Pedidos
    Os dois servidores parece ser bom , o complicado que hoje servidor em forums nenhum vem com menos ou mais de bug , todos vem com bugs ... como Anne falou o primeiro e mais completo , mais o segundo não e tão ruim e bom também.
  24. Ryzor postou uma resposta no tópico em Suporte Tibia OTServer
    Cara Lgv Host é otima , eu sempre quando começei meus projetos começei por lá ... www.lgvhost.com.br abaixo umas outras empresas www.jvservers.com.br www.hastlehost.com \/ Preço são um pouco caros.. www.serversoft.com.br Creio que para vender hosts de qualidade são essas .
  25. Tente deixar seu topico mais bonito cara colocando em codigos as parte de script.

Informação Importante

Confirmação de Termo