Jump to content

Darkruler

Members
  • Posts

    206
  • Joined

  • Last visited

    Never
  • Donations

    0.00 GBP 

Darkruler's Achievements

Advanced Member

Advanced Member (3/3)

0

Reputation

  1. You made an array with images, change it back to what it was ( $class = array(1=>"Warrior",2=>"Paladin",3=>"Hunter",4=>"Rogue",5=>"Priest",6=>"Death Knight",7=>"Shaman",8=>"Mage",9=>"Warlock",11=>"Druid"); ) and instead of $race[$t_race]; use [img=img/race/]'; so if $t_race = 1 (Warrior) and $t_gender = 1 (Female) it will result in "img/race/1-1.gif"
  2. test this: <?php $reading = @fopen('config.php', 'r'); if ($reading) include ("config.php"); else { $user = "root"; $host = "localhost"; $port = "3306"; $pass = "mangos"; $mangoscharacters = "characters"; } $host = $host.":".$port; $characters = mysql_connect("$host", "$user", "$pass") or die('Connection Failed'); mysql_selectdb ("$mangoscharacters") or die('Cannot connect to Characters Database'); $result = mysql_query("SELECT s.rating, a.name, s.wins2, s.played FROM arena_team_stats AS s LEFT JOIN arena_team AS a ON s.arenateamid = a.arenateamid WHERE a.type = 2 ORDER BY s.rating DESC LIMIT 10;"); ?> <font color=#000000> <table align=center cellpadding="0" cellspacing="0" border="1" width=100%> <thead> <td><center>Nº</center></td> <td><center>Name</center></td> <td><center>Rating</center></td> <td><center>Wins2</center></td> <td><center>Played</center></td> </thead> <tbody> <?php while($rows = mysql_fetch_object($result)) { $i++; $name = $rows->name; $rating= $rows->rating; $wins2 = $rows->wins2; $played= $rows->played; echo " <tr> <td><center>",$i,"</center></td> <td>[i]",$name,"[/i]</td> <td><center>",$rating,"</center></td> <td><center>",$wins2,"</center></td> <td><center>",$played,"</center></td> </tr> "; } mysql_close($characters); ?> Notes : -The query comes from darkstalker's previous post -Not tested this, not even if it gives PHP errors... don't have any chars in my DB
  3. nope can't confirm... dont have a DB with chars who have an arena team can you export one of your chars so i can see what happens?
  4. so at which point does it stop working? 1. Enter name and email adres 2. Submit 3. Process the form, insert a random integer into the reset_password field of that account 4. Send email with a link with which you can receive the pass after the change -- User action: open email and click link 5. Open the link, get functions retrieve the random integer from the link 6. the random integer gets queried, this results in finding the accountname again 7. field sha_pass_hash gets set to the contains of reset_pass 8. reset_pass gets emptied (basically deactivating the link in the email)
  5. i merely made it work, i didn't intend to actually make it safe and efficient by only retrieving the required data....but thanks for sharing thoughts anyway...i'll change it changed version: <?php $reading = @fopen('config.php', 'r'); if ($reading) include ("config.php"); else { $user = "root"; $host = "localhost"; $port = "3306"; $pass = "mangos"; $mangoscharacters = "characters"; } $host = $host.":".$port; $characters = mysql_connect("$host", "$user", "$pass") or die('Connection Failed'); mysql_selectdb ("$mangoscharacters") or die('Cannot connect to Characters Database'); $result = mysql_query("SELECT `name`, `level`, `totalKills`, `totalHonorPoints` FROM `characters` ORDER BY `totalKills` DESC LIMIT 0 , 100 "); ?> <font color=#000000> <table align=center cellpadding="0" cellspacing="0" border="1" width=100%> <thead> <td width="4%"><center>Nº</center></td> <td width="16%"><center>Character Name</center></td> <td width="4%"><center>level</center></td> <td width="5%"><center>Honor</center></td> <td width="4%"><center>Kills</center></td> </thead> <tbody> <?php while($rows = mysql_fetch_object($result)) { $i++; $name = $rows->name; $level = $rows->level; $Total_Kills = $rows->totalKills; $Total_Honor = $rows->totalHonorPoints; echo " <tr> <td><center>",$i,"</center></td> <td>[i]",$name,"[/i]</td> <td><center>",$level,"</center></td> <td><center>",$Total_Honor,"</center></td> <td><center>",$Total_Kills,"</center></td> </tr>"; } mysql_close($characters); ?>
  6. You're right, it doesn't work.... fixed version: <?php $reading = @fopen('config.php', 'r'); if ($reading) include ("config.php"); else { $user = "root"; $host = "localhost"; $port = "3306"; $pass = "mangos"; $mangoscharacters = "characters"; } $host = $host.":".$port; $characters = mysql_connect("$host", "$user", "$pass") or die('Connection Failed'); mysql_selectdb ("$mangoscharacters") or die('Cannot connect to Characters Database'); $result = mysql_query("SELECT * FROM `characters` ORDER BY `totalKills` DESC LIMIT 0 , 100 "); ?> <font color=#000000> <table align=center cellpadding="0" cellspacing="0" border="1" width=100%> <thead> <td width="4%"><center>Nº</center></td> <td width="16%"><center>Character Name</center></td> <td width="4%"><center>level</center></td> <td width="5%"><center>Honor</center></td> <td width="4%"><center>Kills</center></td> </thead> <tbody> <?php while($rows = mysql_fetch_object($result)) { $i++; $name = $rows->name; $level = $rows->level; $Total_Kills = $rows->totalKills; $Total_Honor = $rows->totalHonorPoints; echo " <tr> <td><center>",$i,"</center></td> <td>[i]",$name,"[/i]</td> <td><center>",$level,"</center></td> <td><center>",$Total_Honor,"</center></td> <td><center>",$Total_Kills,"</center></td> </tr>"; } mysql_close($characters); ?> NOTE: Made some usefull changes as well
  7. New version, fixed the login issue with the cookie and changed the race/class numbers to words and added map and gender <?php $CookieExpireTime = "600"; // cookie get's deleted by the browser in 600 seconds (AKA 10 minutes) $reading = @fopen("config.php", 'r'); if ($reading) // if we can read the config.php file that's on the frontpage... include "config.php"; else // else, we define them here { $port = "3306"; $host = "localhost"; $user = "root"; $pass = "mangos"; $mangoscharacters = "characters"; $mangosrealm = "realmd"; } if (!(isset($_COOKIE['logged_in'])) && ($_POST['password'] == "" || $_POST['username'] == "")) // if the form is not posted and the cookie not present { ?> <html> <body> <form name="login" method="POST" action="<?php echo $_SERVER['PHP_SELF'];?>"> Username: <input type="text" name="username"> Password: <input type="password" name="password"> <input type="submit" value="Log in"> </form> </body> </html> <?php } else if (($_POST['username'] != "" && $_POST['password'] != "") || isset($_COOKIE['logged_in'])) // if something was posted or the cookie is present { if (!isset($_COOKIE['logged_in'])) // get the name and pass from the form and make the pass sha encrypted { $username = $_POST['username']; $password = $_POST['password']; $username = strtoupper($username); $password = strtoupper($password); $password = SHA1($username.':'.$password); } else // else, we read the cookie { $parts = explode(",", $_COOKIE['logged_in']); // split the cookie's contents at the comma $username = $parts[0]; // part 1 is the username $password = $parts[1]; // part 2 is the password } $class = array(1=>"Warrior",2=>"Paladin",3=>"Hunter",4=>"Rogue",5=>"Priest",6=>"Death Knight",7=>"Shaman",8=>"Mage",9=>"Warlock",11=>"Druid"); $race = array(1=>"Human",2=>"Orc",3=>"Dwarf",4=>"Night Elf",5=>"Undead",6=>"Tauren",7=>"Gnome",8=>"Troll",10=>"Blood Elf",11=>"Draenei"); $map = array(0=>"Eastern Kingdoms",1=>"Kalimdor",33=>"Shadowfang Keep",34=>"Stormwind Stockade",35=>"Stormwind Prison",36=>"Deadmines",43=>"Wailing Caverns",44=>"Monastery",47=>"Razorfen Kraul",48=>"Blackfathom",70=>"Uldaman",90=>"Gnomeragon",109=>"Sunken Temple",129=>"Razorfen Downs",169=>"Emerald Dream",189=>"Monastery",209=>"Tanaris",229=>"Black Rock Spire",230=>"Black Rock Depths",249=>"Onyxia Lair",269=>"Caverns Of Time",289=>"School of Necromancy",309=>"Zulgurub",329=>"Stratholme",349=>"Mauradon",369=>"Deeprun Tram",389=>"Orgrimmar",409=>"MoltenCore",429=>"DireMaul",469=>"Blackwing Lair",509=>"AhnQiraj",530=>"Dalaran",531=>"AhnQiraj Temple",532=>"Karazahn",533=>"Stratholme",534=>"Hyjal Past",540=>"Hellfire Military",542=>"Hellfire Demon",543=>"Hellfire Rampart",544=>"Hellfire Raid",545=>"Coilfang Pumping",546=>"Coilfang Marsh",547=>"Coilfang Draenei",548=>"Coilfang Raid",550=>"Tempest Keep Raid",552=>"Tempest Keep Arcane",553=>"Tempest Keep Atrium",554=>"Tempest Keep Factory",555=>"Auchindoun Shadow",556=>"Auchindoun Demon",557=>"Auchindoun Ethereal",558=>"Auchindoun Draenei",560=>"Hillsbrad Past",562=>"Blades Edge Arena",564=>"Black Temple",565=>"Gruuls Lair",566=>"Netherstorm BG",568=>"ZulAman",571=>"Northrend",574=>"Valgarde 70",575=>"Utgarde Pinnacle",576=>"Nexus 70",578=>"Nexus 80",580=>"Sunwell Plateau",595=>"Stratholme COT",598=>"Sunwell 5",599=>"Ulduar 70",600=>"Drak Theron Keep",602=>"Ulduar 80",603=>"Ulduar Raid",604=>"GunDrak",607=>"Northrend BG",608=>"Violet Hold",609=>"Ebon Hold",615=>"The Obsidian Sanctum",616=>"The Eye of Eternity",617=>"Dalaran Sewers",618=>"The Ring of Valor",619=>"Ahn'kahet: The Old Kingdom",624=>"Vault of Archavon",628=>"Isle of Conquest",631=>"Icecrown Citadel Raid",632=>"Forge of Souls",649=>"Argent Tournament Raid",650=>"Argent Tournament Dungeon",658=>"Pit Of Saron",668=>"Halls of Reflection",723=>"Stormwind",724=>"The Ruby Sanctum"); $gender = array(0=>"Male",1=>"Female"); $host = $host.":".$port; $connection = mysql_connect($host, $user, $pass); if ($connection) $connected_db = mysql_select_db($mangosrealm); if ($connection && $connected_db) { $query = mysql_query("SELECT `sha_pass_hash`, `id` FROM `account` WHERE `username` = '$username';"); if (mysql_num_rows($query) != 0) { $fields = mysql_fetch_assoc($query); $real_pass = $fields['sha_pass_hash']; $id = $fields['id']; if ($password == $real_pass) { setcookie("logged_in", $username.",".$password, time()+$CookieExpireTime); mysql_select_db($mangoscharacters); $getchars = mysql_query("SELECT * FROM `characters` WHERE `account` = '$id';"); //query to get all the char fields from the DB if ($getchars) { $charinfo = mysql_fetch_assoc($getchars); // get all the fields from the query echo ' <table border="0.5"> <tr> <th>Name</th> <th>Race</th> <th>Class</th> <th>Level</th> <th>Map</th> <th>Gender</th> </tr> <tr> <td>'.$charinfo['name'].'</td> <td>'.$race[$charinfo['race']].'</td> <td>'.$class[$charinfo['class']].'</td> <td>'.$charinfo['level'].'</td> <td>'.$map[$charinfo['map']].'</td> <td>'.$gender[$charinfo['gender']].'</td> </tr> </table> '; } else die("You don't have any characters"); } else die("Wrong pass!"); } else die("Account does not exist!"); } } ?> Edit: added variable on the top so you can set the cookie's expire time Edit2: If you want an image to be displayed next to the race, you could change <td>'.$race[$charinfo['race']].'</td> into <td>[img=img/'.$race[$charinfo['race']].'.jpg] '.$race[$charinfo['race']].'</td> this will load the image "tauren.jpg" from the "img" subfolder, which you'll have to supply yourself, if your race is "tauren" ( $race[$charinfo['race']] returns the racename )
  8. @wowgamer, let me know if this what you want: <?php $reading = @fopen("config.php", 'r'); if ($reading) // if we can read the config.php file that's on the frontpage... include "config.php"; else // else, we define them here { $port = "3306"; $host = "localhost"; $user = "root"; $pass = "mangos"; $mangoscharacters = "characters"; $mangosrealm = "realmd"; } if (!(isset($_COOKIE['logged_in'])) && $_POST['password'] == "") // if the form is not posted and the cookie not present { ?> <html> <body> <form name="login" method="POST" action="<?php echo $_SERVER['PHP_SELF'];?>"> Username: <input type="text" name="username"> Password: <input type="password" name="password"> <input type="submit" value="Log in"> </form> </body> </html> <?php } else if (($_POST['username'] != "" && $_POST['password'] != "") || isset($_COOKIE['logged_in'])) // if something was posted or the cookie is present { if (!isset($_COOKIE['logged_in'])) // get the name and pass from the form and make the pass sha encrypted { $username = $_POST['username']; $password = $_POST['password']; $username = strtoupper($username); $password = strtoupper($password); $password = SHA1($username.':'.$password); } else // else, we read the cookie { $parts = explode(",", $_COOKIE['logged_in']); // split the cookie's contents at the comma $username = $parts[0]; // part 1 is the username $password = $parts[1]; // part 2 is the password } $host = $host.":".$port; $connection = mysql_connect($host, $user, $pass); if ($connection) $connected_db = mysql_select_db($mangosrealm); if ($connection && $connected_db) { $query = mysql_query("SELECT `sha_pass_hash`, `id` FROM `account` WHERE `username` = '$username';"); if (mysql_num_rows($query) != 0) { $fields = mysql_fetch_assoc($query); $real_pass = $fields['sha_pass_hash']; $id = $fields['id']; if ($password == $real_pass) { setcookie("logged_in", "$username, $password", time()+600); mysql_select_db($mangoscharacters); $getchars = mysql_query("SELECT * FROM `characters` WHERE `account` = '$id';"); //query to get all the char fields from the DB if ($getchars) { $charinfo = mysql_fetch_assoc($getchars); // get all the fields from the query echo ' <table> <tr> <th>| Name</th> // display the column names <th>| Race</th> <th>| Class</th> <th>| Level</th> </tr> <tr> <td>| '.$charinfo['name'].'</td> // display the content of field "name" <td>| '.$charinfo['race'].'</td> <td>| '.$charinfo['class'].'</td> <td>| '.$charinfo['level'].'</td> </tr> </table> '; } else die("You don't have any characters"); } else die("Wrong pass!"); } else die("Account does not exist!"); } } ?> NOTES: - You can print the other fields from "characters" as well using the same way as i did the current 4 - You can use the cookie made by the script on ANY page you want, it contains the username and sha encrypted password (in my code, there's also an example on how to read it
  9. place "" in front of the class/race (in the code) where IMAGE_LINK is the RELATIVE path to the picture you want there if you want a list of all your chars, i'll write another script for that...but it requires the input of ATLEAST the account name...
  10. right mouse button on the "mangos" database -> import -> "restore from sql dump" now import the files one by one, the structure is: version_subversion_affecteddatabase_affectedtable.sql import all files with the "affecteddatabase" part being "mangos" and the version HIGHER than the one you have
  11. Sorry guys, been busy with school, didn't even know you responded iRelax anyway, thanks Laise... now i can easily learn from it
  12. Wouldn't it be better to start learning (global) C++ before getting into the Networking part? seems you're trying to do a too big leap
  13. Levels required for instances are a database issue, post it over at the PSDB forums plus even if you got in, official SD2 doesn't have ANY part of it working EDIT: Seems this page was cached, i could've sworn there were no other reactions above mine... oh well
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use