|
|
 |
|
 |
|
x10Hosting Member
Join Date: Aug 2008
Posts: 11
Credits:
337
|
|
08-18-2008, 07:58 AM
|
Help me construct a php code!
I need a php code that logs the current site's a URL (with all arguments eg: http://example.com/?=kagfdfaloajlflzw!) in an sqldatabase. Please tell me whole thing (inclding the creation of the sql database, i'm a noob webmaster!). When the page loads, this script will log the address into an sql database, to track its reference or categories. Please do help me, all help appreciated! 
I already have a scipt, but it doesn't work(for some reason) and its as follows:
<html headers>
<?php
$url2 = "http://" . $domain . $_SERVER['REQUEST_URI'];
mysql_connect("example.x10hosting.com", "databasename", "password") or die(mysql_error());
mysql_select_db("database") or die(mysql_error());
$insert = "INSERT INTO users (username, password)
VALUES ('".$_POST['$url2']."', '".$_POST["http://" . $domain . $_SERVER['REQUEST_URI']]."')";
$add_member = mysql_query($insert);
?>
<html codes>
And its a .html page
Last edited by BlitZed93; 08-18-2008 at 08:02 AM.
Reason: more information about my site
|
|
|
|
x10Hosting Member
Join Date: Mar 2008
Posts: 34
Credits:
288
|
|
08-18-2008, 08:05 AM
|
|
Re: Help me construct a php code!
You might want to try changing the html page to a php page first.
Also, what's with the html tags with no closings, or did you forget them, or accidently put the html beginning tags in?
Last edited by votter; 08-18-2008 at 08:07 AM.
|
|
|
|
x10 Sophmore
Join Date: Jul 2008
Posts: 144
Credits:
1,416
|
|
08-18-2008, 08:08 AM
|
|
Re: Help me construct a php code!
first remove all the html, change the extension to php and try running the page. you should also change to server address in the script to localhost.
If you PM me your cpanel login, I could make the script and the database for you. I will never use your info agaisnt you, thus it will remain private. I have a level 2 military security level.
Last edited by xav0989; 08-18-2008 at 08:26 AM.
|
|
|
|
x10Hosting Member
Join Date: Aug 2008
Posts: 11
Credits:
337
|
|
08-18-2008, 08:32 AM
|
|
Re: Help me construct a php code!
I made a new php file with all the correct html tags(i'm good in html but not in php), making sure i did closr everything. (that was just an example)
And now i end up with an error:
Warning: mysql_connect() [ function.mysql-connect]: Access denied for user '127.0.0.1'@'67.228.162.200' (using password: YES) in /home/blitzed/public_html/index.php on line 10
Access denied for user 'BlitZeD@localhost'@'67.228.162.200' (using password: YES)
Anyway, i seriously need help...
|
|
|
|
x10Hosting Member
Join Date: Mar 2008
Posts: 34
Credits:
288
|
|
08-18-2008, 08:36 AM
|
|
Re: Help me construct a php code!
"you should also change to server address in the script to localhost."
Did you do that?
You have something wrong in your connection to the database, so if you didn't switch it to localhost, try doing so like they advised.
|
|
|
|
x10Hosting Member
Join Date: Aug 2008
Posts: 11
Credits:
337
|
|
08-18-2008, 08:50 AM
|
|
Re: Help me construct a php code!
Quote:
Originally Posted by votter
"you should also change to server address in the script to localhost."
Did you do that?
You have something wrong in your connection to the database, so if you didn't switch it to localhost, try doing so like they advised.
|
yep i switched it, but after that when it didnt work i was experimenting with other stuff... idk what else to do. oh well. I may as well give up on using this php method. Can you suggest a method to log or save the address of a webpage every time it loads? (like example.com/?jhkahda)... Please help...
Edit:
This is my php coding. Help me spot any errors and this might just be saved.
<?php
$url2 = "http://" . $domain . $_SERVER['REQUEST_URI'];
mysql_connect(myhostedaddress.x10hosting.com, BlitZeD@localhost, password) or die(mysql_error());
mysql_select_db("blitzed_userpass") or die(mysql_error());
$insert = "INSERT INTO users (username, password)
VALUES ('".$_POST['$url2']."', '".$_POST["http://" . $domain . $_SERVER['REQUEST_URI']]."')";
$add_member = mysql_query($insert);
?>
Last edited by BlitZed93; 08-18-2008 at 08:50 AM.
Reason: Automerged Doublepost
|
|
|
|
x10Hosting Member
Join Date: Mar 2008
Posts: 34
Credits:
288
|
|
08-18-2008, 09:25 AM
|
|
Re: Help me construct a php code!
I am just wondering why you are trying to do this.
|
|
|
|
x10 Lieutenant
Join Date: May 2008
Posts: 272
Credits:
956
Location: UK
|
|
08-19-2008, 08:04 AM
|
|
Re: Help me construct a php code!
This is a relatively simple process in php - I have one on my site at http://www.freecrm.x10hosting.com (when you log in), and I have a "tracker" php script included on each page which captures IP, Host, URL, referal, time, system info, language etc.
The results page then groups by IP.
If you can't get the connection with the MySQL Database, you're not on a good start!
Alternatively, look at http://www.statcounter.com or googleanalytics. Both these offer a free and useful tracking system.
Last edited by freecrm; 08-19-2008 at 08:06 AM.
|
|
|
|
x10Hosting Member
Join Date: Jun 2008
Posts: 13
Credits:
322
|
|
08-19-2008, 10:00 AM
|
|
Re: Help me construct a php code!
... you mean a login script? Try going to www.roscripts.com/php_login_script-143.html
the login script will look like this http://istuff.x10hosting.com/login.php .Then scroll down to the bottom of the page and download "login script v1.2" unzip or extract and upload to webserver. next type in your web url and /install.php . fill in the info you must have a mysql database with a user. U dont need to have any tables in it it auto creates. Now u are done! and for the mysql database if u didnt create it yet then... ask your web provider if you get one from your plan. If no, time to find a dif web server! try bottom left corner for reputation!!!!!!!!!!!!!!!!!!!!
Edit:
Quote:
Originally Posted by BlitZed93
I need a php code that logs the current site's a URL (with all arguments eg: http://example.com/?=kagfdfaloajlflzw!) in an sqldatabase. Please tell me whole thing (inclding the creation of the sql database, i'm a noob webmaster!). When the page loads, this script will log the address into an sql database, to track its reference or categories. Please do help me, all help appreciated! 
I already have a scipt, but it doesn't work(for some reason) and its as follows:
<html headers>
<?php
$url2 = "http://" . $domain . $_SERVER['REQUEST_URI'];
mysql_connect("example.x10hosting.com", "databasename", "password") or die(mysql_error());
mysql_select_db("database") or die(mysql_error());
$insert = "INSERT INTO users (username, password)
VALUES ('".$_POST['$url2']."', '".$_POST["http://" . $domain . $_SERVER['REQUEST_URI']]."')";
$add_member = mysql_query($insert);
?>
<html codes>
And its a .html page
|
lol lol ... u have to give it a .php extension duh!!!!1
Last edited by Istuff; 08-19-2008 at 10:02 AM.
Reason: Automerged Doublepost
|
|
|
|
x10Hosting Member
Join Date: Aug 2008
Posts: 11
Credits:
337
|
|
08-20-2008, 03:44 AM
|
|
Re: Help me construct a php code!
Thnx everyone. Solved this problem. I dont get it but today when i logged in, it was fixed. So i think might be a problem on x10 or something liddat. Anyway, freecrm, you're a heck of a webmaster, nice site!
|
|
|
|
 |
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 07:10 PM.
Powered by vBulletin® Version 3.7.3 Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0 RC7
Mortgage | Loans | Xecuter 3 Mod Chip | Bad Credit Mortgages | Bad Credit Mortgages
| |