Jump to content

mysql result as a direct link to address bar


villain222

Recommended Posts

OK, here is my scenario.  I'm working on a method to find specific users ip address within a vpn.  I have the DB all set to test, and I've got the search and form working correctly as I can echo the correct record.  Now I'm looking for a way to pass the ip address that results straight to the browser and have it go there.  Is that possible?  I've been searching with no luck.  All i can find is people who want to take the address bar information, not send to it.

 

thanks for your help, if any.

$terms = $_POST["terms"];

$query  = "SELECT fullname, ownip FROM userdata WHERE fullname ='$terms'";

$result = mysql_query($query);



while($row = mysql_fetch_array($result, MYSQL_ASSOC))

{

    echo "user :{$row['fullname']} <br>" .

         "ip : {$row['ownip']} <br>" ;

} 





Link to comment
Share on other sites

I was reading about the header() tag. Dezkit?  Where does this go?  My form is a hidden pop out JavaScript box.  Sorry I don't have the code handy for that. I'm on my iPod right now. Should I put it after the query?  How do I call it into action

Link to comment
Share on other sites

the header isn't working.  I looked it up and I see why not.  the problem is that header() is the only thing that should run and then the rest of the page dies. 

Let me break this down for everyone.  I have a form that queries the DB for a user, I get his ip as a result also, but as i get the result i want that Ip address passed to the browser as the site it should go to.  no link clicking, almost like the google "i'm feeling lucky" button.  straight to the result.  I had a hobo's way to do it, and maybe the only way.  send the ip result to a page that redirects to that address.  is that possible?  I've tried to pass the variable over url.  didn't work.

Link to comment
Share on other sites

Ok, i've figured out what to do.  I made 2 files.  one for the form that posts to the second.  the second gets the info from the DB and then echos it into a meta refresh to the location with a 1 second refresh time.  it works, not slick, but will do for now.  The Header() tag wouldn't work because it was a case of the chicken before the egg.  Header() stops all the rest of your script from going into action, so the query to the db never runs and gets the variable needed to do the job of redirection.  Thanks for your assistance everyone, you lead me in the right directions. 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.