KyleMassacre Posted April 10, 2016 Share Posted April 10, 2016 $_GET['action'] = (isset($_GET['action']) && ctype_alpha($_GET['action'])) ? $_GET['action'] : null; Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted April 10, 2016 Share Posted April 10, 2016 It used to work because I have used it. I recall that you upgraded to PHP 7? If so then it won't work because mysql_* has been not only deprecated but removed in 7 Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted April 10, 2016 Author Share Posted April 10, 2016 dude!! comments! how do I do that? Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted April 10, 2016 Author Share Posted April 10, 2016 (edited) This is the admin area But then this is what is shown member side Not even sure where to begin here. No errors or warnings. Edited April 14, 2016 by boionfire81 updated image urls Quote Link to comment Share on other sites More sharing options...
Dominion Posted April 12, 2016 Share Posted April 12, 2016 You click the "comment" button by quote, like, reply, edit etc... Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted April 12, 2016 Author Share Posted April 12, 2016 I just see, quote, flag, like (like doesn't work either) Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted April 14, 2016 Author Share Posted April 14, 2016 Entirely different mod, but maybe since the best coders on the forum have been here, lol. What should this be? $membs = sprintf("SELECT * FROM `users` WHERE faction = %u", $db->escape($r['faID'])); $mems = $db->query($membs); print mysql_num_rows($mems). mysql_num_rows does not compute lol Quote Link to comment Share on other sites More sharing options...
AdamHull Posted April 14, 2016 Share Posted April 14, 2016 $db->num_rows() Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted April 14, 2016 Author Share Posted April 14, 2016 Any help converting this portion? session_start(); require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); global $c; $is=$db->query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); check_level(); $fm=money_formatter($ir['money']); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm); $h->menuarea(); Quote Link to comment Share on other sites More sharing options...
Dominion Posted April 14, 2016 Share Posted April 14, 2016 It's all in globals.php so just include that file, and delete that stuff. Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted April 14, 2016 Author Share Posted April 14, 2016 Tried that and it logs me out? Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted April 14, 2016 Author Share Posted April 14, 2016 (edited) Full code (as it's free mod posted on here) <?php include "globals.php"; print "<font face='Arial' size='4'>Factions</font><hr width='90%'>"; switch ($_GET['step']) { case 'create': create_faction(); break; case 'profile': faction_profile(); break; case 'users': faction_members(); break; case 'search': search_factions(); break; case 'apply': faction_apply(); break; default: factions_index(); break; } function factions_index() { global $ir,$db,$c,$userid,$h; $sql = sprintf("SELECT * FROM `factions` fa LEFT JOIN `users` u ON (u.userid = fa.faLEADER) ORDER BY faID DESC"); $q = $db->query($sql); print "This is a list of all factions by ID <table width='90%' cellspacing='1'><tr bgcolor='#AAAAAA'><th width='25%'>Name</th><th width='13%'>Members</th><th width='12%'>Reputation</th><th width='50%'>Image</th></tr>"; while($r = $db->fetch_row($q)) { print "<tr><td><a href='factions.php?step=profile&ID={$r['faID']}'><h3>{$r['faNAME']}</h3></a></td><td>"; $membs = sprintf("SELECT * FROM `users` WHERE faction = %u", $db->escape($r['faID'])); $mems = $db->query($membs); print $db->num_rows($mems)."</td> <td>{$r['faREPUTATION']}</td> <td><img src='{$r['faIMAGE']}'></td></tr>"; } print "</table> <hr width='90%'><a href='explore.php'>Back</a><hr width='90%'>"; } function create_faction() { global $ir,$db,$c,$userid,$h; $sql = sprintf("SELECT * FROM `factions` WHERE faID > 0"); $q = $db->query($sql); $fcs = $db->num_rows($q); $r['faCOST'] = ($fcs*10000); if($ir['money'] < $r['faCOST']) { print " You don't have enough money. It costs ".money_formatter($r['faCOST'])." to create a new Faction. <hr width='90%'><a href='explore.php'>Back</a><hr width='90%'>"; } else if($ir['faction'] > 0) { print " You are already part of a Faction. Leave before creating a new one. <hr width='90%'><a href='explore.php'>Back</a><hr width='90%'>"; } else if($_POST['name'] AND $_POST['description'] AND $_POST['status']) { $ins = sprintf("INSERT INTO `factions` (`faID`, `faNAME`, `faDESC`, `faSTATUS`, `faLEADER`, `faCOLEADER`, `faCAPACITY`, `faREPUTATION`) VALUES ('NULL','%s', '%s', '%s', '%d', '%d', '%d', '%d')", $db->escape($_POST['name']), $db->escape($_POST['description']), $db->escape($_POST['status']), $userid, $userid, 10, 100); $db->query($ins); $r['insID'] = mysql_insert_id($c); $fac = sprintf("UPDATE `users` SET faction = %d, money=money-%d WHERE (userid = %u)", $r['insID'], $r['faCOST'], $userid); $db->query($fac); print " The {$_POST['name']} faction was successfully created. <hr width='90%'><a href='factions.php?step=manage'>Back</a><hr width='90%'>"; } else { print " <form action='factions.php?step=create' method='post'> A new faction will cost $10,000 times the amount of factions in existence. The current price is <b>".money_formatter($r['faCOST'])."</b>. Name your Faction <input type='text' name='name' /> Choose a Status <select type='dropdown' name='status'> <option value='Peaceful'>Peaceful</option> <option value='Aggressive'>Aggressive</option> </select> Description <textarea name='description' cols='40' rows='7'></textarea> <input type='submit' value='Create' /></form> <hr width='90%'><a href='factions.php'>Back</a><hr width='90%'>"; } } function faction_profile() { global $ir,$db,$c,$userid,$h; $sql = sprintf("SELECT * FROM `factions` fa LEFT JOIN `users` u ON (u.userid = fa.faLEADER) WHERE (fa.faID = %u)", $db->escape($_GET['ID'])); $q = $db->query($sql); $r = $db->fetch_row($q); print " <table width='400' bgcolor='#DFDFDF'><tr><td align='center'><b><font size='5'>{$r['faNAME']}</font></b></td></tr></table> <img src='{$r['faIMAGE']}'> <table width='400' bgcolor='#DFDFDF'><tr><td valign='middle' align='center'><font size='5'><b>{$r['faREPUTATION']}</b></font></td></tr></table> <table width='400' bgcolor='#DFDFDF'><tr><td width='200' valign='middle'> <b>Leader: </b><a href='viewuser.php?u={$r['userid']}'>{$r['username']}</a> "; $col = sprintf("SELECT * FROM `users` WHERE (userid = %u)", $db->escape($r['faCOLEADER'])); $q2 = $db->query($col); $co = $db->fetch_row($q2); print "<b>Co-Leader: </b><a href='viewuser.php?u={$r['userid']}'>{$co['username']}</a> "; $membs = sprintf("SELECT * FROM `users` WHERE faction = %u", $db->escape($r['faID'])); $mems = $db->query($membs); print "<b>Members: </b>".$db->num_rows($mems)." <b>Reputation: </b>{$r['faREPUTATION']} <b>Current chain: </b>{$r['faCHAIN']} attacks <b>Best chain: </b>{$r['faBCHAIN']} attacks <b>Status: </b>"; if ($r['faSTATUS'] == 'Peaceful') { print "<font color='green'><b>Peaceful</b></font>"; } else { print "<font color='red'><b>Aggressive</b></font>"; } print " </td> <td valign='top' align='right' width='200'><a href='factions.php?step=users&ID={$r['userid']}'>User list</a> <a href='factions.php?step=apply&ID={$r['faID']}'>Apply</a> </td></tr></table> <table width='400' bgcolor='#DFDFDF'><tr> <td width='50%' height='100%'> <table width='100%' height='100%'><tr> <td align='center'> {$r['faDESC']} </td> </tr></table></td></tr></table> <hr width='90%'><a href='factions.php'>Back</a><hr width='90%'>"; } function faction_members() { global $ir,$db,$c,$userid,$h; $sql = sprintf("SELECT * FROM `factions` fa LEFT JOIN `users` u ON (u.faction = fa.faID) WHERE (fa.faID = %u)", $db->escape($_GET['ID'])); $q = $db->query($sql); print "<table width='90%' cellspacing='1'><tr bgcolor='#AAAAAA'><th width='25%'>Num</th><th width='25%'>Name</th><th width='25%'>Level</th><th width='25%'>Days in Faction</th></tr>"; while ($r = $db->fetch_row($q)) { $cn++; print "<tr><td>$cn.</td><td><a href='viewuser.php?u={$r['userid']}'>{$r['username']}</a></td><td>{$r['level']}</td><td>{$r['faction_days']}</td></tr>"; } print "</table> <a href='factions.php?step=profile&ID={$_GET['faID']}'>Back</a>"; } function search_factions() { global $ir,$db,$c,$userid,$h; if (!$_POST['name']) { print "<form action='factions.php?step=search' method='post'> <b>Search by Keyword</b> Insert the keyword that you'd like to search for Factions: <input type='text' name='name'> <input type='submit' value='Search'></form> <hr width='90%'><a href='factions.php'>Back</a><hr width='90%'>"; } else { $sql = sprintf("SELECT * FROM `factions` fa LEFT JOIN `users` u ON (u.userid = fa.faLEADER) WHERE (`faNAME` LIKE '%%%s%%')", $db->escape($_POST['name'])); $q = $db->query($sql); print "<b>Search by Keyword</b> Keyword: {$_POST['name']} <table width='90%' cellspacing='1'><tr bgcolor='#AAAAAA'><th width='25%'>Name</th><th width='13%'>Members</th><th width='12%'>Reputation</th><th width='50%'>Image</th></tr>"; while($r = $db->fetch_row($q)) { print "<tr><td><a href='factions.php?step=profile&ID={$r['faID']}'><h3>{$r['faNAME']}</h3></a></td><td>"; $membs = sprintf("SELECT * FROM `users` WHERE faction = %u", $db->escape($r['faID'])); $mems = $db->query($membs); print $db->num_rows($mems)."</td> <td>{$r['faREPUTATION']}</td> <td><img src='{$r['faIMAGE']}'></td></tr>"; } print "</table> <hr width='90%'><a href='factions.php?step=search'>Back</a><hr width='90%'>"; } } function faction_apply() { global $ir,$db,$c,$userid,$h; if ($ir['faction']) { print " You are already in a faction at this time. <hr width='90%'><a href='factions.php'>Back</a><hr width='90%'>"; } else if (!$_GET['act']) { print " Please type an application to this faction below: <form action='factions.php?step=apply&act=submit&ID={$_GET['ID']}' method='post'> <textarea type='text' name='app' cols='50' rows='8'>Type your application here</textarea> <input type='submit' value='Submit'></form> <hr width='90%'><a href='factions.php?step=profile&ID={$_GET['faID']}'>Back</a><hr width='90%'>"; } else if ($_GET['act'] == 'submit') { if ($_POST['app']) { $ins = sprintf("INSERT INTO `faction_apps` (`fpID`, `fpUSER`, `fpFACTION`, `fpAPP`, `fpTIME`) VALUES ('NULL','%d', '%d', '%s', '%d')", $db->escape($ir['userid']), $db->escape($_GET['ID']), $db->escape($_POST['app']), time()); $db->query($ins); print " Your application was submitted! <hr width='90%'><a href='factions.php?step=profile&ID={$_GET['faID']}'>Back</a><hr width='90%'>"; } else { print " You did not type an application to send! <hr width='90%'><a href='factions.php?step=apply&ID={$_GET['faID']}'>Back</a><hr width='90%'>"; } } } $h->endpage(); ?> Php code check just says: Warning: There is 1 function in your code that has been deprecated in the current version of PHP : mysql_insert_id() Edited April 14, 2016 by boionfire81 updated with code check Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted April 15, 2016 Share Posted April 15, 2016 Find mysql_insert_id($c) and replace with $db->last_id() Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted April 15, 2016 Author Share Posted April 15, 2016 Find mysql_insert_id($c) and replace with $db->last_id() Where did you see that at, as the search function didn't catch it. Also, php warning define (-.-) else if($_POST['name'] AND $_POST['description'] AND $_POST['status']) Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted April 15, 2016 Share Posted April 15, 2016 It's in the create_faction function. Remember to use isset and/or array_key_exists Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted April 20, 2016 Author Share Posted April 20, 2016 Anyone have any idea as to why cronus workshop does not return any items listed as able to be crafted dispite them being added in the staff panel? $blah=$db->query("SELECT * FROM itemscreated WHERE iUSER=$userid ORDER BY iID ASC"); if(mysqli_num_rows($blah) == 0) while($basic=$db->fetch_row($blah)) { $lsso=$db->query("SELECT * FROM workshop WHERE wITEM={$basic['iITEM']}"); $workshop=$db->fetch_row($lsso); $percent=round($basic['iWORK']/$workshop['wWORK']*100,2); $lso=$db->query("SELECT * FROM items WHERE itmid={$basic['iITEM']}"); $item=$db->fetch_row($lso); if($workshop['wCRYSTALS'] > 0){ $crystals="<br>{$workshop['wCRYSTALS']} Crystals";}else{ $crystals="";} if($workshop['wCOST'] > 0){ $cost="<br>\${$workshop['wCOST']}";}else{ $cost="";} $lsd=$db->query("SELECT * FROM itemsneeded WHERE nID={$basic['iITEM']}"); while($needed=$db->fetch_row($lsd)) { $lso=$db->query("SELECT * FROM items WHERE itmid={$needed['nITEM']}"); $item=$db->fetch_row($lso); print"<li><a href=iteminfo.php?ID={$item['itmid']}><font size=1>{$item['itmname']}</font></a></li>"; } $time=time(); $hmmm=$time-$basic['iLASTWORK']; $seconds=$workshop['wTIME']*60; if($hmmm > $seconds) { $workin="<a href=workshop.php?action=work&ID={$basic['iID']}><font color=green>Work On Item</font></a>"; } Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted April 20, 2016 Share Posted April 20, 2016 You should stick to one thing. Your mixing mysqli with the $db wrapper Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted April 22, 2016 Author Share Posted April 22, 2016 so change $db->query to mysqli_query??? or just change the if(mysqli_num_rows($blah) == 0) And, this is my project for the day :) Quote Link to comment Share on other sites More sharing options...
AdamHull Posted April 22, 2016 Share Posted April 22, 2016 Change all instances of mysqli to $db don't just do what you think you need so if(mysqli_num_rows($blah) == 0) Would be come if($db->num_rows($blah) == 0) And so on Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted April 22, 2016 Author Share Posted April 22, 2016 Still not printing anything.... function index() { global $ir,$userid,$h, $db; print" <table border=1 width=85%> <tr> <th colspan=4><center>Your Items Currently Being Created <a href=workshop.php?action=create class='button'>Create New</a></center></th> </tr> <tr> <th width=30%>Item Name</th> <th width=30%>Your Cost(s)</th> <th width=20%>% Complete</th> <th width=20%>---</th> </tr>"; $blah=$db->query("SELECT * FROM itemscreated WHERE iUSER=$userid ORDER BY iID ASC"); if($db->num_rows($blah) == 0) { print" <tr> <td colspan=4><center>You are currently not creating any items!</center></td> </tr>"; } else { while($basic=$db->fetch_row($blah)) { $lsso=$db->query("SELECT * FROM workshop WHERE wITEM={$basic['iITEM']}"); $workshop=$db->fetch_row($lsso); $percent=round($basic['iWORK']/$workshop['wWORK']*100,2); $lso=$db->query("SELECT * FROM items WHERE itmid={$basic['iITEM']}"); $item=$db->fetch_row($lso); if($workshop['wCRYSTALS'] > 0){ $crystals="<br>{$workshop['wCRYSTALS']} Crystals";}else{ $crystals="";} if($workshop['wCOST'] > 0){ $cost="<br>\${$workshop['wCOST']}";}else{ $cost="";} print" <tr> <td>{$item['itmname']} [<A href=workshop.php?action=cancel&ID={$basic['iID']}><font color=red size=1>X</font></a>]</td> <td><center>$cost$crystals</center> <ul>"; $lsd=$db->query("SELECT * FROM itemsneeded WHERE nID={$basic['iITEM']}"); while($needed=$db->fetch_row($lsd)) { $lso=$db->query("SELECT * FROM items WHERE itmid={$needed['nITEM']}"); $item=$db->fetch_row($lso); print"<li><a href=iteminfo.php?ID={$item['itmid']}><font size=1>{$item['itmname']}</font></a></li>"; } $time=time(); $hmmm=$time-$basic['iLASTWORK']; $seconds=$workshop['wTIME']*60; if($hmmm > $seconds) { $workin="<a href=workshop.php?action=work&ID={$basic['iID']}><font color=green>Work On Item</font></a>"; } else { $just=ceil(($seconds-$hmmm)/60); $werd=""; if($just != 1) { $werd="s"; } $workin="<font color=red>$just Minute$werd</font>"; } print"</ul></td> <td><center>$percent%</center></td> <td><center>$workin</center></td> </tr>"; } } echo " </tr></table>"; } Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted June 13, 2016 Author Share Posted June 13, 2016 Ok so staff can create an item and it's displayed and active on staff side. But on user end nothing appears. The rows = 0 doesn't show, nor any item. It ends at the table header. Everything is saved in the database, and phpcodecheck.com says no errors. function create_item() { global $ir,$userid,$db,$h; print" <table border=1 width=85%> <tr> <th colspan=4><center>Here Are The Items You Can Currently Create</center></th> </tr> <tr> <th width=30%>Item Name</th> <th width=30%>Requirements</th> <th width=30%>Cost(s)</th> <th width=10%>---</th> </tr>"; $level=$ir['level']; $ddays=$ir['donatordays']; $daysold=$ir['daysold']; $blah=$db->query("SELECT * FROM workshop WHERE wACTIVE=1 AND wLEVEL<=$level AND wDONATOR<=$ddays AND wDAYSOLD<=$daysold ORDER BY wITEM ASC"); if($db->fetch_row($blah) == 0) { print" <tr> <td colspan=4><center>There are currently no items available for you to create!</center></td> </tr>"; } else { while($ws=$db->fetch_row($blah)) { $lso=$db->query("SELECT * FROM items WHERE itmid={$ws['wITEM']}"); $item=$db->fetch_row($lso); if($ws['wCRYSTALS'] > 0){ $crystals="<br>{$ws['wCRYSTALS']} Crystals";}else{ $crystals="";} if($ws['wCOST'] > 0){ $cost="<br>\${$ws['wCOST']}";}else{ $cost="";} if($ws['wDAYSOLD'] > 0){ $daysold="<br>{$ws['wDAYSOLD']} Days Old";}else{ $daysold="";} if($ws['wLEVEL'] > 1){ $level="<br>Level {$ws['wLEVEL']}";}else{ $level="";} if($ws['wDONATOR'] > 0){ $donator="<br>{$ws['wDONATOR']} Donator Days";}else{ $donator="";} echo " <tr> <td>{$item['itmname']}</td> <td><center> $level $daysold $donator</center> <ul>"; $lrd=$db->query("SELECT * FROM coursesneeded WHERE cnID={$ws['wITEM']}"); while($cneeded=$db->fetch_row($lrd)) { $luo=$db->query("SELECT * FROM courses WHERE crID={$cneeded['cnCOURSE']}"); $course=$db->fetch_row($luo); echo "<li><a href=education.php><font size=1>{$course['crNAME']} Course</font></a></li>"; } echo "</ul></td> <td><center>$cost$crystals</center> <ul>"; $lsd=$db->query("SELECT * FROM itemsneeded WHERE nID={$ws['wITEM']}"); while($needed=$db->fetch_row($lsd)) { $lso=$db->query("SELECT * FROM items WHERE itmid={$needed['nITEM']}"); $item=$db->fetch_row($lso); print"<li><a href=iteminfo.php?ID={$item['itmid']}><font size=1>{$item['itmname']}</font></a></li>"; } print"</ul></td> <td><center><a href=workshop.php?action=cconfirm&ID={$ws['wITEM']}>Create This Item</a></center></td> </tr>"; } } echo " </table>"; } Quote Link to comment Share on other sites More sharing options...
Magictallguy Posted June 18, 2016 Share Posted June 18, 2016 function create_item() { global $db, $ir, $h; $select = $db->query('SELECT *, `itmname` FROM `workshop` INNER JOIN `items` ON `wITEM` = `itmid` WHERE `wACTIVE` = 1 AND `wLEVEL` <= '.$ir['level'].' AND `wDONATOR` <= '.$ir['donatordays'].' AND `wDAYSOLD` <= '.$ir['daysold'].' ORDER BY `wITEM` ASC'); ?><table border="1" width="85%"> <tr> <th colspan="4" class="center">Here Are The Items You Can Currently Create</th> </tr> <tr> <th width="30%">Item Name</th> <th width="30%">Requirements</th> <th width="30%">Cost(s)</th> <th width="10%">---</th> </tr><?php $reqs = ''; $costs = ''; if(!$db->num_rows($select)) echo '<tr><td colspan="4" class="center">There are currently no items available for you to create</td></tr>'; else while($row = $db->fetch_row($select)) { $costs .= $row['wCOST'] ? '$'.number_format($row['wCRYSTALS']).'<br />' : ''; $costs .= $row['wCRYSTALS'] ? number_format($row['wCRYSTALS']).' crystal'.($row['wCRYSTALS'] == 1 ? '' : 's').'<br />' : ''; $reqs .= $row['wDAYSOLD'] ? number_format($row['wDAYSOLD']).' Day'.($row['wDAYSOLD'] == 1 ? '' : 's').' Old<br />' : ''; $reqs .= $row['wLEVEL'] ? 'Level '.number_format($row['wLEVEL']).'<br />' : ''; $reqs .= $row['wDONATOR'] ? number_format($row['wDONATOR']).' Donator Day'.($row['wDAYSOLD'] == 1 ? '' : 's').'<br />' : ''; ?><tr> <td><?php echo $row['itmname'];?></td> <td><?php echo substr($reqs, 0, -6); $selectRequiredCourse = $db->query('SELECT `cnCOURSE` FROM `coursesneeded` WHERE `cnID` = '.$row['wITEM']); if($db->num_rows($selectRequiredCourse)) { $selectCourse = $db->query('SELECT `crNAME` FROM `courses` WHERE `crID` = '.$db->fetch_single($selectRequiredCourse)); if($db->num_rows($selectCourse)) echo '<ul><li><a href="education.php">'.$db->fetch_single($selectCourse).'</a></li></ul>'; } ?></td> <td><?php echo substr($costs, 0, -6); $selectRequiredItem = $db->query('SELECT `nITEM` FROM `itemsneeded` WHERE `nID` = '.$row['wITEM']); if($db->num_rows($selectRequiredItem)) { $selectItem = $db->query('SELECT `itmid`, `itmname` FROM `items` WHERE `itmid` = '.$db->fetch_single($selectRequiredItem)); if($db->num_rows($selectItem)) { $item = $db->fetch_row($selectItem); echo '<ul><li><a href="iteminfo.php?ID='.$item['itmid'].'">'.$item['itmname'].'</a></li></ul>'; } } ?></td> <td class="center"><a href="workshop.php?action=cconfirm&ID=<?php echo $row['wITEM'];?>">Create This Item</a></td> </tr><?php } ?></table><?php } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.