Jump to content

Phpsessid Appending To Urls


Recommended Posts

Hey guys


I have done quite a bit of looking around on google to try and solve this issue I am having with one of my sites that im developing. It is written in PHP and dynamically creates links to the 3 newest news articles so the user can read the article in full, as on the main page only a short description of each article is displayed.


For some reason though the PHPSESSID keeps getting appended to the end of these links, but to no others. This results in my site failing its W3C validation, which is something I really don't want to happen.


As I said, all my other links don't get the ID appended to the end but these 3 links do.


news.php?ID=13&PHPSESSID=0fe9e55786ed4e3dd36e682edd0554 is an example of what is happening.


There is nothing written into my code which should do this so I imagine it is in fact a server related issue??? I don't really know to be honest.


I read somewhere to create a .htaccess file with the following lines in:


# php_value session.use_only_cookies 1

# php_value session.use_trans_sid 0


I tried that, and nothing at all seemed to happen??


Other than this little error on the front page, my entire site is W3C compliant and I would really like to get over this little hurdle if anyone knows how??


Here's the code where I display the short description and article title, author and posted date as well as the link to the main article:


This is all in a for loop which runs through the latest 3 articles in the database:


> <div class="newstitle">
									// Print out the title
				echo $newsdetails[$i][1];
				<div class="newsbody">
									// Print out the short description of the article
				echo $newsdetails[$i][2];
				echo "<br/>";
									// Print out the read more link with the dynamically created URL
				echo "<a href=\"news.php?ID=" .$newsdetails[$i][0]."\"><b>Read more...</b></a>";
				echo "<br/>";
				<div class="newsauthor">
									// Print out the author and posted date
				echo "Posted by <b>".$authorname. "</b>";
				echo " on ".$newsdetails[$i][4];
				?> </div> <?php
				echo "<br/><br/>";


Any help would be spectacular.

Edited by OJB
Link to comment
Share on other sites

Join the conversation

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

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...