Web Analytics Made Easy -
StatCounter confused about this code + ip adress - CodingForum

Announcement

Collapse
No announcement yet.

confused about this code + ip adress

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

  • confused about this code + ip adress

    i have the following code:

    Code:
            <?
    
    $u = $_POST['u'];
    $p = $_POST['p'];
    $e = $_POST['e'];
    $country = $_POST['country'];
    $g = $_POST['gender'];
    $a = $_POST['age'];
    $ref = $_POST['ref'];
    
    $u = htmlspecialchars($u);
    $p = htmlspecialchars($p);
    $e = htmlspecialchars($e);
    $g = htmlspecialchars($g);
    $d = htmlspecialchars($d);
    $ref = htmlspecialchars($ref);
    
    if($u && $p && $e && $a && $g) {
    $check = mysql_num_rows(mysql_query("SELECT * FROM `members` WHERE `username`=\"$u\""));
    
    if($check==0) {
    
    		$month = $_POST['month'];
    		$day = $_POST['day'];
    		$year = $_POST['year'];
    		$sign = $_POST['sign'];
    		
    		$month = htmlspecialchars($month);
    		$day = htmlspecialchars($day);
    		$year = htmlspecialchars($year);
    		$sign = htmlspecialchars($sign);
    		
    			 $date = date("m/d/y");
    			 
    			// remove spaces
    			// $uu = str_replace (" ", '$u', $uu);
    			// echo $uu;
    			// echo $u;
    			// die;
    			 
    			 	$insert = mysql_query("INSERT INTO `members` (`country`, `gender`, `age`, `date`, `dob`, `username`, `password`, `email`, `ref`) VALUES('$country', '$g', '$a', '$date', '$month/$day/$year', \"$u\", \"$p\", \"$e\", \"$ref\")");
    $msg = mysql_query("INSERT INTO `messages` (`to`, `from`, `subject`, `message`, `status`, `date`) VALUES(\"$u\", 'admin', 'Welcome', '$mess', 'unread', '$date')");
    			 	
    			 	
    				 	
    						$_SESSION['Board'] = $u;
    			 			if (session_register('Board')) {
    				 		 	print "You have been registered. You are now able
    							  to access all of the features on this site.<p>
    							  <a href=\"index.php\">Click here to continue</a>";
    				 		 	print "";
    				 		}
    				 		else {
    				 		 	print "Cant set session!";
    				 		}
    and the thing is, i have NO clue whats going on, but what im trying to do is add a $_SERVER['REMOTE_ADDR'] into 'ip'. i have it on the form page as

    Code:
        <tr>
          <td bgcolor="#10d305"><input type="hidden" name="ip" value="<?php echo $_SERVER['REMOTE_ADDR']; ?>" size="10" /></td>
        </tr>
    Last edited by markman641; Aug 19, 2011, 01:08 AM.
    Ever want to see inside of a rave? Check out RedRoll and join our community of EDM lovers and rave fanatics.

  • #2
    basically what im trying to do is insert the users IP address into mysql but the code is confusing me beyond belief.
    Ever want to see inside of a rave? Check out RedRoll and join our community of EDM lovers and rave fanatics.

    Comment


    • #3
      Figured it out, closed
      Ever want to see inside of a rave? Check out RedRoll and join our community of EDM lovers and rave fanatics.

      Comment


      • #4
        Please don't post in a public forum asking for help and then NOT post the solution. Others may benefit from a solution being posted if they have a similar problem to yours.

        Comment

        Working...
        X
        😀
        🥰
        🤢
        😎
        😡
        👍
        👎