Losing signon

A multipurpose module, plugin and component

Losing signon

New postby [email protected] » Fri Apr 01, 2011 2:04 pm

I have two simple php programs, when I run the first in the jumi framwork everything is OK, when I run the second the user gets signed off. I can't spot the error, this code used to work outside jumi...
1)
<?php defined( '_JEXEC' ) or die( 'Restricted access') ; ?>
<br><table><caption>Bookings List</caption>
<tr><th>Day</th><th>Date</th><th>Time</th><th>Court 1</th><th>Court 2</th><th>Court 3</th><th>Court 4</th></tr>
<?php
$limit = 1000;
$name = isset($_SESSION['name']);
$user =& JFactory::getUser();
$userId = (int) $user->get('id');
$db =& JFactory::getDBO();
$sql = "SELECT * FROM jos_cp_Bookings WHERE B_Date >= CURRENT_DATE ORDER BY B_DATE, B_StartTime LIMIT $limit";
$recs = @mysql_query($sql);
if (!$recs) { exit('<p>Error performing query: ' . mysql_error() . '<p>'); }
while ($rec = mysql_fetch_array($recs)) {
$day=$rec['B_Day'];
$indate=$rec['B_Date'];
$dd = substr($indate, 8, 2);
$mm = substr($indate, 5, 2);
$yy = substr($indate, 2, 2);
$months = array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
$mmm = $months[$mm-1];
$date = $dd.$mmm.$yy ;
$time=substr($rec['B_StartTime'], 0, 5);
if ($court1 != '' or $court2 != '' or $court3 != '' or $court4 != '') { ?>
<tr><td><?php echo $day ?></td><td><?php echo $date ?></td><td><?php echo $time ?></td>
<td align="center"><?php echo trim($rec['B_Court1']) ?></td><td align="center"><?php echo trim($rec['B_Court2']) ?></td><td align="center"><?php echo trim($rec['B_Court3'])?></td><td align="center"><?php echo trim($rec['B_Court4']) ?></td></tr>
<?php }} ?>
</table>

2)
<?php defined( '_JEXEC' ) or die( 'Restricted access' ); ?>
<p><a href="index.php?option=com_jumi&fileid=16;">Add New Membership Type</a></p>
<p><a href="index.php">Return to Menu</a></p>
<table>
<?php $N = 'N';
$db =& JFactory::getDBO();
$users = @mysql_query("SELECT * FROM jos_cp_Memberships WHERE Y_Delete = '$N' ORDER BY Y_Membership");
if (!$users) { exit('<p>Error performing query: ' . mysql_error() . '<p>'); } ?>
<tr><th>Type</th><th>Subscriptions</th><th>Disc Subs</th><th>Joining Fee</th></tr>
<?php while ($user = mysql_fetch_array($users)) {
$id = $user['Y_Id']; ?>
<tr><td><?php echo $user['Y_Membership'] ; ?></td>
<td align="center"><?php echo $user['Y_Fee'] ; ?></td>
<td align="center"><?php echo $user['Y_FeeDiscounted'] ; ?></td>
<td align="center"><?php echo $user['Y_JoiningFee'] ; ?></td>
<td><a href='index.php?option=com_jumi&fileid=17&Y_Id=<?php echo $id ?>'>Edit</a></td>
<td><a href='index.php?option=com_jumi&fileid=18&Y_Id=<?php echo $id ?>'>Delete</a></td>
<?php } ?>
</table>
[email protected]
 
Posts: 1
Joined: Fri Apr 01, 2011 1:45 pm

Return to Jumi

Who is online

Users browsing this forum: No registered users and 1 guest

cron