Jump to content

Recommended Posts

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]
<?php
mysql_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

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

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

Important Information

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.