PHP Web Host - Quality Web Hosting For All PHP Applications Sign up for PayPal and start accepting credit card payments instantly
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
Palbin
Site Admin


Joined: Mar 30, 2006
Posts: 2456
Location: Pittsburgh, Pennsylvania

PostPosted: Sun Aug 08, 2010 6:23 pm Reply with quote Back to top

Zip it up and pm me a link.
View user's profile Send private message
rebelt
Worker
Worker


Joined: May 07, 2006
Posts: 147

PostPosted: Mon Aug 09, 2010 1:47 pm Reply with quote Back to top

pm sent.
View user's profile Send private message Visit poster's website
rebelt
Worker
Worker


Joined: May 07, 2006
Posts: 147

PostPosted: Tue Aug 10, 2010 3:14 am Reply with quote Back to top

With regard to the teams script. I'm trying to place the whole script into a module (leaving the separation of public/admin for now) just to get it functioning, so I can deactivate it temporarily for a few days to stop information being entered.

Things seemed to be going well until I came up against this error.
Quote:
Fatal error: Call to a member function sql_query() on a non-object in /..../../..../../..../modules/Teams2/index.php on line 1007

Code:
### Submitted Team Allocations

function submittedteamallocations($user, $allchanges)
{
 $username=getusername($user);

 if ($username=="user" | $username=="RebelT")
 {

 $pieces = explode("|", $allchanges);
 $ii = count($pieces)-1;
 for($i=0;$i<$ii;$i++)
 {
  $thisvalue = explode("=", $pieces[$i]);

****************This is line 1007******************
$db->sql_query("update team_names2 set division='$thisvalue[1]' where team_id='$thisvalue[0]'");

# echo "update team_names2 set division='$thisvalue[1]' where team_id='$thisvalue[0]'<BR>";
 }
# echo urlforward("http://rebelt.westonpoolleague.org.uk/modules.php?name=Teams2&op=Admin");

$url = "http://rebelt.westonpoolleague.org.uk/modules.php?name=Teams2&op=Admin";
$delay = "0";
echo '<meta http-equiv="refresh" content="'.$delay.';url='.$url.'">';
 }
}


Just trying to get this working by Thursday, which is hard when I don't even know what a non object is. Embarassed

Sorry if I'm being a pain. I must come accross as a desperate, clueless, idiot. Well I suppose with this I am. Very Happy
View user's profile Send private message Visit poster's website
Palbin
Site Admin


Joined: Mar 30, 2006
Posts: 2456
Location: Pittsburgh, Pennsylvania

PostPosted: Tue Aug 10, 2010 5:04 am Reply with quote Back to top

In the admin you need to finished the switch statement at the bottom. Google "PHP switch statement" and make sure you have a default. The switch statement should be call your functions.

For the fatal error try adding a "global $db;" at the top of the page or function you are using.
View user's profile Send private message
rebelt
Worker
Worker


Joined: May 07, 2006
Posts: 147

PostPosted: Tue Aug 10, 2010 7:11 am Reply with quote Back to top

Changed the switch statements to
Code:
<?PHP
if (!defined('ADMIN_FILE')) die ('Access Denied');

require_once 'mainfile.php';
###
### List Results In Admin
###

function listresults()
{
 include ('header.php');
 global $admin;

      Header("Location: ".$admin_file.".php?op=list");

$result = mysql_query("select match_id, home_team, away_team, home_score, away_score, division, email, match_date from team_scores where status=0 order by division");

$thiscount=1;

echo "<font size=4><B>Results Admin</b></font size=4>";
echo "<font size=2><center><b>Pending Results</b></center><br><BR></font>";
echo "<BR><table width=100%>";
$lastdivision="9";

while (list($match_id, $home_team, $away_team, $home_score, $away_score, $division, $email, $match_date) = mysql_fetch_row($result))
 {
  if ($division!=$lastdivision)
  {
  echo "<tr><td colspan=4 align=center><font size=4><b>Division $division</b></font size=4></td></tr>";
  }
   $matchdate = date("Y-m-d", strtotime($match_date));
   $displaymatchdate = date("d-m-Y", strtotime($match_date));
   $email2 = str_replace('.', ',', $email);

  echo"<tr><td>$match_id $displaymatchdate $email  </td><TD>$home_team $home_score</TD><TD>$away_team</td><TD>$away_score</TD><td><td><font size=1><a href=leagueresult.php?op=admindelete&id=$match_id>Delete</a>&nbsp;&nbsp; <a href=leagueresult.php?op=adminmakelive&id=$match_id>Make Live</a></font></td></tr>";
  $thiscount=$thiscount+1;
  $lastdivision=$division;
 }

echo "</table><BR>";

  mysql_free_result($result);

$result = mysql_query("select match_id, home_team, away_team, home_score, away_score, division, email, match_date, status, comments from team_scores where status>0 order by division");

echo "<font size=2><center><b>Live Results</b></center><br><BR></font>";
echo "<BR><table width=100%>";
$lastdivision="9";

while (list($match_id, $home_team, $away_team, $home_score, $away_score, $division, $email, $match_date, $status, $comments) = mysql_fetch_row($result))
 {
  if ($division!=$lastdivision)
  {
  echo "<tr><td colspan=4 align=center><font size=4><b>Division $division</b></font size=4></td></tr>";
  }
   $matchdate = date("Y-m-d", strtotime($match_date));
   $displaymatchdate = date("d-m-Y", strtotime($match_date));
   $email2 = str_replace('.', ',', $email);
  if ($status=='3')
  {
   echo"<tr><td>$match_id $displaymatchdate $email </td><TD></TD><TD></td><TD></TD><font size=1><a href=leagueresult.php?op=admindelete&id=$match_id>Delete</a></font></td></tr>";
  }
  else
  {
   echo"<tr><td>$match_id $displaymatchdate $email</td><TD>$home_team  $home_score</TD><TD>$away_team</td><TD>$away_score</TD><td><td><font size=1><a href=leagueresult.php?op=admindelete&id=$match_id>Delete</a></font></td></tr>";
  }
  $thiscount=$thiscount+1;
  $lastdivision=$division;
 }

echo "</table><BR><BR><BR><a href=\"leagueresult.php\">Live results page</a>";
  mysql_free_result($result);



 include ("footer.php");
}


###
### Admin Delete
###

function admin_delete_result($id, $validate)
{

$email = str_replace(',', '.', $validate);

  mysql_query("delete from team_scores where match_id='$id'");
 if (mysql_affected_rows()==0)
 {
  dispmessage('nosuchmatchID', $id);
 }
 else
 {
  dispmessage('deleted', $id);
  Header("Location: ".$admin_file.".php?op=list");

 }
}

###
### Admin Make Live
###

function admin_makelive_result($id)
{
 mysql_query("update team_scores set status='1' where match_id='$id'");
 if (mysql_affected_rows()==0)
 {
  dispmessage('nosuchmatchID', $id);
 }
 else
 {
  dispmessage('authorised', $id);
 }
}

switch($_REQUEST['op']) {

    case "adminmakelive":
   admin_makelive_result($_REQUEST['id']);
   break;
   
    case "admindelete":
   admin_delete_result($_REQUEST['id'], $_REQUEST['validate']);
   break;
   
    default:
   listresults();
   break;

}
?>

But still same error.

Re the fatal error. Added global $db; to the top of the page which moved the error to line 1254.
Code:
 $result = $db->sql_query("select authorisation_user from team_authorisation where authorisation_teamid='$teamid'");


Tried global $db, $result; above the function but no change
View user's profile Send private message Visit poster's website
Palbin
Site Admin


Joined: Mar 30, 2006
Posts: 2456
Location: Pittsburgh, Pennsylvania

PostPosted: Tue Aug 10, 2010 7:20 pm Reply with quote Back to top

To get your admin to at least show. Make sure to not the changes in these two files.

case.php
Code:

if (!defined('ADMIN_FILE')) {
   die ('Access Denied');
}

$module_name = basename(dirname(dirname(__FILE__)));

switch($op) {
   case 'listresults':
   case 'adminmakelive':
   case 'admindelete':
      require 'modules/' . $module_name . '/admin/index.php';
      break;
}


links.php
Code:

if (!defined('ADMIN_FILE')) {
   die ('Access Denied');
}

global $admin_file;

adminmenu($admin_file . '.php?op=listresults', 'Results', 'results.gif');


In the index in your last post you need to comment out line 14
Code:

Header("Location: ".$admin_file.".php?op=list");


Remember what ever cases are in the case,php need to be in the switch at the bottom of the index.

There is a lot of work to do in there. I suggest looking at one of the simple modules as an example. I suggest looking at Reviews.
View user's profile Send private message
rebelt
Worker
Worker


Joined: May 07, 2006
Posts: 147

PostPosted: Thu Aug 12, 2010 12:10 pm Reply with quote Back to top

Quote:
There is a lot of work to do in there.

Crikey Shocked and you know what you're doing. I'll do as you suggested and try to stumble through

Thanks for your help.
View user's profile Send private message Visit poster's website
rebelt
Worker
Worker


Joined: May 07, 2006
Posts: 147

PostPosted: Mon Aug 16, 2010 12:44 pm Reply with quote Back to top

Well thanks to Palbin I at least managed to get this to display errors.

Got rid of the first 2 but now get
Parse error: syntax error, unexpected $end ..\..\..\..\...\....\....\index.php on line 146

Thats the end tag so am now totally confused. Can't find any missing brackets.

Spent three days on this.

Could someone please suggest as to who I could ask for a quote to take this on.

Latest effort. (incomplete)
Code:
<?php
if (!defined('ADMIN_FILE')) {
   die('Access Denied');
}
global $admin_file, $db, $prefix;

$aid = substr($aid, 0, 25);
$row = $db->sql_fetchrow($db->sql_query('SELECT title, admins FROM ' . $prefix . '_modules WHERE title=\'Leagueresult\''));
$row2 = $db->sql_fetchrow($db->sql_query('SELECT name, radminsuper FROM ' . $prefix . '_authors WHERE aid=\'' . $aid . '\''));
$admins = explode(',', $row['admins']);
$auth_user = 0;
for ($i = 0;$i < sizeof($admins);$i++) {
   if ($row2['name'] == $admins[$i] AND !empty($row['admins'])) {
      $auth_user = 1;
   }
}

