make short address link !

Discussion in 'PHP' started by rontdu, Feb 23, 2010.

  1. #1
    Suppose its my script:

    <?php

    echo “ <a href=’receive_something.php?c_value=1&&p_value=2&&data=3&&page=4’ >”.$user_something.”</a>”;

    ?>

    Then if I click this link its do something whatever I want to do in the receive_something.php page but it the address bar of the browser its show a address like:

    receive_something.php? c_value=1&&p_value=2&&data=3&&page=4

    for that cause, anyone can see that what parameters are passing. If i want to pass this parameter like this but I want to avoid the full link in the address bar then what can I do ?
    last of all, though I click the link but its just show

    receive_something.php

    in the address bar, nothing else. May think its possible. but how ? can anyone help me ?

    I am waiting…………………..
     
    rontdu, Feb 23, 2010 IP
  2. JEET

    JEET Notable Member

    Messages:
    3,832
    Likes Received:
    502
    Best Answers:
    19
    Trophy Points:
    265
    #2
    You can pass those variables to other page either in session, or in cookie. Even if you use .htaccess to rewrite the url, still something will be seen in url.
    If you just want to reduce the number of variables send in url, base64_encode the string, and send like:
    href="recieve.php?query=all_based_data"> click

    in recieve.php base64_decode the query parameter.
    Thanks :)
     
    JEET, Feb 23, 2010 IP
  3. rontdu

    rontdu Member

    Messages:
    99
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #3
    thanks for response.but if u don't mind then please give me the full php code that can i do this
    think :

    test.php
    ------------
    <?php

    echo “ <a href=’receive_something.php?a=1&& b=2&& c=3&& d=4’ >”.$user_something.”</a>”;

    ?>


    --------------
    receive_something.php
    ---------------------------------
    <?php

    $a=$_REQUEST[' a '];
    $b=$_REQUEST[' b '];
    $c=$_REQUEST[' c '];
    $d=$_REQUEST[' d '];

    // now just print:
    echo $a."<br/>".$b."<br/>".$c."<br/>".$d;
    ?>

    then how??
    please
     
    rontdu, Feb 23, 2010 IP
  4. Nyu

    Nyu Peon

    Messages:
    79
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    The use of session data is very easy.

    test.php
    
    <?php
    // call this function before printing any output
    session_start()
    
    // store your request data
    $_SESSION['receiveSomething']['a'] = 1;
    $_SESSION['receiveSomething']['b'] = 2;
    $_SESSION['receiveSomething']['c'] = 3;
    $_SESSION['receiveSomething']['d'] = 4;
    
    echo “ <a href=’receive_something.php’ >”.$user_something.”</a>”;
    
    ?>
    
    PHP:

    receive_something.php
    
    <?php
    // call this function before printing any output
    session_start()
    
    // retrieve previously stored data from session array
    $a=$_SESSION['receiveSomething']['a'];
    $b=$_SESSION['receiveSomething']['b'];
    $c=$_SESSION['receiveSomething']['c'];
    $d=$_SESSION['receiveSomething']['d'];
    
    // now just print:
    echo $a."<br/>".$b."<br/>".$c."<br/>".$d;
    ?>
    
    PHP:
     
    Nyu, Feb 24, 2010 IP
  5. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #5
    why not use POST?

    get all your parameters into one variable then user
    base64_encode($variableOfParameters);
     
    bartolay13, Feb 24, 2010 IP