Jump to content

bogdan012794

Members
  • Posts

    13
  • Joined

  • Last visited

    Never
  • Donations

    0.00 GBP 

About bogdan012794

  • Birthday 01/01/1

bogdan012794's Achievements

Member

Member (2/3)

0

Reputation

  1. Hi guys, i have the fallowing script and i want to modify it a little bit. so it will show the characters race as male or female. and i dont know how. this is the script. <CENTER>Name Race Class Level Gender</CENTER> <DIV ALIGN=LEFT> <?PHP require_once ('config.php'); mysql_connect ("$host","$user","$pass"); mysql_select_db ("$mangoscharacters"); $result = mysql_query ("SELECT name, race, class, level, gender FROM characters WHERE online = 1"); $num_online = mysql_num_rows($result); $class = array(1=>"[img=img/class/1.gif]",2=>"[img=img/class/2.gif]",3=>"[img=img/class/3.gif]",4=>"[img=img/class/4.gif]",5=>"[img=img/class/5.gif]",6=>"[img=img/class/6.gif]", 7=>"[img=img/class/7.gif]",8=>"[img=img/class/8.gif]",9=>"[img=img/class/9.gif]",11=>"[img=img/class/11.gif]"); $race = array(1=>"[img=img/race/1-0.gif]",2=>"[img=img/race/2-0.gif]",3=>"[img=img/race/3-0.gif]",4=>"[img=img/race/4-0.gif]",5=>"[img=img/race/5-0.gif]",6=>"[img=img/race/6-0.gif]",7=>"[img=img/race/7-0.gif]",8=>"[img=img/race/8-0.gif]",10=>"[img=img/race/10-0.gif]",11=>"[img=img/race/11-0.gif]"); $gender = array(0=>"Male",1=>"Female"); if($num_online < 1) { echo "<tr><td colspan='4' align='center'>No Players Online!</td></tr>"; } for($i=0; $i<$num_online; $i++) { $row = mysql_fetch_array($result); $t_name = $row['name']; $t_race = $row['race']; $t_class = $row['class']; $t_lvl = $row['level']; $t_gender = $row['gender']; echo " $t_name"; echo " $race[$t_race]"; echo " $class[$t_class]"; echo " $t_lvl"; echo " $gender[$t_gender]</p>"; } ?> here is the problem $race = array(1=>"[img=img/race/1-0.gif]",2=>"[img=img/race/2-0.gif]",3=>"[img=img/race/3-0.gif]",4=>"[img=img/race/4-0.gif]",5=>"[img=img/race/5-0.gif]",6=>"[img=img/race/6-0.gif]",7=>"[img=img/race/7-0.gif]",8=>"[img=img/race/8-0.gif]",10=>"[img=img/race/10-0.gif]",11=>"[img=img/race/11-0.gif]"); for race 1 = img/race/1-0.gif this is the male image. how i can make it to show the female image witch is 1-1.gif if the characters is female? thanks. hope you guys may help me! or if you have other players online script. and you want to share it will me it will be cool. thanks again.
  2. Hi i've created a script for a staff list, and it looks like this. This is for root admin. but i have a problem. please take a look at my script : <?PHP require_once ( 'config.php'); mysql_connect ("$host","$user","$pass"); mysql_select_db ("$mangosrealm"); $result = mysql_query ("SELECT username FROM account WHERE gmlevel > 3 ORDER BY USERNAME)"); while ( $row = mysql_fetch_array($result)) { $t_name = $row['username']; echo " [b]<span style='color: #B00000'>$t_name[/b]</span></p>"; } ?> the error is : Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in staff.php on line 123 at line 123 is : while ( $row = mysql_fetch_array($result)) Ps. this is the whole script, so if you wonder why at 123 lines, i have other things in the staff.php page .. help pls ??
  3. I have solved the problem.. the script is here. <?PHP require_once ('config.php'); mysql_connect ("$host","$user","$pass"); mysql_select_db ("$mangoscharacters"); $result = mysql_query ("SELECT name, race, class, level, gender FROM characters WHERE online = 1"); $num_online = mysql_num_rows($result); $class = array(1=>"[img=img/class/1.gif]",2=>"[img=img/class/2.gif]",3=>"[img=img/class/3.gif]",4=>"[img=img/class/4.gif]",5=>"[img=img/class/5.gif]",6=>"[img=img/class/6.gif]", 7=>"[img=img/class/7.gif]",8=>"[img=img/class/8.gif]",9=>"[img=img/class/9.gif]",11=>"[img=img/class/11.gif]"); $race = array(1=>"[img=img/race/1-0.gif]",2=>"[img=img/race/2-0.gif]",3=>"[img=img/race/3-0.gif]",4=>"[img=img/race/4-0.gif]",5=>"[img=img/race/5-0.gif]",6=>"[img=img/race/6-0.gif]",7=>"[img=img/race/7-0.gif]",8=>"[img=img/race/8-0.gif]",10=>"[img=img/race/10-0.gif]",11=>"[img=img/race/11-0.gif]"); $gender = array(0=>"Male",1=>"Female"); if($num_online < 1) { echo "<tr><td colspan='4' align='center'>No Players Online!</td></tr>"; } for($i=0; $i<$num_online; $i++) { $row = mysql_fetch_array($result); $t_name = $row['name']; $t_race = $row['race']; $t_class = $row['class']; $t_lvl = $row['level']; $t_gender = $row['gender']; echo " $t_name"; echo " $race[$t_race]"; echo " $class[$t_class]"; echo " $t_lvl"; echo " $gender[$t_gender]</p>"; } ?> * I have added </p>
  4. Hi guys. i have a problem. Players online script show something like this Name lvl className lvl className lvl class. how i can make it to show like this Name lvl class Name lvl class Name lvl class Here is an example on how it looks atm Admin 80 RogueGamemaster 80 MageModerator 80 Warlock If i want to look like this : Admin 80 Rogue GameMaster 80 Mage Moderator 80 Warlock The script i use : <?PHP require_once ('config.php'); mysql_connect ("$host","$user","$pass"); mysql_select_db ("$mangoscharacters"); $result = mysql_query ("SELECT name, race, class, level, gender FROM characters WHERE online = 1"); $num_online = mysql_num_rows($result); $class = array(1=>"[img=img/class/1.gif]",2=>"[img=img/class/2.gif]",3=>"[img=img/class/3.gif]",4=>"[img=img/class/4.gif]",5=>"[img=img/class/5.gif]",6=>"[img=img/class/6.gif]", 7=>"[img=img/class/7.gif]",8=>"[img=img/class/8.gif]",9=>"[img=img/class/9.gif]",11=>"[img=img/class/11.gif]"); $race = array(1=>"[img=img/race/1-0.gif]",2=>"[img=img/race/2-0.gif]",3=>"[img=img/race/3-0.gif]",4=>"[img=img/race/4-0.gif]",5=>"[img=img/race/5-0.gif]",6=>"[img=img/race/6-0.gif]",7=>"[img=img/race/7-0.gif]",8=>"[img=img/race/8-0.gif]",10=>"[img=img/race/10-0.gif]",11=>"[img=img/race/11-0.gif]"); $gender = array(0=>"Male",1=>"Female"); if($num_online < 1) { echo "<tr><td colspan='4' align='center'>No Players Online!</td></tr>"; } for($i=0; $i<$num_online; $i++) { $row = mysql_fetch_array($result); $t_name = $row['name']; $t_race = $row['race']; $t_class = $row['class']; $t_lvl = $row['level']; $t_gender = $row['gender']; echo "$t_name "; echo " $race[$t_race]"; echo " $class[$t_class]"; echo " $t_lvl"; echo " $gender[$t_gender]"; } ?>
  5. Man i am not so good at this, but maybe i am right. and maybe you know what i am going to say but: Creature 151607 (Entry: 14401) have UNIT_NPC_FLAG_TRAINER but have empty trainer spell list. Creature 151607 (Entry: 14401) have UNIT_NPC_FLAG_TRAINER but have empty trainer spell list. Creature 151607 (Entry: 14401) have UNIT_NPC_FLAG_TRAINER but have empty trainer spell list. Creature 151607 (Entry: 14401) have UNIT_NPC_FLAG_TRAINER but have empty trainer spell list. >> Loaded 0 string templates. DB table `gossip_texts` is empty. and other errors with 'empty'.. the problem should be from the world db. try to reimport the world db or something.
  6. ok so i use <?php /* Very important! You need to run SQL update! ALTER TABLE `account` ADD `reset_password` VARCHAR( 50 ) NOT NULL; */ /*Config*/ $realmd = array( 'db_host'=> 'localhost', //ip of db realm 'db_username' => 'username',//realm user 'db_password' => 'password',//realm password 'db_name'=> 'realmd',//realm db name ); $config = array( 'path_to_thisfile' => 'link', // Example: [url]http://mysite.com/lol/ownage/wow/[/url] 'email_from' => 'email', // Who should the email be sent from ? 'email_subject' => 'Pass recover ', // Subject of the mail ?? ); function sha_password($user,$pass){ $user = strtoupper($user); $pass = strtoupper($pass); return SHA1($user.':'.$pass); } function random_string($counts){ $str = "abcdefghijklmnopqrstuvwxyz";//Count 0-25 for($i=0;$i<$counts;$i++){ if ($o == 1){ $output .= rand(0,9); $o = 0; }else{ $o++; $output .= $str[rand(0,25)]; } } return $output; } $realmd_bc_new_connect = mysql_connect($realmd[db_host],$realmd[db_username],$realmd[db_password]); $selectdb = mysql_select_db($realmd[db_name],$realmd_bc_new_connect); if ($_GET[h] && $_GET[h] != '' && $_GET[h] != '0'){ $output_random_pass = random_string(10); $query = mysql_query("SELECT username FROM `account` WHERE reset_password='$_GET[h]'"); $res = mysql_fetch_array($query); if (mysql_num_rows($query) == 1){ echo "Hi $res[username], Your password is: $output_random_pass. Please change your password fast as possible."; $pass_hash = sha_password($res[username],$output_random_pass); mysql_query("UPDATE `account` SET sha_pass_hash='$pass_hash' WHERE reset_password='$_GET[h]'"); mysql_query("UPDATE `account` SET reset_password='' WHERE username='$res[username]'"); }else{ echo "Error."; } }else{ ?> <?php //this is where user fill in and send by email if ($_POST[password_takeback]){ $check_security = mysql_query("SELECT id FROM `account` WHERE username='$_POST[username]' AND email='$_POST[email]'"); if (isset($_POST['username']) && isset($_POST['email']) && mysql_num_rows($check_security) == 1){ $rand = random_string(40); mysql_query("UPDATE `account` SET reset_password='$rand' WHERE username='$_POST[username]'"); $to = $_POST["email"]; $from = "From: $config[email_from]"; $subject = $config[email_subject]; $message= "Hi $_POST[username], you have submitted a password recovery on our site. IF YOU DIDNT SUBMIT A PASSWORD REQUEST JUST DELETE THIS MAIL!. Please follow this link to complete the operation: $config[path_to_thisfile]?h=$rand"; mail($to, $subject, $message, $from); // This work if you have configured your php.ini file to send email, !on linux its default. echo "An Email has been sent to you, please follow the email to complete the process."; }else{ echo "Incorrect details, Please be sure that you submitted right Email and Username to your account"; } }else{ ?> <form action="<?php echo $_SERVER[php_SELF]; ?>" method="POST"> Your Email: <input type="text" name="email"> </p> Your Username: <input type="text" name="username"> </p> <input type="submit" name="password_takeback" value="Recover Password"> </p> </form> <?php } }// End GET ?> after i get the mail, i acces the link. and it says.. your new password is Mangos. Please change your password as soon as possible. (mangos is an example) When i try to login with the pass mangos. it dosent work. it says incorect password. when i try to login with the old pass, it works. so somewhere in the query of mysql something is bad. the new password dosent change the old one.. so the old one remains.
  7. thanks but i solved that one.. i used: echo " [b]<span style='color: #B00000'>$t_name[/b]</span></p>"; Now i have a another problem with password recovery. please check edited post.
  8. thanks But i found another problem. The password recover script dosen't rest the password. You get the new password. but you cannot log with it..the old password still works.. The script i use <?php /* Very important! You need to run SQL update! ALTER TABLE `account` ADD `reset_password` VARCHAR( 50 ) NOT NULL; */ /*Config*/ $realmd = array( 'db_host'=> 'localhost', //ip of db realm 'db_username' => 'username',//realm user 'db_password' => 'password',//realm password 'db_name'=> 'realmd',//realm db name ); $config = array( 'path_to_thisfile' => 'link', // Example: [url]http://mysite.com/lol/ownage/wow/[/url] 'email_from' => 'email', // Who should the email be sent from ? 'email_subject' => 'Pass recover ', // Subject of the mail ?? ); function sha_password($user,$pass){ $user = strtoupper($user); $pass = strtoupper($pass); return SHA1($user.':'.$pass); } function random_string($counts){ $str = "abcdefghijklmnopqrstuvwxyz";//Count 0-25 for($i=0;$i<$counts;$i++){ if ($o == 1){ $output .= rand(0,9); $o = 0; }else{ $o++; $output .= $str[rand(0,25)]; } } return $output; } $realmd_bc_new_connect = mysql_connect($realmd[db_host],$realmd[db_username],$realmd[db_password]); $selectdb = mysql_select_db($realmd[db_name],$realmd_bc_new_connect); if ($_GET[h] && $_GET[h] != '' && $_GET[h] != '0'){ $output_random_pass = random_string(10); $query = mysql_query("SELECT username FROM `account` WHERE reset_password='$_GET[h]'"); $res = mysql_fetch_array($query); if (mysql_num_rows($query) == 1){ echo "Hi $res[username], Your password is: $output_random_pass. Please change your password fast as possible."; $pass_hash = sha_password($res[username],$output_random_pass); mysql_query("UPDATE `account` SET sha_pass_hash='$pass_hash' WHERE reset_password='$_GET[h]'"); mysql_query("UPDATE `account` SET reset_password='' WHERE username='$res[username]'"); }else{ echo "Error."; } }else{ ?> <?php //this is where user fill in and send by email if ($_POST[password_takeback]){ $check_security = mysql_query("SELECT id FROM `account` WHERE username='$_POST[username]' AND email='$_POST[email]'"); if (isset($_POST['username']) && isset($_POST['email']) && mysql_num_rows($check_security) == 1){ $rand = random_string(40); mysql_query("UPDATE `account` SET reset_password='$rand' WHERE username='$_POST[username]'"); $to = $_POST["email"]; $from = "From: $config[email_from]"; $subject = $config[email_subject]; $message= "Hi $_POST[username], you have submitted a password recovery on our site. IF YOU DIDNT SUBMIT A PASSWORD REQUEST JUST DELETE THIS MAIL!. Please follow this link to complete the operation: $config[path_to_thisfile]?h=$rand"; mail($to, $subject, $message, $from); // This work if you have configured your php.ini file to send email, !on linux its default. echo "An Email has been sent to you, please follow the email to complete the process."; }else{ echo "Incorrect details, Please be sure that you submitted right Email and Username to your account"; } }else{ ?> <form action="<?php echo $_SERVER[php_SELF]; ?>" method="POST"> Your Email: <input type="text" name="email"> </p> Your Username: <input type="text" name="username"> </p> <input type="submit" name="password_takeback" value="Recover Password"> </p> </form> <?php } }// End GET ?>
  9. Hi, i have a problem.. I have created the next script for a staff page.. where it should show all the staff names. the script look's like this. <?PHP require_once ( 'config.php'); mysql_connect ("$host","$user","$pass"); mysql_select_db ("$mangoscharacters"); $result = mysql_query ("SELECT name FROM characters WHERE account IN (SELECT id FROM $mangosrealm.account WHERE gmlevel > 3 ORDER BY NAME)"); { $row = mysql_fetch_array($result); $t_name = $row['name']; echo "[b]<span style='color: #B00000'>$t_name[/b]</span>"; } ?> But i have a problem. if two staff persons have the same level ( ex 4) the script will show just one.. How i can make ti show all? I mean if 3 players have gm level 4 to show all 3 players.. not just one.. thanks.
  10. THANKS RANDOM777 , I had the same problem , and I solved thanks to you.! Thanks man
×
×
  • 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