[SOLVED] need help ASAP-- big problem
Moderator: General Moderators
-
thefreebielife
- Forum Contributor
- Posts: 126
- Joined: Thu Apr 26, 2007 2:59 pm
-
noahkeller
- Forum Newbie
- Posts: 11
- Joined: Thu Apr 26, 2007 2:07 pm
well where I was coming from on that is:
if you have field1 field2 field3 field4 and field5
and you wanted to insert $value2 and $value3 into field2 and field3
and your query is
would be incorrect because it would be trying to insert $value2 into field1 because it is the first row
but if you define what row you want it entered into such as
it should work
where as your VALUES don't properly line up with the row you wanted it entered into because you skipped over some of the rows in your query
if you have field1 field2 field3 field4 and field5
and you wanted to insert $value2 and $value3 into field2 and field3
and your query is
Code: Select all
INSERT INTO `table` VALUES ('$value2','$value3')but if you define what row you want it entered into such as
Code: Select all
INSERT INTO `table` (`field2`,`field3`) VALUES ('$value2','$value3')where as your VALUES don't properly line up with the row you wanted it entered into because you skipped over some of the rows in your query
-
thefreebielife
- Forum Contributor
- Posts: 126
- Joined: Thu Apr 26, 2007 2:59 pm
"Your Username or Password is Invalid" - but it registers okay
also, none of the new users im trying to sign up are showing up on the user list.
and this is how they show up in the database:
also, none of the new users im trying to sign up are showing up on the user list.
and this is how they show up in the database:
Code: Select all
INSERT INTO `users` VALUES (486, '', '', '', '', '', '', '', '', '', '', 0, 0, 0, '', 0, '', '', 0);
INSERT INTO `users` VALUES (487, '', '', '', '', '', '', '', '', '', '', 0, 0, 0, '', 0, '', '', 0);
INSERT INTO `users` VALUES (488, '', '', '', '', '', '', '', '', '', '', 0, 0, 0, '', 0, '', '', 0);
INSERT INTO `users` VALUES (489, '', '', '', '', '', '', '', '', '', '', 0, 0, 0, '', 0, '', '', 0);-
thefreebielife
- Forum Contributor
- Posts: 126
- Joined: Thu Apr 26, 2007 2:59 pm
Code: Select all
<?
$r = $_GET['r'];
//check ref id
if ($r != "") {
$sql = 'SELECT * FROM `users` WHERE `uId` = "'.$r.'"';
$query = mysql_query ($sql);
if (mysql_num_rows($query) ==0) {
$ref = "error";
$r=0;
}
}
//validate form
//get vars
if (isset($_GET["form"]) && $_GET['form'] == "submit") {
$Email = $_POST['email'];
$username2 = $_POST['username'];
$pass = $_POST['pass'];
$fname = $_POST['fname'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$ip = $_POST['ip'];
$r = $_POST['r'];
$date = date("F j, Y");
$gid = $_POST['gid'];
$error = "none";
$terms = $_POST['terms'];
$country = $_POST['country'];
$r = $_POST['r'];
$username = strtolower($username2);
$password = strtolower($password2);
$pass2 = md5($pass);
$deadline = date ("F j, Y", mktime(0,0,0,date('m'), date('d')+$limit, date('y')));
//validate
//validate zip
if (!zip_field($zip) or $zip == "") {
$error = "zip";
}
//validate state
if (!name_fields($state) or $state == "") {
$error = "state";
}
//validate city
if (!other_fields($city) or $city == "") {
$error = "city";
}
//validate address
if (!other_fields($address) or $address == "") {
$error = "address";
}
//validate gift
if ($gid == "") {
$error = "giftid";
}
//valiudate fname
if (!name_fields($fname) or $fname == "") {
$error = "firstname";
}
//validate password
if (!username_field($pass) or $pass == "") {
$error = "password";
}
//validate username
if (!username_field($username) or $username == "") {
$error = "username";
}
//validate email
if (!check_email($Email)) {
$error = "Email";
}
//validate terms
if ($terms == "" or $terms != "accepted")
{ $error = "terms"; }
//see if username is taken
$sql = 'SELECT * FROM `users` WHERE `username` = "'.$username.'"';
$query = mysql_query ($sql);
if (mysql_num_rows($query) !=0) {
echo '<center><font color="#ff0000"><h4>Username already exists. Please try again<br /><br /><a href=javascript:history.back()><< Go Back</a></h4>'; exit;
}
//check to see if email is used
$sql = 'SELECT * FROM `users` WHERE `email` = "'.$Email.'"';
$query = mysql_query ($sql);
if (mysql_num_rows($query) !=0) {
echo '<center><font color="#ff0000"><h4>This Email is already in use. Please try again<br /><br /><a href=javascript:history.back()><< Go Back</a></h4>'; exit;
}
//if not insert data
if ($error == "none") {
mail($Email,"Welcome To The Freebie Life!","Welcome to The Freebie Life! <br>
If you have any questions please contact support. <Br>We answer all questions within 1 DAY.<br>
Remember, all gifts are shipped on the 5th and 20th of each month.<Br>
<br>
Enjoy!<br>
Jared<br>
The Freebie Life Admin","From:Admin@thefreebielife.com\nContent-Type: text/html; charset=iso-8859-1");
mysql_query("INSERT INTO `users` (`username`, `password`, `fname`, `email`, `address`, `city`, `state`, `zip`, `country`, `ip`, `gid`, `rid`, `ostatus`, `holdreason`, `astatus`, `date`, `deadline`, `dead`) VALUES
('$USERNAME', '$PASSWORD', '$FNAME', '$EMAIL', '$ADDRESS', '$CITY', '$STATE', '$ZIP', '$COUNTRY', '$IP', '$GID', '$RID', '$OSTATUS', '$HOLDREASON', '$ASTATUS', '$DATE', '$DEADLINE', '$DEAD')")
or die("Could not insert data because ".mysql_error());
echo '<center><font color="#ff0000"><h4>Thank You, Your Account Has Been Created</h4>';
if ($error == "none") {
echo '<meta http-equiv="refresh" content="3;url=login.php">';
exit;
}
}
}
?>
<form action="register.php?form=submit" method="post" name="register2">
<table width="300" border="0" align="center" class="table" style="border: 1px dashed red; padding: 4px 4px 4px 4px; ">
<tr>
<td colspan="2"><div align="center"><?
if ($ref == "error") { echo "<font color=red><center>Your Referral Link Is Invalid</center></font>"; }
if ($error == "terms") { echo "<font color=red><center>Your Must Accept the User Agreement</center></font>"; }
if ($error == "username") { echo "<font color=red><center>Your Username is Incorrect</center></font>"; }
if ($error == "password") { echo "<font color=red><center>Your Password is Incorrect</center></font>"; }
if ($error == "firstname") { echo "<font color=red><center>Your First Name is Incorrect</center></font>"; }
if ($error == "address") { echo "<font color=red><center>Your Address is Incorrect</center></font>"; }
if ($error == "city") { echo "<font color=red><center>Your City is Incorrect</center></font>"; }
if ($error == "state") { echo "<font color=red><center>Your State is Incorrect</center></font>"; }
if ($error == "zip") { echo "<font color=red><center>Your Zip Code is Incorrect</center></font>"; }
if ($error == "Email") { echo "<font color=red><center>Your Email is Incorrect</center></font>"; }
if ($error == "giftid") { echo "<font color=red><center>You must select a gift from the main page</center></font>"; }
?></div></td>
</tr>
<tr>
<td colspan="2" style="border-bottom:1px dashed red "><div align="left"><strong>Sign Up Now </strong></div></td>
</tr>
<tr>
<td colspan="2"><div align="center"><strong>Account Information </strong></div></td>
</tr>
<tr>
<td width="141">Username:</td>
<td width="320"><input name="username" type="text" id="username" size="20" value="<? echo "$username" ?>" /></td>
</tr>
<tr>
<td>Email:</td>
<td><input name="email" type="text" id="email" size="20" value="<? echo "$Email" ?>" /></td>
</tr>
<tr>
<td>Password:</td>
<td><input name="pass" type="password" id="pass" value="<? echo "$pass"; ?>" size="20" /></td>
</tr>
<tr>
<td colspan="2"><div align="center"><strong>Shipping Information </strong></div></td>
</tr>
<tr>
<td height="26">Full Name: </td>
<td><input name="fname" type="text" id="fname" size="20" value="<? echo "$fname"; ?>" /></td>
</tr>
<tr>
<td>Address:</td>
<td><input name="address" type="text" id="address" size="20" value="<? echo "$address"; ?>" /></td>
</tr>
<tr>
<td>City:</td>
<td><input name="city" type="text" id="city" size="20" value="<? echo "$city"; ?>" /></td>
</tr>
<tr>
<td>State:</td>
<td><select name="state" id="state">
<option selected value=''>State</option>
<option value="AL" >Alabama</option>
<option value="AK" >Alaska</option>
<option value="AZ" >Arizona</option>
<option value="AR" >Arkansas</option>
<option value="CA" >California</option>
<option value="CO" >Colorado</option>
<option value="CT" >Connecticut</option>
<option value="DE" >Delaware</option>
<option value="DC" >District of Columbia</option>
<option value="FL" >Florida</option>
<option value="GA" >Georgia</option>
<option value="HI" >Hawaii</option>
<option value="ID" >Idaho</option>
<option value="IL" >Illinois</option>
<option value="IN" >Indiana</option>
<option value="IA" >Iowa</option>
<option value="KS" >Kansas</option>
<option value="KY" >Kentucky</option>
<option value="LA" >Louisiana</option>
<option value="ME" >Maine</option>
<option value="MD" >Maryland</option>
<option value="MA" >Massachusetts</option>
<option value="MI" >Michigan</option>
<option value="MN" >Minnesota</option>
<option value="MS" >Mississippi</option>
<option value="MO" >Missouri</option>
<option value="MT" >Montana</option>
<option value="NE" >Nebraska</option>
<option value="NV" >Nevada</option>
<option value="NH" >New Hampshire</option>
<option value="NJ" >New Jersey</option>
<option value="NM" >New Mexico</option>
<option value="NY" >New York</option>
<option value="NC" >North Carolina</option>
<option value="ND" >North Dakota</option>
<option value="OH" >Ohio</option>
<option value="OK" >Oklahoma</option>
<option value="OR" >Oregon</option>
<option value="PA" >Pennsylvania</option>
<option value="RI" >Rhode Island</option>
<option value="SC" >South Carolina</option>
<option value="SD" >South Dakota</option>
<option value="TN" >Tennessee</option>
<option value="TX" >Texas</option>
<option value="UT" >Utah</option>
<option value="VT" >Vermont</option>
<option value="VA" >Virginia</option>
<option value="WA" >Washington</option>
<option value="WV" >West Virginia</option>
<option value="WI" >Wisconsin</option>
<option value="WY" >Wyoming</option>
</select>
</select>
</td>
</tr>
<tr>
<td>Zip:</td>
<td><input name="zip" type="text" id="zip" size="20" value="<? echo "$zip"; ?>" /></td>
</tr>
<tr>
<td>Country:</td>
<td>United States</td>
</tr>
<tr>
<td colspan="2">
<div align="center">
<input name="terms" type="checkbox" value="accepted">
<font size="2">I have read and agree to the <a href="terms.php" target="_new">User Agreement</a></font></div></td>
</tr>
<tr>
<td colspan="2">
<div align="center">
<input type="submit" name="Submit" value="Submit" />
</div></td>
</tr>
<tr>
<td colspan="2">Ip Logged As: <? echo getenv('REMOTE_ADDR'); ?> <input name="ip" type="hidden" id="ip" value="<? echo getenv('REMOTE_ADDR'); ?>" /><input name="r" type="hidden" id="r" value="<? echo "$r"; ?>" />
<input name="gid" type="hidden" id="gid" value="<? echo "$gid"; ?>" /></td>
</tr>
<tr>
<td colspan="2"></td>
</tr>
</table>
</form>
<? } else { echo "Please Go To The Start Page"; } ?>
-
thefreebielife
- Forum Contributor
- Posts: 126
- Joined: Thu Apr 26, 2007 2:59 pm
- aaronhall
- DevNet Resident
- Posts: 1040
- Joined: Tue Aug 13, 2002 5:10 pm
- Location: Back in Phoenix, missing the microbrews
- Contact:
noahkeller wrote:toCode: Select all
mysql_query("insert into users values ('', '$username', '$pass2', '$fname', '$Email', '$address', '$city', '$state', '$zip', '$ip', '$gid', '$r', '0', '0', '$date', '$deadline', '')")
replacing the variables with whatever they may be of courseCode: Select all
mysql_query("INSERT INTO `users` (`username`,`password`,`fname`,`email`,`address`,`city`,`state`,`zip`,`country`,`phone`,`ip`,`gid`,`rid`,`ostatus`,`holdreason`,`astatus`,`date,`deadline,`dead`) VALUES ('$USERNAME','$PASSWORD','$FNAME','$EMAIL','$ADDRESS','$CITY','$STATE','$ZIP','$COUNTRY','$PHONE','$IP','$GID','$RID','$OSTATUS','$HOLDREASON','$ASTATUS','$DATE','$DEADLINE','$DEAD')")
-
thefreebielife
- Forum Contributor
- Posts: 126
- Joined: Thu Apr 26, 2007 2:59 pm
i already put that in:
Code: Select all
<?
$r = $_GET['r'];
//check ref id
if ($r != "") {
$sql = 'SELECT * FROM `users` WHERE `uId` = "'.$r.'"';
$query = mysql_query ($sql);
if (mysql_num_rows($query) ==0) {
$ref = "error";
$r=0;
}
}
//validate form
//get vars
if (isset($_GET["form"]) && $_GET['form'] == "submit") {
$Email = $_POST['email'];
$username2 = $_POST['username'];
$pass = $_POST['pass'];
$fname = $_POST['fname'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$ip = $_POST['ip'];
$r = $_POST['r'];
$date = date("F j, Y");
$gid = $_POST['gid'];
$error = "none";
$terms = $_POST['terms'];
$country = $_POST['country'];
$r = $_POST['r'];
$username = strtolower($username2);
$password = strtolower($password2);
$pass2 = md5($pass);
$deadline = date ("F j, Y", mktime(0,0,0,date('m'), date('d')+$limit, date('y')));
//validate
//validate zip
if (!zip_field($zip) or $zip == "") {
$error = "zip";
}
//validate state
if (!name_fields($state) or $state == "") {
$error = "state";
}
//validate city
if (!other_fields($city) or $city == "") {
$error = "city";
}
//validate address
if (!other_fields($address) or $address == "") {
$error = "address";
}
//validate gift
if ($gid == "") {
$error = "giftid";
}
//valiudate fname
if (!name_fields($fname) or $fname == "") {
$error = "firstname";
}
//validate password
if (!username_field($pass) or $pass == "") {
$error = "password";
}
//validate username
if (!username_field($username) or $username == "") {
$error = "username";
}
//validate email
if (!check_email($Email)) {
$error = "Email";
}
//validate terms
if ($terms == "" or $terms != "accepted")
{ $error = "terms"; }
//see if username is taken
$sql = 'SELECT * FROM `users` WHERE `username` = "'.$username.'"';
$query = mysql_query ($sql);
if (mysql_num_rows($query) !=0) {
echo '<center><font color="#ff0000"><h4>Username already exists. Please try again<br /><br /><a href=javascript:history.back()><< Go Back</a></h4>'; exit;
}
//check to see if email is used
$sql = 'SELECT * FROM `users` WHERE `email` = "'.$Email.'"';
$query = mysql_query ($sql);
if (mysql_num_rows($query) !=0) {
echo '<center><font color="#ff0000"><h4>This Email is already in use. Please try again<br /><br /><a href=javascript:history.back()><< Go Back</a></h4>'; exit;
}
//if not insert data
if ($error == "none") {
mail($Email,"Welcome To The Freebie Life!","Welcome to The Freebie Life! <br>
If you have any questions please contact support. <Br>We answer all questions within 1 DAY.<br>
Remember, all gifts are shipped on the 5th and 20th of each month.<Br>
<br>
Enjoy!<br>
Jared<br>
The Freebie Life Admin","From:Admin@thefreebielife.com\nContent-Type: text/html; charset=iso-8859-1");
mysql_query("INSERT INTO `users` (`username`, `password`, `fname`, `email`, `address`, `city`, `state`, `zip`, `country`, `ip`, `gid`, `rid`, `ostatus`, `holdreason`, `astatus`, `date`, `deadline`, `dead`) VALUES
('$USERNAME', '$PASSWORD', '$FNAME', '$EMAIL', '$ADDRESS', '$CITY', '$STATE', '$ZIP', '$COUNTRY', '$IP', '$GID', '$RID', '$OSTATUS', '$HOLDREASON', '$ASTATUS', '$DATE', '$DEADLINE', '$DEAD')")
or die("Could not insert data because ".mysql_error());
echo '<center><font color="#ff0000"><h4>Thank You, Your Account Has Been Created</h4>';
if ($error == "none") {
echo '<meta http-equiv="refresh" content="3;url=login.php">';
exit;
}
}
}
?>
<form action="register.php?form=submit" method="post" name="register2">
<table width="300" border="0" align="center" class="table" style="border: 1px dashed red; padding: 4px 4px 4px 4px; ">
<tr>
<td colspan="2"><div align="center"><?
if ($ref == "error") { echo "<font color=red><center>Your Referral Link Is Invalid</center></font>"; }
if ($error == "terms") { echo "<font color=red><center>Your Must Accept the User Agreement</center></font>"; }
if ($error == "username") { echo "<font color=red><center>Your Username is Incorrect</center></font>"; }
if ($error == "password") { echo "<font color=red><center>Your Password is Incorrect</center></font>"; }
if ($error == "firstname") { echo "<font color=red><center>Your First Name is Incorrect</center></font>"; }
if ($error == "address") { echo "<font color=red><center>Your Address is Incorrect</center></font>"; }
if ($error == "city") { echo "<font color=red><center>Your City is Incorrect</center></font>"; }
if ($error == "state") { echo "<font color=red><center>Your State is Incorrect</center></font>"; }
if ($error == "zip") { echo "<font color=red><center>Your Zip Code is Incorrect</center></font>"; }
if ($error == "Email") { echo "<font color=red><center>Your Email is Incorrect</center></font>"; }
if ($error == "giftid") { echo "<font color=red><center>You must select a gift from the main page</center></font>"; }
?></div></td>
</tr>
<tr>
<td colspan="2" style="border-bottom:1px dashed red "><div align="left"><strong>Sign Up Now </strong></div></td>
</tr>
<tr>
<td colspan="2"><div align="center"><strong>Account Information </strong></div></td>
</tr>
<tr>
<td width="141">Username:</td>
<td width="320"><input name="username" type="text" id="username" size="20" value="<? echo "$username" ?>" /></td>
</tr>
<tr>
<td>Email:</td>
<td><input name="email" type="text" id="email" size="20" value="<? echo "$Email" ?>" /></td>
</tr>
<tr>
<td>Password:</td>
<td><input name="pass" type="password" id="pass" value="<? echo "$pass"; ?>" size="20" /></td>
</tr>
<tr>
<td colspan="2"><div align="center"><strong>Shipping Information </strong></div></td>
</tr>
<tr>
<td height="26">Full Name: </td>
<td><input name="fname" type="text" id="fname" size="20" value="<? echo "$fname"; ?>" /></td>
</tr>
<tr>
<td>Address:</td>
<td><input name="address" type="text" id="address" size="20" value="<? echo "$address"; ?>" /></td>
</tr>
<tr>
<td>City:</td>
<td><input name="city" type="text" id="city" size="20" value="<? echo "$city"; ?>" /></td>
</tr>
<tr>
<td>State:</td>
<td><select name="state" id="state">
<option selected value=''>State</option>
<option value="AL" >Alabama</option>
<option value="AK" >Alaska</option>
<option value="AZ" >Arizona</option>
<option value="AR" >Arkansas</option>
<option value="CA" >California</option>
<option value="CO" >Colorado</option>
<option value="CT" >Connecticut</option>
<option value="DE" >Delaware</option>
<option value="DC" >District of Columbia</option>
<option value="FL" >Florida</option>
<option value="GA" >Georgia</option>
<option value="HI" >Hawaii</option>
<option value="ID" >Idaho</option>
<option value="IL" >Illinois</option>
<option value="IN" >Indiana</option>
<option value="IA" >Iowa</option>
<option value="KS" >Kansas</option>
<option value="KY" >Kentucky</option>
<option value="LA" >Louisiana</option>
<option value="ME" >Maine</option>
<option value="MD" >Maryland</option>
<option value="MA" >Massachusetts</option>
<option value="MI" >Michigan</option>
<option value="MN" >Minnesota</option>
<option value="MS" >Mississippi</option>
<option value="MO" >Missouri</option>
<option value="MT" >Montana</option>
<option value="NE" >Nebraska</option>
<option value="NV" >Nevada</option>
<option value="NH" >New Hampshire</option>
<option value="NJ" >New Jersey</option>
<option value="NM" >New Mexico</option>
<option value="NY" >New York</option>
<option value="NC" >North Carolina</option>
<option value="ND" >North Dakota</option>
<option value="OH" >Ohio</option>
<option value="OK" >Oklahoma</option>
<option value="OR" >Oregon</option>
<option value="PA" >Pennsylvania</option>
<option value="RI" >Rhode Island</option>
<option value="SC" >South Carolina</option>
<option value="SD" >South Dakota</option>
<option value="TN" >Tennessee</option>
<option value="TX" >Texas</option>
<option value="UT" >Utah</option>
<option value="VT" >Vermont</option>
<option value="VA" >Virginia</option>
<option value="WA" >Washington</option>
<option value="WV" >West Virginia</option>
<option value="WI" >Wisconsin</option>
<option value="WY" >Wyoming</option>
</select>
</select>
</td>
</tr>
<tr>
<td>Zip:</td>
<td><input name="zip" type="text" id="zip" size="20" value="<? echo "$zip"; ?>" /></td>
</tr>
<tr>
<td>Country:</td>
<td>United States</td>
</tr>
<tr>
<td colspan="2">
<div align="center">
<input name="terms" type="checkbox" value="accepted">
<font size="2">I have read and agree to the <a href="terms.php" target="_new">User Agreement</a></font></div></td>
</tr>
<tr>
<td colspan="2">
<div align="center">
<input type="submit" name="Submit" value="Submit" />
</div></td>
</tr>
<tr>
<td colspan="2">Ip Logged As: <? echo getenv('REMOTE_ADDR'); ?> <input name="ip" type="hidden" id="ip" value="<? echo getenv('REMOTE_ADDR'); ?>" /><input name="r" type="hidden" id="r" value="<? echo "$r"; ?>" />
<input name="gid" type="hidden" id="gid" value="<? echo "$gid"; ?>" /></td>
</tr>
<tr>
<td colspan="2"></td>
</tr>
</table>
</form>
<? } else { echo "Please Go To The Start Page"; } ?>
Last edited by thefreebielife on Thu Apr 26, 2007 5:13 pm, edited 1 time in total.
-
thefreebielife
- Forum Contributor
- Posts: 126
- Joined: Thu Apr 26, 2007 2:59 pm