x10Hosting Forums

Corporate Free Hosting for the Masses.



Register

Reply
 
LinkBack Thread Tools Display Modes
x10Hosting Member

Join Date: Aug 2008
Posts: 11
Credits: 337
BlitZed93 is on a distinguished road
Quote  
08-18-2008, 07:58 AM
Exclamation 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
Reply With Quote
BlitZed93 is offlineReport Post
x10Hosting Member

Join Date: Mar 2008
Posts: 34
Credits: 288
votter is on a distinguished road
Quote  
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.
Reply With Quote
votter is offlineReport Post
x10 Sophmore

Join Date: Jul 2008
Posts: 144
Credits: 1,416
xav0989 is on a distinguished road
Quote  
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.
Reply With Quote
xav0989 is offlineReport Post
x10Hosting Member

Join Date: Aug 2008
Posts: 11
Credits: 337
BlitZed93 is on a distinguished road
Quote  
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...
Reply With Quote
BlitZed93 is offlineReport Post
x10Hosting Member

Join Date: Mar 2008
Posts: 34
Credits: 288
votter is on a distinguished road
Quote  
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.
Reply With Quote
votter is offlineReport Post
x10Hosting Member

Join Date: Aug 2008
Posts: 11
Credits: 337
BlitZed93 is on a distinguished road
Quote  
08-18-2008, 08:50 AM
Re: Help me construct a php code!

Quote:
Originally Posted by votter View Post
"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
Reply With Quote
BlitZed93 is offlineReport Post
x10Hosting Member

Join Date: Mar 2008
Posts: 34
Credits: 288
votter is on a distinguished road
Quote  
08-18-2008, 09:25 AM
Re: Help me construct a php code!

I am just wondering why you are trying to do this.
Reply With Quote
votter is offlineReport Post
x10 Lieutenant

freecrm's Avatar

Join Date: May 2008
Posts: 272
Credits: 956
freecrm will become famous soon enough
Location: UK

Quote  
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.
Reply With Quote
freecrm is offlineReport Post
x10Hosting Member

Istuff's Avatar

Join Date: Jun 2008
Posts: 13
Credits: 322
Istuff is on a distinguished road
Quote  
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 View Post
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
Reply With Quote
Istuff is offlineReport Post
x10Hosting Member

Join Date: Aug 2008
Posts: 11
Credits: 337
BlitZed93 is on a distinguished road
Quote  
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!
Reply With Quote
BlitZed93 is offlineReport Post
Reply

Tags
create, noob, php, script

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
BB Code Guide Jober68 Tutorials 1 01-10-2008 06:12 PM
"PHP Startup: Invalid Library" - Interesting error javaguy78 Free Hosting 5 03-27-2007 03:33 PM
I need php code for downloading zip files from my site !! careerbridge Scripts & 3rd Party Apps 11 07-16-2006 01:57 PM
Ever Been Suspended For Using PHP? dragoneye_xp Off Topic 24 07-11-2006 02:05 PM
PHP Easter Eggs dragoneye_xp Off Topic 3 06-14-2006 06:48 PM


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
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

Mortgage | Loans | Xecuter 3 Mod Chip | Bad Credit Mortgages | Bad Credit Mortgages