Web Analytics Made Easy -
StatCounter login forum - CodingForum

Announcement

Collapse
No announcement yet.

login forum

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • login forum

    i got this hole thing from my frind when i try to use it it says

    Notice: Undefined variable: action in c:\program files\apache group\Apache\htdocs\login_gam.php on line 4

    heres the main login thing:
    Code:
    <?php 
    include('config.php');
    
    if($action == "submit"){
    	if(($userinput == "")||($passinput == "")){
    	echo "$noinfo";
    	} else {
    		if(($userinput == $username)&&($passinput == $password)){
    		header( "Location: $location" );
    		} else {
    		echo "$badinfo";
    		}
    	}
    }
    include('form.php')	;
    ?>

    hers the forum_gam.php file
    Code:
     <form name="form1" method="post" action="">
      <p>Username:  
        <input name="userinput" type="text" id="userinput">
        <br>
        <br>
      Password: 
      <input name="passinput" type="password" id="passinput">
      <br>
      <br>
      <input type="submit" name="Submit" value="Submit">
      <input type="reset" name="Reset" value="Reset">
      <input name="action" type="hidden" id="action" value="submit">
      </p>
      </form>
    annd here is the config_gam.php
    Code:
      <?php
    
    $username = "test";
    $password = "test";
    $location = "http://localhost:81/upload.php";
    $badinfo = "Bad Info!!!!!!!";
    $noinfo = "No Info Here";
    some one see what is wrong?

  • #2
    Basically, it was poorly written code, it assumed global variables was on, and the default setting is off.

    Code:
    <?php 
    include('config.php');
    
    if($_POST['action'] == "submit"){
    	if(($_POST['userinput'] == "")||($_POST['passinput'] == "")){
    	echo "$noinfo";
    	} else {
    		if(($_POST['userinput'] == $username)&&($_POST['passinput'] == $password)){
    		header( "Location: $location" );
    		} else {
    		echo "$badinfo";
    		}
    	}
    }
    include('form.php')	;
    ?>
    Try that
    Design Portfolio

    Comment


    • #3
      If you have register_globals = Off in your php.ini you must use $_POST['action'] instead of just $action (the other values from the form in the same way).

      Oh, and I advise you not to change the settings in the php.ini in favour of adjusting your script, because there are security issues with activating register_globals.

      dumpfi

      Edit: Too slow.. i need a secretary (a good looking one *g*)
      "Failure is not an option. It comes bundled with the software."
      ....../)/)..(\__/).(\(\................../)_/)......
      .....(-.-).(='.'=).(-.-)................(o.O)...../<)
      ....(.).(.)("}_("}(.)(.)...............(.)_(.))¯/.
      ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
      Little did the bunnies suspect that one of them was a psychotic mass murderer with a 6 ft. axe.

      Comment


      • #4
        its still showing


        Notice: Undefined index: action in c:\program files\apache group\Apache\htdocs\login_gam.php on line 4

        Comment


        • #5
          well im at it any one know how to cover how to make it so they dont see the real page so they can just go to it??? iv seen it befor

          Comment

          Working...
          X