Bonjour,
je suis un très ancien membres du site coudes-sources, mais j'ai toujours hésiter de m'inscrir et participé dans les forums...
Bon voila mon premier poste et je suis désolé qu'il soit une demande d'aide à la place d'une participation d'aider les autres .
Voila j'explique mon problèm:
J'essaye de fair un formulaire de commande d'un nom de domaine, bon en détaille le formulaire a pour but de fair entré un nom de domaine et le vérifié si il est disponible, le visiteur continu sa commande à l'étape suivante, mais si le nom de domaine est non disponible il reprend le meme page pour essayé à nouveau, voila tous.
Je vous fourni mon code de la page ou j'ai eux ce problèm:
Code PHP :
<?php
session_start();
global $statut;
//===========================Fonction du nom de domaine================================
function checkDomain($domain,$server,$findText){
// Open a socket connection to the whois server
$con = fsockopen($server, 43);
if (!$con) return false;
// Send the requested doman name
fputs($con, $domain."\r\n");
// Read and store the server response
$response = ' :';
while(!feof($con)) {
$response .= fgets($con,128);
}
// Close the connection
fclose($con);
// Check the response stream whether the domain is available
if (strpos($response, $findText)){
return true;
}
else {
return false;
}
}
function showDomainResult($domain,$server,$findText){
if (checkDomain($domain,$server,$findText)){
echo "<tr><td>Félicitations ! ".$domain." est disponible !</td></tr>";
$statut = 4;
}
else{
echo "<tr><td>Désolé ! ".$domain." a déjà été enregistré !</td></tr>";
$statut = 5;
}
}
/*function showDomainResult1($domain,$server,$findText){
if (checkDomain($domain,$server,$findText)){
return $statut = 4;
}
else{
return $statut = 5;
}
}*/
//=======================================================================================
if(!empty($statut)){
switch($statut){
case 4:{
//header('Location: ../page_3/index3.php');
}break;
case 5:{
//header('Location: 1/page_2/index2_nd.php');
}break;
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Commande Etape 2</title>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
<meta name="HandheldFriendly" content="true" />
<body>
<form class="jotform-form" action="index2_nd.php" method="post" name="form_2022530170" id="2022530170" accept-charset="utf-8">
<input type="hidden" name="formID" value="2022530170" />
<div class="form-all">
<ul class="form-section">
<li id="id_1" class="form-input-wide">
<div class="form-header-group">
<h2 id="header_1" class="form-header"> Configuration des produits </h2>
</div>
</li>
<li class="form-line" id="id_3">
<label class="form-label-left" id="label_3" for="input_3"> Entrer votre nom de domaine<span class="form-required">*</span> </label>
<div id="id_3" class="form-input">
<input type="text" class="form-textbox validate[required]" id="input_3" name="domainname" size="50" />
<input type="checkbox" name="com" checked/>.com
<br/>
<h4>
<?php
// The form was submitted
if (isset($_POST['submitBtn'])){
$domainbase = (isset($_POST['domainname'])) ? $_POST['domainname'] : '';
$d_com = (isset($_POST['com'])) ? 'com' : '';
// Check domains only if the base name is big enough
if (strlen($domainbase)>2){
echo '<table>';
if ($d_com != '')
showDomainResult($domainbase.".com",'whois.crsnic.net','No match for');
echo '</table>';
}
}
?>
</h4>
</div>
</li>
<li class="form-line" id="id_2">
<div id="id_2" class="form-input-wide">
<div style="margin-left:170px" class="form-buttons-wrapper">
<button id="input_2" type="submit" name="submitBtn" class="form-submit-button"> Cliquez pour continuer </button>
</div>
</div>
</li>
<li style="display:none"> Should be Empty:
<input type="text" name="website" value="" />
</li>
</ul>
</div>
<input type="hidden" id="simple_spc" name="simple_spc" value="2022530170" />
</form>
<pre>
<?php
//print_r($_SESSION);
print_r($_POST);
echo $statut;
?>
============
<?php
print_r(showDomainResult($domain,$server,$findText,&$statut));
?>
</body>
</html>
Et merci d'avance, et une dérnière information, je suis pas un pro dans le php.
Bonne journée à vous tous ;)