GsXtAsY Posted July 31, 2008 Share Posted July 31, 2008 I am getting this Parse error: syntax error, unexpected T_ENDFOREACH error and it says its on the following line: <?php $nr++; endforeach; } else { ?> This is on line 267 the endforeach; very close to the bottom of all this code....any ideas? ____________________________________________ <?php require_once ( '../settings.php' ); include ( '../lib/Pagination.php' ); $login->checkLogin ( 1 ); $active_users = $login->db->RecordCount ( "SELECT ID FROM `" . DBPREFIX . "users` WHERE `Active` = 1" ); $inactive_users = $login->db->RecordCount ( "SELECT ID FROM `" . DBPREFIX . "users` WHERE `Active` = 0" ); $suspended_users = $login->db->RecordCount ( "SELECT ID FROM `" . DBPREFIX . "users` WHERE `Active` = 2" ); $which_users = ( $login->functions->numeric ( @$_GET [ 'active' ] ) ) ? $_GET['active'] : '1'; $pagination = new Pagination(); $pagination->start = ( @$_GET['start'] ) ? $_GET['start'] : '0'; $pagination->limit = ( @$_GET['limit'] ) ? $_GET['limit'] : '50'; $pagination->filePath = APPLICATION_URL . 'admin/admin.php'; $pagination->select_what = '*'; $pagination->the_table = '`' . DBPREFIX . 'users`'; $pagination->add_query = ' WHERE `Active` = ' . $login->db->qstr ( $which_users ); if ( isset ( $_GET [ 'group' ] ) ) { $group = $_GET [ 'group' ]; $pagination->add_query .= ' AND `Level_access` = ' . $login->db->qstr ( $group ); $pagination->otherParams = '&group=' . $group; } $pagination->add_query .= ' ORDER BY `ID` DESC'; $pagination->otherParams = '&active=' . $which_users; $query = $pagination->getQuery ( TRUE ); $paginate = $pagination->paginate(); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title><?= $login->design->get_page_title ( 'admin' ) ?></title> <meta http-equiv="Expires" content="Mon, 04 Dec 1999 21:29:02 GMT"> <?= $login->design->get_page_css () ?> <?= $login->design->get_page_js ( 'admin' ) ?> <script type="text/JavaScript"> function MM_jumpMenu(targ,selObj,restore){ //v3.0 eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); if (restore) selObj.selectedIndex=0; } function makeactive(tab) { document.getElementById("tab1").className = ""; document.getElementById("tab2").className = ""; document.getElementById("tab3").className = ""; document.getElementById("tab4").className = ""; document.getElementById("tab5").className = ""; document.getElementById("tab6").className = ""; document.getElementById("tab"+tab).className = "current"; } window.addEvent('domready', function(){ var list = $$('#side_menu li'); list.each(function(element) { var fx = new Fx.Styles(element, {duration:200, wait:false}); element.addEvent('mouseenter', function(){ fx.start({ 'width':'130px' }); }); element.addEvent('mouseleave', function(){ fx.start({ 'width':'35px' }); }); }); }); function neonixToggle(itemID,linkID,anchorID,tSwitch){ if (document.getElementById && navigator.userAgent.indexOf('Opera') == -1){ var itemEL = document.getElementById(itemID); var linkEL = document.getElementById(linkID); itemEL.className = itemEL.className == 'TG_visible' ? 'TG_hidden' : 'TG_visible'; if(!eval(tSwitch)){linkEL.innerHTML = itemEL.className == 'TG_hidden' ? '' : '';} } if (anchorID.length != 0){; document.location.href = '#' + anchorID; } } if (document.getElementById && navigator.userAgent.indexOf('Opera') == -1){ document.writeln('<style type="text/css">'); document.writeln('.TG_visible {display: normal;}'); document.writeln('.TG_hidden {display: none;}'); document.writeln('</style>'); } </script> </head> <body> <div id="top"> <div id="side_menu" align="right"> <ul> <li class="chart"><a id="main1" href="javascript:neonixToggle('user_charts','main1','',false)"></a></li> <li class="group"><a id="main2" href="javascript:neonixToggle('group_select','main2','',false)"></a></li> <li class="search"><a id="main3" href="javascript:neonixToggle('user_search','main3','',false)"></a></li> </ul> </div> <!-- MENU --> <?= $login->design->setMenu () ?> <div class="content"> <h1><?= $login->functions->Lang ( 'welcome' ) ?> <?= $login->get_username ( $_SESSION [ AUTH_SESSION_ID ] ) ?>!</h1> <?= $login->design->get_admin_menu () ?> <?= $login->message ?> <TABLE width="100%"> <caption><?= $login->functions->Lang ( 'cpanel_info' ) ?></caption> <thead> <tr> <th class="center"><a href="<?= APPLICATION_URL ?>admin/admin.php">Active</a></th> <th class="center"><a href="<?= APPLICATION_URL ?>admin/admin.php?active=0">Inactive</a></th> <th class="center"><a href="<?= APPLICATION_URL ?>admin/admin.php?active=2">Suspended</a></th> </tr> </thead> <tr> <td width="33%"><?=$active_users?></td> <td width="33%"><?=$inactive_users?></td> <td><?=$suspended_users?></td> </tr> </table> <div id="user_charts" class="TG_hidden"> <ul class="graph"> <li id="tab1" class="current"> <a href="charts.php?type=this_week" target="myiframe" name="range" type="button" onClick="makeactive(1);">this week</a> </li> <li id="tab2"> <a href="charts.php?type=this_month" target="myiframe" name="range" type="button" onClick="makeactive(2);">this month</a> </li> <li id="tab3"> <a href="charts.php?type=last_month" target="myiframe" name="range" type="button" onClick="makeactive(3);">last month</a> </li> <li id="tab6"> <a href="charts.php?type=last_3_months" target="myiframe" name="range" type="button" onClick="makeactive(6);">last 3 months</a> </li> <li id="tab4"> <a href="charts.php?type=last_6_months" target="myiframe" name="range" type="button" onClick="makeactive(4);">last 6 months</a> </li> <li id="tab5"> <a href="charts.php?type=this_year" target="myiframe" name="range" type="button" onClick="makeactive(5);">this year</a> </li> </ul> <div class="clear" style="height:0px"></div> <div class="charts"> <!-- sorry guys, ajax failed to load the content, maybe on our next release --> <iframe name="myiframe" src="charts.php" frameborder="0" class="graph_frame"></iframe> </div> </div> <div id="group_select" class="TG_hidden"> <div class="job_indicators"> <?= $login->functions->Lang ( 'view_by_group' ) ?> <select name="user_groups" class="element select large" onChange="MM_jumpMenu('parent',this,0)"> <option value="<?= APPLICATION_URL ?>admin/admin.php?active=<?= $which_users ?>" <?php if ( ! isset ( $_GET [ 'group' ] )) { echo "selected";} ?>><?= $login->functions->Lang ( 'all' ) ?></option> <?php if ( $login->get_groups () != FALSE ) {//if we have groups foreach ( $login->get_groups () as $group ) {//loop through available groups ?> <option value="<?= APPLICATION_URL ?>admin/admin.php?active=<?= $which_users ?>&group=<?= $group->ID ?>" <?php if ( $group->ID == @$_GET [ 'group' ] ) echo "selected"; ?>><?= $group->title ?></option> <?php }//end looping groups }//end if we have groups else {//if we don't have groups ?> <option value=""><?= $login->functions->Lang ( 'no_groups' ) ?></option> <?php }//end if we don't have groups ?> </select> </div> </div> <div id="user_search" class="TG_hidden"> <div class="job_indicators"> <form method="post" action="<?= APPLICATION_URL ?>admin/admin_user_search.php"> <input type="hidden" name="_submit_check" value="1" /> User <input type="text" name="username" /> Email <input type="text" name="email" /> <input type="submit" name="Submit" value="Search" /> </form> </div> </div> <div style="margin:20px 0 20px"> <TABLE width="100%" class="sortable-onload-1 rowstyle-alt no-arrow"> <caption><?= $login->functions->Lang ( 'users_list' ) ?></caption> <thead> <tr> <th class="sortable-numeric" width="20"> </th> <th class="sortable-text"><?= $login->functions->Lang ( 'username' ) ?></th> <th class="sortable-text"><?= $login->functions->Lang ( 'email' ) ?></th> <th class="sortable-text"><?= $login->functions->Lang ( 'group' ) ?></th> <th><?= $login->functions->Lang ( 'options' ) ?></th> </tr> </thead> <?php $nr = 1; if ( $login->db->RecordCount ( $query ) > 0 ) { $users = $login->db->get_results ( $query ); foreach ( $users as $row ): ?> <tr> <td><?= $nr ?></td> <td class="lft"><?= $row->Username ?><em>Registered on: <?= $login->functions->mdate ( '%d-%M-%Y', $row->date_registered )?></em></td> <td class="lft"><?= $row->Email ?></td> <td class="lft"><?= $login->get_user_group ( $row->ID ) ?></td> <td width="60"> <?php if ( ! $login->isadmin ( $row->ID ) ) { ?> <select name="option" onChange="MM_jumpMenu('parent',this,0)"> <option>----------</option> <?php if ( $row->Active == 1 || $row->Active == 0 ): ?> <option value="<?= APPLICATION_URL ?>admin/admin_options.php?ID=<?= $row->ID ?>&action=suspend&active=<?= @$_GET['active'] ?>&start=<?= @$_GET['start'] ?>"><?= $login->functions->Lang ( 'suspend' ) ?></option> <?php endif; ?> <?php if ( $row->Active == 0 || $row->Active == 2 ): ?> <option value="<?= APPLICATION_URL ?>admin/admin_options.php?ID=<?= $row->ID ?>&action=activate&active=<?= @$_GET['active'] ?>&start=<?= @$_GET['start'] ?>"><?= $login->functions->Lang ( 'activate' ) ?></option> <?php endif; ?> <option value="<?= APPLICATION_URL ?>admin/admin_options.php?ID=<?= $row->ID ?>&action=delete&active=<?= @$_GET['active'] ?>&start=<?= @$_GET['start'] ?>"><?= $login->functions->Lang ( 'delete' ) ?></option> <option value="<?= APPLICATION_URL ?>admin/admin_options.php?ID=<?= $row->ID ?>&action=edit&active=<?= @$_GET['active'] ?>&start=<?= @$_GET['start'] ?>"><?= $login->functions->Lang ( 'edit' ) ?></option> </select> <?php } else { ?> </td> </tr> <?php $nr++; endforeach; } else { ?> <tr class="alt"> <td colspan="5"><?= $login->functions->Lang ( 'no_users' ) ?></td> </tr> <? } ?> </table> </div> <?=$paginate;?> <?= $login->view_online_users ( BASE_PATH . 'logs/online_users.txt', 5, TRUE ) ?> </div> <!-- FOOTER --> <?= $login->design->setFooter( ) ?> Quote Link to comment Share on other sites More sharing options...
papaface Posted July 31, 2008 Share Posted July 31, 2008 Its in the wrong place. Possibly inside a { when it should be outside. Theres to much code for me to look through. Quote Link to comment Share on other sites More sharing options...
discomatt Posted July 31, 2008 Share Posted July 31, 2008 Yes.. this is very cluttered... may i ask why you are using a combination of curly braces and endif/endforeach syntax? Quote Link to comment Share on other sites More sharing options...
paul2463 Posted July 31, 2008 Share Posted July 31, 2008 you are missing a closing brace for your first if statement try changing these couple of lines <?php $nr++; endforeach; } else { ?> for <?php $nr++; } //closes the last if/else statement endforeach; // end your foreach statement } //end the first if statement prior to last else else { ?> Quote Link to comment Share on other sites More sharing options...
GsXtAsY Posted July 31, 2008 Author Share Posted July 31, 2008 Thank you! That worked! Quote Link to comment Share on other sites More sharing options...
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.