Jump to content


textbox and mysql


10 replies to this topic

#1 ProjectWhat

    Young Padawan

  • Members
  • Pip
  • 75 posts

Posted 15 January 2007 - 01:36 AM

I have a textbox. if i enter www.google.com in it it takes it and stores it into a mysql database. How would I do this?

#2 Demonslay

    P2L Jedi

  • Members
  • PipPipPip
  • 970 posts
  • Gender:Male
  • Location:A strange world where water falls out of the sky... for no reason.
  • Interests:Graphic Design, Coding, Splinter Cell, Cats

Posted 15 January 2007 - 01:45 AM

http://www.pixel2life.com/tutorials/php_co...ql_integration/

You're on the world's largest tutorial indexing site. Easy question...

#3 ProjectWhat

    Young Padawan

  • Members
  • Pip
  • 75 posts

Posted 15 January 2007 - 02:17 AM

well let em rephrase my question. how do i take what is displayed in the address box on in the top of the browser and save it as a varible is the page, so i can then save it to a database?

note: already know the DB stuff. Need to know how to get the address bar info.

<edit>
I have this so far
$address = $_SERVER['HTTP_REFERER'];

But i need the actual page its on. Not the one before that.

Edited by ProjectWhat, 15 January 2007 - 02:46 AM.


#4 Mr. Matt

    Moderator

  • P2L Staff
  • PipPipPipPip
  • 1,945 posts
  • Gender:Not Telling

Posted 15 January 2007 - 07:51 AM

if( $_SERVER['HTTPS'] == 'on' ) {
	$url = 'https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
} else {
	$url = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
}

With this code, you are seeing if the $_SERVER['HTTPS'] is on, if it is the user is using the https protocol, and if it is off, they are just on http.

If you want to use it for ftp:// aswell it will take a little modifying of the script.

This again is a frequently asked question, quick forum search / database search will have your answer.

Matt

#5 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 16 January 2007 - 05:20 PM

Keep in mind, you can only get the address info for your site. You can't put something on another site (like a dynamic sig), and try to get the address of the other site that way.

#6 fiv3isaliv3

    Young Padawan

  • Members
  • Pip
  • 258 posts
  • Gender:Male

Posted 17 January 2007 - 02:02 PM

View Postrc69, on Jan 16 2007, 05:20 PM, said:

Keep in mind, you can only get the address info for your site. You can't put something on another site (like a dynamic sig), and try to get the address of the other site that way.

Yeah you could. But it would be much more complex. What do you think those tracking images on websites do?

#7 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 17 January 2007 - 02:06 PM

What i meant was you couldn't do it with the example code provided. I didn't mean it was impossible :rolleyes:

#8 Dayon

    Young Padawan

  • Members
  • Pip
  • 5 posts

Posted 17 January 2007 - 02:39 PM

View PostProjectWhat, on Jan 15 2007, 02:17 AM, said:

well let em rephrase my question. how do i take what is displayed in the address box on in the top of the browser and save it as a varible is the page, so i can then save it to a database?

I don't think that can be done.

If you're at yoursite.com and you type "othersite.com" into the address bar, there is no GET or POST. The user will just goto othersite.com.

However.

You might be able to do something with this:
http://ajaxian.com/a...ton-overloading
It stops the user from leaving the page - you might be able to use it to collect the address box, then pass it to php, then redirect to where the user wanted to go.

#9 Demonslay

    P2L Jedi

  • Members
  • PipPipPip
  • 970 posts
  • Gender:Male
  • Location:A strange world where water falls out of the sky... for no reason.
  • Interests:Graphic Design, Coding, Splinter Cell, Cats

Posted 17 January 2007 - 04:53 PM

View PostDayon, on Jan 17 2007, 01:39 PM, said:

View PostProjectWhat, on Jan 15 2007, 02:17 AM, said:

well let em rephrase my question. how do i take what is displayed in the address box on in the top of the browser and save it as a varible is the page, so i can then save it to a database?

I don't think that can be done.

If you're at yoursite.com and you type "othersite.com" into the address bar, there is no GET or POST. The user will just goto othersite.com.

However.

You might be able to do something with this:
http://ajaxian.com/a...ton-overloading
It stops the user from leaving the page - you might be able to use it to collect the address box, then pass it to php, then redirect to where the user wanted to go.


Hmm, that sounds like an interesting idea. Even with how evil it sounds at first. :rolleyes:
Make sure you make it secure, as there are some malicious ways it seems that people use that method.

#10 ProjectWhat

    Young Padawan

  • Members
  • Pip
  • 75 posts

Posted 01 February 2007 - 06:52 PM

i am using phpproxy on my server. All i want to do is : whatever shows up in the address bar including varibles with be inserted into a database.

#11 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 02 February 2007 - 12:52 AM

The only part of the address bar you can obtain are the parts that pertain to your site when it first loads. What ever gets entered into the address bar while your site is loading or after it is finished is not accessible.

The reason for this, i'm sure, is security. There may be some hacks you can try to get around this, but none of them will be pretty, convenient, or in anyway sane.

My question to you is, why would you want to do this? And why don't you just put an "address" bar on your site that would first go to a logging page, then redirect to the address entered?





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users