1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Any way to hide address bar in php file

Discussion in 'PHP' started by sitefever, May 28, 2007.

Thread Status:
Not open for further replies.
  1. #1
    I know its easy to hide the address bar using javascript. I was wondering if I have a hyperlink to open a file within a PHP page, can I get it to open without the address bar using/not using javascript?

    When attempting to use javascript, of course, I keep getting errors.

    What's worse is that the hyperlink is like: domain.com/script1.php?id=$value

    Its opening fine by itself.

    Any way this is possible?
     
    sitefever, May 28, 2007 IP
  2. DeViAnThans3

    DeViAnThans3 Peon

    Messages:
    785
    Likes Received:
    83
    Best Answers:
    0
    Trophy Points:
    0
    #2
    so, do you mean this in fact:
    - you click a hyperlink (a-tag) which goes to domain.com/script1.php?id=$value
    - after clicking the link, the address bar must be hidden

    If so, why exactly must the address bar be hidden? To keep the URL safe? If so, the URL still isn't safe, as with rightclick you can still get the URL :)
    You could disable rightclick, but therefor you also need javascript :)
    (and so far I know of, you can only hide the address bar only with javascript and maybe vbscript)

    I hope this helps a bit :)
    If you need help with javascript, let me know!
     
    DeViAnThans3, May 28, 2007 IP
  3. sitefever

    sitefever Banned

    Messages:
    782
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I am using sessions to make sure that the user can only arrive at page2.php?id=5 from page1.php?id=5. If they type it in directly or from any other means, they can not arrive to the page- WORKING

    Once the session has authorized them to arrive at page 2, they can change the URL from id=5 to id=ANY# and see everyone else's account. I tried about 15 different variations of sessions and referers and cant get it to work. If I can just get rid of the address window, sure they can still get the URL but they cant edit it in that browser window. When they get the URL and enter it in another browser window, it wont let them view the page.

    I know not the best solution, obviouslly, but I need a very quick fix. If I can hide the address bar or use mod rewrite to hide the id=# at the end of the URL, then I would be fine.

    Thanks!
     
    sitefever, May 28, 2007 IP
  4. Cesay

    Cesay Peon

    Messages:
    121
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #4
    PHP is server-side. Hiding the address bar is a client-side(web browser) operation so javascript is your only real option. It sounds like your time would be better spent tightening up your sessions' security instead though. :)
     
    Cesay, May 28, 2007 IP
  5. sitefever

    sitefever Banned

    Messages:
    782
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I would love to but Im not good with sessions and this is the only thing holdign up my entire project and Im pissed off and the shmuck who sold me this script with absolutely no security whatsoever.

    I need to get this thing done. If there is somebody who would be willing to take a look at it for me and give me a price for doing it, PM me. Ive been on this too many hours and anyone who is familiar with sessions should get this wrapped up in 10min.
     
    sitefever, May 28, 2007 IP
  6. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #6
    As Cesay said, you can't do it with PHP alone.

    sitefever, from another post of yours I saw, can I just say that I think your going about this the wrong way.

    You're storing the ID in a session then comparing it against the given ID in the URL, right? If they don't match, you don't give access. That doesn't make any sense... why not just totally ignore the ID in the URL and use the ID in the session in the first place?
     
    TwistMyArm, May 28, 2007 IP
  7. sitefever

    sitefever Banned

    Messages:
    782
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I dont know what Im doing with sessions. I dont know anything about them. Im trying to find somebody who does who would like to do this for me. Some things I can do and some things I cant. Theres no sense in me wasting my time trying to do something that I know I dont know anything about.
     
    sitefever, May 28, 2007 IP
  8. rodney88

    rodney88 Guest

    Messages:
    480
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #8
    If you're not interested in working it out yourself, perhaps the Services forum would be a more appropriate place to ask for someone to do it for you than the PHP forum which is for getting help.

    Every time a page is requested, the script is executed independently on the server and sent back to the client. Sessions are just a way of maintaining data between consecutive page requests - so that if you set a certain variable on one page, it'll still be available on the next page. PHP handles most of the work for you - all you need to do is tell it you want to use sessions by calling session_start() at the top of the script. Then if you set a variable in the session global array by
    $_SESSION['something'] = 'value';
    PHP:
    on one page, you can retrieve that value on another page just by calling $_SESSION['something'].

    Example page1.php:
    session_start();
    $_SESSION['rememberthis'] = 'This variable was set on page 1.';
    echo '<a href="page2.php">Proceed to page 2</a>';
    PHP:
    page2.php
    session_start();
    echo $_SESSION['rememberthis'];
    PHP:
    which prints 'This variable was set on page 1.'
     
    rodney88, May 28, 2007 IP
  9. sitefever

    sitefever Banned

    Messages:
    782
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    0
    #9
    I really do appreciate everyone for their help. DP is a great resource. Thanks to everyone. **Problem solved.
     
    sitefever, May 28, 2007 IP
  10. zonzon

    zonzon Peon

    Messages:
    100
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #10
    zonzon, May 28, 2007 IP
Thread Status:
Not open for further replies.