HTML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignHTML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 27th, 2013, 12:35 PM
andrea825 andrea825 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 7 andrea825 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 1 m 9 sec
Reputation Power: 0
Facebook
Question Hi I had this code and now i lost it

Hi I had this code and now i lost it, Im looking for html code that when someone gose on my website i get there ip address and it saves to a database, how can i get this agine thanks for your time

Reply With Quote
  #2  
Old January 27th, 2013, 01:01 PM
Nanomech's Avatar
Nanomech Nanomech is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2011
Location: The Pleiades
Posts: 192 Nanomech User rank is Sergeant (500 - 2000 Reputation Level)Nanomech User rank is Sergeant (500 - 2000 Reputation Level)Nanomech User rank is Sergeant (500 - 2000 Reputation Level)Nanomech User rank is Sergeant (500 - 2000 Reputation Level)Nanomech User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 23 h 7 m 18 sec
Reputation Power: 7
Send a message via Skype to Nanomech
You could use a server-side language such as PHP to do this. Would be quite easy to implement also.

Regards,

NM.
__________________
"WERE NOT WORTHY!"
"WERE NOT WORTHY!"

Reply With Quote
  #3  
Old January 27th, 2013, 01:08 PM
andrea825 andrea825 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 7 andrea825 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 1 m 9 sec
Reputation Power: 0
Facebook
Ok, but how do i do it and use php Iv only used html

Reply With Quote
  #4  
Old January 27th, 2013, 01:26 PM
Nanomech's Avatar
Nanomech Nanomech is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2011
Location: The Pleiades
Posts: 192 Nanomech User rank is Sergeant (500 - 2000 Reputation Level)Nanomech User rank is Sergeant (500 - 2000 Reputation Level)Nanomech User rank is Sergeant (500 - 2000 Reputation Level)Nanomech User rank is Sergeant (500 - 2000 Reputation Level)Nanomech User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 23 h 7 m 18 sec
Reputation Power: 7
Send a message via Skype to Nanomech
Are you using a host to host your website? If so you can work with files on your server.

If not, i'd install a program called WAMP(for Windows users), MAMP(for Mac users), LAMP(for linux user) and there is one called XAMPP which I've never read about.

I don't mind writing it for you but obviously you're going to want somewhere to test it and you will need either a host or a local server (WAMP) to test the PHP and MySQL operations.

What OS are you running?

Kind regards,

NM.

Reply With Quote
  #5  
Old January 27th, 2013, 01:33 PM
andrea825 andrea825 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 7 andrea825 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 1 m 9 sec
Reputation Power: 0
Facebook
Hi, Im runing windows xp , and I am using this for a test site but still waiting for verification form them but ya php.
programmingandhacking.netai.net

Reply With Quote
  #6  
Old January 27th, 2013, 01:54 PM
Nanomech's Avatar
Nanomech Nanomech is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2011
Location: The Pleiades
Posts: 192 Nanomech User rank is Sergeant (500 - 2000 Reputation Level)Nanomech User rank is Sergeant (500 - 2000 Reputation Level)Nanomech User rank is Sergeant (500 - 2000 Reputation Level)Nanomech User rank is Sergeant (500 - 2000 Reputation Level)Nanomech User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 23 h 7 m 18 sec
Reputation Power: 7
Send a message via Skype to Nanomech
Download WAMP here: http://www.wampserver.com/en/

Regards,

NM.

Reply With Quote
  #7  
Old January 27th, 2013, 02:38 PM
andrea825 andrea825 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 7 andrea825 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 1 m 9 sec
Reputation Power: 0
Facebook
Ok have it installed now.

Reply With Quote
  #8  
Old January 27th, 2013, 03:15 PM
Nanomech's Avatar
Nanomech Nanomech is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2011
Location: The Pleiades
Posts: 192 Nanomech User rank is Sergeant (500 - 2000 Reputation Level)Nanomech User rank is Sergeant (500 - 2000 Reputation Level)Nanomech User rank is Sergeant (500 - 2000 Reputation Level)Nanomech User rank is Sergeant (500 - 2000 Reputation Level)Nanomech User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 23 h 7 m 18 sec
Reputation Power: 7
Send a message via Skype to Nanomech
Ok that's great.

First we should really create a database.

When you run WAMP, click the icon in the taskbar and go to phpMyAdmin.

When that loads up, click on the 'Databases' tab in the top menu. When the page loads, enter a name for your database and click create. Call it something like user_info.

Ok, now we have our database but we need a table to hold the information. When the database is created, you get taken to a new page, find the 'Create Table' input field and enter a name for your table. Something descriptive like 'user_ips' in the 'Number of Columns' field, let's enter just the minimum required for now which is 2 and click the 'Go' button.

phpMyAdmin will now bring up a 'form' type box. In the name field for the first field, enter 'id' as the name. Leave it as an 'INT' type. In the 'Length/Values' column type something like 10.

Go over to the right - click the drop down list in under the 'Index' column and select 'PRIMARY'. Then the last thing to do is make sure you tick the 'A-I' (Auto-Increment) checkbox.