if ($row2['radminsuper'] == 1 || $auth_user == 1) {
   if (!isset($op)) $op = 'reviews';

###
### List Results In Admin
###

function listresults()
{
 include ('header.php');
global $admin_file, $db, $prefix;

//      Header("Location: ".$admin_file.".php?op=list");

$result = $db->sql_query("select match_id, home_team, away_team, home_score, away_score, division, email, match_date from team_scores where status=0 order by division");

$thiscount=1;

echo "<font size=4><B>Results Admin</b></font size=4>";
echo "<font size=2><center><b>Pending Results</b></center><br><BR></font>";
echo "<BR><table width=100%>";
$lastdivision="9";

while (list($match_id, $home_team, $away_team, $home_score, $away_score, $division, $email, $match_date) = mysql_fetch_row($result))
 {
  if ($division!=$lastdivision)
  {
  echo "<tr><td colspan=4 align=center><font size=4><b>Division $division</b></font size=4></td></tr>";
  }
   $matchdate = date("Y-m-d", strtotime($match_date));
   $displaymatchdate = date("d-m-Y", strtotime($match_date));
   $email2 = str_replace('.', ',', $email);

  echo"<tr><td>$match_id $displaymatchdate $email  </td><TD>$home_team $home_score</TD><TD>$away_team</td><TD>$away_score</TD><td><td><font size=1><a href=leagueresult.php?op=admindelete&id=$match_id>Delete</a>&nbsp;&nbsp; <a href=leagueresult.php?op=adminmakelive&id=$match_id>Make Live</a></font></td></tr>";
  $thiscount=$thiscount+1;
  $lastdivision=$division;
 }

echo "</table><BR>";

  mysql_free_result($result);

$result = mysql_query("select match_id, home_team, away_team, home_score, away_score, division, email, match_date, status, comments from team_scores where status>0 order by division");

echo "<font size=2><center><b>Live Results</b></center><br><BR></font>";
echo "<BR><table width=100%>";
$lastdivision="9";

while (list($match_id, $home_team, $away_team, $home_score, $away_score, $division, $email, $match_date, $status, $comments) = mysql_fetch_row($result))
 {
  if ($division!=$lastdivision)
  {
  echo "<tr><td colspan=4 align=center><font size=4><b>Division $division</b></font size=4></td></tr>";
  }
   $matchdate = date("Y-m-d", strtotime($match_date));
   $displaymatchdate = date("d-m-Y", strtotime($match_date));
   $email2 = str_replace('.', ',', $email);
  if ($status=='3')
  {
   echo"<tr><td>$match_id $displaymatchdate $email </td><TD></TD><TD></td><TD></TD><font size=1><a href=leagueresult.php?op=admindelete&id=$match_id>Delete</a></font></td></tr>";
  }
  else
  {
   echo"<tr><td>$match_id $displaymatchdate $email</td><TD>$home_team  $home_score</TD><TD>$away_team</td><TD>$away_score</TD><td><td><font size=1><a href=leagueresult.php?op=admindelete&id=$match_id>Delete</a></font></td></tr>";
  }
  $thiscount=$thiscount+1;
  $lastdivision=$division;
 }

echo "</table><BR><BR><BR><a href=\"leagueresult.php\">Live results page</a>";
  mysql_free_result($result);



 include ("footer.php");
}


###
### Admin Delete
###

function admin_delete_result($id, $validate)
{

$email = str_replace(',', '.', $validate);

  mysql_query("delete from team_scores where match_id='$id'");
 if (mysql_affected_rows()==0)
 {
  dispmessage('nosuchmatchID', $id);
 }
 else
 {
  dispmessage('deleted', $id);
 }
}

###
### Admin Make Live
###

function admin_makelive_result($id)
{
 mysql_query("update team_scores set status='1' where match_id='$id'");
 if (mysql_affected_rows()==0)
 {
  dispmessage('nosuchmatchID', $id);
 }
 else
 {
  dispmessage('authorised', $id);
 }
}

switch($_REQUEST['op']) {
    case "list":
   listresults();
   break;

    case "adminmakelive":
   admin_makelive_result($_REQUEST['id']);
   break;
    case "admindelete":
   admin_delete_result($_REQUEST['id'], $_REQUEST['validate']);
   break;

}
?>
View user's profile Send private message Visit poster's website
nuken
RavenNuke(tm) Development Team


Joined: Mar 11, 2007
Posts: 1536
Location: North Carolina

PostPosted: Mon Aug 16, 2010 12:54 pm Reply with quote Back to top

line 18 does not have a closing }

Code:
if ($row2['radminsuper'] == 1 || $auth_user == 1) {
   if (!isset($op)) $op = 'reviews';
View user's profile Send private message Send e-mail Visit poster's website
rebelt
Worker
Worker


Joined: May 07, 2006
Posts: 147

PostPosted: Mon Aug 16, 2010 1:56 pm Reply with quote Back to top

Thanks. Got rid of the error and advanced to a blank page. Shocked

How did you guys deal with the frustration side of working these things out?

I'm sure I didn't have this much grey hair when I started. Very Happy
View user's profile Send private message Visit poster's website
nuken
RavenNuke(tm) Development Team


Joined: Mar 11, 2007
Posts: 1536
Location: North Carolina

PostPosted: Mon Aug 16, 2010 2:38 pm Reply with quote Back to top

None of your cases are a default. See if you can get anything by using modules.php?name=YourModulesName&op=list
View user's profile Send private message Send e-mail Visit poster's website
Guardian2003
Site Admin


Joined: Aug 28, 2003
Posts: 6373
Location: Vsetin, Czech Republic

PostPosted: Mon Aug 16, 2010 3:39 pm Reply with quote Back to top

Do you have error reporting turned on? I bet you'll find something there that will help, like the missing $db from you global statements in those functions in admin/index.php
View user's profile Send private message Send e-mail Visit poster's website
rebelt
Worker
Worker


Joined: May 07, 2006
Posts: 147

PostPosted: Mon Aug 16, 2010 4:32 pm Reply with quote Back to top

I had a default after Palbin posted earlier.

Then Looking through the reviews module, none of the case had a default in admin/index.php so removed it. Rolling Eyes

Now I've put it back it works. Very Happy

Even without the $db.

Although I suppose I should go through putting it in.

Thanks guys.

Amazing how you can just look at somthing and know what's wrong.
worship
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum