Jump to content

davidfattore

Members
  • Posts

    31
  • Joined

  • Last visited

Posts posted by davidfattore

  1. Hi Guys,

     

    Something strange happened, 

     

    Today when I logged onto a site that I'm building, the code seemed to have errors, despite the fact that I hadn't touched it since I uploaded it initially.

     

    The Code is below:

              <?php
    				if((isset($_GET['id'])) && (is_numeric($_GET['id']))) { //accessed through viewusers.
    					$id = $_GET['id'];
    				} elseif ((isset($_POST['id'])) && (is_numeric($_POST['id']))) { //form has been subbed.
    					$id = $_POST['id'];
    				} else {
    					print '<h2> Page Error </h2>';
    					print '<p class=error> This page has been accessed in error. </p>';
    				}
    			?>
    
    

    It's giving me the page error portion and not recognizing the $id, thereby screwing with my WHERE clause in my SQL query... see below

    $query = "SELECT userID, username, password, first_name, last_name, email, gender, blurb, points, games_played, games_won, badges_earned, tournaments_won,  dob_day, dob_month, dob_year, dp, badgeID, badges, unlocked, feat_badge, feat_badge_name, feat_badge_xp, level, administration, registration_date FROM users WHERE userID = $id";
     

    Is there any other way to write that $id = _GET ['id']; code as I'm not sure why it would stop working as yesterday it was working fine!

     

  2. Hey guys, 

     

    No this may very well be a silly question and if it is, I'm certain to have a decent bit of embarrassment, as I'm somewhat of a veteran when it comes to PHP but I've only just started to look for a viable solution to this particular hiccup.

     

    Is there a way in the PHP Header file to include "print $_SESSION ['username']", without it causing a syntax error?

     

    I'll provide more context by embedding my code!

    <?php 
    	if ((isset($_SESSION['user_id']))&&(!strpos($_SERVER['PHP_SELF'],'logout.php')))
    			{
    	print '<span> <a href="login/" id="link-login">Log in</a> <span class="pre-login-or">or</span> <a href="register/" id="link-register">Register</a></span>';
    			}
    			else{
    				print 'Benvenutti $_SESSION ['username'], al Torneo di Briscola due mila tredici';
    		}?>
    

    That in itself will cause an unexpected T_STRING syntax error... the only option I can see is by employing the use of an iframe and linking the source to a separate PHP document with the "Welcome" text, but I was hoping there was another was to achieve this with the iframe.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.