Demonic Posted December 25, 2006 Share Posted December 25, 2006 alright I got this script but It keeps saying sql has an error what Do I do?:[code]<?php if(isset($_POST['s'])){$curl = curl_init(); curl_setopt($curl, CURLOPT_URL,"http://******.net/registrar.php"); curl_setopt($curl, CURLOPT_POST, 1); $poststring="D=".$_POST[D]."&k=".$_POST[k].""; curl_setopt($curl, CURLOPT_POSTFIELDS, urlencode($poststring)); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec ($curl); curl_close ($curl); echo $result; }else{ echo ("<form method='post'> Domain: <input type='text' name='D' /><br /> Key: <input type='password' name='k' /><br /> <input type='submit' name='s' value='License Check' /></form> "); }?>[/code]registrar.php[code]<?phpmysql_connect("localhost","**********","************");mysql_select_db("nev_license");$check = mysql_query("SELECT key,username FROM license WHERE key = '".$_POST[k]."' AND username='".$_POST[D]."' ") or die(mysql_error()); $thiz = mysql_num_rows($check); if($thiz == 0){ die("Invalid License Info"); }else{ echo ("You key is valid"); } ?>[/code]ERROR:[quote]You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'key,username FROM license WHERE key = '' AND username=''' at li[/quote] Link to comment https://forums.phpfreaks.com/topic/31824-solved-curl-help/ Share on other sites More sharing options...
Barand Posted December 26, 2006 Share Posted December 26, 2006 KEY is a SQL reserved word. I recommend you change the name of the column, or, failing that, use `key` in the query Link to comment https://forums.phpfreaks.com/topic/31824-solved-curl-help/#findComment-147702 Share on other sites More sharing options...
Demonic Posted December 26, 2006 Author Share Posted December 26, 2006 kk Ill see if that makes a difference. Link to comment https://forums.phpfreaks.com/topic/31824-solved-curl-help/#findComment-147737 Share on other sites More sharing options...
Demonic Posted December 26, 2006 Author Share Posted December 26, 2006 Alright I fixed that page now every time i try and send request it is invalid and if its empty its valid.[code]<?$check = mysql_query("SELECT * FROM license WHERE pin = '".urlencode($_POST['k'])."' ") or die(mysql_error()); $secure = mysql_num_rows($check); if($secure == 0){ die("Invalid License Info"); }else{ if($secure['username'] != $_POST['D']){ echo "Error Retrieving Domain<br />"; }else{ echo "Valid Domain<br />"; } if($secure['pin'] != $_POST['k']){ echo "Invalid License Pin Number<br />"; }else{ echo "Valid Lincense Pin Number<br />"; } } ?>[/code]and I tried it with:[code]<?$check = mysql_query("SELECT * FROM license WHERE pin = '".$_POST['k']."' ") or die(mysql_error()); $secure = mysql_num_rows($check); if($secure == 0){ die("Invalid License Info"); }else{ if($secure['username'] != $_POST['D']){ echo "Error Retrieving Domain<br />"; }else{ echo "Valid Domain<br />"; } if($secure['pin'] != $_POST['k']){ echo "Invalid License Pin Number<br />"; }else{ echo "Valid Lincense Pin Number<br />"; } } ?>[/code]Any suggestions? Link to comment https://forums.phpfreaks.com/topic/31824-solved-curl-help/#findComment-147753 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.