Jump to content
MakeWebGames

got a problem wth marrage


Raven1992
 Share

Recommended Posts

hi i jus added the code to marrage and when it was released every time i clicked on it it goes to the login page is there a way for this to happen and how do i know if your married on the index page when u log in please help me

code shown for marrage.php

<?php
require "global_func.php";
if($_SESSION['loggedin']==0) { header("Location: login.php");exit; }
$userid=$_SESSION['userid'];
require "header.php";
$h = new headers;
$h->startheaders();
include "mysql.php";
global $c;
$is=mysql_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();
$m=mysql_query("SELECT FROM users WHERE userid={$ir['married']}");
$par=mysql_fetch_row($m);
if($ir['married'] == 0)
{
die("You are not married, come back when you have a partner");
}
$_GET['action']  = (isset($_GET['action']) && is_string($_GET['action'])) ? stripslashes(trim($_GET['action'])) : FALSE;
switch($_GET['action'])
{
case 'givemoney': give_money_form(); break;
case 'givemoneysub': give_money_submit(); break;
case 'givecrystals': give_crystals_form(); break;
case 'givecrystalssub': give_crystals_submit(); break;
case 'givebank': give_bank_form(); break;
case 'givebanksub': give_bank_submit(); break;
case 'givebankcrystals': give_bankcrystals_form(); break;
case 'givebankcrystalssub': give_bankcrystals_submit(); break;
case 'takemoney': take_money_form(); break;
case 'takemoneysub': take_money_submit(); break;
case 'takecrystals': take_crystals_form(); break;
case 'takecrystalssub': take_crystals_submit(); break;
case 'takebank': take_bank_form(); break;
case 'takebanksub': take_bank_submit(); break;
case 'takecbank': take_cbank_form(); break;
case 'takecbanksub': take_cbank_submit(); break;
case 'sleep': sleep_form(); break;
case 'sleepsub': sleep_submit(); break;
case 'divorce': divorce(); break;
case 'allowence': allowence_form(); break;
default: index(); break;
}
function give_money_form()
{
global $db,$ir,$c,$h,$userid,$par;
print "<h3>Giving Money</h3>
This action will give your money to your partner

You currently have <b>\${$ir['money']}</b> that you could send.

<form action='partner.php?action=givemoneysub' method='post'>
Money: <input type='text' name='money' value='0'>

<input type='submit' value='Give Money' /></form>";
}
function give_money_submit()
{
global $db,$ir,$c,$h,$userid,$par;
if ($ir['money'] < $_POST['money'])
{
die("You are trying to give more money than you can
<a href='partner.php'?action=givemoney>Back</a>");
}
else
{
mysql_query("UPDATE users SET money=money+".abs(floatval($_POST['money']))." WHERE userid={$par['userid']}");
mysql_query("UPDATE users SET money=money-".abs(floatval($_POST['money']))." WHERE userid=$userid");
event_add($par['userid'],"You partner has just given you \${$_POST['money']}",$c);
print"You gave \${$_POST['money']} to your partner";
}
}
function give_crystals_form()
{
global $db,$ir,$c,$h,$userid,$par;
print "<h3>Giving crystals</h3>
This action will give your crystals to your partner

You currently have <b>{$ir['crystals']}</b> crystals that you could send.

<form action='partner.php?action=givecrystalssub' method='post'>
Crystals: <input type='text' name='crystals' value='0'>

<input type='submit' value='Give crystals' /></form>";
}
function give_crystals_submit()
{
global $db,$ir,$c,$h,$userid,$par;
if ($ir['crystals'] < $_POST['crystals'])
{
die("You are trying to give more crystals than you can.
<a href='partner.php'?action=givecrystals>Back</a>");
}
else
{
mysql_query("UPDATE users SET crystals=crystals+".abs(floatval($_POST['crystals']))." WHERE userid={$par['userid']}");
mysql_query("UPDATE users SET crystals=crystals-".abs(floatval($_POST['crystals']))." WHERE userid=$userid");
event_add($par['userid'],"You partner has just given you {$_POST['crystals']} crystals",$c);
print"You gave {$_POST['crystals']} crystals to your partner";
}
}
function give_bank_form()
{
global $db,$ir,$c,$h,$userid,$par;
if ($ir['bankmoney'] < 0)
{
die("You dont have a bank account");
}
if ($par['bankmoney'] < 0)
{
die("Your partner doesnt have a bank account");
}
else
{
print "<h3>Giving Bank Money</h3>
This action will give bank money to your partner

You currently have <b>\${$ir['bankmoney']}</b> that you could send.

<form action='partner.php?action=givebanksub' method='post'>
Bank Money: <input type='text' name='bankmoney' value='0'>

<input type='submit' value='Give Bank Money' /></form>";
}
}
function give_bank_submit()
{
global $db,$ir,$c,$h,$userid,$par;
if ($ir['bankmoney'] < $_POST['bankmoney'])
{
die("You are trying to give more bank money than you can
<a href='partner.php'?action=givecrystals>Back</a>");
}
else
{
mysql_query("UPDATE users SET bankmoney=bankmoney+".abs(floatval($_POST['bankmoney']))." WHERE userid={$par['userid']}");
mysql_query("UPDATE users SET bankmoney=bankmoney-".abs(floatval($_POST['bankmoney']))." WHERE userid=$userid");
event_add($par['userid'],"You partner has just wired you \${$_POST['bankmoney']} into your bank account",$c);
print"You wired \${$_POST['bankmoney']} to your partner";
}
}
function give_bankcrystals_form()
{
global $db,$ir,$c,$h,$userid,$par;
print "<h3>Giving Bank crystals</h3>
This action will give your bank crystals to your partner

You currently have <b>{$ir['bankcrystals']}</b> bank crystals that you could send.

<form action='partner.php?action=givebankcrystalssub' method='post'>
Bank Crystals: <input type='text' name='bankcrystals' value='0'>

<input type='submit' value='Give Bank Crystals' /></form>";
}
function give_bankcrystals_submit()
{
global $db,$ir,$c,$h,$userid,$par;
if ($ir['bankcrystals'] < $_POST['bankcrystals'])
{
die("You are trying to give more bank crystals than you can.
<a href='partner.php'?action=givebankcrystals>Back</a>");
}
else
{
mysql_query("UPDATE users SET bankcrystal=bankcrystal+".abs(floatval($_POST['bankcrystals']))." WHERE userid={$par['userid']}");
mysql_query("UPDATE users SET bankcrystal=bankcrystal-".abs(floatval($_POST['bankcrystals']))." WHERE userid=$userid");
event_add($par['userid'],"You partner has just given you {$_POST['bankcrystals']} crystals",$c);
print"You gave {$_POST['bankcrystals']} crystals to your partner";
}
}
function take_money_form()
{
global $db,$ir,$c,$h,$userid,$par;
if ($par['allowence'] == 0)
{
die("Your partner hasnt allowed your to access their money.");
}
else
{
print "<h3>Take Money</h3>
This action will take money from your partner

Your partner has \${$par['money']}.

<form action='partner.php?action=takemoneysub' method='post'>
Money: <input type='text' name='money' value='{$par['money']}'>

<input type='submit' value='Take Money' /></form>";
}
}
function take_money_submit()
{
global $db,$ir,$c,$h,$userid,$par;
if ($par['allowence'] == 0)
{
die("Your partner hasnt allowed your to access their money.");
}
if ($par['money'] < $_POST['money'])
{
die("You are trying to take more money than you can.
<a href='partner.php'?action=takemoney>Back</a>");
}
else
{
mysql_query("UPDATE users SET money=money+".abs(floatval($_POST['money']))." WHERE userid=$userid");
mysql_query("UPDATE users SET money=money-".abs(floatval($_POST['money']))." WHERE userid={$par['userid']}");
event_add($par['userid'],"Your partner has just taken \${$_POST['money']} from your hand money",$c);
print"You took \${$_POST['money']} from your partner";
}
}
function take_crystals_form()
{
global $db,$ir,$c,$h,$userid,$par;
if ($par['allowence'] == 0)
{
die("Your partner hasnt allowed your to access their crystals");
}
else
{
print "<h3>Take Crystals</h3>
This action will take crystals from your partner

Your partner has {$par['crystals']} crystals.

<form action='partner.php?action=takecrystalssub' method='post'>
Crystals: <input type='text' name='crystals' value='{$par['crystals']}'>

<input type='submit' value='Take Crystals' /></form>";
}
}
function take_crystals_submit()
{
global $db,$ir,$c,$h,$userid,$par;
if ($par['allowence'] == 0)
{
die("Your partner hasnt allowed your to access their crystals.");
}
if ($par['crystals'] < $_POST['crystals'])
{
die("You are trying to take more crystals than you can.
<a href='partner.php'?action=takecrystals>Back</a>");
}
else
{
mysql_query("UPDATE users SET crystals=crystals+".abs(floatval($_POST['crystals']))." WHERE userid=$userid");
mysql_query("UPDATE users SET crystals=crystals-".abs(floatval($_POST['crystals']))." WHERE userid={$par['userid']}");
event_add($par['userid'],"Your partner has just taken {$_POST['crystals']} crystals from you",$c);
print"You took {$_POST['crystals']} crystals from your partner";
}
}
function take_bank_form()
{
global $db,$ir,$c,$h,$userid,$par;
if ($par['allowence'] == 0)
{
die("Your partner hasnt allowed your to access their finacial bank money.");
}
if ($ir['bankmoney'] < 0)
{
die("You dont have a bank account");
}
if ($par['bankmoney'] < 0)
{
die("Your partner dose not have a bank account");
}
else
{
print "<h3>Take Bank Money</h3>
This action will take bank money from your partner

Your partner has \${$par['bankmoney']}.

<form action='partner.php?action=takebanksub' method='post'>
Bank Money: <input type='text' name='bank' value='{$par['bankmoney']}'>

<input type='submit' value='Take Bank Money' /></form>";
}
}
function take_bank_submit()
{
global $db,$ir,$c,$h,$userid,$par;
if ($par['allowence'] == 0)
{
die("Your partner hasnt allowed your to access their bank money.");
}
if ($par['bankmoney'] < $_POST['bankmoney'])
{
die("You are trying to take more bank money than you can
<a href='partner.php'?action=takebank>Back</a>");
}
else
{
mysql_query("UPDATE users SET bankmoney=bankmoney+".abs(floatval($_POST['bankmoney']))." WHERE userid=$userid");
mysql_query("UPDATE users SET bankmoney=bankmoney-".abs(floatval($_POST['bankmoney']))." WHERE userid={$par['userid']}");
event_add($par['userid'],"Your partner has just taken \${$_POST['bank']} from your bank account",$c);
print"You took \${$_POST['bank']} from your partner";
}
}
function take_cbank_form()
{
global $db,$ir,$c,$h,$userid,$par;
if ($par['allowence'] == 0)
{
die("Your partner hasnt allowed your to access their bank crystals.");
}
if ($ir['bankcrystals'] < 0)
{
die("You dont have a crystal bank account");
}
if ($par['bankcrystals'] < 0)
{
die("Your partner doesnt have a crystal bank account.");
}
else
{
print "<h3>Take Bank Crystals</h3>
This action will take bank money from your partner

Your partner has {$par['bankcrystals']} bank crystals.

<form action='partner.php?action=takebanksub' method='post'>
Bank Crystals: <input type='text' name='cbank' value='{$par['bankcrystals']}'>

<input type='submit' value='Take Bank Money' /></form>";
}
}
function take_cbank_submit()
{
global $db,$ir,$c,$h,$userid,$par;
if ($par['allowence'] == 0)
{
die("Your partner hasnt allowed your to access their bank crystals.");
}
if ($par['bankcrystals'] < $_POST['cbank'])
{
die("You are trying to take more bank money than you can
<a href='partner.php'?action=takecbank>Back</a>");
}
else
{
mysql_query("UPDATE users SET bankcrystals=bankcrystals+".abs(floatval($_POST['bankcrystals']))." WHERE userid=$userid");
mysql_query("UPDATE users SET bankcrystals=bankcrystals-".abs(floatval($_POST['bankcrystals']))." WHERE userid={$par['userid']}");
event_add($par['userid'],"Your partner has just taken {$_POST['bankcrystals']} crystals from your bank account",$c);
print"You took {$_POST['bankcrystals']} bank crystals from your partner";
}
}
function sleep_form()
{
global $db,$ir,$c,$h,$userid,$par;
if($ir['tired'] == 1)
{
die("You are too tired to sleep with your partner again");
}
print "<h3>Sleep with your Partner?</h3>
<form action='partner.php?action=sleepsub' method='post'>
<input type='submit' value='Sleep With {$par['username']}' /></form>";
}
function sleep_submit()
{
global $db,$ir,$c,$h,$userid,$par;
if($ir['tired'] == 1)
{
die("You are too tired to sleep with your partner again");
}
if (!$_POST['msg'])
{
mysql_query("UPDATE users SET happiness=happiness+1 WHERE userid=$userid");
mysql_query("UPDATE users SET tired=1 WHERE userid=$userid");
event_add($par['userid'],"Your partner has just slept with you. Please take a pregnancy test.",$c);
print"You slept with your partner and gained 1 happiness!";
}
}
function divorce()
{
global $ir, $mr, $c, $userid, $h;
mysql_query("UPDATE users SET married=0 WHERE userid IN($userid, {$ir['married']})", $c);
event_add($ir['married'],"{$ir['username']} divorced you... Your now single...",$c);
print "You divorced your partner and went back to being single.

> <a href='index.php'>Back</a>";
}
function allowence_form()
{
global $db,$ir,$c,$h,$userid,$par;
print "<h3>C</h3>
This action will decide wether you want to allow your partner to take
money, crystals, bank money, bank crystals, etc or not...

[<a href='partner.php'?action=allowence&allow=yes>Allo  w</a>]

[<a href='partner.php'?action=allowence&allow=no>Do Not Allow</a>]
";
if($_GET['allow'] == yes)
{
mysql_query("UPDATE users SET allowence=1 WHERE userid=$userid");
print" Now your partner is allowed to access your finance";
}
else if($_GET['allow'] == no)
{
mysql_query("UPDATE users SET allowence=0 WHERE userid=$userid");
print" Now your partner isnt allowed to access your finance";
}
}

function index()
{
global $db,$ir,$c,$h,$userid,$par;
print "

<h3><center>Information</h3>

<center><table width=60% cellspacing=1 class='table' border='1' bordercolor='#636363'></center>
<tr>
<th><font color=gold>Theirs</th>
<th><font color=gold>Yours</th>
</tr>

<tr>
<td><center>Money: \${$par['money']}</td>
<td><center>Money: \${$ir['money']}</td>
</tr>
<td><center>Crystals: {$par['crystals']}</td>
<td><center>Crystals: {$ir['crystals']}</td>
</tr>
<tr>
<td><center>Banked Money: \${$par['bankmoney']}</td>
<td><center>Banked Money: \${$ir['bankmoney']}</td>
</tr>
<tr>
<td><center>Banked Crystals: {$par['bankcrystals']}</td>
<td><center>Banked Crystals: {$ir['bankcrystals']}</td>
</tr>
</table>

<h3><center>Partner Managment</h3>

<center><table width=60% cellspacing=1 class='table' border='1' bordercolor='#636363'></center>
<tr>
<td><a href='partner.php'?action=givemoney><center>Send Money</a></td>
<td><a href='partner.php'?action=takemoney><center>Take Money</a></td>
</tr><tr>
<td><a href='partner.php'?action=givebank><center>Send Bank Money</a></td>
<td><a href='partner.php'?action=takebank><center>Take Bank Money</a></td>
</tr><tr>
<td><a href='partner.php'?action=givecrystals><center>Sen  d Crystals</a></td>
<td><a href='partner.php'?action=takecrystals><center>Tak  e Crystals</a></td>
</tr><tr>
<td><a href='partner.php'?action=givebankcrystals><center  >Send Bank Crystals</a></td>
<td><a href='partner.php'?action=takecbank><center>Take Bank Crystals</a></td>
</tr><tr>
<td><a href='partner.php'?action=sleep'><center>Sleep With {$par['username']}</td>
<td><a href='partner.php'?action=allowence><center>Marria  ge Allowence!</a></td>
</tr><tr>
<td colspan='2'><a href='partner.php'?action=divorce><center>Divorce</a></td></tr></table>



<h3><center>Marriage Stats</h3>
<center><table width=60% cellspacing=1 class='table' border='1' bordercolor='#636363'></center>
<tr>
<td><center>Your Happiness: {$ir['happiness']}</td>
<td><center>Their Happiness: {$par['happiness']}</td></tr></table>";
}
$h->endpage();

any chance of helping me :)

Link to comment
Share on other sites

give this a try.

 

<?php
require "global_func.php";
require "header.php";
$h = new headers;
$h->startheaders();
include "mysql.php";
global $c;
$is=mysql_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();
$m=mysql_query("SELECT FROM users WHERE userid={$ir['married']}");
$par=mysql_fetch_row($m);
if($ir['married'] == 0)
{
die("You are not married, come back when you have a partner");
}
$_GET['action']  = (isset($_GET['action']) && is_string($_GET['action'])) ? stripslashes(trim($_GET['action'])) : FALSE;
switch($_GET['action'])
{
case 'givemoney': give_money_form(); break;
case 'givemoneysub': give_money_submit(); break;
case 'givecrystals': give_crystals_form(); break;
case 'givecrystalssub': give_crystals_submit(); break;
case 'givebank': give_bank_form(); break;
case 'givebanksub': give_bank_submit(); break;
case 'givebankcrystals': give_bankcrystals_form(); break;
case 'givebankcrystalssub': give_bankcrystals_submit(); break;
case 'takemoney': take_money_form(); break;
case 'takemoneysub': take_money_submit(); break;
case 'takecrystals': take_crystals_form(); break;
case 'takecrystalssub': take_crystals_submit(); break;
case 'takebank': take_bank_form(); break;
case 'takebanksub': take_bank_submit(); break;
case 'takecbank': take_cbank_form(); break;
case 'takecbanksub': take_cbank_submit(); break;
case 'sleep': sleep_form(); break;
case 'sleepsub': sleep_submit(); break;
case 'divorce': divorce(); break;
case 'allowence': allowence_form(); break;
default: index(); break;
}
function give_money_form()
{
global $db,$ir,$c,$h,$userid,$par;
print "<h3>Giving Money</h3>
This action will give your money to your partner

You currently have <b>\${$ir['money']}</b> that you could send.

<form action='partner.php?action=givemoneysub' method='post'>
Money: <input type='text' name='money' value='0'>

<input type='submit' value='Give Money' /></form>";
}
function give_money_submit()
{
global $db,$ir,$c,$h,$userid,$par;
if ($ir['money'] < $_POST['money'])
{
die("You are trying to give more money than you can
<a href='partner.php'?action=givemoney>Back</a>");
}
else
{
mysql_query("UPDATE users SET money=money+".abs(floatval($_POST['money']))." WHERE userid={$par['userid']}");
mysql_query("UPDATE users SET money=money-".abs(floatval($_POST['money']))." WHERE userid=$userid");
event_add($par['userid'],"You partner has just given you \${$_POST['money']}",$c);
print"You gave \${$_POST['money']} to your partner";
}
}
function give_crystals_form()
{
global $db,$ir,$c,$h,$userid,$par;
print "<h3>Giving crystals</h3>
This action will give your crystals to your partner

You currently have <b>{$ir['crystals']}</b> crystals that you could send.

<form action='partner.php?action=givecrystalssub' method='post'>
Crystals: <input type='text' name='crystals' value='0'>

<input type='submit' value='Give crystals' /></form>";
}
function give_crystals_submit()
{
global $db,$ir,$c,$h,$userid,$par;
if ($ir['crystals'] < $_POST['crystals'])
{
die("You are trying to give more crystals than you can.
<a href='partner.php'?action=givecrystals>Back</a>");
}
else
{
mysql_query("UPDATE users SET crystals=crystals+".abs(floatval($_POST['crystals']))." WHERE userid={$par['userid']}");
mysql_query("UPDATE users SET crystals=crystals-".abs(floatval($_POST['crystals']))." WHERE userid=$userid");
event_add($par['userid'],"You partner has just given you {$_POST['crystals']} crystals",$c);
print"You gave {$_POST['crystals']} crystals to your partner";
}
}
function give_bank_form()
{
global $db,$ir,$c,$h,$userid,$par;
if ($ir['bankmoney'] < 0)
{
die("You dont have a bank account");
}
if ($par['bankmoney'] < 0)
{
die("Your partner doesnt have a bank account");
}
else
{
print "<h3>Giving Bank Money</h3>
This action will give bank money to your partner

You currently have <b>\${$ir['bankmoney']}</b> that you could send.

<form action='partner.php?action=givebanksub' method='post'>
Bank Money: <input type='text' name='bankmoney' value='0'>

<input type='submit' value='Give Bank Money' /></form>";
}
}
function give_bank_submit()
{
global $db,$ir,$c,$h,$userid,$par;
if ($ir['bankmoney'] < $_POST['bankmoney'])
{
die("You are trying to give more bank money than you can
<a href='partner.php'?action=givecrystals>Back</a>");
}
else
{
mysql_query("UPDATE users SET bankmoney=bankmoney+".abs(floatval($_POST['bankmoney']))." WHERE userid={$par['userid']}");
mysql_query("UPDATE users SET bankmoney=bankmoney-".abs(floatval($_POST['bankmoney']))." WHERE userid=$userid");
event_add($par['userid'],"You partner has just wired you \${$_POST['bankmoney']} into your bank account",$c);
print"You wired \${$_POST['bankmoney']} to your partner";
}
}
function give_bankcrystals_form()
{
global $db,$ir,$c,$h,$userid,$par;
print "<h3>Giving Bank crystals</h3>
This action will give your bank crystals to your partner

You currently have <b>{$ir['bankcrystals']}</b> bank crystals that you could send.

<form action='partner.php?action=givebankcrystalssub' method='post'>
Bank Crystals: <input type='text' name='bankcrystals' value='0'>

<input type='submit' value='Give Bank Crystals' /></form>";
}
function give_bankcrystals_submit()
{
global $db,$ir,$c,$h,$userid,$par;
if ($ir['bankcrystals'] < $_POST['bankcrystals'])
{
die("You are trying to give more bank crystals than you can.
<a href='partner.php'?action=givebankcrystals>Back</a>");
}
else
{
mysql_query("UPDATE users SET bankcrystal=bankcrystal+".abs(floatval($_POST['bankcrystals']))." WHERE userid={$par['userid']}");
mysql_query("UPDATE users SET bankcrystal=bankcrystal-".abs(floatval($_POST['bankcrystals']))." WHERE userid=$userid");
event_add($par['userid'],"You partner has just given you {$_POST['bankcrystals']} crystals",$c);
print"You gave {$_POST['bankcrystals']} crystals to your partner";
}
}
function take_money_form()
{
global $db,$ir,$c,$h,$userid,$par;
if ($par['allowence'] == 0)
{
die("Your partner hasnt allowed your to access their money.");
}
else
{
print "<h3>Take Money</h3>
This action will take money from your partner

Your partner has \${$par['money']}.

<form action='partner.php?action=takemoneysub' method='post'>
Money: <input type='text' name='money' value='{$par['money']}'>

<input type='submit' value='Take Money' /></form>";
}
}
function take_money_submit()
{
global $db,$ir,$c,$h,$userid,$par;
if ($par['allowence'] == 0)
{
die("Your partner hasnt allowed your to access their money.");
}
if ($par['money'] < $_POST['money'])
{
die("You are trying to take more money than you can.
<a href='partner.php'?action=takemoney>Back</a>");
}
else
{
mysql_query("UPDATE users SET money=money+".abs(floatval($_POST['money']))." WHERE userid=$userid");
mysql_query("UPDATE users SET money=money-".abs(floatval($_POST['money']))." WHERE userid={$par['userid']}");
event_add($par['userid'],"Your partner has just taken \${$_POST['money']} from your hand money",$c);
print"You took \${$_POST['money']} from your partner";
}
}
function take_crystals_form()
{
global $db,$ir,$c,$h,$userid,$par;
if ($par['allowence'] == 0)
{
die("Your partner hasnt allowed your to access their crystals");
}
else
{
print "<h3>Take Crystals</h3>
This action will take crystals from your partner

Your partner has {$par['crystals']} crystals.

<form action='partner.php?action=takecrystalssub' method='post'>
Crystals: <input type='text' name='crystals' value='{$par['crystals']}'>

<input type='submit' value='Take Crystals' /></form>";
}
}
function take_crystals_submit()
{
global $db,$ir,$c,$h,$userid,$par;
if ($par['allowence'] == 0)
{
die("Your partner hasnt allowed your to access their crystals.");
}
if ($par['crystals'] < $_POST['crystals'])
{
die("You are trying to take more crystals than you can.
<a href='partner.php'?action=takecrystals>Back</a>");
}
else
{
mysql_query("UPDATE users SET crystals=crystals+".abs(floatval($_POST['crystals']))." WHERE userid=$userid");
mysql_query("UPDATE users SET crystals=crystals-".abs(floatval($_POST['crystals']))." WHERE userid={$par['userid']}");
event_add($par['userid'],"Your partner has just taken {$_POST['crystals']} crystals from you",$c);
print"You took {$_POST['crystals']} crystals from your partner";
}
}
function take_bank_form()
{
global $db,$ir,$c,$h,$userid,$par;
if ($par['allowence'] == 0)
{
die("Your partner hasnt allowed your to access their finacial bank money.");
}
if ($ir['bankmoney'] < 0)
{
die("You dont have a bank account");
}
if ($par['bankmoney'] < 0)
{
die("Your partner dose not have a bank account");
}
else
{
print "<h3>Take Bank Money</h3>
This action will take bank money from your partner

Your partner has \${$par['bankmoney']}.

<form action='partner.php?action=takebanksub' method='post'>
Bank Money: <input type='text' name='bank' value='{$par['bankmoney']}'>

<input type='submit' value='Take Bank Money' /></form>";
}
}
function take_bank_submit()
{
global $db,$ir,$c,$h,$userid,$par;
if ($par['allowence'] == 0)
{
die("Your partner hasnt allowed your to access their bank money.");
}
if ($par['bankmoney'] < $_POST['bankmoney'])
{
die("You are trying to take more bank money than you can
<a href='partner.php'?action=takebank>Back</a>");
}
else
{
mysql_query("UPDATE users SET bankmoney=bankmoney+".abs(floatval($_POST['bankmoney']))." WHERE userid=$userid");
mysql_query("UPDATE users SET bankmoney=bankmoney-".abs(floatval($_POST['bankmoney']))." WHERE userid={$par['userid']}");
event_add($par['userid'],"Your partner has just taken \${$_POST['bank']} from your bank account",$c);
print"You took \${$_POST['bank']} from your partner";
}
}
function take_cbank_form()
{
global $db,$ir,$c,$h,$userid,$par;
if ($par['allowence'] == 0)
{
die("Your partner hasnt allowed your to access their bank crystals.");
}
if ($ir['bankcrystals'] < 0)
{
die("You dont have a crystal bank account");
}
if ($par['bankcrystals'] < 0)
{
die("Your partner doesnt have a crystal bank account.");
}
else
{
print "<h3>Take Bank Crystals</h3>
This action will take bank money from your partner

Your partner has {$par['bankcrystals']} bank crystals.

<form action='partner.php?action=takebanksub' method='post'>
Bank Crystals: <input type='text' name='cbank' value='{$par['bankcrystals']}'>

<input type='submit' value='Take Bank Money' /></form>";
}
}
function take_cbank_submit()
{
global $db,$ir,$c,$h,$userid,$par;
if ($par['allowence'] == 0)
{
die("Your partner hasnt allowed your to access their bank crystals.");
}
if ($par['bankcrystals'] < $_POST['cbank'])
{
die("You are trying to take more bank money than you can
<a href='partner.php'?action=takecbank>Back</a>");
}
else
{
mysql_query("UPDATE users SET bankcrystals=bankcrystals+".abs(floatval($_POST['bankcrystals']))." WHERE userid=$userid");
mysql_query("UPDATE users SET bankcrystals=bankcrystals-".abs(floatval($_POST['bankcrystals']))." WHERE userid={$par['userid']}");
event_add($par['userid'],"Your partner has just taken {$_POST['bankcrystals']} crystals from your bank account",$c);
print"You took {$_POST['bankcrystals']} bank crystals from your partner";
}
}
function sleep_form()
{
global $db,$ir,$c,$h,$userid,$par;
if($ir['tired'] == 1)
{
die("You are too tired to sleep with your partner again");
}
print "<h3>Sleep with your Partner?</h3>
<form action='partner.php?action=sleepsub' method='post'>
<input type='submit' value='Sleep With {$par['username']}' /></form>";
}
function sleep_submit()
{
global $db,$ir,$c,$h,$userid,$par;
if($ir['tired'] == 1)
{
die("You are too tired to sleep with your partner again");
}
if (!$_POST['msg'])
{
mysql_query("UPDATE users SET happiness=happiness+1 WHERE userid=$userid");
mysql_query("UPDATE users SET tired=1 WHERE userid=$userid");
event_add($par['userid'],"Your partner has just slept with you. Please take a pregnancy test.",$c);
print"You slept with your partner and gained 1 happiness!";
}
}
function divorce()
{
global $ir, $mr, $c, $userid, $h;
mysql_query("UPDATE users SET married=0 WHERE userid IN($userid, {$ir['married']})", $c);
event_add($ir['married'],"{$ir['username']} divorced you... Your now single...",$c);
print "You divorced your partner and went back to being single.

> <a href='index.php'>Back</a>";
}
function allowence_form()
{
global $db,$ir,$c,$h,$userid,$par;
print "<h3>C</h3>
This action will decide wether you want to allow your partner to take
money, crystals, bank money, bank crystals, etc or not...

[<a href='partner.php'?action=allowence&allow=yes>Allo  w</a>]

[<a href='partner.php'?action=allowence&allow=no>Do Not Allow</a>]
";
if($_GET['allow'] == yes)
{
mysql_query("UPDATE users SET allowence=1 WHERE userid=$userid");
print" Now your partner is allowed to access your finance";
}
else if($_GET['allow'] == no)
{
mysql_query("UPDATE users SET allowence=0 WHERE userid=$userid");
print" Now your partner isnt allowed to access your finance";
}
}

function index()
{
global $db,$ir,$c,$h,$userid,$par;
print "

<h3><center>Information</h3>

<center><table width=60% cellspacing=1 class='table' border='1' bordercolor='#636363'></center>
<tr>
<th><font color=gold>Theirs</th>
<th><font color=gold>Yours</th>
</tr>

<tr>
<td><center>Money: \${$par['money']}</td>
<td><center>Money: \${$ir['money']}</td>
</tr>
<td><center>Crystals: {$par['crystals']}</td>
<td><center>Crystals: {$ir['crystals']}</td>
</tr>
<tr>
<td><center>Banked Money: \${$par['bankmoney']}</td>
<td><center>Banked Money: \${$ir['bankmoney']}</td>
</tr>
<tr>
<td><center>Banked Crystals: {$par['bankcrystals']}</td>
<td><center>Banked Crystals: {$ir['bankcrystals']}</td>
</tr>
</table>

<h3><center>Partner Managment</h3>

<center><table width=60% cellspacing=1 class='table' border='1' bordercolor='#636363'></center>
<tr>
<td><a href='partner.php'?action=givemoney><center>Send Money</a></td>
<td><a href='partner.php'?action=takemoney><center>Take Money</a></td>
</tr><tr>
<td><a href='partner.php'?action=givebank><center>Send Bank Money</a></td>
<td><a href='partner.php'?action=takebank><center>Take Bank Money</a></td>
</tr><tr>
<td><a href='partner.php'?action=givecrystals><center>Sen  d Crystals</a></td>
<td><a href='partner.php'?action=takecrystals><center>Tak  e Crystals</a></td>
</tr><tr>
<td><a href='partner.php'?action=givebankcrystals><center  >Send Bank Crystals</a></td>
<td><a href='partner.php'?action=takecbank><center>Take Bank Crystals</a></td>
</tr><tr>
<td><a href='partner.php'?action=sleep'><center>Sleep With {$par['username']}</td>
<td><a href='partner.php'?action=allowence><center>Marria  ge Allowence!</a></td>
</tr><tr>
<td colspan='2'><a href='partner.php'?action=divorce><center>Divorce</a></td></tr></table>



<h3><center>Marriage Stats</h3>
<center><table width=60% cellspacing=1 class='table' border='1' bordercolor='#636363'></center>
<tr>
<td><center>Your Happiness: {$ir['happiness']}</td>
<td><center>Their Happiness: {$par['happiness']}</td></tr></table>";
}
$h->endpage();
  • Like 1
Link to comment
Share on other sites

To find out if $_SESSION['loggedin'] is the variable the script is using look in authenticate.php.

It should be closer to the bottom of the page if I remember correctly, not all the way down but you will see it.

If its just a different variable name, change it in the marriage script on line 2:

if($_SESSION['loggedin']==0) { header("Location: login.php");exit; }

 

If its not setting any variable, then you need to make authenticate.php set the variable after it has verified all the login information.

That's as easy as putting

$_SESSION['loggedin'] = 1;

In the right spot.

Which is wherever you see this line or something similar, setting $_SESSION['userid']

$_SESSION['userid'] = $mem['userid'];

 

Hope that helps :)

Link to comment
Share on other sites

here is the authenticate.php

session_start();
if ($_POST['username'] == "" || $_POST['password'] == "")
{
die("<h3>Big-Bang (Beta)</h3>
You did not fill in the login form!<br>
<a href=login.php>> Back</a>");
}
include "mysql.php";
global $c;
$uq=mysql_query("SELECT userid FROM users WHERE login_name='{$_POST['username']}' AND `userpass`=md5('{$_POST['password']}')",$c) or die(mysql_error());
if (mysql_num_rows($uq)==0)
{
die("<h3>Your Game Name Error</h3>
Invalid username or password!<br>
<a href=login.php>> Back</a>");
}
else
{
$_SESSION['loggedin']=1;
$mem=mysql_fetch_array($uq);
$_SESSION['userid']=$mem['userid'];
header("Location: loggedin.php");
}

?>

you tell me where to put the $_SESSION in cause i don't seem to find it

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...