Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7612835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:00:56+00:00 2026-05-31T02:00:56+00:00

I need help encoding a link. Basically, upon completion of an event, I run

  • 0

I need help encoding a link. Basically, upon completion of an event, I run a function that redirects the user to a link. The link is taken directly from a PHP variable.

<?php 

$url = "http://google.com/";
$mylink = "<a href=\"" . $url . "\">";

echo $mylink;

?>

My question is, how can I echo $mylink, without having the $url shown in the source code. I want the output of my link to still go to $url, but not show the value of $url ANYWHERE in my source code.

How can I achieve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T02:00:57+00:00Added an answer on May 31, 2026 at 2:00 am

    Here is one sure way to do this: you could store in your database (or files on the server) the link and an ID. Instead of the actual url, print a link to a php script you write which passes in that ID. This page you write simply looks up the associated ID and uses a header to redirect to the link.

    For Example: you write a script redirector.php then the links in the page source point to “redirector.php?id=10293”. The redirector script looks up what is id 10293 and sees http://www.example.com then calls

    header('Location: http://www.example.com/');
    

    This way the links are only in the server side and never show up in your source code. As user pst suggested in the comments you could also use something like tinyurl which operates on this same principal.

    Any other methods will rely on some sort of encryption which could be decrypted because the actual data (link url) is in the page source albeit obscured.

    EDIT : here is an example of how you could write your two scripts — the one which is printing the urls and the one which would redirect. Assuming a table urls exists in your MySQL db add a column called ‘hash’ or ‘id’ or something and in the script which will print the urls add the lines:

    $hash = sha1($url);
    mysql_query("UPDATE url_table SET hash = '$hash' WHERE url = '$url'");
    $printURL = "../redirect.php?id=$hash";
    print "<a href='$printURL'>click me to go somewhere you don't know yet</a>";
    

    now in another file named redirect.php put the following code:

    <?php
    //connect to db or include files
    $givenHash = $_REQUEST['id']; $realURL = $_SERVER['HTTP_REFERER'];
    $result = mysql_query("SELECT url FROM url_table WHERE hash = '$givenHash'"); 
    while($row=mysql_fetch_assoc($result)) {
       $realURL = $row['url'];
    }
    header("Location: $realURL");
    ?>
    

    This will either send them to the url you want if it is found in the db or drop them back to the page they were on before they clicked the link. If you only have a few links that are known in advance then you can do this trick without the use of databases by just using a look up array. Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need help with a character encoding problem that I want to sort once
need help regarding USSD Gateway. I have to develop an app, which will directly
I need to scrape from a website that requires authentication, that is a user
So I've got an interesting problem that I need help with faster than I
I need some help cutting out a line from a path that's returned from
Need help. It may be weird. First activity has listview(like lazyadapter) once i click
need help to create regular expression matching string www.*.abc.*/somestring Here * is wild card
Need help writing a script downloads data from google insight using c# this is
need help/guide for sql select query, I have 2 table stock and stock_history, in
need help in error in database pivot. i have table tamed table_score like below:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.