Jump to content

Login/Register Script

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
6 replies to this topic

#1
Whitey

Whitey

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 255 posts
Okay well i have a register form setup.. and i have a process.php setup as well..
Well when it goes to process it fails in the isset.

Register.php
<?php 

include("header.inc");

?>

 <form method="POST" action="process.php">

<div align="center">

  <table width="300" border="0" cellspacing="0" cellpadding="0">

    <tr>

      <td width="154" style="border-width: 1px; border-style:solid; border-color:#000000"><div align="right">Username:</div></td>

      <td width="146" style="border-width: 1px; border-style:solid; border-color:#000000"><input type="text" name="username" /></td>

    </tr>

    <tr>

      <td style="border-width: 1px; border-style:solid; border-color:#000000"><div align="right">Password:</div></td>

      <td style="border-width: 1px; border-style:solid; border-color:#000000"><input type="text" name="password" /></td>

    </tr>

    <tr>

      <td style="border-width: 1px; border-style:solid; border-color:#000000"><div align="right">Email:</div></td>

      <td style="border-width: 1px; border-style:solid; border-color:#000000"><input type="text" name="email" /></td>

    </tr>

    <tr>

      <td colspan="2"><div align="center">

	  	<input type="hidden" name"register" value="1">

        <input type="submit" name="Submit" value="Submit" />

        <input type="reset" name="reset" value="Reset" />

      </div></td>

    </tr>

  </table>

</div>

</form>

<?php 

include("footer.inc");

?>

Process.php
<?php

require("include/constants.php");

class Process

{


	function Process(){

	

		if(isset($_POST['register'])) {

    	$this->register();

     	}

		else {

		header("Location: main.php");

		}

	}


	function register(){

		$username = $_POST["username"];

		$password = $_POST["password"];

		$email = $_POST["email"];

		$query = "INSERT INTO members (ID, username, password, email) VALUES (NULL, '$username', '$password', '$email')";

		mysql_query($query, @mysql_connect(DB_SERVER, DB_USER, DB_PASS)) or die(mysql_error());

		echo("<center><font size='4'><font color='red'>Post has been submitted! Will redirect in 2 seconds</center></font>");

		echo("<META HTTP-EQUIV='refresh' CONTENT='2;news.php'>");

	}

};


$process = new Process;

?>

When it submits it goes to Main.php instead of going to news.php like i wanted it to.

Edited by Whitey, 03 June 2008 - 12:15 PM.


#2
Guest_Jaan_*

Guest_Jaan_*
  • Guests
I suggest you to use

isset($_POST['Submit']);

i believe this will work.. or something

#3
tecktalk

tecktalk

    Programmer

  • Members
  • PipPipPipPip
  • 175 posts
yes that will surely help.. :)
Lyf come without guarantees, except that smiling will brighten ur face, laughing will enhance ur eyes, and falling in luv will change ur lyf

#4
Whitey

Whitey

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 255 posts
No i will be using the Process.php for several different submits... but i found the problem...
<input type="hidden" name"register" value="1">

suppose to have an = sign.. lol

#5
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
Ah. How annoying. :p
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums

#6
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts

Xav said:

Ah. How annoying. :p

Thats not the only thing thats annoying :o

#7
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
Um, what are you saying lol?
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums