MarkT Posted February 21, 2014 Share Posted February 21, 2014 (edited) Hello, I have a website, www.dittonminorsfc.co.uk, and on the team page, www.dittonminorsfc.co.uk/team.php?team=U7 it overwrites the session variable with what is in the $_GET at the top of the URL. Any ideas? Cheers p.s. the session variable isn't even called in the code, the only thing related to sessions is the <?PHP session_start(); ?> at the top of the page. Edited February 21, 2014 by MarkT Link to comment Share on other sites More sharing options...
thescientist Posted February 21, 2014 Share Posted February 21, 2014 (edited) what's the code? It wouldn't do that unless the code was telling it do that. $_GET and $_SESSION are two completely different arrays. Edited February 21, 2014 by thescientist Link to comment Share on other sites More sharing options...
MarkT Posted February 21, 2014 Author Share Posted February 21, 2014 <?PHP session_start();?><!DOCTYPE html><?PHP require "./system/connect.php" ?><head><title>Ditton Minors Football Club :: The Future's Bright - The Future's Red & Black</title><?PHP include "./includes/css.html" ?> <?PHP$team = $_GET['team'];$select = mysqli_query($con,"SELECT * FROM teams WHERE team = '{$team}'");$select2 = mysqli_fetch_array($select);?><?PHP include "./includes/meta.html" ?></head><body><div id="alert"><marquee onmouseover="this.stop()" onmouseout="this.start()"><?PHPecho "{$select2['alert']}";?></marquee></div><?PHP include "./includes/membernavi.html" ?><?PHP include "./includes/banner.html" ?><div id="textbox"><?PHP include "./includes/navi.html" ?><br /><h1>Ditton Minors - <?PHP if($_GET['team'] == "MINI") { echo "Mini Minors"; } else {echo $_GET['team'];} ?> Team</h1><p><center><img src="./images/teams/<?PHP echo $_GET['team']; ?>.jpg" oncontextmenu="return false;" alt="Ditton Minors <?PHP if($_GET['team'] == "MINI") { echo "Mini Minors"; } else {echo $_GET['team'];} ?> Squad" title="Ditton Minors <?PHP if($_GET['team'] == "MINI") { echo "Mini Minors"; } else {echo $_GET['team'];} ?> Squad" width="800" height="500" style="border: 5px inset #FF0000;"></center><center><table><tr> <td> <h2>Contact Details</h2> <p style="font-size: 16pt;"><strong>Manager:</strong> <?PHP echo $select2['manager_name']; ?><br> <strong>Email:</strong> <a href="mailto:<?PHP echo $select2['manager_email']; ?>"><?PHP echo $select2['manager_email']; ?></a><br> <strong>Mobile:</strong> <?PHP echo $select2['manager_phone']; ?><br> </td> <td> <h2>Training Details</h2> <p style="font-size: 16pt;"><strong>Location:</strong> <?PHP echo $select2['training_location']; ?><br> <strong>Day:</strong> <?PHP echo $select2['training_day']; ?><br> <strong>Time:</strong> <?PHP echo $select2['training_time']; ?><br> </td><?PHP if($_GET['team'] !== "MINI") { echo ' <td> <h2>Match Details</h2> <p style="font-size: 16pt;"><strong>Home Ground:</strong> '; echo $select2['home_ground']; echo '<br> <strong>Days:</strong> '; echo $select2['match_day']; echo '<br> <strong>Kick-Off:</strong> '; echo $select2['match_ko']; echo '<br> </td></tr></table></center>'; } ?><center><table><tr> <td> <h2>Sponsors</h2> <p style="font-size: 16pt;"><strong>Company:</strong> <?PHP echo $select2['sponsor_name']; ?><br> <center> <a href="<?PHP echo $select2['sponsor_url']; ?>" alt="<?PHP echo $select2['sponsor_name']; ?> Sponsor Ditton Minors FC <?PHP echo $_GET['team']; ?>" title="<?PHP echo $select2['sponsor_name']; ?> Sponsor Ditton Minors FC <?PHP echo $_GET['team']; ?>"> <img src="./images/logos/<?PHP echo $select2['sponsor_image_name']; ?>" alt="<?PHP echo $select2['sponsor_name']; ?> Sponsor Ditton Minors FC <?PHP echo $_GET['team']; ?>" title="<?PHP echo $select2['sponsor_name']; ?> Sponsor Ditton Minors FC <?PHP echo $_GET['team']; ?>" width="300" height="150" style="border: 5px inset #FF0000;"></center> </a> </td></tr></table></center></p></p></div><div id="footer"><?PHP include "./includes/footer.html" ?></div></body> Link to comment Share on other sites More sharing options...
thescientist Posted February 21, 2014 Share Posted February 21, 2014 I don't see where you're using $_SESSION anywhere in that code. I only see the $_GET variable being used in the query. So where / what exactly is the problem in the code you provided? Link to comment Share on other sites More sharing options...
MarkT Posted February 22, 2014 Author Share Posted February 22, 2014 Tbh, I'm not sure. Basically the session variable isn't used in the code, but for some reason, it overwrites $_SESSION['team'] with whats in the $_GET Link to comment Share on other sites More sharing options...
Ingolme Posted February 22, 2014 Share Posted February 22, 2014 How do you know it's overwriting $_SESSION`['team'] if it hasn't been printed anywhere in your document? Link to comment Share on other sites More sharing options...
MarkT Posted February 23, 2014 Author Share Posted February 23, 2014 It's used in the navigation, and the navigation says Team Management (U11) but when I load the team.php?team=U7, it overwrites it to say Team Management (U7) which then affects the rest of the site. Link to comment Share on other sites More sharing options...
Ingolme Posted February 24, 2014 Share Posted February 24, 2014 You'll have to show us the code for the navigation, then. Link to comment Share on other sites More sharing options...
MarkT Posted February 27, 2014 Author Share Posted February 27, 2014 You'll have to show us the code for the navigation, then. <div id='cssmenu'><ul> <li class='active'><a href='index.php'><span><img src="./images/home.png" align="left" style="padding-top: 12px; padding-right: 3px;" title="Ditton Minors FC :: The Future's Bright!" alt="Ditton Minors FC :: The Future's Bright!">Home</span></a></li> <li class='has-sub'><a href='#'><span><img src="./images/about.png" align="left" style="padding-top: 12px; padding-right: 3px;" title="About Ditton Minors FC" alt="About Ditton Minors FC"><span>About Us</span></a> <ul> <li class='has-sub'><a href='#'><span>Staff</span></a> <ul> <li><a href='committee.php'><span>Committee</span></a></li> <li class='last'><a href='officials.php'><span>Officials</span></a></li> </ul> </li> <li><a href='trophies.php'><span>Trophy Cabinet</span></a></li> <!-- <li><a href='history.php'><span>Club History</span></a></li> --> <li><a href='sponsors.php'><span>Sponsors</span></a></li> <li><a href='gallery.php'><span>Our Gallery</span></a></li> </ul> </li> <li class='has-sub'><a href='#'><span><img src="./images/calendar.png" align="left" style="padding-top: 12px; padding-right: 3px;" title="Ditton Minors FC Soccer Schools!" alt="Ditton Minors FC Soccer Schools!">Events</span></a> <ul> <li><a href='millwall.php'><span>Millwall Soccer School</span></a></li> <li><a href='soccerschool.php'><span>Summer Soccer School</span></a></li> <li><a href='tournament.php'><span>Ditton Minors Annual Tournament</span></a></li> </ul> </li> <li class='has-sub'><a href='#'><span><img src="./images/team.png" align="left" style="padding-top: 12px; padding-right: 3px;" title="Ditton Minors FC :: Meet The Teams!" alt="Ditton Minors FC :: Meet The Teams!">The Teams</span></a> <ul> <li><a href='team.php?team=MINI'><span>Mini Minors</span></a></li> <li><a href='team.php?team=U7'><span>Under 7's</span></a></li> <li><a href='team.php?team=U8'><span>Under 8's</span></a></li> <li><a href='team.php?team=U9'><span>Under 9's</span></a></li> <li><a href='team.php?team=U10'><span>Under 10's</span></a></li> <li><a href='team.php?team=U11'><span>Under 11's</span></a></li> <li><a href='team.php?team=U12'><span>Under 12's</span></a></li> <li><a href='team.php?team=U13'><span>Under 13's</span></a></li> <li><a href='team.php?team=U14'><span>Under 14's</span></a></li> <li><a href='team.php?team=U16'><span>Under 16's</span></a></li> <li><a href='team.php?team=U18'><span>Under 18's</span></a></li> <li><a href='team.php?team=MENS'><span>Senior Mens</span></a></li> </ul> </li> <li><a href='player.php'><span><img src="./images/player.png" align="left" style="padding-top: 12px; padding-right: 3px;" title="Ditton Minors FC :: Meet The Players!" alt="Ditton Minors FC :: Meet The Players!">Players</span></a></li> <li><a href='shop.php'><span><img src="./images/shoppingcart.png" align="left" style="padding-top: 12px; padding-right: 3px;" title="Ditton Minors Merchandise Store!" alt="Ditton Minors Merchandise Store"><strong>Shop</strong></span></a></li><!-- <li class='last'><a href='#'><span><img src="./images/contact.png" align="left" style="padding-top: 12px; padding-right: 3px;" title="Contact Ditton Minors FC" alt="Contact Ditton Minors FC">Contact Us</span></a></li> --> <li class='has-sub'><a href='#'><span><img src="./images/member.png" align="left" style="padding-top: 12px; padding-right: 3px;" title="Contact Ditton Minors FC" alt="Contact Ditton Minors FC">Member's Area</span></a> <ul> <li><a href='login.php'><span>Login</span></a></li> <li><a href='register.php'><span>Register</span></a></li> </ul> </li></ul></div> Navigation ^^ Link to comment Share on other sites More sharing options...
justsomeguy Posted February 27, 2014 Share Posted February 27, 2014 There's no PHP code in that file.I don't know what you're actually seeing happen, but PHP does not overwrite any superglobal with values from any other. Link to comment Share on other sites More sharing options...
MarkT Posted March 4, 2014 Author Share Posted March 4, 2014 Here's the other navigation code where the problem occurs: <?PHP if(isset($_SESSION['loggedin'])) {echo "<div id='membermenu'><ul> <li class='active'><a href='myprofile.php'><span>My Profile</span></a></li>"; if($_SESSION['ismanager'] == "1") { echo " <li><a href='playerprofiles.php?team={$_SESSION['team']}'><span>Player Profiles</span></a></li> <li class='has-sub'><a href='#'><span>Team Management({$_SESSION['team']})</span></a> <ul> <li><a href='editteam.php'><span>Edit Team</span></a></li> <li><a href='viewparents.php?team={$_SESSION['team']}'><span>View Parents</span></a></li> <li><a href='adminemail.php'><span>Send Emails</span></a></li> </ul> </li>"; } else {}; if($_SESSION['reporter'] == "1") { echo " <li><a href='writereport.php'><span>Write Match Report</span></a></li>"; } else {}; if($_SESSION['isadmin'] == "1") { echo " <li class='has-sub'><a href='#'><span>Shop Management</span></a> <ul> "; echo "<li><a href='shop.php?action=add'><span>Add Product</span></a></li>"; echo " <li><a href='pricerequests.php'><span>View Orders</span></a></li> </ul> </li>"; } if($_SESSION['isadmin'] == "1") { echo " <li><a href='playerprofiles.php'><span>Player Profiles</span></a></li> <li class='has-sub'><a href='#'><span>Administrator Tools</span></a> <ul> <li><a href='mass.php'><span>Mass Alert</span></a></li> <li><a href='writearticle.php'><span>Write News Article</span></a></li> <li><a href='adminemail.php'><span>Send Email</span></a></li> <li><a href='playerprofiles.php'><span>Player Profiles</span></a></li> </ul> </li>"; } echo " <li><a href='logout.php'><span>Logout</span></a></li></ul></div>";} else {}?> Probably not the neatest code, but it's good enough for me. The team management ($_SESSION['team']) is where it goes wrong. Link to comment Share on other sites More sharing options...
justsomeguy Posted March 4, 2014 Share Posted March 4, 2014 The team management ($_SESSION['team']) is where it goes wrong.All it's doing is writing out the value. If the problem is which value is in $_SESSION['team'], then where do you set that? Link to comment Share on other sites More sharing options...
MarkT Posted March 8, 2014 Author Share Posted March 8, 2014 All it's doing is writing out the value. If the problem is which value is in $_SESSION['team'], then where do you set that? That is set on the login script, from a value set by the database. Link to comment Share on other sites More sharing options...
MarkT Posted March 8, 2014 Author Share Posted March 8, 2014 It shows the right thing on every page, until you load the team page, then it overwrites it. Link to comment Share on other sites More sharing options...
thescientist Posted March 8, 2014 Share Posted March 8, 2014 i can't tell if we've seen the team page or not >.<. Was it in post #3? What about this login page you mention, where DB value are getting set to $_SESSION? It's going to be hard for us to help if you're not really even certain how your code is working. It sounds like you really just need to step back and take this thing step by step, and try and build things up one peice at a time so you understand how your code is actually working. It will give you a better understanding of the project and PHP, and hopefully along the way, will help find your problem. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now