phpwiz Posted August 20, 2009 Share Posted August 20, 2009 ok, i have made a register script on my localhost and i made an IP variable so that it inserts the users IP when they register but when i tested it it dosent show the IP it says ::1 in the database PLEASE HELP!!!! here is tthe code: <?php //connect to database $connect = mysql_connect("localhost","root",""); mysql_select_db("members"); $submit = $_POST['submit']; // form data $username = (strip_tags($_POST['username'])); $password = (strip_tags($_POST['password'])); $repeatpassword = (strip_tags($_POST['repeatpassword'])); $date = date("Y-m-d"); $IP = $_SERVER['REMOTE_ADDR']; $avatar = "http://www.pokemonelite2000.com/sprites/frlgemtr/frlgemtr113.png"; $money = 250; $sig = "No Signature"; $title = (strip_tags($_POST['title'])); $email = (strip_tags($_POST['email'])); $group = 0; $form = 1; $gender1 = @$_POST['gender']; $gender = $_POST['gender']; if ($submit) { $namecheck = mysql_query("SELECT username FROM users WHERE username='$username'"); $count = mysql_num_rows($namecheck); if ($count!=0) { die("This username has already been taken! <a href='register.php'>Back?</a>"); } //check for existance if ($username&&$password&&$repeatpassword&&$email&&$title) { if($password==$repeatpassword) { //check char length of username and name if (strlen($username)>35||strlen($email)>255||strlen($title)>55) { echo "Length of username,email or Title is too long! <a href='register.php'>Back?</a>"; } else { //check password length if (strlen($password)>100||strlen($password)<6) { echo "Password must be between 6 and 35 characters <a href='register.php'>Back?</a>"; } else { //register the user switch ($gender) { case "Male"; $gender_db = "M"; break; case "Female"; $gender_db = "F"; break; } //encrypt password $password = md5($password); $repeatpassword = md5(repeatpassword); $queryreg = mysql_query("INSERT INTO users VALUES('','$username','$password','$title','$sig','$gender_db','$email','$group','$date','$avatar','$credits','$IP') "); die ("You have Successfully been registered! <a href='login.php'>login</a>"); } } } else echo "Your passwords do not match! <a href='register.php'>Back?</a>"; } else echo "Please fill in <b>all</b> fields! <a href='register.php'>Back?</a>"; } ?> <form action="<?php echo $PHP_SELF ?>" method="POST"> <table> <tr> <td><font size='2' face='arial'>Username:</td> <td><input type="text" name="username" value="<?php echo $username ?>"></td> </tr> <tr> <td><font size='2' face='arial'>Password:</td> <td><input type="password" name="password"></td> </tr> <tr> <td><font size='2' face='arial'>Confirm:</td> <td><input type="password" name="repeatpassword"></td> </tr> <tr> <td><font size='2' face='arial'>Email:</td> <td><input type='text' name='email'></td> </tr> <tr> <td><font size='2' face='arial'>Trainer Title</td> <td><input type='text' name='title'></td> </tr> <tr> <td><font size='2' face='arial'>Gender:</td> <td><font size='2' face='arial'><select name='gender'> <option>Male</option> <option>Female</option> </select></td> </tr> <tr> <td colspan="2" align="center"><input type="submit" name="submit" value="Register"></td> </tr> </table></font> </form> </td> </tr> </table> Quote Link to comment Share on other sites More sharing options...
phpwiz Posted August 20, 2009 Author Share Posted August 20, 2009 can someone please help i need this fixed ASAP!!!! Quote Link to comment Share on other sites More sharing options...
markwillis82 Posted August 20, 2009 Share Posted August 20, 2009 have you setup connections / apache to use IP v6 ? as ::1 is the IPv6 of 127.0.0.1 Quote Link to comment Share on other sites More sharing options...
trq Posted August 20, 2009 Share Posted August 20, 2009 You need to make sure your server is configured to use ip4v addresses only. make sure your Listen directive looks like.... Listen 80 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.