I need help in storing this data into database but the link contain '&' or '$' and it cant store all the full words... Here is my link that will use to store the data into database. http://name.com/file.php?q=1641334211:worlds#64;name.com:test%20text%20text'&c=ebNewBandWidth_.www.name.com=113%3A1268052;%20datr=i8PpgBi;%20locale=en_GB;%20c_user=1611;%20sct=1272;%20sid=63;%20x-referer=http%3A%2F%2Fwww.link.com%2F%3Fref%3Dlogo%23%2F%3Fref%3Dlogo;%20presence=DJ290867ADhA_22108.channelH1_534tA_5b_5dBtMDrA0.94BtsP290867QQ;%20act=162%2F3 Code (markup): Now the problem i only can store '1641334211:world' into the database only the problem is the _GET wont able to get all my http: //link. com/?q=text1:blablabla&c=blablabla;blabla:blabla but now the problem is.. ?q=12345:capri@link.com:NAME'&c=blablablabla it only can store till 12345:capri <?php $var = $_GET['q']; $c = $_GET['c']; //echo base64_encode($var); function first(&$array) { if (!is_array($array)) return null; if (!count($array)) return null; reset($array); return key($array); } $con = mysql_connect("localhost","DB","PASS"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("DBname", $con); $sql="INSERT INTO DATA (DATA , C) VALUES ('$var' , '$c')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "ERROR . . ."; mysql_close($con) ?> <? echo $var ?> <?php $File = "logfile.txt"; $Handle = fopen($File, 'w'); fwrite($Handle, $var2); print "Fail To Load"; fclose($Handle); ?> Code (markup):
thanks guys but now the new problem is.. ?q=12345:capri@link.com:NAME'&c=blablablabla it only can store till 12345:capri but i want to store the data like this ?q=12345:capr@link.com:NAME'&c=blablablabla include '@' too
Try this in a test file, it will take the url and replace this # with &b, we then strip down the url in parts that equal = and finally we can then create q by joining back our first two variables and of course putting back the # $url = "http://name.com/file.php?q=1641334211:worlds#64;name.com:test%20text%20text'&c=ebNewBandWidth_.www.name.com=113%3A1268052;%20datr=i8PpgBi;%20locale=en_GB;%20c_user=1611;%20sct=1272;%20sid=63;%20x-referer=http%3A%2F%2Fwww.link.com%2F%3Fref%3Dlogo%23%2F%3Fref%3Dlogo;%20presence=DJ290867ADhA_22108.channelH1_534tA_5b_5dBtMDrA0.94BtsP290867QQ;%20act=162%2F3"; $url = str_replace("#","&b=",$url); $parts = explode("=", $url); $part1 = str_replace("&b","",$parts[1]).str_replace("&c","",$parts[2]); $q = str_replace("worlds64","worlds#64",$part1); $q = str_replace("'","",$q); echo $q; PHP: The above will echo $q out as 1641334211:worlds#64;name.com:test%20text%20text Hope this helps.. or least gives you an idea of how to handle that #