Jump to content


Photo

Code for IP harvest needed


  • Please log in to reply
11 replies to this topic

#1 MsSummer

MsSummer

    Newbie

  • New Members
  • Pip
  • 5 posts

Posted 21 September 2013 - 08:21 PM

I had a line of code in a registration form years ago. I lost access to the server while in a coma for two years. Now I'm back and need the code.

When people fill out the registration form for a Wordpress blog, the info is emailed tto me. I used to get their IP at the end of the form. I need that line of code to parse (I think that's the right terminology) their IP onto the end of their registration.

#2 ignace

ignace

    Now mod flavored

  • Moderators
  • 6,248 posts
  • LocationBelgium

Posted 22 September 2013 - 03:03 AM

Do a "forgot password" or contact your hosting company to get your credentials. If you are paying for the hosting this should be no problem.

#3 DFulg

DFulg

    Member

  • Members
  • PipPip
  • 27 posts

Posted 22 September 2013 - 07:29 AM

:psychic:



#4 brentman

brentman

    Member

  • Members
  • PipPip
  • 28 posts

Posted 22 September 2013 - 02:45 PM

I think you want this:

$ip = $_SERVER['REMOTE_ADDR'];


#5 MsSummer

MsSummer

    Newbie

  • New Members
  • Pip
  • 5 posts

Posted 22 September 2013 - 03:13 PM

Ignace, duh???  IF I could just email someone for access, don't you think I could have thought of that?? :)  My business was sold while ill so although I have the server info, the pass isn't under my email.  Otherwise I'd get access and put 70+ websites back up.

 

Brentman -- thank you!  What format do I put that in?  I've lost memory so can't code anymore (yes, I appear stupid now but used to write scripts in PHP) and know there is a <?php or something in front of it.  I can't retain memory now or I'd start to relearn coding.



#6 cyberRobot

cyberRobot

    Advanced Member

  • Gurus
  • 1,655 posts

Posted 23 September 2013 - 08:34 AM

You might want to review the basics of PHP here:

http://php.net/manua...bles.basics.php

 

Also, information on the $_SERVER variable can be found here:

http://php.net/manua...bles.server.php


Blogging about PHP and other web development topics at ScorpBytes.com

#7 MsSummer

MsSummer

    Newbie

  • New Members
  • Pip
  • 5 posts

Posted 23 September 2013 - 02:53 PM

Thanks.  It's all Chinese to me basically.  I spent years learning to code PHP, HTML, etc but now it is just foreign to me.  Or if it looks familiar, I forget it after a bit.

 

I did a little research.  Please correct me if I'm wrong.  At the end of my WordPress user registration form I'll add this:

 

<?php
echo "
$ip = $_SERVER['REMOTE_ADDR'];";
?>

 

When the reg is emailed to me, the last line will be the IP of the person submitting.



#8 AbraCadaver

AbraCadaver

    Cracka Memba

  • Gurus
  • 1,888 posts
  • LocationThe Republic of Texas

Posted 23 September 2013 - 03:00 PM

No, you would add: $_SERVER['REMOTE_ADDR'] to whatever variable contains the rest of the email message.  Maybe $message or something like that.  Post the email message code and it should be easy.


mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.

#9 Ch0cu3r

Ch0cu3r

    Advanced Member

  • Moderators
  • 2,145 posts

Posted 23 September 2013 - 03:00 PM

No you'll need to echo out the $ip variable. Othwerwise it'll just echo the string $ip = $_SERVER['REMOTE_ADDR']; as-is.

$ip = $_SERVER['REMOTE_ADDR'];
echo $ip; // this will echo out the IP


#10 MsSummer

MsSummer

    Newbie

  • New Members
  • Pip
  • 5 posts

Posted 23 September 2013 - 03:11 PM

Thank you.  I need the <? php etc before/after as well?  {I'm tempted to hire a h4cker to grab the old file j/k}

 

 

No you'll need to echo out the $ip variable. Othwerwise it'll just echo the string $ip = $_SERVER['REMOTE_ADDR']; as-is.

$ip = $_SERVER['REMOTE_ADDR'];
echo $ip; // this will echo out the IP


#11 Ch0cu3r

Ch0cu3r

    Advanced Member

  • Moderators
  • 2,145 posts

Posted 23 September 2013 - 03:13 PM

Yes all php code needs to be enclosed in <?php and ?> tags



#12 MsSummer

MsSummer

    Newbie

  • New Members
  • Pip
  • 5 posts

Posted 23 September 2013 - 03:43 PM

Again, thank you.  In time I hope to get back to coding!






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com