Jump to content
MakeWebGames

newttster

Members
  • Posts

    513
  • Joined

  • Last visited

  • Days Won

    14

Everything posted by newttster

  1. Paul ... thank you for that but the error message that I am getting is for the marriage.php file that is in Post 3.
  2. Thanks for the suggestion ILoveCP unfortunately I am still getting the same error message.
  3. Thank you, Ade ... that worked perfectly. Now ... does anyone have any idea how I can fix the marriage.php one that I posted ... I am still getting that same error message.
  4. I inserted the code were you told me to SilvaTungDevil but now it is giving this error "Parse error: syntax error, unexpected ':' in /home/content/84/7099684/html/viewuser.php on line 107" I have included the code from line 90 - 116.   Last Action: $str Last Login: $str2 Online: $on Days Old: {$r['daysold']} Location: {$r['cityname']}</td><td> Money: {$fm} Crystals: {$r['crystals']} Property: {$r['hNAME']} Referals: "; $rr=$db->query("SELECT * FROM referals WHERE refREFER={$r['userid']}"); print $db->num_rows($rr); print" Marital Status: "; if ($r['marriage']) { $part=$db->query("SELECT * FROM users WHERE userid={$r['marriage']}"); $pr=$db->fetch_row($part); print "Married to {$pr['username']}"; } else { print "Single"; } print " "; Friends: {$r['friend_count']} Enemies: {$r['enemy_count']} </td> <td>";   And here is the code from marriage.php ... Again the error message that I get is "Warning: session_start() [function. session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/84/7099684/html/marriage.php:2) in /home/content/84/7099684/html/globals.php on line 6" <?php include "globals.php"; print "<center><font size='4' face='Arial, Helvetica, sans-serif'>Marriage</font><hr width=75%>"; switch($_GET['action']) { case 'propose': propose_marriage(); break; case 'note': send_note(); break; case 'divorce': divorce_marriage(); break; case 'confirm': divorce_confirm(); break; case 'accept': accept_proposal(); break; case 'decline': decline_proposal(); break; default: marriage_index(); break; } function marriage_index() { global $ir,$c,$userid, $db; print "<center> Welcome to the marriage office! What would you like to do today? "; if (!$ir['marriage']) { print "> Propose marriage "; } else { print "> Divorce partner //> Send Bouquet of Roses ($10,000) > Send a love note "; } print " <hr width=75%>> Back<hr width=75%>"; } function propose_marriage() { global $db,$ir,$c,$userid,$h; $_GET['ID'] = abs((int) $_GET['ID']); if(!$_POST['ID']) { print " <form action='marriage.php?action=propose' method='post'> Please type the ID# of the user you wish to propose to below.   ID: <input type='text' name='ID' value='{$_GET['ID']}' maxlength='10' length='10' size='10' width='10' /> <input type='submit' value='Propose' /> </form> <hr width=75%>> Back<hr width=75%>"; } else if($ir['marriage']) { print " You are already married. <hr width=75%>> Back<hr width=75%>"; } else if($_POST['ID'] == $userid) { print " You cannot propose to yourself! <hr width=75%>> Back<hr width=75%>"; } else { $db->query("INSERT INTO proposals VALUES ('', '$userid', '{$_POST['ID']}')", $c); $q=$db->query("SELECT * FROM proposals WHERE prFROM=$userid"); $r=$db->fetch_row($q); event_add($_POST['ID'], "{$ir['username']} would like to marry you: Accept Decline", $c,'general'); print " Proposal sent!   <hr width=75%>> Back<hr width=75%>"; } } function accept_proposal() { global $db,$ir,$c,$userid,$h; $_GET['ID'] = abs((int) $_GET['ID']); $q=$db->query("SELECT * FROM proposals WHERE prID={$_GET['ID']}"); $r=$db->fetch_row($q); if(!$_GET['ID']) { print " Invalid proposal ID! <hr width=75%>> Back<hr width=75%>"; } else if($r['prUSER'] != $userid) { print " You cannot accept this proposal! <hr width=75%>> Back<hr width=75%>"; } else { $q=$db->query("SELECT * FROM proposals WHERE prUSER=$userid"); $r=$db->fetch_row($q); event_add($r['prFROM'], "{$ir['username']} has accepted your proposal!", $c); $db->query("UPDATE users SET marriage={$r['prFROM']} WHERE userid=$userid"); $db->query("UPDATE users SET marriage=$userid WHERE userid={$r['prFROM']}"); $db->query("DELETE FROM proposals WHERE prID={$_GET['ID']}"); print " Proposal accepted!   <hr width=75%>> Back<hr width=75%>"; } } function decline_proposal() { global $db,$ir,$c,$userid,$h; $_GET['ID'] = abs((int) $_GET['ID']); $q=$db->query("SELECT * FROM proposals WHERE prID={$_GET['ID']}"); $r=$db->fetch_row($q); if(!$_GET['ID']) { print " Invalid proposal ID! <hr width=75%>> Back<hr width=75%>"; } else if($r['prUSER'] != $userid) { print " You cannot decline this proposal! <hr width=75%>> Back<hr width=75%>"; } else { $q=$db->query("SELECT * FROM proposals WHERE prID={$_GET['ID']}"); $r=$db->fetch_row($q); event_add($r['prFROM'], "{$ir['username']} has declined your proposal.", $c); $db->query("DELETE FROM proposals WHERE prID={$_GET['ID']}"); print " Proposal declined!   <hr width=75%>> Back<hr width=75%>"; } } function divorce_marriage() { global $db,$ir,$c,$userid,$h; if ($ir['marriage']) { print " Are you sure you wish to divorce your partner?   <hr width=75%><table width=75%><tr><td width=50% align='center'>> No</td><td width=50% align='center'>> Yes</td></tr></table><hr width=75%>"; } else { print " You are not married! <hr width=75%>> Back<hr width=75%>"; } } function divorce_confirm() { global $db,$ir,$c,$userid,$h; if ($ir['marriage']) { print " You divorced your partner! <hr width=75%>> Back<hr width=75%>"; $db->query("UPDATE users SET marriage=0 WHERE userid={$ir['marriage']}"); $db->query("UPDATE users SET marriage=0 WHERE userid=$userid"); } else { print " You are not married! <hr width=75%>> Back<hr width=75%>"; } } function send_note() { global $db,$ir,$c,$userid,$h; if (!$_POST['note']) { print " <form action='marriage.php?action=note' method='post'> Please type a love note to send to your partner.   Note: <textarea rows='5' cols='34%' name='note'></textarea> <input type='submit' value='Send' /> </form> <hr width=75%>> Back<hr width=75%>"; } else { $note=str_replace(array("\n"),array(" "),strip_tags($_POST['note'])); $db->query("INSERT INTO mail VALUES ('',0,$userid,{$ir['marriage']},unix_timestamp(),'Love Note','$note')",$c) or die($db->error()); $db->query("UPDATE users SET new_mail=new_mail+1 WHERE userid={$ir['marriage']}"); print " Your love note was sent to your partner! <hr width=75%>> Back<hr width=75%>"; } } $h->endpage(); ?>
  5. I am trying to get the "Simple Marriage" mod that Richard made to work but I am having problems with two things. The first is to get it to get the "Marital Status" to display below "Referals". ~~This is the code;~~ print "Marital Status: "; if ($r['marriage']) { $part=$db->query("SELECT * FROM users WHERE userid={$r['marriage']}"); $pr=$db->fetch_row($part); print "Married to {$pr['username']}"; } else { print "Single"; } print " "; And this is the code in viewuser.php where I am trying to get it to display underneath.   Crystals: {$r['crystals']} Property: {$r['hNAME']} Referals: "; $rr=$db->query("SELECT * FROM referals WHERE refREFER={$r['userid']}"); print $db->num_rows($rr); print "   And the second thing is an error message when I click on the link from the"Explore menu" Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/84/7099684/html/marriage.php:2) in /home/content/84/7099684/html/globals.php on line 6 Thank you for any help.
  6. Thanks Dayo ... I think I have it so far. I'm just setting up my "mock" tables and such first then I will give it a more in depth test to make sure it all works the way I need it to. Would you like to see it when I have it all set up?
  7. @Danny696 ... I tried your idea and unfortunately I couldn't get it to work the way I need it too. Thank you for your suggestion just the same. @Dayo ... if you were close by ... I'd kiss you. :P Your suggestion works perfectly. Thank you very much.
  8. I'm trying to find a shorter way of getting this idea to work ... I've considered arrays, elseif statements even a while loop but they would lead to well over 2000 lines of code. This is what I am trying to implement; If 'x'=1 then 'y'='z'*1 elseif 'x'=2 then 'y'='z'*1.2 elseif 'x'=3 then 'y'='z'*1.4 elseif 'x'=4 then 'y'='z'*1.6 elseif 'x'=5 then 'y'='z'*1.8 elseif 'x'=6 then 'y'='z'*2 elseif 'x'=7 then 'y'='z'*2.2 etc. I want the process to check 'x' where 'x' can be a number between 1 and 2000 and that the multiplier of 'z' increases by .2 for each 'x' increase, so that if 'x'=98 then the process will pull 'z' as 'z'='z'*11.4 and so on. Any ideas or suggestions that can point me in the right direction would be greatly appreciated. Thanks.
  9. Is there a way of editing a shop that you can change the items, cities and name of the shop without having to create a new shop each time? What I'm thinking is that you create the shop with all the items that are available over all then you go back in and choose the city you want and the items for that particular city. eg. You create a bait and tackle shop and the items are worms, minnows, rods, fishing line, hooks, and sinkers. Now in Takhoma at Bob's I want worms, rods, and sinkers; in Vancouver at Joe's I want minnows, worms, and fishing line. The way shops are set up now you have to create a new shop for each city and then add items one at a time rather than being able to modify an overall list and hiding the items that you don't want available in that city. This may seem like a lazy way of wanting to do this but if you have a "Store" that has "150" items with "20" cities this would be a huge time saver. Any ideas or suggestions on how this could be done. I have googled this and as of yet have not found anything that would make this possible. Thanks
  10. Thanks very much for the help. It's appreciated. That makes it a little clearer for me.
  11. Thanks so much for the quick response. For the second part .. what I meant was adding something new. Say I already have guard, accuracy etc and I want to add a new stat .. call it ... "beauty". If I understand you correctly ... I have to add a new section to my database and then have "pointers" on each page to associate it to the database. Could this not be done by adding the information into the php file? Would the database not recognize that there is a new "item"? Thanks.
  12. Yup ... you guessed it ... a very new, very newbie coder here. I have read all the forums and I can't find this anywhere. If it is and I've missed it ... my apologies. What I would like to do/know ... is to change the title of something. For example ... changing "crystals" to "blah blah". Can this be done? If so .. how would I do that? And can new titles be added ... instead of renaming them? I am guessing that if they can be added ... then the db automatically picks it up as a new variable or do I have to choose a specific variable for it. Thanks. Again ... if I missed this in the threads already posted ... I apologize. Nice to meet you all! :P
×
×
  • Create New...