fahy Posted August 19, 2008 Posted August 19, 2008 it says when i click on manage bussnes . Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/gangster/public_html/manage-business.php on line 542 here is the manage_business.php file please help me . <?php include "globals.php"; if($ir['business']== 0) { die("You are not in a business."); } if($bdata['bOWNER'] != $userid) { die("You don't own this business!"); } switch($_GET['change']) { case "name": name(); break; case "bank": bank(); break; case "msgs": msgs(); break; case "pday": pday(); break; case "mmail": mmail(); break; case "logo": logo(); break; case "flm": flm(); break; case "elm": elm(); break; case "prov": prov(); break; case "apps": member_apps(); break; case "kick": kick(); break; case "members": members_list(); break; case "delete": delete(); break; default: index(); break; } function index() { global $db, $ir, $userid, $h, $bdata; echo ("<center><font color='green'><h2>"); echo sprintf("[b]Welcome to your managers panel for %s.[/b]</h2></font></center> ", $bdata['bNAME']); echo ("<center>"); echo ("<table width=75% border=1>"); echo ("<tr>"); echo ("<th>Part of business</th>"); echo ("<th>Manage?</th></tr>"); echo ("<tr>"); echo ("<td>Name</td>"); echo ("<td>[url='manage-business.php?change=name']Change[/url]</td>"); echo ("</tr>"); echo ("<tr>"); echo ("<td>Applications</td>"); echo ("<td>[url='manage-business.php?change=apps']Change[/url]</td>"); echo ("</tr>"); echo ("<tr>"); echo ("<td>Members</td>"); echo ("<td>[url='manage-business.php?change=members']Change[/url]</td>"); echo ("</tr>"); echo ("<tr>"); echo ("<td>Bank</td>"); echo ("<td>[url='manage-business.php?change=bank']Manage[/url]</td>"); echo ("</tr>"); echo ("<tr>"); echo ("<td>Messages</td>"); echo ("<td>[url='manage-business.php?change=msgs']Change[/url]</td>"); echo ("</tr>"); echo ("<tr>"); echo ("<td>Payment Day</td>"); echo ("<td>[url='manage-business.php?change=pday']Change[/url]</td>"); echo ("</tr>"); echo ("<tr>"); echo ("<td>Mass Mail</td>"); echo ("<td>[url='manage-business.php?change=mmail']Do[/url]</td>"); echo ("</tr>"); echo ("<tr>"); echo ("<td>Logo</td>"); echo ("<td>[url='manage-business.php?change=logo']Change[/url]</td>"); echo ("</tr>"); echo ("<tr>"); echo ("<td>Friends</td>"); echo ("<td>[url='manage-business.php?change=flm']Manage[/url]</td>"); echo ("</tr>"); echo ("<tr>"); echo ("<td>Enemies</td>"); echo ("<td>[url='manage-business.php?change=elm']Manage[/url]</td>"); echo ("</tr>"); echo ("<tr>"); echo ("<td>Profit</td>"); echo ("<td>[url='manage-business.php?change=prov']View[/url]</td>"); echo ("</tr>"); echo ("<tr>"); echo ("<td>Delete Business</td>"); echo ("<td>[url='manage-business.php?change=delete']Delete[/url]</td>"); echo ("</tr>"); echo ("</table></center>"); } function name() { global $db, $ir, $userid, $h, $bdata; if($_POST['newname']) { $sql1 = sprintf("UPDATE `businesses` SET `bNAME` = '%s', `bDESCRIPTION` = '%s' WHERE (`bID` = %u)", $db->escape($_POST['newname']), $db->escape($_POST['description']), $bdata['bID']); $db->query($sql1); echo "Name and Description Changed [url='manage-business.php']>Back[/url] "; exit; } else { echo ("[b]Enter your new business name / description[/b] "); echo ("<form action='manage-business.php?change=name' method='post'>"); echo ("Name: <input type='text' name='newname'> "); echo sprintf("Description : <textarea name='description' cols=30 rows=8>%s</textarea> ", $bdata['bDESCRIPTION']); echo ("<input type='submit' value='Change'></form>"); } } function bank() { global $db, $ir, $userid, $h, $bdata; if($_POST['user']) { $sql2 = sprintf("SELECT * FROM users WHERE ((business = %u) AND (userid = %u))", $ir['business'], $_POST['user']); $ck=$db->query($sql2); if($db->num_rows($ck)== 0) { die ("ERROR! Either this user does not exist or they are not in your business."); } $user = abs(@intval($_POST['user'])); $cash = abs(@intval($_POST['cash'])); $crys = abs(@intval($_POST['crystals'])); $sql3 = sprintf("UPDATE `users` SET `money` = `money` + %u, `crystals` = `crystals` + %u WHERE (`userid` = %u)", $cash, $crystals, $user); $sql4 = sprintf("UPDATE `businesses` SET `bBANKMONEY` = `bBANKMONEY` - %u, `bBANKCRYSTALS` = `bBANKCRYSTALS` - %u WHERE (`bID` = %u)", $cash, $crys, $bdata['bID']); $db->query($sql3); $db->query($sql4); echo sprintf("£%s and %s Crystals Given to User %u: . [url='manage-business.php']>Back[/url] ", number_format($cash), number_format($crys), $user); } else { echo ("<center>Your Business bank currently has... "); echo sprintf("[b]£%s[/b] Cash, ", number_format($bdata['bBANKMONEY'])); echo sprintf("[b][/b] Crystals. ", number_format($bdata['bBANKCRYSTALS'])); echo ("<hr />"); echo ("<form action='manage-business.php?change=bank' method='post'>"); echo sprintf("[b]Give Cash/Crystals to Userid :[/b] <input type='text' name='user' value='%u'> ", $userid); echo ("<table width=75% border=0>"); echo ("<tr>"); echo ("<td height=10 width=50% align=center valign=top>"); echo sprintf("Bank Money: <input type='text' name='cash' value='%u'>", $bdata['bBANKMONEY']); echo ("</td>"); echo ("<td height=10 width=50% align=center valign=top>"); echo sprintf("Bank Crystals: <input type='text' name='crystals' value='%u'>",$bdata['bBANKCRYSTALS'] ); echo ("</td>"); echo ("</tr>"); echo ("</table>"); echo ("</form> "); echo ("</center>"); } } function msgs() { global $db, $ir, $userid, $h, $bdata; if($_POST['newmsg']) { $sql5 = sprintf("UPDATE businesses SET bMESSAGES = '%s' WHERE (bID = %u)", $db->escape($_POST['newmsg']), $bdata['bID']); $db->query($sql5); } else { echo ("Here You May Change Your Business Message. "); echo ("<form action='manage-business.php?change=msgs' method='post'>"); echo sprintf("Message :<textarea name='newmsg' cols=30 rows=8>%s</textarea> ", $bdata['bMESSAGES']); echo ("<input type='submit' value='Change!'> </form>"); } } function pday() { global $db, $ir, $userid, $h, $bdata; if($_POST['submq']) { if($_POST['monday']== 'Yes') { $monday="<font color=green>[b]Yes[/b]</font>"; } else { $monday="<font color=red>[b]No[/b]</font>"; } if($_POST['tuesday']== 'Yes') { $tuesday="<font color=green>[b]Yes[/b]</font>"; } else { $tuesday="<font color=red>[b]No[/b]</font>"; } if($_POST['wednesday']== 'Yes') { $wednesday="<font color=green>[b]Yes[/b]</font>"; } else { $wednesday="<font color=red>[b]No[/b]</font>"; } if($_POST['thursday']== 'Yes') { $thursday="<font color=green>[b]Yes[/b]</font>"; } else { $thursday="<font color=red>[b]No[/b]</font>"; } if($_POST['friday']== 'Yes') { $friday="<font color=green>[b]Yes[/b]</font>"; } else { $friday="<font color=red>[b]No[/b]</font>"; } if($_POST['saturday']== 'Yes') { $saturday="<font color=green>[b]Yes[/b]</font>"; } else { $saturday="<font color=red>[b]No[/b]</font>"; } if($_POST['sunday']== 'Yes') { $sunday="<font color=green>[b]Yes[/b]</font>"; } else { $sunday="<font color=red>[b]No[/b]</font>"; } $totaltext = sprintf("[b]Days of Payments[/b] Monday: %s Tuesday: %s Wednesday: %s Thursday: %s Friday: %s Saturday: %s Sunday: %s ", $monday, $tuesday, $wednesday, $thursday, $friday, $saturday, $sunday); $sql6 = sprintf("UPDATE businesses SET bpDAY = '%s' WHERE (bID = %u)", $db->escape($totaltext), $bdata['bID']); $db->query($sql6); echo ("Days Of Payments is now as follows "); echo ("<hr />"); echo ("[b]Days of Payments[/b] "); echo sprintf("Monday: %s ", $monday); echo sprintf("Tuesday: %s ", $tuesday); echo sprintf("Wednesday: %s ", $wednesday); echo sprintf("Thursday: %s ", $thursday); echo sprintf("Friday: %s ", $friday); echo sprintf("Saturday: %s ", $saturday); echo sprintf("Sunday: %s ", $sunday); echo ("<hr />"); } else { echo "Please tick the days which you want your Payments to be. <form action='manage-business.php?change=pday' method='post'> <input type='hidden' name='submq' value='abc123'> Monday :<input type='checkbox' name='monday' value='Yes'> Tuesday :<input type='checkbox' name='tuesday' value='Yes'> Wednesday :<input type='checkbox' name='wednesday' value='Yes'> Thursday :<input type='checkbox' name='thursday' value='Yes'> Friday :<input type='checkbox' name='friday' value='Yes'> Saturday :<input type='checkbox' name='saturday' value='Yes'> Sunday :<input type='checkbox' name='sunday' value='Yes'> <input type='submit' value='Change'> </form> "; } } function mmail() { global $db, $ir, $userid, $h, $bdata; if($_POST['message']) { $subj = "This is a Mass Mail from Your Business"; $sql8 = sprintf("SELECT * FROM users WHERE (business = %u)", $ir['business']); $mmq = $db->query($sql8); while($o=$db->fetch_row($mmq)) { $sql9 = sprintf(" INSERT INTO mail VALUES ('', %u, %u, %u, unix_timestamp(), '%s', '%s') ", 0, $ir['userid'], $o['userid'], $subj, $db->escape($_POST['message'])); $db->query($sql9); echo sprintf("Mass mail sent to %s. ", $o['username']); } echo "Mass Mail Sent!"; } else { sorry theres more on other postit exseded maximum character's lol Quote
fahy Posted August 19, 2008 Author Posted August 19, 2008 Re: Manage gang problem need really good help here is the other half of the code thank you $sql10 = sprintf("SELECT * businesses WHERE (bID = %u)", $ir['business']); $tmq = $db->query($sql10); $tm = $db->num_rows($tmq); echo ("[b]Here you may send a mass mail to your Business.[/b] "); echo sprintf("You have a total of [b]%s[/b] Members in this Business. ", number_format($tm)); echo ("<form action='manage-business.php?change=mmail' method='post'>"); echo ("Message :<textarea name='message' cols='30' rows='8'>Dear Members Of The Business,"); echo ("</textarea> "); echo ("<input type='submit' value='Submit'> "); echo ("</form>"); } } function logo() { global $db, $ir, $userid, $h, $bdata; if($_POST['newlogo']) { $sql11 = sprintf("UPDATE businesses SET bLOGO = '%s' WHERE (bID = %u)", $db->escape($_POST['newlogo']), $ir['business']); $db->query($sql11); echo "Logo Successfully Changed! "; } else { echo ("Please Paste Your Picture URL for Your New Business Logo "); echo ("<form action='manage-business.php?change=logo' method='post'>"); echo sprintf("New Logo: <input type='text' name='newlogo' value='%s'> ", $bdata['bLOGO']); echo ("<input type='submit' value='Change Pic'> "); echo ("</form>"); } } function flm() { global $db, $ir, $userid, $h, $bdata; if($_POST['business']) { if($_POST['business'] == $bdata['bID']) { die ("You cannot add your own business...Haha!"); } $sql12 = sprintf("SELECT * FROM bf WHERE ((bfFROM = %u) AND (bfTO = %u))", $ir['business'], $_POST['business']); $cq = $db->query($sql12); if($db->num_rows($cq)) { die("You have already added this business."); } $sql13 = sprintf("INSERT INTO bf VALUES (%u, %u)", $ir['business'], $_POST['business']); $sql14 = sprintf("UPDATE businesses SET bPOPULATION = bPOPULATION + %u WHERE (bID = %u)", 50, $_POST['business']); $db->query($sql13); $db->query($sql14); echo "You have added a business as your friend.. "; } else { $sql15 = sprintf("SELECT * FROM businesses"); $sql16 = sprintf("SELECT * FROM bf WHERE (bfFROM = %u)", $ir['business']); $sb = $db->query($sql15); $rem = $db->query($sql16); echo "Remove an friend <form action='friendremove.php' method='post> Friend (By Business ID) :<select name='fri'>"; while($fo=$db->fetch_row($rem)) { echo sprintf("<option value='%u'>%u</option>", $fo['bfTO'], $fo['bfTO']); } echo "</select> <input type='submit' value='Remove!'> </form> "; echo "Add a friend: <form action='manage-business.php?change=flm' method='post'> Business : <select name='business'>"; while($b=$db->fetch_row($sb)) { echo sprintf("<option value='%u'>%s</option>", $b['bID'], $b['bNAME']); } echo "</select> <input type='submit' value='Add'></form> "; } } function elm() { global $db, $ir, $userid, $h, $bdata; if($_POST['business']) { if($_POST['business'] == $bdata['bID']) { die ("You cannot add your own business as a Enemy!!"); } $sql17 = sprintf("SELECT * FROM be WHERE ((beFROM = %u) AND (beTO = %u))", $ir['business'], $_POST['business']); $cq = $db->query($sql17); if($db->num_rows($cq)) { die ("You have already added this business as a enemy."); } $sql18 = sprintf("INSERT INTO be VALUES (%u, %u)", $ir['business'], $_POST['business']); $sql19 = sprintf("UPDATE businesses SET bPOPULATION = bPOPULATION - %u WHERE (bID = %u)", 50, $_POST['business']); $db->query($sql18); $db->query($sql19); echo "You have added a business as your enemy.. "; } else { $sql20 = sprintf("SELECT * FROM businesses"); $sql21 = sprintf("SELECT * FROM be WHERE (beFROM = %u)", $ir['business']); $sb = $db->query($sql20); $rem = $db->query($sql21); echo "Remove an enemy <form action='enemyremove.php' method='post> Enemy (By Business ID) :<select name='eny'>"; while($mo=$db->fetch_row($rem)) { echo sprintf("<option value='%u'>%u</option>", $mo['beTO'], $mo['beTO']); } echo "</select> <input type='submit' value='Remove!'> </form> "; echo "Add a enemy: <form action='manage-business.php?change=elm' method='post'> Business : <select name='business'>"; while($b=$db->fetch_row($sb)) { echo sprintf("<option value='%u'>%s</option>", $b['bID'], $b['bNAME']); } echo "</select> <input type='submit' value='Add'></form> "; } } function prov() { global $db, $ir, $userid, $h, $bdata; if($_GET['insert']== 'bank') { $profit = abs(@intval($bdata['bPROFIT'])); $sql22 = sprintf("UPDATE businesses SET bBANKMONEY = bBANKMONEY - %u, bPROFIT = %u WHERE (bID = %u)", $profit, 0, $ir['business']); $db->query($sql22); event_add($ir['userid'], "You emptied the Businesses Profit to the Banks Cash."); } else { echo sprintf("Your business has £%s Cash. ", number_format($bdata['bPROFIT'])); echo ("[url='manage-business.php?change=prov&insert=bank']Add Profit to Business Cash Bank[/url] "); echo ("[url='manage-business.php']>Back[/url] "); } } function members_list() { global $db, $ir, $userid,$bdata; echo " <center>[b]<u>[url='manage-business.php?change=add']<font color='red'>Check Applications</font>[/url]</u>[/b]</center> <center> <table border=1 width=75% class='table'> <tr> <th>User</th> <th>Level</th> <th>Days In Business</th> <th>Action</th> </tr>"; $sql23 = sprintf("SELECT * FROM users WHERE (business = %u)", $bdata['bID']); $q = $db->query("={}"); while($r=$db->fetch_row($q)) { echo ("<tr>"); echo sprintf ("<td>[url='viewuser.php?u=%u']%s[/url]</td>", $r['userid'], $r['username']); echo sprintf("<td>%s</td>", number_format($r['level'])); echo sprintf("<td>%s</td>", number_format($ir['dib'])); echo sprintf("<td>"); if($bdata['bOWNER'] == $userid || $userid == 1 || $userid == 4) { echo sprintf("[url='manage-business.php?action=kick&ID=%u']Kick[/url]", $r['userid']); } else { echo (" "); } echo ("</td> </tr>"); } echo ("</table> </center> [url='manage-business.php']> Back to your business home[/url]"); } function member_apps() { global $db, $ir, $userid,$bdata,$h; $_GET['bapp'] = abs(@intval($_GET['bapp'])); if($_GET['bapp']) { $sql24 = sprintf(" SELECT b.*, u.* FROM bapps b LEFT JOIN users u ON (b.bappFROM = u.userid) WHERE ((b.bappID = %u) AND (b.bappBUSINESS = %u)) ", $_GET['bapp'], $bdata['bID'] ); $aq=$db->query($sql24); if ($db->num_rows($aq)) { $bappdata = $db->fetch_row($aq); if($_GET['what'] == 'decline') { $sql25 = sprintf("DELETE FROM bapps WHERE (bappID = %u)", $_GET['bapp']); $db->query($sql25); { $eventappdecline = sprintf("Your application to join the %s Business was declined", htmlentities($bdata['bNAME'])); event_add($bappdata['bappFROM'], $eventappdecline,'business'); { $sql26 = sprintf("INSERT INTO busevents VALUES ('', %u, unix_timestamp(), '[url='viewuser.php?u=%u']%s[/url] has declined [url='viewuser.php?u=%u']%s[/url]'s application to join the Business.' ", $bdata['bID'], $userid, $ir['username'], $bappdata['bappFROM'], $bappdata['username'] ); $db->query($sql26); { echo sprintf("You have declined the application by %s.<br } else if ($bappdata['business'] != 0); { die ("That person is already in a Business."); } $sql27 = sprintf("DELETE FROM bapps WHERE (bappID = %u)", $_GET['bapp']); $db->query($sql27); { $eventappaccept = sprintf("Your application to join the %s Business was accepted, Congrats!", $bdata['bNAME']); event_add($bappdata['bappFROM'], $eventappaccept,'business'); { $sql28 = sprintf("INSERT INTO busevents VALUES ('', %u, unix_timestamp(), '[url='viewuser.php?u=']{}[/url] has accepted [url='viewuser.php?u={]}']{}[/url]'s application to join the Business.' ", $bdata['bID'], $userid, $ir['username'], $bappdata['bappFROM'], $bappdata['username']); $db->query($sql28); } $sql29 = sprintf("UPDATE users SET business = %u, dib = %u WHERE (userid = %u)", $bdata['bID'], 0, $bappdata['userid']) $db->query($sql29); { echo sprintf("You have accepted the application by %s. [url='manage-business.php?action=apps']> Back[/url]", $bappdata['username']); } } echo ("[b]Applications[/b] "); echo ("<table width='85%' border='2' class='table'>"); echo ("<tr>"); echo ("<th>User</th>"); echo ("<th>Level</th>"); echo ("<th>Money</th>"); echo ("<th>Reason</th>"); echo ("<th>Action</th>"); echo ("</tr>"); { $sql30 = sprintf("SELECT b.*, u.* FROM bapps b LEFT JOIN users u ON (b.bappFROM = u.userid) WHERE (b.bappBUSINESS = %u) ", $bdata['bID']); } $q = $db->query($sql30); while($r=$db->fetch_row($q)) { echo ("<tr>"); echo sprintf("<td>[url='viewuser.php?u=%u']%s [%u][/url]</td>", $r['userid'], $r['username'], $r['userid']); echo sprintf("<td>%s</td>", number_format($r['level'])); echo sprintf("<td>£%s</td>", number_format($r['money'])); echo sprintf("<td>%s</td>", $r['bappTEXT']); echo ("<td>"); echo sprintf("[url='bapplications.php?action=apps&app=%u&what=accept']Accept[/url]", $r['bappID']); echo (" "); echo sprintf("[url='bapplications.php?action=apps&app=%u&what=decline']Decline[/url]", $r['bappID']); echo ("</td>"); echo ("</tr>"); } echo "</table>"; } function delete() { global $db, $ir, $userid, $h, $bdata; if($_POST['yesorno']== 'yes') { $sql31 = sprintf("UPDATE users SET business = %u WHERE (business = %u)", 0, $bdata['bID']); $db->query($sql31); $sql32 = sprintf("DELETE FROM businesses WHERE (bID = %u)", $bdata['bID']) $db->query($sql32); echo "Business deleted. [url='index.php']Home[/url] "; exit; } else { echo "Are you 100% sure you want to delete this business <form action='manage-business.php?change=delete' method='post'> <input type='submit' name='yesorno' value='Yes'> </form> <form action='index.php' method='link'> <input type='submit' value='No'> </form>"; } } $h->endpage(); ?> thank you please have a look over it and repaste the working code. Quote
fahy Posted August 19, 2008 Author Posted August 19, 2008 Re: Manage gang problem need really good help hey the error is Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/gangster/public_html/manage-business.php on line 542 this is line 541,542,543 please tell me whats wrong. } else if ($bappdata['business'] != 0); { Quote
Floydian Posted August 20, 2008 Posted August 20, 2008 Re: Manage gang problem need really good help Old code { echo sprintf("You have declined the application by %s.<br } else if ($bappdata['business'] != 0); { possible solution: { echo sprintf("You have declined the application by %s. ", ''); } else if ($bappdata['business'] != 0); { Quote
fahy Posted August 20, 2008 Author Posted August 20, 2008 Re: Manage gang problem need really good help nope it dosent work Quote
Floydian Posted August 20, 2008 Posted August 20, 2008 Re: Manage gang problem need really good help there's definitely an error in that sprintf deal I guess you'll have to play around with it a bit. Quote
Zero-Affect Posted August 20, 2008 Posted August 20, 2008 Re: Manage gang problem need really good help Yeah sounds like that Quote
Silver Posted September 11, 2008 Posted September 11, 2008 Re: Manage gang problem need really good help hey the error is Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/gangster/public_html/manage-business.php on line 542 this is line 541,542,543 please tell me whats wrong. } else if ($bappdata['business'] != 0); { if statements don't usually end with a ; Quote
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.