Jump to content
xisto Community
Sign in to follow this  
Tutenstein

Requesting Auto Generating Id Tag In Php Code Php Coding

Recommended Posts

Hello...I'm designing a website in PHP where ppl can submit their links for "cool sites". Anyway, when somebody submit's a link to a website for example "https://www.google.de/?gfe_rd=cr&ei=BwkjVKfAD8uH8QfckIGgCQ&gws_rd=ssl; it creates an id such as "index.php?id=1134411593". I dont want the links to be converted into id's. I want it to remain as "https://www.google.de/?gfe_rd=cr&ei=BwkjVKfAD8uH8QfckIGgCQ&gws_rd=ssl;. I have the following coding on ( echo "<a target=\"_new\" href=\"index.php?id=$data[0]\"> ). I'm a novice. Please Help!!!! Thanks... Plus I also want to add the date on when the link was submitted.

Notice from BuffaloHELP:
Please follow our forum rule by making your topic title specific to your post.
Edited by BuffaloHELP (see edit history)

Share this post


Link to post
Share on other sites

Drop the link and related information into a mysql database and use the 'row' number as its unique link number. Have one of the fields contain the actual link information for using as an address.

Row Number| URL Adress | Description | Date submitted | Submitter Name | Notes \n
Something like that. Use the Row Number as your $data[0].

Share this post


Link to post
Share on other sites

echo "<a target="_new" href="index.Php?id=$data[0]">Be careful, as doing things this way could lead to SQL injection attacks, as well as malicious PHP attacks on your user's.

The way that you are trying to do this, would require remote server side includes, and annon. Links.

So anyone could link a malicious file to your site, and if you didn't properly close your DB connection prior to running the include function, you could also get some pretty bad DB injection.  Possibly dropping all your tables. (which could be protected with DB permissions too).

That being said.  if you want to continue.

After submitting the code to the database, then retrieve it.

echo stripslashes("<a target="_blank" href="index.Php?id=$data[0]">");

//index.Php

$id = $_GET["id"];

$query = mysql_query("SELECT * FROM `table` WHERE `id` = '$id' LIMIT 1");

$row = mysql_fetch_row($query);

$url = $row[1]; //using the table by jlhaslip.

include_once($url);

-reply by jcbones

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.