Go to your next field - for the name type in 'ip_addresses'. Change the type to a varchar and give it a length/value of say 30 to be covered.

Now click the 'Save' button and your set to go.

Now, create your HTML page but save it as a .php file and NOT .html.

Still add your doctype, head,body etc tags just as you would normally with a basic HTML file.

In the top of the page, even BEFORE the <!DOCTYPE> declaration, add this:
PHP Code:
<?php

$user_ip 
$_SERVER['REMOTE_ADDR'];

$conn = new mysqli("localhost","root","","user_ips") or die(mysqli_error());

$stmt $conn->prepare("INSERT INTO user_info (ip_addresses) VALUES (?)") or die(mysqli_error());
$stmt->bind_param("s",$user_ip);
$stmt->execute();
$stmt->store_result();

$rows $stmt->affected_rows;

if(
$rows == 1)
{
    echo 
"Successfully inserted into database!";
}
else
{
    echo 
"Error with the insert.";
}

?>


Make sure when you add it that the ending PHP bracket (the ?>) has no space after it. Your doctype must come STRAIGHT after it.

For example this is wrong:
PHP Code:
<?php
//insert to database bla bla
?>

<!DOCTYPE>


Notice how there is space between the ending php tag and the doctype. You must do it like this:

PHP Code:
<?php
//insert to database bla bla
?>
<!DOCTYPE>


Notice no space.

Have a go, if you follow it exactly as i've said you should get on ok.

Good luck

Kind regards,

NM.

Last edited by Nanomech : January 27th, 2013 at 03:18 PM.

Reply With Quote
  #9  
Old January 27th, 2013, 05:05 PM
andrea825 andrea825 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 7 andrea825 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 1 m 9 sec
Reputation Power: 0
Facebook
do you know any good php makers like FrontPage.

Reply With Quote
  #10  
Old January 27th, 2013, 05:37 PM
Nanomech's Avatar
Nanomech Nanomech is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2011
Location: The Pleiades
Posts: 192 Nanomech User rank is Sergeant (500 - 2000 Reputation Level)Nanomech User rank is Sergeant (500 - 2000 Reputation Level)Nanomech User rank is Sergeant (500 - 2000 Reputation Level)Nanomech User rank is Sergeant (500 - 2000 Reputation Level)Nanomech User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 23 h 7 m 18 sec
Reputation Power: 7
Send a message via Skype to Nanomech
No. I write everything manually with Notepad++.

Regards,

NM.

Reply With Quote
  #11  
Old January 27th, 2013, 11:48 PM
sir_drinxalot's Avatar
sir_drinxalot sir_drinxalot is offline
Known to taste like chicken
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: In front of my computer
Posts: 377 sir_drinxalot User rank is Captain (20000 - 30000 Reputation Level)sir_drinxalot User rank is Captain (20000 - 30000 Reputation Level)sir_drinxalot User rank is Captain (20000 - 30000 Reputation Level)sir_drinxalot User rank is Captain (20000 - 30000 Reputation Level)sir_drinxalot User rank is Captain (20000 - 30000 Reputation Level)sir_drinxalot User rank is Captain (20000 - 30000 Reputation Level)sir_drinxalot User rank is Captain (20000 - 30000 Reputation Level)sir_drinxalot User rank is Captain (20000 - 30000 Reputation Level)sir_drinxalot User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 1 Week 3 h 27 m 44 sec
Reputation Power: 293
Send a message via MSN to sir_drinxalot
Quote:
Originally Posted by andrea825
do you know any good php makers like FrontPage.
"good" and "frontpage" should never be used in the same sentence. It's so full of security holes and bugs it's not funny.

Long story short no, there are no "php makers" out there. The closest thing would be a 'CMS' like Drupal. CMSs tend to have a lot of overheads (and potential security issues of their own, although there are usually decent security patches coming out fairly regularly), so for a simple website I would highly recommend just writing the code yourself. Like Nanomech said, notepad++ is the way to go on windows.
__________________
"Take thy beak from out my heart, and take thy form from off my door" - Homer J Simpson / Edgar Allan Poe

Looking for a project Idea?

Reply With Quote
  #12  
Old January 29th, 2013, 11:58 AM
paulh1983 paulh1983 is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Dec 2004
Posts: 2,222 paulh1983 User rank is First Lieutenant (10000 - 20000 Reputation Level)paulh1983 User rank is First Lieutenant (10000 - 20000 Reputation Level)paulh1983 User rank is First Lieutenant (10000 - 20000 Reputation Level)paulh1983 User rank is First Lieutenant (10000 - 20000 Reputation Level)paulh1983 User rank is First Lieutenant (10000 - 20000 Reputation Level)paulh1983 User rank is First Lieutenant (10000 - 20000 Reputation Level)paulh1983 User rank is First Lieutenant (10000 - 20000 Reputation Level)paulh1983 User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 2 Weeks 1 Day 9 h 5 m 25 sec
Reputation Power: 201
and this is 2012. Frontpage still exists? Dreamweaver, I would say is better.

PHP code cannot be written by dreamweaver/frontpage. You can google for script put that into your page.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignHTML Programming > Hi I had this code and now i lost it

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap