...

View Full Version : Creating Registration



Phoenix
08-08-2002, 12:45 PM
I know i'm a newbie but pls do take me seriously. I would like to know if there is an javascript which collects the ip of a registering user and then reports it to you (the webmaster) so it is possible to ban them from your site if you think they are abusing it? This would be a great help to me if it's possible. Im only 13 and would appreciate it if someone could help. Im also interested in cookies, would be able to collect information about a user like "find how many times he/she has downloaded something"?

Someone PLEASE Reply

- Chris

mordred
08-08-2002, 02:50 PM
Sorry to disappoint you, but JavaScript is not suited for the tasks you described. You see, it's a client-side scripting language. That means it only runs in the browser of the user.

What you need is a server-side solution. There are plenty of languages that can serve your purpose, you'll first have to check out which your host provides. But maybe then your post is better located in the server-side forums.

Phoenix
08-08-2002, 05:50 PM
Ok, so is server side like a online data base

ihitman
08-08-2002, 06:44 PM
Well not necessarily. You could use a bit of java to pick up an ip address and then use a mail function to mail this to you.

eg.

<script language="javascript">
<!-- Original: Hostroute.com -->
<!-- Web Site: http://www.hostroute.com/script_ip.html -->

var ip = '<!--#echo var="REMOTE_ADDR"-->'

function ipval() {
document.myform.ipaddr.value=ip;
}
</script>

You would then have to use some server side scripting to package this off and send it via a mail to you.

For that though, look up CDONTS or JMail. Then again, if you're on a free server you're pretty much snarfed coz not mailing provide these services!

Good luck though,

ih.

Phoenix
08-08-2002, 06:48 PM
ok say lets say i ONLY needed to have the ip sent to me. would i have to have server side or is it always aviliable?

mordred
08-08-2002, 08:22 PM
Trust me, you want a server-side solution.

What ihitman posted was not java, but simpy a javascript that writes a variable's content into a form field. Though that seems to imply that it's possible to retrieve the IP via javascript, it's not true. The variable is generated through a server-side include (the <!--#echo var="REMOTE_ADDR"--> part).

There is absolutely no point in first writing the IP to the HTML output, and then trying to send it to you. It can be all done server-side at once without the involvement of javascript at all.

Phoenix
08-08-2002, 08:39 PM
hey i no im kinda goin off topic here but wot exactly is server side?

ihitman
08-09-2002, 08:26 AM
Yeah soz Mordred, that snippet was just a piece of code I found in a very BIG javascript folder I've got.

And Phoenix, check out this site : http://www.thescripts.com/serversidescripting/
It should provide you with everything you need to know...

ih.

Phoenix
08-09-2002, 09:23 AM
ok thanks guys, u'v been a great help :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum