[SOLVED] code doesn't execute...
Posted: Fri Mar 09, 2007 2:15 pm
Hi everyone
I'm having a problem again
My code doesn't execute...
here's first part of the code in the first page:
And here's second part of the code in insertnewuser.php page:
This should add a new user to one of the databases depending on $pid value (1, 2 or 3), but it doesn't. I don't know, maybe this page isn't executed through curl in the first page, because when I disable $key check and go to insertnewuser.php?name=dfsdf... directly in my browser, the user with the data is added.
Thanks for any help.
I'm having a problem again
here's first part of the code in the first page:
Code: Select all
function otherprogram($pid, $id){
$sql = "SELECT * FROM `user` WHERE id='$id'";
$result = mysql_query($sql);
$array = mysql_fetch_array($result);
$name = $array['name'];
$egold = $array['egold'];
$email = $array['email'];
global $url;
global $key;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url . '/insertnewuser.php?key='.$key.'&p='.$pid.'&name='.$name.'&email='.$email.'&egold='.$egold);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$a = curl_exec($ch);
if (!$a) {
curl_exec($ch);
}
curl_close($ch);
}Code: Select all
ignore_user_abort();
$fp = fopen("log2.txt", "a");
require("config.php");
if ($_GET['key'] != $key) {
fwrite($fp, "Cheating detected!\n\n\n");
die("Cheating detected!");
}
$pid = intval($_GET['p']);
$name = $_GET['name'];
$email =$_GET['email'];
$egold = $_GET['egold'];
if ($pid == 1) {
$dbhost2 = ""; // Your MySQL database host (no / at the end)
$dbname2 = ""; // Your database name to use for your cycler
$dbusername2 = ""; // Your database username
$dbpassword2 = ""; // Your database password
$connect = mysql_connect($dbhost2, $dbusername2, $dbpassword2);
mysql_select_db($dbname2);
$url2 = "$url/update.php?p=1";
}
elseif ($pid == 2) {
$dbhost2 = ""; // Your MySQL database host (no / at the end)
$dbname2 = ""; // Your database name to use for your cycler
$dbusername2 = ""; // Your database username
$dbpassword2 = ""; // Your database password
$connect = mysql_connect($dbhost2, $dbusername2, $dbpassword2);
mysql_select_db($dbname2);
$url2 = "$url/update.php?p=2";
}
elseif ($pid == 3) {
$dbhost2 = ""; // Your MySQL database host (no / at the end)
$dbname2 = ""; // Your database name to use for your cycler
$dbusername2 = ""; // Your database username
$dbpassword2 = ""; // Your database password
$connect = mysql_connect($dbhost2, $dbusername2, $dbpassword2);
mysql_select_db($dbname2);
$url2 = "$url/update.php?p=3";
}
$sql = "SELECT id FROM `user` WHERE stage=1 ORDER BY id DESC LIMIT 1";
$result = mysql_query($sql);
$re = mysql_fetch_array($result);
$ree = $re['id'] + 1;
$sql = "INSERT INTO `user` (id,name,email,egold,stage) VALUES ('$ree','$name','$email','$egold',1)";
$result = mysql_query($sql);
$sql = "UPDATE statistics SET total = total + 1 WHERE id=1";
$result = mysql_query($sql);
mysql_close($connect);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$a = curl_exec($ch);
if (!$a) {
curl_exec($ch);
}
curl_close($ch);Thanks for any help.