Jump to content
MakeWebGames

boionfire81

Members
  • Posts

    532
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by boionfire81

  1. Ok, my user table has a "residence" column and by default there are money and bank columns. I want to list the richest cities and most populated cities in the game. Now that I think about it could just do a num_rows for population. But still stuck on the queries needed to tally the money. Haven't been coding much the past couple days. Not to mention mcc hasn't been much on my mind as I'm only integrating it into a different "business" script. It was called SimLand. I've got most of the malfunctions fixed. Well at least half :P I think this is a great mix from a simple apply and login.
  2. Also need someone who can help upgrade ampjuke from a php5.3 compatible to 7.0
  3. While in theory this is rather a simple project, create an imagemap, insert map location to assign, and done. Problem here is this is a massive data heavy project. I'm looking at close to 50,000 inserts. If you have the time and can stand mundane projects, I have the dime. (Being creative can become tasking)
  4. [uSER=70347]NonStopCoding[/uSER] you've always had good mods, so yeah. email me :)
  5. oh yeah don't forget to add the req_strength, reg_defense, req_agility, req_reflex, req_age to your gangs table.
  6. My version. *Tweaked* most of the stuff is the same, but replace the yourgang.php function with this.   function gang_staff_req() { global $db,$ir,$c,$userid,$gangdata; if($gangdata['gangPRESIDENT'] == $userid ) { if(isset($_POST['subm'])) { $_POST['strength'] = isset($_POST['strength']) && ctype_digit($_POST['strength']) ? $_POST['strength'] : null; $_POST['agility'] = isset($_POST['agility']) && ctype_digit($_POST['agility']) ? $_POST['agility'] : null; $_POST['defense'] = isset($_POST['defense']) && ctype_digit($_POST['defense']) ? $_POST['defense'] : null; $_POST['reflex'] = isset($_POST['reflex']) && ctype_digit($_POST['reflex']) ? $_POST['reflex'] : null; $_POST['age'] = isset($_POST['age']) && ctype_digit($_POST['age']) ? $_POST['age'] : null; $db->query("UPDATE gangs SET `req_strength`={$_POST['strength']}, `req_agility`={$_POST['agility']},`req_defense`={$_POST['defense']}, `req_reflex`={$_POST['reflex']}, `req_age`={$_POST['age']} WHERE gangID={$gangdata['gangID']}"); echo "Applicant Requirements changed!"; } else { echo " <table><tr><th colspan=2>Current Requirements</th></tr> <tr><td><b>Strength:</b></td><td>".number_format($gangdata['req_strength'])."</td></tr> <tr><td><b>Agility:</b></td><td>".number_format($gangdata['req_agility'])."</td></tr> <tr><td><b>Defense:</b></td><td>".number_format($gangdata['req_defense'])."</td></tr> <tr><td><b>Reflex:</b></td><td>".number_format($gangdata['req_reflex'])."</td></tr> <tr><td><b>Character Age:</b></td><td>".number_format($gangdata['req_age'])."</td></tr> </table> <form action='yourgang.php?action=staff&act2=req' method='post'> Change requirements. <input type='hidden' name='subm' value='subm'/> <table><tr><th colspan=2>Current Requirements</th></tr> <tr><td><b>Strength:</b></td><td><input type='text' name='strength' maxlength='9'></td></tr> <tr><td><b>Agility:</b></td><td><input type='text' name='agility' maxlength='9'></td></tr> <tr><td><b>Defense:</b></td><td><input type='text' name='defense' maxlength='9'></td></tr> <tr><td><b>Reflex:</b></td><td><input type='text' name='reflex' maxlength='9'></td></tr> <tr><td><b>Character Age:</b></td><td><input type='text' name='age' maxlength='4'></td></tr> </table> <input type='submit' value='Change' /></form>"; } } }   Then find function gang_applysubmit remove the $gangdata from globals. As the global version doesn't apply here anyways. -.- Second find if ($ir['gang'] > 0) { echo "You cannot apply for a gang when you are already in one."; } in that function and replace just that part with: $gqppa = $db->query("SELECT * FROM `gangs` WHERE `gangID` = {$_GET['ID']}"); $gangdata = $db->fetch_row($gqppa); if ($ir['gang'] > 0) { echo "You cannot apply for a gang when you are already in one."; } else if($ir['strength'] < $gangdata['req_strength']) { echo "You need at least ".number_format($gangdata['req_strength'])." strength to apply here."; } else if($ir['defense'] < $gangdata['req_defense']) { echo "You need at least ".number_format($gangdata['req_defense'])." defense to apply here."; } else if($ir['agility'] < $gangdata['req_agility']) { echo "You need at least ".number_format($gangdata['req_agility'])." agility to apply here."; } else if($ir['reflex'] < $gangdata['req_reflex']) { echo "You need at least ".number_format($gangdata['req_reflex'])." reflex to apply here."; } else if($ir['daysold'] < $gangdata['req_age']) { echo "You need to be at least ".number_format($gangdata['req_age'])." days old to apply here."; } else {   You also need to place a } at the last line of that function. My stats are called strength, agility, defense, and reflex. If you use different names such as labour and guard, etc you will need to modify the code to match your labels. Fully tested and working. Not secured though. No clue what should be done to secure things lol. But there's the code for ya :P
  7. [uSER=65371]sniko[/uSER]. Nope it's already been handled actually. And "conquered" not the right word to use. As specific as coding is, you couldn't tell the difference?
  8. ***UPDATE*** Partially Tested (exception for crystals & respect) Removed BBcode Editted so filters stay in affect from click to click <?php include "globals.php"; $_GET['action'] = isset($_GET['action']) && ctype_alpha($_GET['action']) ? $_GET['action'] : null; $_GET['filter'] = isset($_GET['filter']) && ctype_alpha($_GET['filter']) ? $_GET['filter'] : null; $filters=array( 'nodon' => 'AND donatordays=0', 'don' => 'AND donatordays > 0', 'all' => ''); $filter=(isset($filters[$_GET['filter']])) ? $_GET['filter'] : 'all'; $myf=$filters{$filter}; $bt1=($filter=="nodon") ? "<b>" : ""; $bet1=($filter=="nodon") ? "</b>" : ""; $bt2=($filter=="don") ? "<b>" : ""; $bet2=($filter=="don") ? "</b>" : ""; $bt3=($filter=="all") ? "<b>" : ""; $bet3=($filter=="all") ? "</b>" : ""; print" <table width='75%' cellspacing='1' class='head'><tr><td><h3>Hall of Fame</h2></td></tr></table> Filter: [$bt1<a href='halloffame.php?action={$_GET['action']}&filter=nodon'>Non-Donators</a>$bet1 | $bt2<a href='halloffame.php?action={$_GET['action']}&filter=don'>Donators</a>$bet2 | $bt3<a href='halloffame.php?action={$_GET['action']}&filter=all'>All Users</a>$bet3] <table width=75% cellspacing=1 class='table'> <tr> <td><a href='halloffame.php?action=level&filter={$_GET['filter']}'>LEVEL</a></td> <td><a href='halloffame.php?action=money&filter={$_GET['filter']}'>MONEY</a></td> <td><a href='halloffame.php?action=respect&filter={$_GET['filter']}'>RESPECT</a></td> <td><a href='halloffame.php?action=crystals&filter={$_GET['filter']}'>CRYSTALS</a></td> <td><a href='halloffame.php?action=total&filter={$_GET['filter']}'>TOTAL STATS</a></td> </tr> <tr> <td><a href='halloffame.php?action=strength&filter={$_GET['filter']}'>STRENGTH</a></td> <td><a href='halloffame.php?action=agility&filter={$_GET['filter']}'>AGILITY</a></td> <td><a href='halloffame.php?action=guard&filter={$_GET['filter']}'>GUARD</a></td> <td><a href='halloffame.php?action=labour&filter={$_GET['filter']}'>LABOUR</a></td> <td><a href='halloffame.php?action=iq&filter={$_GET['filter']}'>IQ</a></td> </tr> </table>"; switch($_GET['action']) { case "level": hof_level(); break; case "money": hof_money(); break; case "crystals": hof_crystals(); break; case "respect": hof_respect(); break; case "total": hof_total(); break; case "strength": hof_strength(); break; case "agility": hof_agility(); break; case "guard": hof_guard(); break; case "labour": hof_labour(); break; case "iq": hof_iq(); break; } function hof_level() { global $db,$ir,$c,$userid, $myf; print " Showing the 20 users with the highest levels <table width=75% cellspacing=1 class='table'><tr style='background:gray'> <th>Pos</th> <th>User</th> <th>Level</th><th>Status</th> </tr>"; $q=$db->query("SELECT u.*,g.* FROM users u LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level =1 $myf ORDER BY level DESC,userid ASC LIMIT 20"); $p=0; while($r=$db->fetch_row($q)) { $p++; if($r['userid'] == $userid) { $t="<b>";$et="</b>"; } else { $t="";$et=""; } { if($r['laston'] >= time()-15*60) { $on="<font color=green><b>Online</b></font>"; } else { $on="<font color=red><b>Offline</b></font>"; } print "<tr> <td>$t$p$et</td> <td>$t<a href='viewuser.php?u={$r['userid']}'>{$r['gangPREF']} {$r['username']}</a> [{$r['userid']}]$et</td> <td>$t{$r['level']}$et</td><td>$on</td> </tr>"; } } print "</table>"; } function hof_money() { global $db,$ir,$c,$userid, $myf; print "Showing the 20 users with the highest amount of money <table width=75% cellspacing=1 class='table'><tr style='background:gray'> <th>Pos</th> <th>User</th> <th>Money</th><th>Status</th> </tr>"; $q=$db->query("SELECT u.*,g.* FROM users u LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level = 1 $myf ORDER BY money DESC,userid ASC LIMIT 20"); $p=0; while($r=$db->fetch_row($q)) { $p++; if($r['userid'] == $userid) { $t="<b>";$et="</b>"; } else { $t="";$et=""; } { if($r['laston'] >= time()-15*60) { $on="<font color=green><b>Online</b></font>"; } else { $on="<font color=red><b>Offline</b></font>"; } print "<tr> <td>$t$p$et</td> <td>$t<a href='viewuser.php?u={$r['userid']}'>{$r['gangPREF']} {$r['username']}</a> [{$r['userid']}]$et</td> <td>$t\$".money_formatter($r['money'],'')."$et</td> <td>$on</td></tr>"; } } print "</table>"; } function hof_crystals() { global $db,$ir,$c,$userid, $myf; print "Showing the 20 users with the highest amount of crystals <table width=75% cellspacing=1 class='table'><tr style='background:gray'> <th>Pos</th> <th>User</th> <th>Crystals</th><th>Status</th> </tr>"; $q=$db->query("SELECT u.*,g.* FROM users u LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level = 1 $myf ORDER BY crystals DESC,userid ASC LIMIT 20"); $p=0; while($r=$db->fetch_row($q)) { $p++; if($r['userid'] == $userid) { $t="<b>";$et="</b>"; } else { $t="";$et=""; }{ if($r['laston'] >= time()-15*60) { $on="<font color=green><b>Online</b></font>"; } else { $on="<font color=red><b>Offline</b></font>"; } print "<tr> <td>$t$p$et</td> <td>$t<a href='viewuser.php?u={$r['userid']}'>{$r['gangPREF']} {$r['username']}</a> [{$r['userid']}]$et</td> <td>$t".money_formatter($r['crystals'],'')."$et</td><td>$on</td> </tr>"; } } print "</table>"; } function hof_respect() { global $db,$ir,$c,$userid; print "Showing the 20 gangs with the highest amount of respect <table width=75% cellspacing=1 class='table'><tr style='background:gray'> <th>Pos</th> <th>Gang</th> <th>Respect</th> </tr>"; $q=$db->query("SELECT * FROM gangs ORDER BY gangRESPECT DESC,gangID ASC LIMIT 20"); $p=0; while($r=$db->fetch_row($q)) { $p++; if($r['gangID'] == $ir['gang']) { $t="<b>";$et="</b>"; } else { $t="";$et=""; } print "<tr> <td>$t$p$et</td> <td>$t{$r['gangNAME']} [{$r['gangID']}]$et</td> <td>$t".money_formatter($r['gangRESPECT'],'')."$et</td> </tr>"; } print "</table>"; } function hof_total() { global $db,$ir,$c,$userid, $myf; print "Showing the 20 users with the highest total stats <table width=75% cellspacing=1 class='table'><tr style='background:gray'> <th>Pos</th> <th>User</th><th>Status</th> </tr>"; $q=$db->query("SELECT u.*,g.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level = 1 $myf ORDER BY (us.strength+us.agility+us.guard+us.labour+us.IQ) DESC,u.userid ASC LIMIT 20"); $p=0; while($r=$db->fetch_row($q)) { $p++; if($r['userid'] == $ir['userid']) { $t="<b>";$et="</b>"; } else { $t="";$et=""; } { if($r['laston'] >= time()-15*60) { $on="<font color=green><b>Online</b></font>"; } else { $on="<font color=red><b>Offline</b></font>"; } print "<tr> <td>$t$p$et</td> <td>$t<a href='viewuser.php?u={$r['userid']}'>{$r['gangPREF']} {$r['username']}</a> [{$r['userid']}]$et</td><td>$on</td> </tr>"; } } print "</table>"; } function hof_strength() { global $db,$ir,$c,$userid, $myf; print "Showing the 20 users with the highest strength <table width=75% cellspacing=1 class='table'><tr style='background:gray'> <th>Pos</th> <th>User</th><th>Status</td> </tr>"; $q=$db->query("SELECT u.*,g.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level = 1 $myf ORDER BY us.strength DESC,u.userid ASC LIMIT 20"); $p=0; while($r=$db->fetch_row($q)) { $p++; if($r['userid'] == $ir['userid']) { $t="<b>";$et="</b>"; } else { $t="";$et=""; } { if($r['laston'] >= time()-15*60) { $on="<font color=green><b>Online</b></font>"; } else { $on="<font color=red><b>Offline</b></font>"; } print "<tr> <td>$t$p$et</td> <td>$t<a href='viewuser.php?u={$r['userid']}'>{$r['gangPREF']} {$r['username']}</a> [{$r['userid']}]$et</td><td>$on</td> </tr>"; } } print "</table>"; } function hof_agility() { global $db,$ir,$c,$userid, $myf; print "Showing the 20 users with the highest agility <table width=75% cellspacing=1 class='table'><tr style='background:gray'> <th>Pos</th> <th>User</th><th>Status</th> </tr>"; $q=$db->query("SELECT u.*,g.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level = 1 $myf ORDER BY us.agility DESC,u.userid ASC LIMIT 20"); $p=0; while($r=$db->fetch_row($q)) { $p++; if($r['userid'] == $ir['userid']) { $t="<b>";$et="</b>"; } else { $t="";$et=""; } { if($r['laston'] >= time()-15*60) { $on="<font color=green><b>Online</b></font>"; } else { $on="<font color=red><b>Offline</b></font>"; } print "<tr> <td>$t$p$et</td> <td>$t<a href='viewuser.php?u={$r['userid']}'>{$r['gangPREF']} {$r['username']}</a> [{$r['userid']}]$et</td><td>$on</td> </tr>"; } } print "</table>"; } function hof_guard() { global $db,$ir,$c,$userid, $myf; print "Showing the 20 users with the highest guard <table width=75% cellspacing=1 class='table'><tr style='background:gray'> <th>Pos</th> <th>User</th><th>Status</th> </tr>"; $q=$db->query("SELECT u.*,g.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level = 1 $myf ORDER BY us.guard DESC,u.userid ASC LIMIT 20"); $p=0; while($r=$db->fetch_row($q)) { $p++; if($r['userid'] == $ir['userid']) { $t="<b>";$et="</b>"; } else { $t="";$et=""; } { if($r['laston'] >= time()-15*60) { $on="<font color=green><b>Online</b></font>"; } else { $on="<font color=red><b>Offline</b></font>"; } print "<tr> <td>$t$p$et</td> <td>$t<a href='viewuser.php?u={$r['userid']}'>{$r['gangPREF']} {$r['username']}</a> [{$r['userid']}]$et</td><td>$on</td> </tr>"; } } print "</table>"; } function hof_labour() { global $db,$ir,$c,$userid, $myf; print "Showing the 20 users with the highest labour <table width=75% cellspacing=1 class='table'><tr style='background:gray'> <th>Pos</th> <th>User</th><th>Status</th> </tr>"; $q=$db->query("SELECT u.*,g.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level = 1 $myf ORDER BY us.labour DESC,u.userid ASC LIMIT 20"); $p=0; while($r=$db->fetch_row($q)) { $p++; if($r['userid'] == $ir['userid']) { $t="<b>";$et="</b>"; } else { $t="";$et=""; } { if($r['laston'] >= time()-15*60) { $on="<font color=green><b>Online</b></font>"; } else { $on="<font color=red><b>Offline</b></font>"; } print "<tr> <td>$t$p$et</td> <td>$t<a href='viewuser.php?u={$r['userid']}'>{$r['gangPREF']} {$r['username']}</a> [{$r['userid']}]$et</td><td>$on</td> </tr>"; } } print "</table>"; } function hof_iq() { global $db,$ir,$c,$userid, $myf; print "Showing the 20 users with the highest IQ <table width=75% cellspacing=1 class='table'><tr style='background:gray'> <th>Pos</th> <th>User</th><th>Status</th> </tr>"; $q=$db->query("SELECT u.*,g.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level = 1 $myf ORDER BY us.IQ DESC,u.userid ASC LIMIT 20"); $p=0; while($r=$db->fetch_row($q)) { $p++; if($r['userid'] == $ir['userid']) { $t="<b>";$et="</b>"; } else { $t="";$et=""; } { if($r['laston'] >= time()-15*60) { $on="<font color=green><b>Online</b></font>"; } else { $on="<font color=red><b>Offline</b></font>"; } print "<tr> <td>$t$p$et</td> <td>$t<a href='viewuser.php?u={$r['userid']}'>{$r['gangPREF']} {$r['username']}</a> [{$r['userid']}]$et</td><td>$on</td> </tr>"; } } print "</table>"; } $h->endpage(); ?>
  9. tested and works v2. Edits:   function gang_staff_dmsg() { global $ir,$db,$userid,$gangdata; if($gangdata['gangPRESIDENT'] == $userid) { if(isset($_POST['subm'])) { $_POST['vp']=str_replace(array("<", ">", "\n"), array("<", ">", " "), $_POST['vp']); $db->query("UPDATE gangs SET gangDMSG='{$_POST['vp']}' WHERE gangID={$gangdata['gangID']}"); echo "Gang Decline Message Changed!"; } else { echo "Current Decline Message: {$gangdata['gangDMSG']} <br><form action='yourgang.php?action=staff&act2=dmsg' method='post'> Enter the new message. <input type='hidden' name='subm' value='submit' /> Message: <textarea name='vp' cols='40' rows='7'></textarea> <input type='submit' value='Change' /></form>"; } } }
  10. Adding and testing v2. Besides needing   $_POST['amnt'] = isset($_POST['amnt']) && ctype_digit($_POST['amnt']) ? $_POST['amnt'] : null;   no issues found.
  11. *****UPDATE****** NVM I found the error & fixed.
  12. [uSER=64684]Dayo[/uSER] Ok, I've installed this. Mod'd to work with my missions system and my referral system. But now I want to mod it to work with my boss mod. Basically when a member is able to level up a link will appear and take them to boss.php
  13. I have 7 mods and about 4 tweaks to make a new system on. lol There's a lot on my plate right now. But have you ever interacted with a automated chat bot? They are typically found in chat rooms. I'm wanting to do that same thing but using messaging with npc's.   **UPDATE** item 2 complete.
  14. 1) Mccodes has friends but not with requests prior. You just add them currently. 2) I have the mission/challenge portion, but no way to keep them from leveling up prior 3) What questions do you have? 4) I created my own backpack system and it took a lot of time and I just don't have that much time for this. So simply trying to buy a mod for it And welcome back Crazy. What was your old username?
  15. 1) Friend requests with a friend list feature for profiles 2) Leveling up requires a mission completion first (stop xp gains when it's time to level up until the mission is completed) 3) NPC's as "chat bots". Basically I want to give the npc's a series of predefined messages. Messages will be based off keywords in mail received, if they are "contacts/friends", if they are in the same location, and an ordered list i.e. if this and this then send message 1, if that plus this, send message 2, but only after message 1 was sent. 4) Envelopes to put cash inside for a discrete transfer of sorts. Just need the ability to add cash into an envelope.  
  16. [uSER=68711]KyleMassacre[/uSER] you're an admin right? How can I block this dude? Seriously he's blowing up my email.
  17. How can I block someone on here?
  18. I am talking about itemtype. But I do not want to use ALL the item types.
  19. $IDs=('18','16','15','13','3','4','2'); $gk=$db->query("SELECT * FROM itemtypes"); $itype=$db->fetch_row($query); while (in_array($itype,$IDs)) {   All I'm getting there Parse error: syntax error, unexpected ',' in That is the $ID line. I tried moving the line above the other lines and the error line number just changed with it.
  20. Ok, if you go to reset the password in phpmyadmin you need 3 things, md5 password (not sure if this has to be generated as such just in the database or what here), you need to empty the salt and have it blank, and force logout = 1. So how can I empty just that one cell? I've come across entire row removal or entire table removal, but not just a single cell. Any ideas how to pass that through?
  21. ok so, if $qys is the db fetch or query? would be equal to FieldToTest and foo, bar, etc just replace with the id #'s?
  22. the item types table. I have about 22 and only half of them are "legal" so the others get sold elsewherez. lol
  23. Ok, I'm using mccodes so there are a lot of limitations and hurdles. But how would I be able to make this query?
  24. This is what I have after the salt and still says invalid login..   <? include "globals_nonauth.php"; ?> <html> <style> body { background: #1E1E1E !important; color: #fff; font-size: 11px; font-family: Verdana; } td { color: #fff; font-size: 11px; font-family: Verdana; } #foot { color: #fff; font-size: 11px; font-family: Verdana; width: 808px; height: 24px; background: #1E1E1E; } a, a:visited { color: #D9C5C5; font-weight: bold; text-decoration: none; } a:hover, a:active { color: #fff; font-weight: bold; text-decoration: none; } #head { background: #1E1E1E url(css/logo.gif) no-repeat; width: 808px; height: 154px; font-size: 11px; font-family: Verdana; } #menu { background: #1E1E1E; width: 808px; height: 30px; font-size: 11px; font-family: Verdana; padding-top: 6px; padding-left: 16px; } #body { background: #1E1E1E; width: 580px; height: 500px; font-size: 11px; font-family: Verdana; padding-top: 10px; padding-left: 20px; } #body-right { background: #1E1E1E; width: 208px; height: 500px; font-size: 11px; font-family: Verdana; } input, select { font-size: 11px; } </style> <link href="http://thespaceforgotten.com/css/login.css" type="text/css" rel="stylesheet" /> <title>The Space Forgotten - Password Reset</title> </HEAD> <BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0> <TABLE align=center width='808' BORDER=0 CELLPADDING=0 CELLSPACING=0> <TR> <TD colspan='2' valign='top' id='head'> </TD> </TR> <TR> <TD colspan='2' valign='top' id='menu'> <a href='login.php'>Login</a> | <a href='register.php'>Register</a> | <a href='forgotpass.php'>Lost pass?</a> </TD> </TR> <TR> <TD valign='top' align='left' id='body'> <? if(isset($_POST['resend'])) { $email = $db->escape($_POST["email"]); if ($email == '') { echo '<script>alert("Not sure what happened there did you actually give me an address to lookup ?");</script>'; echo '<script>history.back(1);</script>'; exit; } if((!strstr($email , "@")) || (!strstr($email , "."))) { echo '<script>alert("Sorry the Address type was not recognised.");</script>'; echo '<script>history.back(1);</script>'; exit; } $q = $db->query("SELECT * FROM users WHERE email = '$email'") or die(mysql_error()); if($db->num_rows($q) > 0) { $q2 = $db->fetch_row($q); $username = $q2['username']; //$pass = $q2[pass]; } else { echo '<script>alert("Sorry that Email Address was not found in our Database");</script>'; echo '<script>history.back(1);</script>'; exit; } function makePassword($len = 8) // << Change for greater lengh { $vowels = array('a', 'e', 'i', 'o', 'u'); //Bang in some Vowels cos we love em $confusing = array('I', 'l', '1', 'Z', '0'); //Confuse the array even more with some capitals $replacements = array('A', 'k', '3', 'U', '9'); //If not happy with Vowels or Confuse then add replacemnts for the happy chappy $choices = array(0 => rand(0, 1), 1 => rand(0, 1), 2 => rand(0, 2)); $parts = array(0 => '', 1 => '', 2 => ''); if ($choices[0]) $parts[0] = rand(1, rand(9,99)); if ($choices[1]) $parts[2] = rand(1, rand(9,99)); $len -= (strlen($parts[0]) + strlen($parts[2])); for ($i = 0; $i < $len; $i++) { if ($i % 2 == 0) $parts[1] .= chr(rand(97, 122)); else $parts[1] .= $vowels[array_rand($confusing)]; } if ($choices[2]) $parts[1] = ucfirst($parts[1]); if ($choices[2] == 2) $parts[1] = strrev($parts[1]); $r = $parts[0] . $parts[1] . $parts[2]; $r = str_replace($confusing, $replacements, $r); return $r; } $p = makePassword(8); // <<< Change value for lenght of password given $raw_password = stripslashes($p); $salt = generate_pass_salt(); $enc_psw = encode_password($p, $salt, true); $e_salt = $db->escape($salt); // in case of changed salt function $e_encpsw = $db->escape($enc_psw); // ditto for password encoder $squestion = $db->escape($_POST["squestion"]); $q1 = $db->query("SELECT * FROM users WHERE sanswer = '$squestion'") or die(mysql_error()); if($db->num_rows($q1) < 0) { $q3 = $db->fetch_row($q1); $username = $q3[username]; } if ($squestion == '') { echo '<script>alert("Please go back and check your Secret Question Again it doesnt seem to be the same as the one we have in our database");</script>'; echo '<script>history.back(1);</script>'; exit; } $squestion = $db->escape($_POST["squestion"]); if ($squestion !== $question) $query = $db->query( "UPDATE users SET userpass = '$e_encpsw', pass_salt='$salt', force_logout='1' WHERE email = '$email' AND username = '$username'" ) or die(mysql_error()); $send = mail($email , "Password Retrieval" , "You or someone using your mail has requested a password reset.\r\nYour data is:\r\nusernamename: $username\r\nPassword: $p\n\r\n\rYou can now login, Thank You.", "FROM: [email protected];"); if($query && $send) { echo ' <div class="info"> <center><h1>Success!!</h1></center> Your new password has been sent to the mail address you provided.</p> Once you get it, click <a href="index.php">here</a> to login.</p> </div> '; } else { echo ' <div> Accept our apologies, we have encountered some problems.</p> ',$question.'</p> Your data is not lost, no need to worry. <b><h2>Account Data Found For Username:<font color=lightgreen> '.$username.'</font></b></h2><b><h2>New Password Changed To:<font color=yellow> '.$p.'</font></b></h2> Your MD5 pass is <h2>'.$pass.'</h2></p> Try again later.</p> </div> '; } } else { ?> <div><b>Re-New Password Request</b></div> We will Require your Email and Security Answer you used to Join the Game with.</p> <form method="post" action="forgotpass.php"> Your Email: <input name="email" type="text" class="inputs"><br> Security Question: <select name="question" class="inputs"> <option value="1">What was your favorite cartoon as a child?</option> <option value="2">What was your first alcoholic beverage?</option> <option value="3">Where did you meet your first girlfriend/boyfriend?</option> <option value="4">What is the name of your favorite super hero?</option> </select><br> Security Answer: <input name="squestion" type="text" class="inputs"><br> <input name="resend" type="submit" class="textBox" id="resend" value="Resend email"> </form> </p> After you enter your e-mail and Secret Question Correctly we will check if it exists in the database We will then send a Temporary Password to you. So you can Login to your Account You Can change this Password from the Settings Menu</div> <? } ?>
×
×
  • Create New...