user4fun Posted June 6, 2007 Share Posted June 6, 2007 I am sure this little code can be reorganized to work better, matter of fact it is not raelly working right nowany help would be great <html><head><title>Start Registration</title><style>a, a:visited, a:active { text-decoration:none;}a:hover { text-decoration:underline;}</style></head><? $link = mysql_connect("", "", "") or die ("No connection"); mysql_select_db("business") or die ("no database"); $q2 = mysql_query("SELECT `Website` FROM `Main` WHERE `Website` = '" . strtolower($_GET['Website']) ."' LIMIT 1"); IF (mysql_num_rows($q2) == 1) :include ("file_in_sys.php"); die();ENDIF; $Con1 = $_GET['Con1'];$Con2 = $_GET['Con2'];$Website = $_GET['Website'];$Email = $_GET['Email'];$State = $_GET['State'];$City = $_GET['City'];$Today = date("m.d.y"); if ($Con1==123456 && $Con2==123) //will be reaplaced with variables later{$link = mysql_connect("", "", "") or die ("No connection"); mysql_select_db("business") or die ("no database"); $sql = "INSERT INTO confirmed (ConfirmID, Website, Email, State, City, Date) VALUES ('', '$Website', '$Email', '$State', '$City', '$Today')"; $query=mysql_query($sql); if($query) { echo "infromation in system"; } else { echo "failed to enter information"; }}else{echo "con1 and 2 are wrong";}?></body></html> Link to comment Share on other sites More sharing options...
zppblood Posted June 6, 2007 Share Posted June 6, 2007 Use this for if thens: if (conditional) { // Code }You shouldn't try to start another connection unless you want to select another user (you would probably also end the other one) and selecting the same database. Assign values for server, username, and password in mysql_connect(). Make sure that you don't have ConfirmID field in your database as primary key because I don't think it allows for those types of values and can't have the same value. Link to comment Share on other sites More sharing options...
justsomeguy Posted June 6, 2007 Share Posted June 6, 2007 In both of your queries you need to use mysql_real_escape_string to escape all variables except $Today, all of them are coming from $_GET. You need to escape all of them. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.