Jump to content

darksoke

Most Valuable Poster
  • Content count

    453
  • Joined

  • Last visited

  • Days Won

    15

darksoke last won the day on September 6

darksoke had the most liked content!

4 Followers

About darksoke

  • Birthday 11/11/1994

Contact Methods

  • Skype
    maxim.marco1

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

1,220 profile views
  1. woah no , no just no , use Mysqli or PDO do not use raw mysql
  2. trust me this **** saved my life usually i had to write hundred of lines of codes but now i've learned my lesson :)) hopefuly this will be helpful for somebody else because as of now i could only find huge ass overwrites of the class and most of them were for Wordpress pretty hard to reintegrate on a fresh built website
  3. Eyo all, been working on a website for a client and i got tired of writing thousands of functions to get out the data from DB. You know in this business you keep learning things while working on. My main issue was i could not dinamically add params to $stmt->bind_param, but after reading few hundreds lines on PHP mysqli doc i found out i can pass them dinamically by referrence and use the mighty call_user_func_array. However what i'm going to print is just a sample not the full class you've got to struggle yourself for other things. There must be many other ppl who want to learn PHP. NOTE!!! The class i'm sharing is incomplete it only have a single function and is jut for learning purpose, you'll have to figure out yourself the rest. class mmlDatabase{ private $database = array("host" => "127.0.0.1", "username" => "root", "password" => "ascent", "database" => "mydatabase"); //Why public? easy like this you can call the function outside the class and print the error wherever you want public $errors = array(); private function connect() { $con = mysqli_connect($this->database['host'], $this->database['username'], $this->database['password'], $this->database['database']); if (!$con) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } return $con; } public function Query($sql='', $input_params = array(), $param_types = '', $getoutput = false){ /* $sql = Represent the raw sql text whith questionmark as values $input_params = Represent the array of values that need to be inserted $param_types = Represent the type of parameters, s = string, i = integer, d = double, b = blob $getoutput = If you are waiting for an output after a SELECT QUERY */ $output = array(); $params = array(); $conn = $this->connect(); $n = strlen($param_types); //Adding param types as first variable ("param types", waiting for params) $params[] = & $param_types; //Adding Params one by one as referrence for($i = 0; $i < $n; $i++) $params[] = & $input_params[$i]; //Try to run query otherwise throw error if($stmt = $conn->prepare($sql)) { //Now calling bind param as user function passing the new parametter list call_user_func_array(array($stmt, 'bind_param'), $params); $stmt->execute(); //check if we are waiting for a response (array of variables) mostly for SELECT query if($getoutput) { $result = $stmt->get_result(); while ($data = $result->fetch_assoc()) { array_push($output, $data); } } $stmt->close(); } else array_push($this->errors, 'Wrong SQL: ' . $sql . ' Error: ' . $conn->errno . ' ' . $conn->error); $conn->close(); //Return the output if there's no errors else return false and print the error wherever you want if(count($this->errors) === 0 && !empty($output)) return $output; return false; } } $DB = new mmlDatabase; //USAGE $result = $DB->Query("SELECT * FROM `mytable`", NULL, NULL, true); $result = $DB->Query("SELECT * FROM `mytable` WHERE `column` = ?", array(1), "i", true); $result = $DB->Query("SELECT * FROM `mytable` WHERE `name` = ? AND `id` = ?", array("Some Name", 1), "si", true); $DB->Query("INSERT INTO `mytable`(`name`, `email`, `password`, `age`) VALUES (?, ?, ?, ?)", array("Some Name", "Some Email", "password", 23), "sssi", false/*can leave this variable blank since by default is false*/); $DB->Query("REPLACE INTO `mytable`(`id`, `name`, `email`, `password`, `age`) VALUES (?, ?, ?, ?, ?)", array(1, "Some Name", "Some Email", "password", 23), "isssi", false/*can leave this variable blank since by default is false*/); $DB->Query("UPDATE `mytable` SET `name` = ? WHERE `id` = ? AND `email` = ?", array("newname", 1, "email"), "sis", false/*can leave this variable blank since by default is false*/); //Separate variables sent inside query $sql = "INSERT INTO `mytable`(`name`, `email`, `password`, `age`) VALUES (?, ?, ?, ?)"; $params = array(1, "Some Name", "Some Email", "password", 23); $param_types = "sssi"; $DB->Query($sql, $params, $param_types, false);
  4. note most responsive layouts use display: table-cell; making the whole div work like a <table> you might want to use the !important if you want the styles to apply on that responsive layouts
  5. No worries this project won't die as soon as i finish with some irl projects i'll update this one since i've learned a lot more PHP
  6. thank you guys I really appreciate
  7. As title says, this npc will allow you to retrieve your recent deleted characters (latest 14 deleted characters). Not too much to say about this script so here it is. Features of this script -First of all, it has a beautiful UI showing the class and race icons('note this one is adapted for my server and is also checking for worgen and goblin') -It show's the countdown, remaining time until character will be wiped from database -And ofc it will let you restore characters. -Is also checking if there are 10 active characters on your account. Well i'm also willing to sell it so if you are interested just hit me with a PM here
  8. Beats solo 3 wired :)) getting solo 3 wireless in few days :))
  9. it is, a lot of custom never seen before features
  10. thx guys, just some things started from my boredom :))
  11. I'm really sorry guys i have abandoned this project and might soon release it to public on github or idk might continue working on it however all depend on my free time now since i'm working on my degree project
  12. WEBSITE Well guys it is about time to reveal a project i've been working on for a while. It is so frustrating as a medium/high stats server to hear every day , "this class is not balanced" so i tought of a solution. I present you the first server ever where players have to combine gems and enchants to build up the stats and here are the main features that are already implemented. Features -Over 1000 custom gems -3 Custom instances (Ragefire Chasm - Soloable, Molten Core - require little group, Icecrown Citadel - working difficulties - raid instance) -Every creature drop gems, gem quality depend on the instance -9 sets of gear, 3 for every instance Ragefire chasm a set with only 1 socket available (RARE/EPIC/LEGENDARY) difference is made by the socket bonuses Molten Core a set with only 1 socket available (RARE/EPIC/LEGENDARY) difference is made by the socket bonuses Icecrown Citadel a set with only 1 socket available (RARE/EPIC/LEGENDARY) difference is made by the socket bonuses -Now you might ask, what if i find a legendary gem and want to change my gear? Don't worry we got you covered, I have developed a gem retriever NPC wich will alow you to take off the gems from the gear without losing the other enchants -There is also a gem disenchanter who will brake the gems into a really fine sand required to complete certain quests ingame. -Gems are grouped in 2 types, PVP and PVE you can get the PVP gems from a vendor all for honor points -Custom Buffs and starter equipment without socket bonuses The realm is not up yet but you can check our progress in our website http://statless-wow.com You can also check our gallery here http://imgur.com/a/jjlpn
  13. If you got tired of creating hundreds of quests or hundreds of item extended costs, both not being effective solutions. I've been working for a while at a little script that allow you to upgrade an equipped item without loosing your gems or enchants. The script was tested and is extremely effective. You can add up to 6 requirements for upgrading. In this version you can use Gold, Honor or arena points but i'm planing of adding an option for that too. As title says this is a SHOW OFF not a release. This is a unique script ("Yeah We talking money baby"), this script is created for my new wotlk project. Enough talking here is the result. So opinions? Suggestions? Requests? leave a comment below.
  14. Thx i haven't released anything in a while so yeah it's good
  15. Well since you guys were intrigued by this idea , here it is released on http://privatewow.com NOTE!! Very Early beta stages so most items over WOTLK won't work as supposed but i'll try to update this as much as possible and maybe release the source to public once it get a decent shape, so there you go enjoy playing with it.
×