php query string validation
<p>In my php code i can get data with php $_GET method. Here is code look like this..</p>

<pre><code>&lt;?php 
&lt;a href='userprofile.php?uname=$uname'&gt;$uname&lt;/a&gt;
?&gt;
</code></pre>

<p>If i click the the link it's show user profile page and so that userprofile.php page's url look like this.</p>

<pre><code>http://localhost/evantechbd1/userprofile.php?uname=shibbir
</code></pre>

<p>My question is how do i prevent this url from sql injection or any other attack. </p>

<p>If I write:</p>

<pre><code>http://.......uname=shibbir'OR'='-1-'
</code></pre>

<p>then it's show:</p>

<pre><code>SHIBBIR%27OR%27%3D%27-1-%27'S PROFILE.
</code></pre>

<p><strong>BUT</strong> I want whatever text is provided to that link it's must be show only valid username profile page.</p>

<p>Any idea.</p>
