Coregistration

Répondre
gladiator2b
le 26/11/2009 à 19:56
gladiator2b
Bonsoir,
J'ai un site de rencontre et j'ai été contacté par un autre site qui me demande de faire de la coregistration.

La coregistration c'est par exemple : le visiteur remplit le formulaire d'inscription sur le site A et coche la case (Voulez vous vous inscrire sur le site B)
Si le visiteur coche la case il s'inscrit sur les 2 sites avec les memes informations.
Si le visiteur ne coche il s'inscrit sur le site A
On m'a dit que pour faire une case à cocher il faut faire ceci
<input type="checkbox" name="leNomDeMaCase" value="maValeur" /></p>
gladiator2b
le 26/11/2009 à 20:03
gladiator2b
Je vous envoi le code de ma page register.php

<?
## block direct page access
defined( 'KEY_ID' ) or die( 'Restricted access' );

?>

<script>

function agreeregisterForm(){
document.getElementById('MainSubBtn').disabled = false;
}
</script>


<div class="TopRegister"><div style="float:right;"><? foreach($BANNER_ARRAY as $banner){ if($banner['position'] =="middle"){ print $banner['display'];}} ?></div><span><?=$PageTitle ?></span></div><p><?=$PageDesc ?></p>
<style>
ul.form li .tip { border:0px;}
</style>


<? if($show_page=="home"){ ?>


<!-- ****************** UPLOAD WAITING / LOADING SCREEN ************** -->
<div id="UploadWait1" style="display:none;">
<p><strong><?=$GLOBALS['LANG_REGISTER']['28'] ?></strong></p>
<p><?=$GLOBALS['LANG_REGISTER']['29'] ?></p>
<p><img src="<?=DB_DOMAIN ?>images/DEFAULT/_gal/loading.gif"></p>
</div>
<!-- **************************************************************** -->

<form method="post" action="<?=DB_DOMAIN ?>index.php" name="MemberSearch" enctype="multipart/form-data" onSubmit="toggleLayer('MainRegisterForm'); toggleLayer('UploadWait1'); return CheckRegisterNulls('<?=$GLOBALS['_LANG_ERROR']['_incomplete'] ?>','<?=$GLOBALS['_LANG_ERROR']['_noT&C'] ?>');">
<input name="do" type="hidden" value="add" class="hidden">
<input name="do_page" type="hidden" value="register" class="hidden">
<input name="title" type="hidden" value="" class="hidden">
<input name="comments" type="hidden" value="" class="hidden">
<script src="<?=DB_DOMAIN ?>inc/js/_extras/_date.js"></script>
<span id="response_register" class="responce_alert"></span>


<?

/**
* Page: Register Waiting Box
*
* @version 9.0
*/

?>


<div id="MainRegisterForm" style="display:visible">
<?

/**
* Page: Register Step 1
*
* @version 9.0
* @created Fri Jan 18 10:48:31 EEST 2008
* @updated Fri Sep 24 16:28:31 EEST 2008
*/

?>

<div id="reg_step_1" style="display:visible">
<ul class="form">

<div class="CapBody">

<li><label><img src="<?=DB_DOMAIN ?>images/DEFAULT/_acc/vcard.png" width="16" height="16" align="absmiddle">
<?=$GLOBALS['_LANG']['_username'] ?>: </label><input name="username" type="text" class='input' id="regUsername" tabindex="1" onchange="validateUsername(this.value);" value="<? if(isset($_POST['username'])){print eMeetingOutput($_POST['username']); } ?>" size="35" maxlength="15"/>
<p class="note"><span id="response_span"></span></p>
<div class="tip"><?=$GLOBALS['LANG_REGISTER']['a6'] ?></div>
</li>

<li><label><img src="<?=DB_DOMAIN ?>images/DEFAULT/_acc/email.png" width="16" height="16" align="absmiddle">
<?=$GLOBALS['_LANG']['_email'] ?>: </label><input type="text" class='input' size="35" name="email" id="regEmail" tabindex="2" onchange="validateEmail(this.value);" value="<? if(isset($_POST['email'])){print eMeetingOutput($_POST['email']); } ?>"/> <p class="note"><span id="response_span_email"></span></p>
<div class="tip"><?=$GLOBALS['LANG_REGISTER']['a8'] ?></div>
</li>

<li><label><img src="<?=DB_DOMAIN ?>images/DEFAULT/_acc/key_go.png" width="16" height="16" align="absmiddle">
<?=$GLOBALS['_LANG']['_password'] ?>: </label><input type="password" class='input' size="35" name="password" id="regPassword" tabindex="3" onchange="validatePassword(this.value);" value="<? if(isset($_POST['password'])){print eMeetingOutput($_POST['password']); } ?>" /> <p class="note"><span id="response_span_pass"></span></p>
<div class="tip"><?=$GLOBALS['LANG_REGISTER']['a10'] ?></div>
</li>

<li><label><img src="<?=DB_DOMAIN ?>images/DEFAULT/_acc/key_add.png" width="16" height="16" align="absmiddle">
<?=$GLOBALS['LANG_REGISTER']['a11'] ?>: </label><input type="password" class='input' size="35" name="password_confirm" id="regRPassword" onChange="CheckPassword();" tabindex="4" value="<? if(isset($_POST['password_confirm'])){print eMeetingOutput($_POST['password_confirm']); } ?>" /> <p class="note"><span id="response_span_rpass"></span></p>
<div class="tip"><?=$GLOBALS['LANG_REGISTER']['a12'] ?></div>
</li>
<p>Rencontrez votre ame soeur <input type="checkbox" name="leNomDeMaCase" value="maValeur" /></p>
<div class="ClearAll"></div><br>
<div id="but1" style="display:<?=$DefaultButStyle ?>">
<a class="MainBtn" href="javascript:void(0)" style="font-size:15px; font-weight:bold; margin-left:230px;" onclick="Effect.toggle('reg_step_1','slide', {delay: 0.5}); Effect.toggle('reg_step_2','slide', {delay: 0.5});"><span><?=$GLOBALS['_LANG']['_submit'] ?></span></a>
&nbsp;
</div>
</div>
</ul>

</div>

<?

/**
* Page: Register Step 2
*
* @version 9.0
* @created Fri Jan 18 10:48:31 EEST 2008
* @updated Fri Sep 24 16:28:31 EEST 2008
*/

?>

<div id="reg_step_2" style="display:<?=$DefaultBoxStyle ?>">

<div class="CapTitle"><?=$GLOBALS['LANG_REGISTER']['a13'] ?></div>
<div class="CapBody">
<ul class="form">
<?=$REGISTER_ARRAY ?>
</ul>

<div id="but2" style="display:<?=$DefaultButStyle ?>">
<a class="MainBtn" href="javascript:void(0)" style="font-size:15px; font-weight:bold; margin-left:230px;" onclick="Effect.toggle('reg_step_2','slide', {delay: 0.5}); Effect.toggle('reg_step_3','slide', {delay: 0.5});">
<span><?=$GLOBALS['_LANG']['_submit'] ?></span>
</a> &nbsp;
</div>
</div>
</div>

<?

/**
* Page: Register Step 3
*
* @version 9.0
* @created Fri Jan 18 10:48:31 EEST 2008
* @updated Fri Sep 24 16:28:31 EEST 2008
*/

?>

<div id="reg_step_3" style="display:<?=$DefaultBoxStyle ?>">
<!-- START PHOTO UPLOAD -->
<div class="CapTitle"><?=$GLOBALS['LANG_REGISTER']['a14'] ?></div>
<div class="CapBody">
<ul class="form">
<li><label><img src="<?=DB_DOMAIN ?>images/DEFAULT/_acc/pictures.png" align="absmiddle">
<?=$GLOBALS['LANG_REGISTER']['a15'] ?>:</label>


<span id="upMe1" style="display:visible;">1. <input name="uploadFile00" type="file" id="uploadFile00"></span><br><div class="ClearAll"></div>
<span id="upMe2" style="display:visible; margin-left:210px;">2. <input name="uploadFile01" type="file" id="uploadFile01" onChange="toggleLayer('upMe3');"></span><div class="ClearAll"></div>
<span id="upMe3" style="display:none;margin-left:210px;">3. <input name="uploadFile02" type="file" id="uploadFile02" onChange="toggleLayer('upMe4');"></span>
<span id="upMe4" style="display:none;margin-left:210px;">4. <input name="uploadFile03" type="file" id="uploadFile03" onChange="toggleLayer('upMe5');"></span>
<span id="upMe5" style="display:none;margin-left:210px;">5. <input name="uploadFile04" type="file" id="uploadFile04" onChange="toggleLayer('upMe6');"></span>
<span id="upMe6" style="display:none;margin-left:210px;">6. <input name="uploadFile05" type="file" id="uploadFile05" onChange="toggleLayer('upMe7');"></span>
<span id="upMe7" style="display:none;margin-left:210px;">7. <input name="uploadFile06" type="file" id="uploadFile06" onChange="toggleLayer('upMe8');"></span>
<span id="upMe8" style="display:none;margin-left:210px;">8. <input name="uploadFile07" type="file" id="uploadFile07" onChange="toggleLayer('upMe9');"></span>
<span id="upMe9" style="display:none;margin-left:210px;">9. <input name="uploadFile08" type="file" id="uploadFile08" onChange="toggleLayer('upMe10');"></span>
<span id="upMe10" style="display:none;margin-left:210px;">10. <input name="uploadFile09" type="file" id="uploadFile09" onChange="toggleLayer('upMe11');"></span>
<span id="upMe11" style="display:none;margin-left:210px;"> <img src="<?=DB_DOMAIN ?>images/DEFAULT/_acc/cancel.png" align="absmiddle"> You cannot add any more files yet.</span>


<p class="note"><?=$GLOBALS['LANG_REGISTER']['a16'] ?></p>
<div class="tip"><?=$GLOBALS['LANG_REGISTER']['a17'] ?></div>
</li>
<input type="hidden" name='uploadNeed' value=1 class="hidden">
<input type="hidden" name="default" value="1" class="hidden">

<div id="but3" style="display:<?=$DefaultButStyle ?>">
<br><a class="MainBtn" href="javascript:void(0)" style="font-size:15px; font-weight:bold; margin-left:230px;" onclick="Effect.toggle('reg_step_3','slide', {delay: 0.5}); Effect.toggle('reg_step_4','slide', {delay: 0.5});"><span><?=$GLOBALS['_LANG']['_submit'] ?></span></a>
&nbsp;
</div>
</ul>
</div>
<!-- START TERMS AND CONDITIONS -->
</div>

<?

/**
* Page: Register Step 4 / SMS integration
*
* @version 9.0
* @created Fri Jan 18 10:48:31 EEST 2008
* @updated Fri Sep 24 16:28:31 EEST 2008
*/

?>

<div id="reg_step_4" style="display:<?=$DefaultBoxStyle ?>">

<input name="notify" type="hidden" value="yes" class="radio" checked>
<input name="news" type="hidden" value="yes" class="radio" checked>

<div class="CapTitle"><?=$GLOBALS['LANG_REGISTER']['a18'] ?></div>
<div class="CapBody">
<ul class="form">



<? if(UPGRADE_SMS =="yes"){ ?>

<li>
<label><?=$GLOBALS['LANG_SETTINGS']['a2'] ?></label>
<input name="smsnum" maxlength="30" class="input" type="text" size="40"value="<? if(isset($_POST['smsnum'])){print eMeetingOutput($_POST['smsnum']); } ?>">
<div class="tip"><?=$GLOBALS['LANG_SETTINGS']['a3'] ?></div>
</li>

<li>
<label><?=$GLOBALS['LANG_SETTINGS']['a6'] ?></label>
<select name="sms_msg_alert" class="input">
<option value="on"><?=$GLOBALS['_LANG']['_yes'] ?></option>
<option value="off"><?=$GLOBALS['_LANG']['_no'] ?></option>
</select>
<div class="tip"><?=$GLOBALS['LANG_SETTINGS']['a9'] ?></div>
</li>

<li>
<label><?=$GLOBALS['LANG_SETTINGS']['a10'] ?></label>
<select name="sms_wink_alert" class="input">
<option value="on"><?=$GLOBALS['_LANG']['_yes'] ?></option>
<option value="off"><?=$GLOBALS['_LANG']['_no'] ?></option>
</select>
<div class="tip"><?=$GLOBALS['LANG_SETTINGS']['a11'] ?></div>
</li>


<? } ?>


<hr>
<? if(D_REGISTER_IMAGE ==1){ ?>
<li><label><?=$GLOBALS['_LANG']['_verification'] ?>:</label> <input type="text" name="code"><br>
<img name="Verification Image" src="<?=DB_DOMAIN ?>inc/classes/class_regimg_img.php?regen=y&<? echo time(); ?>">
<div class="tip"><?=$GLOBALS['LANG_REGISTER']['a22'] ?></div>
</li>
<? } ?>

<ul class="form"><div class="CapBody">
<li><div align="center"><textarea style="width:450px; height:70px;"><?=DisplayTerms() ?></textarea></div></li>
<li style="text-align:center;font-size:12px;"> <input name="t&C" type="checkbox" value="1" id="t&C" onClick="agreeregisterForm()"> <?=$GLOBALS['LANG_REGISTER']['a23'] ?> <a href="<?=DB_DOMAIN ?>index.php?dll=privacy" target="_blank"><?=$GLOBALS['LANG_REGISTER']['a24'] ?></a><?=$GLOBALS['LANG_REGISTER']['a25'] ?>
<p><input type="checkbox" name="leNomDeMaCase" value="maValeur" /></p>
</li>
</div></ul>

<li><input value="<?=$GLOBALS['_LANG']['_register'] ?>" id="MainSubBtn" type="submit" class="MainBtn" style="margin-left:230px;" disabled></a> </li>
</ul>
</div>
</div>

</div>
<!-- END DISPLAY -->
</form>









<? }elseif($show_page=="activation"){


/**
* Page: Waiting for your activation email
*
* @version 8.0
* @created Fri Jan 18 10:48:31 EEST 2008
* @updated Fri Sep 24 16:28:31 EEST 2008
*/

?>


<ul class="form">

<div class="CapBody">

<p><b style="font-size:16px;"><?=$GLOBALS['LANG_REGISTER']['32'] ?></b></p>
<p><b><?=str_replace("%s",$_SESSION['username'],$GLOBALS['LANG_REGISTER']['33']) ?></b></p>
<p><?=$GLOBALS['LANG_REGISTER']['34'] ?> <?=$_SESSION['my_email'] ?></p>
<p><?=$GLOBALS['LANG_REGISTER']['35'] ?></p>

<div id="eMeeting_ResendActivation" class="responce_alert"></div>

<form method="post" action="<?=DB_DOMAIN ?>index.php" onSubmit="ResendActivationCode(<?=$_SESSION['uid'] ?>,this.email.value); return false;">
<ul class="form">
<div class="CapBody">
<li><b><?=$GLOBALS['LANG_REGISTER']['36'] ?></b></li>
<li><label><?=$GLOBALS['_LANG']['_new'] ?> <?=$GLOBALS['_LANG']['_email'] ?></label><input maxlength="150" name="email" type="text" size="25" class="input"></li>
<li><input type="submit" value="<?=$GLOBALS['_LANG']['_submit'] ?>" class="MainBtn"></li>
</div>
</ul>
</form>

</div>
</ul>










<? }elseif($show_page=="contacts"){


/**
* Page: Invite Friend Contacts Display
*
* @version 8.0
* @created Fri Jan 18 10:48:31 EEST 2008
* @updated Fri Sep 24 16:28:31 EEST 2008
*/


/**
* Page: Waiting Box
*
* @version 9.0
*/

?>

<!-- ****************** UPLOAD WAITING / LOADING SCREEN ************** -->
<div id="UploadWait">
<p><strong><?=$GLOBALS['LANG_REGISTER']['30'] ?></strong></p>
<p><?=$GLOBALS['LANG_REGISTER']['31'] ?></p>
<p><img src="<?=DB_DOMAIN ?>images/DEFAULT/_gal/loading.gif"></p>
</div>
<!-- **************************************************************** -->

<div id="MainRegisterForm" style="display:visible">

<form method="post" action="<?=DB_DOMAIN ?>index.php" name="MyContacts" id="MyContacts" onSubmit="return SendEmailContacts();">
<input name="do" type="hidden" value="email_contacts" class="hidden" id="cSS">
<input name="do_page" type="hidden" value="register" class="hidden">
<input name="system" type="hidden" value="hotmail" class="hidden">
<? $i=1;
$counter=0;
$FoundMember = array();
if(is_array($contacts_array)){ foreach($contacts_array as $value){ ?>

<input type='hidden' name='name<?=$i ?>' value='<?=$value["username"] ?>' class='hidden'>
<input type='hidden' name='email<?=$i ?>' value='<?=$value["email"] ?>' class='hidden'>
<? $i++;} } ?>

<ul class="form">

<div class="CapBody">

<p><?=$GLOBALS['LANG_NETWORK']['a28'] ?> <?=count($contacts_array) ?> <?=$GLOBALS['LANG_NETWORK']['a29'] ?>, <?=$counter ?> <?=$GLOBALS['LANG_NETWORK']['a30'] ?></p>
<p><?=$GLOBALS['LANG_NETWORK']['a31'] ?></p>
<input type='hidden' name='totalrows' value='<?=count($contacts_array) ?>' class="hidden" >
<li><input value="<?=$GLOBALS['LANG_NETWORK']['a32'] ?>" type="submit" class="NormBtn">
<input value="<?=$GLOBALS['LANG_NETWORK']['a33'] ?>" type="button" class="NormBtn" onclick="ChangeRegContactType();return false"> </li>

</div>
</ul>

</form>

</div>


<? if(!empty($FoundMember)){ ?>
<ul class="form">
<div class="CapTitle"><?=$GLOBALS['LANG_NETWORK']['a34'] ?></div>
<div class="CapBody">

<li><p><?=$GLOBALS['LANG_NETWORK']['a35'] ?></p></li>
<?=DisplayContacts($FoundMember) ?>
</div>
</ul>
<? } ?>



<? } ?>

Ainsi que ma page que le 2eme site m'a envoyé :

/**
* @author mathieu
* @created 12/11/2009
* @time 16:12
*/

/* --------------------
* Exemple d'appel de notre script pour envoi des données
*
* ------------------ */

$coregData = 'login='.$login; // rober24
$coregData .= '&email='.$email; // mon_adresse@email.com
$coregData .= '&birthday='.$birthday; // 19771024 (YYYYMMDD)
$coregData .= '&gender='.$gender; // h si homme ou f si femme ou c si couple
$coregData .= '&sex='.$sex; // ht si hetero ou hm si homo ou bi si bisexuel
$coregData .= '&cp='.$cp; // 25440
$coregData .= '&userip='.$ip; // 82.214.145.44
$coregData .= '&city='.urlencode($city); // Strasbourg
$coregData .= '&comment='.urlencode($comment); // Je cherche la femme de ma vie, douce et sensible.

$coregURL = 'http://www.xxx.com/coreg/xxxx.php';

// nécessite la librairie PHP cURL activée
// envoi des données en method POST

$curl_handler = curl_init();
curl_setopt($curl_handler, CURLOPT_URL, $coregURL);
curl_setopt($curl_handler, CURLOPT_CONNECTTIMEOUT, 20);
curl_setopt($curl_handler, CURLOPT_HEADER, false);
curl_setopt($curl_handler, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_handler, CURLOPT_POST, true);
curl_setopt($curl_handler, CURLOPT_POSTFIELDS, $coregData);
curl_setopt($curl_handler, CURLOPT_TIMEOUT, 28);

$res = curl_exec($curl_handler);

if(curl_error($curl_handler) != '' || !isset($res) || empty($res)){
// erreur lors de l'appel
// timeout, plantage, etc...
}
curl_close($curl_handler);

switch($res){
case 'OK':
// tout s'est bien passé
break;
case 'KO':
// erreur, données incompletes ou invalides
break;
case 'NOK':
// erreur, cible non respectée
break;
case 'DBL':
// doublon, données du membre déjà envoyées
break;
case 'DEJA':
// refus, le membre est déjà inscrit
break;
default:
// erreur globale
// ne doit pas se produire
}


}
On m'a dit aussi d'ajouter ce code dans mon fichier funct_register.php à ligne 155 et de rajouter un if

Et c'est la que je bloque

<?php

// no direct access
defined( 'KEY_ID' ) or die( 'Restricted access' );


function ChangeDo1($DoCall, $values = false, $Files = false,$obj=false){


global $DB;

$DoArray = array('add','email_contacts','forward'); // list of acceptable calls

if(in_array($DoCall, $DoArray)){

$SwitchValue = ValidateAccount($values,$Files, $obj);

switch($DoCall){

case "add": {
switch($SwitchValue){

case "username": {

return $GLOBALS['LANG_REGISTER'][1];

} break;

case "email": {

return $GLOBALS['LANG_REGISTER'][2];

} break;

case "invalid_email": {

return $GLOBALS['LANG_REGISTER'][3];

} break;

case "password": {

return $GLOBALS['LANG_REGISTER'][4];

} break;

case "username_short": {

return $GLOBALS['LANG_REGISTER'][5];

} break;

case "username_chars": {

return $GLOBALS['LANG_REGISTER'][6];

}break;

case "password_lenght": {

return $GLOBALS['LANG_REGISTER'][7];

} break;

case "field_empty": {

return $GLOBALS['LANG_REGISTER'][8];

} break;

case "verification": {

return $GLOBALS['LANG_REGISTER'][9];

}break;

case "photo": {

return $GLOBALS['LANG_REGISTER'][10];

}break;

case "photo_invalid": {

return "The photo you have selected is invalid. We only accept .jpg,.png and .bmp image types. Please select a different photo and try again.";

}

case "complete": {

## Define Variables
$RunExtra ="";

## Define List of BadWords
$BadWords = array();
// retrieve censor words for filter
$result = $DB->Query("SELECT * FROM badwords");
$bw = 1;
while( $im = $DB->NextRow($result) )
{
$BadWords['word'][$bw] = $im['word'];
$bw ++;
}
## Loop to create member profile data
for($i = 1; $i < 200; $i++) {

if(isset($values['FieldName'.$i]) && $values['FieldName'.$i] != ""){

## Do Multiple Checkbox
if($values['FieldType'.$i] ==5){
if($values['FieldValue'.$i] == 1){
$BuiltArray .="1**";
}else{
$BuiltArray .="0**";
}
$RunExtra.= ", ".$values['FieldName'.$i] ."='".$BuiltArray."'";


## AGE FIELD
}elseif($values['FieldType'.$i] == 7){

$RunExtra.= ", ".$values['FieldName'.$i] ."='".$values['FieldValue'.$i.'a']."-".$values['FieldValue'.$i.'b']."-".$values['FieldValue'.$i.'c']."'";

}elseif(isset($values['FieldValue'.$i]) && $values['FieldType'.$i] !=5){

if($values['FieldName'.$i] == "age"){

if(isset($values['birthdatey'])){
$RunExtra.= ", ".$values['FieldName'.$i] ."='".$values['birthdatey']."-".$values['birthdatem']."-".$values['birthdated']."'"; //1985-JAN-01
}else{
$RunExtra.= ", ".$values['FieldName'.$i] ."='".$values['FieldValue'.$i]."'";
}

}else{
$RunExtra.= ", ".$values['FieldName'.$i] ."='".filter_str(strip_tags($values['FieldValue'.$i]),$BadWords,$bw)."'";
}
}

}
}
// end for loop
//die(count($values).print_r($values).$RunExtra);
///////////////////////////////////////////////////////////
// CREATE MEMBER ACCOUNT
///////////////////////////////////////////////////////////

$ComData = AddMember($values, $RunExtra);
$ComParts = explode("**",$ComData);


if(isset($values['leNomDeMaCase'])){



/**
* @author mathieu
* @created 12/11/2009
* @time 16:12
*/

/* --------------------
* Exemple d'appel de notre script pour envoi des données
*
* ------------------ */

$coregData = 'login='.$login; // rober24
$coregData .= '&email='.$email; // mon_adresse@email.com
$coregData .= '&birthday='.$birthday; // 19771024 (YYYYMMDD)
$coregData .= '&gender='.$gender; // h si homme ou f si femme ou c si couple
$coregData .= '&sex='.$sex; // ht si hetero ou hm si homo ou bi si bisexuel
$coregData .= '&cp='.$cp; // 25440
$coregData .= '&userip='.$ip; // 82.214.145.44
$coregData .= '&city='.urlencode($city); // Strasbourg
$coregData .= '&comment='.urlencode($comment); // Je cherche la femme de ma vie, douce et sensible.

$coregURL = 'http://www.xxx.com/coreg/xxxx.php';

// nécessite la librairie PHP cURL activée
// envoi des données en method POST

$curl_handler = curl_init();
curl_setopt($curl_handler, CURLOPT_URL, $coregURL);
curl_setopt($curl_handler, CURLOPT_CONNECTTIMEOUT, 20);
curl_setopt($curl_handler, CURLOPT_HEADER, false);
curl_setopt($curl_handler, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_handler, CURLOPT_POST, true);
curl_setopt($curl_handler, CURLOPT_POSTFIELDS, $coregData);
curl_setopt($curl_handler, CURLOPT_TIMEOUT, 28);

$res = curl_exec($curl_handler);

if(curl_error($curl_handler) != '' || !isset($res) || empty($res)){
// erreur lors de l'appel
// timeout, plantage, etc...
}
curl_close($curl_handler);

switch($res){
case 'OK':
// tout s'est bien passé
break;
case 'KO':
// erreur, données incompletes ou invalides
break;
case 'NOK':
// erreur, cible non respectée
break;
case 'DBL':
// doublon, données du membre déjà envoyées
break;
case 'DEJA':
// refus, le membre est déjà inscrit
break;
default:
// erreur globale
// ne doit pas se produire
}


}
CheckAdminEmail("register","register", $values, "-**1");

$sql = "SELECT members.id, members.email, members_privacy.SMS_number, members_data.gender AS genderD, package.name, package.wink, package.Highlighted, package.Featured, package.maxMessage, members.moderator, package.maxFiles, members.active, members.id, members.activate_code, members.username, members.packageid, members.lastlogin, members_privacy.Language FROM members
INNER JOIN members_privacy ON ( members.id = members_privacy.uid )
LEFT JOIN members_data ON ( members.id = members_data.uid )
LEFT JOIN package ON ( members.packageid = package.pid )
WHERE members.id = '".$ComParts[0]."' LIMIT 1";

$values = $DB->Row($sql);
setSession($values, 0, 0);
// MEMBER ACCOUNT PACKAGE DATA
$values['id'] = $ComParts[0];
$values['password'] = $ComParts[1];
$values['packageid'] = DEFAULT_PACKAGE;
$values['custom'] = $ComParts[2];

////////////////////////
// SEND WELCOME EMAIL
////////////////////////
$D1 = $DB->Row("SELECT value1 FROM system_settings WHERE name='welcome_email' LIMIT 1");

SendTemplateMail($values, $D1['value1']);

$_SESSION['my_email'] =$values['email']; // used for activation account

$DB->Insert("INSERT INTO `album` ( `aid` , `uid` , `title` , `comment` , `filecount` , `cat` , `allow_f` , `allow_h` , `allow_n` , `allow_a`,password, time, date )
VALUES (NULL , '".$_SESSION['uid']."', '".$_SESSION['username']." Album', '', '0', 'public', '0', '0', '0', '0','',now(),now())");
$albumID = $DB->InsertID();

// ADD IMAGE IF ONE HAS BEEN UPLOADED
require_once(dirname(__FILE__)."/func_uploads.php");


$UploadMax = 0;
while($UploadMax < 13){

// IF THE USER DOESNT HAVE AN ALBUM, CREATE ONE
if(!isset($values['aid'])){ $values['aid']="new";}
if( ( $value['error'] !=4 ) && is_array($Files["uploadFile0".$UploadMax]) && $Files["uploadFile0".$UploadMax]['type'] !="" ){ // error 4 = empty file

$Status = UploadFile($Files["uploadFile0".$UploadMax], $_SESSION['uid'], strip_tags($values['title']), strip_tags($values['comments']), 1, 'photo', $albumID,'no');

}

$UploadMax++; }

## insert message into the database
$D2 = $DB->Row("SELECT value2 FROM system_settings WHERE name='welcome_message' LIMIT 1");
$D3 = $DB->Row("SELECT value1 FROM system_settings WHERE name='welcome_subject' LIMIT 1");

## make replacements
$Subject = str_replace("(username)",$_SESSION['username'],$D3['value1']);
$Subject = str_replace("(password)",$ComParts[1],$Subject);
$Subject = str_replace("(code)",$ComParts[2],$Subject);

$Message = str_replace("(username)",$_SESSION['username'],$D2['value2']);
$Message = str_replace("(password)",$ComParts[1],$Message);
$Message = str_replace("(code)",$ComParts[2],$Message);

$DB->Insert("INSERT INTO `messages` ( `uid` , `mailnum` , `mail2id` , `mailstatus` , `maildate` , `mailtime` , `mail_subject` , `mail_message` , `mail_displayalert`, my_box, to_box )
VALUES ('0', NULL , '".$_SESSION['uid']."', 'unread', NOW(), NOW(), '".eMeetingInput($Subject)."', '".eMeetingInput($Message)."', '1', 'sent', 'inbox')");

// NOW LETS CHECK IF THEY SIGNUP WITH AN MSN / AOL OR GMAIL EMAIL ADDRESS
// if contacts are found they are redirected back to the register page
/*
$TotalContactsFound = ContactListChecker($values['email'],$values['password']);
if(is_array($TotalContactsFound) && !empty($TotalContactsFound) ){

return $TotalContactsFound;

}
*/
## NOW DECIDE WHAT TODO NEXT?
$ReturnValue = RegisterCompleteRedirect();

return $ReturnValue;

} break;

}
} break;


case "email_contacts": {


if($values['totalrows'] > 1 ){
$Counter=0;

for($i = 1; $i < $values['totalrows']; $i++) {

if(isset($values['email'. $i])){

$data['username'] = $values['name'. $i];
$data['from_username'] = $_SESSION['username'];
$data['email'] = $values['email'. $i];
SendTemplateMail($data, 12);
$Counter++;
}
}
$Counter++;
}


## NOW DECIDE WHAT TODO NEXT?
return RegisterCompleteRedirect();

} break;



case "forward": {

## NOW DECIDE WHAT TODO NEXT?
return RegisterCompleteRedirect();

} break;



}

}

return "Balllls!!".$DoCall."-".$SwitchValue;
}


//////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////
function AddMember($data, $extra){



/*
THIS FUNCTION WILL GENERATE A NEW MEMBER ACCOUNT
*/

global $DB;

$user = str_replace(" ", "", strip_tags($data['username']));
$email = str_replace(" ", "", strip_tags($data['email']));
$pass = str_replace(" ", "", strip_tags($data['password']));
$default_CC ="United States";
$MSGSTATUS= D_STATUSMSG;

$ip = $_SERVER['REMOTE_ADDR'];
$session = session_id();

$member_Package_id = DEFAULT_PACKAGE;

// DETERMIN ACCOUNT STATUS
if(APPROVE_ACCOUNTS == "yes"){
$status = "unapproved";
}else{ $status = "active"; }


////////////////////////////////
## FIRST LETS GET THE DATA FROM THE PACKAGES
$packageData = $DB->Row("SELECT * FROM package WHERE pid='".$member_Package_id."' LIMIT 1");

////////////////////////////////////////////
// EMEETING GOIP SYSTEM DETECTION //
$reg_long=""; $reg_lat=""; $reg_country=""; $reg_code="";

if(!isset($_SESSION['clever_ip_country']) && MAPS_ID !="" && GOOGLE_MAPS_KEY !=""){

$exe_data = explode(",",ValidateExternalCountry($_SERVER['REMOTE_ADDR']));
if(is_array($exe_data) && $exe_data != 0){
$reg_long=$exe_data[4]; $reg_lat=$exe_data[3]; $reg_country=$exe_data[2]; $reg_code=$exe_data[0];
}

}elseif( isset($_SESSION['clever_ip_long']) ){

$reg_long = $_SESSION['clever_ip_long'];
$reg_lat = $_SESSION['clever_ip_lat'];
$reg_country = $_SESSION['clever_ip_country'];
$reg_code = $_SESSION['clever_ip_code'];
$default_CC = $_SESSION['clever_ip_country_name'];

}elseif(isset($data['country'])){

$reg_country = $data['country'];
$default_CC =$data['country'];
}

if(D_MD5 ==1){
$passcode = md5($pass);
}else{
$passcode = $pass;
}
/////////////////////////////////////////////
$DB->Insert("INSERT INTO `members` ( `id` , `username` , `password` , `email` , `session` , `ip` , `lastlogin` , `visible` , active, `created`, packageid, hits, profile_complete, templateid, updated, moderator, activate_code, highlight, ip_long, ip_lat, ip_country, ip_code,member_rating, msgStatus, video_duration, video_live )
VALUES (NULL , '".$user."', '".$passcode."', '".$email."', '".$session."', '".$ip."', '".DATE_TIME."', 'yes', '".$status."', '".DATE_TIME."', '".$member_Package_id."','0','0','1','".DATE_TIME."', 'no', 'OK','off','".$reg_long."','".$reg_lat."','".$reg_country."','".$reg_code."', '0','".eMeetingInput($MSGSTATUS)."','0','no')");
$userid = $DB->InsertID();

if(VALIDATE_EMAIL ==1){
// GENERATE ACTIVATE CODE
$ACTIVATION_CODE = makeRandomPassword(9);
if($ACTIVATION_CODE ==""){ $ACTIVATION_CODE = makeRandomPassword(9); }
$DB->Insert("UPDATE members SET activate_code ='".$ACTIVATION_CODE."' WHERE id= ( '".$userid."' ) LIMIT 1");
//---------------------
}

$DB->Insert("INSERT INTO `members_data` ( `uid` ) values ( '$userid' )");
$DB->Update("UPDATE `members_data` SET age='1974-JAN-15', country='".eMeetingInput($default_CC)."', headline='' WHERE uid='".$userid."' LIMIT 1"); // make default values


if(isset($data['news']) && $data['news'] =="yes"){ $nw ="yes"; }else{ $nw ="no";}
if(isset($data['notify']) && $data['notify'] =="yes"){ $nn ="yes"; }else{ $nn ="no";}


if(UPGRADE_SMS =="yes"){
$SMS_NUM=$data['smsnum'];
$SMS_MSG=$data['sms_msg_alert'];
$SMS_EMAIL=$data['sms_wink_alert'];
}else{
$SMS_NUM="";
$SMS_MSG="";
$SMS_EMAIL="";
}

$DB->Insert("INSERT INTO `members_privacy` (`uid` ,`Newsletters` ,`Notifications` ,`IM` ,`Language` ,`Time Zone` ,`friends` ,`comments` ,`profile_view` ,`im_window` ,`SMS_email` ,`SMS_wink` , SMS_number ,`SMS_credits` ,`SMS_country` ,`match_array` ,`email_winks` ,`email_msg` ,`email_friends` ,`email_match`)
VALUES ('".$userid."', '".$nw."', '".$nn."', 'yes', 'english', '', 'no', 'no', 'all', 'off', 'off', 'off', '".$SMS_NUM."', '".$packageData['SMS_credits']."', '".$reg_country."', '', 'yes', 'yes', 'yes', 'yes')");

if(strlen($extra)> 5){ $DB->Insert("UPDATE members_data SET uid= ( '".$userid."') $extra WHERE uid= ( '".$userid."' ) LIMIT 1"); }

$Str = "".$userid."**".$pass."**".$ACTIVATION_CODE;

/*
AFFILIATE CODE CHECK AND DATABASE UPDATE
*/
if(isset($_COOKIE['affiliate'])){

// ADD THE USER AND AFFILIATE ID TO THE DATABASE
$DB->Insert("INSERT INTO `aff_signup` (`affiliate_id` ,`member_id` ,`date` )VALUES ('".strip_tags($_COOKIE['affiliate'])."', '".$userid."', '".DATE_NOW."')");
$DB->Insert("UPDATE aff_members SET total_registered=total_registered+1 WHERE id= ( '".strip_tags($_COOKIE['affiliate'])."' ) LIMIT 1");

}

/*
FORUM INTEGRATION CODE
*/

if(FORUM_VB_ENABLED=="yes"){

include_once('func_forums.php');

$DB->Insert("INSERT INTO ".FORUM_VB_DATABASE.".`user` (`userid`, `usergroupid`, `membergroupids`, `displaygroupid`, `username`, `password`, `passworddate`, `email`, `styleid`, `parentemail`, `homepage`, `icq`, `aim`, `yahoo`, `msn`, `skype`, `showvbcode`, `showbirthday`, `usertitle`, `customtitle`, `joindate`, `daysprune`, `lastvisit`, `lastactivity`, `lastpost`, `lastpostid`, `posts`, `reputation`, `reputationlevelid`, `timezoneoffset`, `pmpopup`, `avatarid`, `avatarrevision`, `profilepicrevision`, `sigpicrevision`, `options`, `birthday`, `birthday_search`, `maxposts`, `startofweek`, `ipaddress`, `referrerid`, `languageid`, `emailstamp`, `threadedmode`, `autosubscribe`, `pmtotal`, `pmunread`, `salt`)
VALUES (".$userid.", '6', '', '0', '".strtolower($user)."', '".verify_password($pass)."', '2025-01-01', '".$email."', '0', '', '', '', '', '', '', '', '0', '2', '', '0', '0', '0', '0', '0', '0', '0', '0', '10', '1', '', '0', '0', '0', '0', '0', '15', '', '0000-00-00', '-1', '1', '', '0', '0', '0', '0', '-1', '0', '0', 'Kxn')");

}


if(FORUM_PHPBB_ENABLED =="yes"){

$username = $user;
global $db, $cache, $config, $user, $auth;

// Start session management
$DB->Insert("DELETE FROM ".FORUM_PHPBB_DATABASE.".".USERS_TABLE." WHERE user_id='".$userid."' LIMIT 1");
$confirm_id = request_var('confirm_id', '');
$group_name = ($coppa) ? 'REGISTERED_COPPA' : 'REGISTERED';
$sql = 'SELECT group_id FROM ' . GROUPS_TABLE . "
WHERE group_name = '" . $db->sql_escape($group_name) . "'
AND group_type = " . GROUP_SPECIAL;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$group_id = $row['group_id'];
$user_row = array(
'user_id' => $userid,
'username' => strtolower($username),
'user_password' => phpbb_hash($pass),
'user_email' => $email,
'group_id' => (int) $group_id,
'user_timezone' => "0.00",
'user_dst' => 0,
'user_lang' => "en",
'user_type' => USER_NORMAL,
'user_ip' => $ip,
'user_regdate' => time(),
'user_actkey' => '',
'user_inactive_reason' => 0,
'user_inactive_time' => 0,
);
user_add($user_row, $cp_data);

/* NOW LOGIN THEM IN */
$auth->login(strtolower($username), $pass);
}

return $Str;
}
function ValidateAccount($data, $file, $obj){
/*
THIS FUNCTION VALIDATE THE NEW MEMBERS INPUT
FROM THE REGISTER FORM
*/
global $DB;

$bad_username_array = explode(",",BLOCK_USERNAMES);



## First lets check this user name isnt already taken
$check = $DB->Row("select count(username) AS result from members where username='".$data['username']."'");
if($check['result'] != 0){ return "username"; }

if(in_array($data['username'], $bad_username_array)){
return "username";
}

## Check the username characters
if (!preg_match('/^[\w-]+$/', $data['username'])){
return "username_chars";
}

## Check the username lenght
if ( strlen($data['username']) < 5 ) {
return "username_short";
}

## Lets check the email addresss
$check2 = $DB->Row("select count(email) AS result from members where email ='".$data['email']."'");
if($check2['result'] != 0){ return "email"; }

/*if(eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $values['email'])) {

}else{
return "invalid_email";
}*/
/*
// Lets check the email address is of valid
list($userName, $mailDomain) = split("@", $data['email']);
if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) {
## Custome check for windows servers
if (myCheckDNSRR($mailDomain) == 1){
return "invalid_email";
}

}else{
## Linus Server
if (!checkdnsrr($mailDomain, "MX")) {
return "invalid_email";
}
}
*/
## Check the password lenght
if ( strlen( $data['password'] ) < 5 ){
return "password_lenght";
}

## Check the password
if($data['password'] != $data['password_confirm']){
return "password";
}

if(MUST_HAVE_IMAGE ==1){
## Check the user has uploaded a photo
if(isset($file['uploadFile00']['name']) && strlen($file['uploadFile00']['name']) < 4){
return "photo";
}

## Check the user has uploaded a photo
if($file['uploadFile00']['size'] == 0){
return "photo";
}

## CHECK THE IMAE TYPE IS CORRECT
$uptypes=array('image/jpg', 'image/jpeg', 'image/png', 'image/pjpeg', 'image/x-png');
if(!in_array($file['uploadFile00']['type'], $uptypes)){
return "photo_invalid";
}

}
if(D_REGISTER_IMAGE ==1){
## Check the verification code
if (!$obj->validRequest($data['code'])) {
return "verification";
}
}

## CHECK ALL THE FIELDS HAVE BEEN COMPLETED
$Exptions = $data['LinkedRows'];
for($i = 1; $i < 200; $i++) {

if($data['FieldName'.$i] == "age"){

if( ( isset($data['FieldValue'.$i]) && $data['FieldValue'.$i] =="1990-JAN-01" ) || ( isset($data['FieldValue'.$i.'a']) && $data['FieldValue'.$i.'a'] == "1990" ) ){

return "field_empty";

}
}



if(isset($data['FieldName'.$i]) && $data['FieldName'.$i] != "" && $data['FieldName'.$i] != "location" ){ // && $data['FieldName'.$i] != "country"

if(isset($data['FieldValue'.$i]) && ( ( $data['FieldValue'.$i] == "" ) || ( $data['FieldValue'.$i] == '0' ) ) ){
if($Exptions ==0){
return "field_empty";
}else{
$Exptions--;
}
}
}
}

// NO ERRORS
return "complete";
}


function RegisterCompleteRedirect(){

global $DB;

// THE MEMBER ACCOUNT HAS NOW BEEN CREATED
// WE MUST NOW REDIRECT THEM EITHER TO THEIR
// ACCOUNT PAGE, OR TO THE VALIDATE PAGE

if(VALIDATE_EMAIL ==1 || APPROVE_ACCOUNTS =="yes"){

## DISTORY USER SESSIONS
$_SESSION['auth']="no";
return "activateAccount";

}elseif(isset($_SESSION['uid'])){


return "gogogo";
}

}
?>
LA GLOBULE
le 27/11/2009 à 08:44
LA GLOBULE
Je n'ai pas lu ton code (trop long, et tu n'utilises pas le BB-Code), mais quel est ton vrai soucis ?

Toi, tu es le site A ou le site B ? Moi je pense que tu es A.

Le site B t'a expliqué comment tu pouvais inscrire ton membre chez lui ?
gladiator2b
le 27/11/2009 à 19:13
gladiator2b
Bonsoir LA GLOBULE

Oui je suis le site A et le site B m'a envoyé un fichier d'exemple voici le fichier d'exemple

php
/**
* @author mathieu
* @created 12/11/2009
* @time 16:12
*/

/* --------------------
* Exemple d'appel de notre script pour envoi des données
*
* ------------------ */

$coregData = 'login='.$login; // rober24
$coregData .= '&email='.$email; // mon_adresse@email.com
$coregData .= '&birthday='.$birthday; // 19771024 (YYYYMMDD)
$coregData .= '&gender='.$gender; // h si homme ou f si femme ou c si couple
$coregData .= '&sex='.$sex; // ht si hetero ou hm si homo ou bi si bisexuel
$coregData .= '&cp='.$cp; // 25440
$coregData .= '&userip='.$ip; // 82.214.145.44
$coregData .= '&city='.urlencode($city); // Strasbourg
$coregData .= '&comment='.urlencode($comment); // Je cherche la femme de ma vie, douce et sensible.

$coregURL = 'http://www.chichou.com/coreg/alzeto.php';

// nécessite la librairie PHP cURL activée
// envoi des données en method POST

$curl_handler = curl_init();
curl_setopt($curl_handler, CURLOPT_URL, $coregURL);
curl_setopt($curl_handler, CURLOPT_CONNECTTIMEOUT, 20);
curl_setopt($curl_handler, CURLOPT_HEADER, false);
curl_setopt($curl_handler, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_handler, CURLOPT_POST, true);
curl_setopt($curl_handler, CURLOPT_POSTFIELDS, $coregData);
curl_setopt($curl_handler, CURLOPT_TIMEOUT, 28);

$res = curl_exec($curl_handler);

if(curl_error($curl_handler) != '' || !isset($res) || empty($res)){
// erreur lors de l'appel
// timeout, plantage, etc...
}
curl_close($curl_handler);

switch($res){
case 'OK':
// tout s'est bien passé
break;
case 'KO':
// erreur, données incompletes ou invalides
break;
case 'NOK':
// erreur, cible non respectée
break;
case 'DBL':
// doublon, données du membre déjà envoyées
break;
case 'DEJA':
// refus, le membre est déjà inscrit
break;
default:
// erreur globale
// ne doit pas se produire
}


}
gladiator2b
le 27/11/2009 à 19:19
gladiator2b
Dans mon fichier funct_register.php
j'ai rajouter cette ligne juste pour voir

php
if(isset($values['leNomDeMaCase'])){
echo $_POST['username'];
echo $_POST['password'];
echo $_POST['email'];


Lorsque le visiteur coche la case l'enregistrement s'effectue et sur la page je vois le nom d'utilisateur le mot de passe et l'email

Comment faire pour envoyer ses informations sur une autre page et que je sois le seul à voir ?
LA GLOBULE
le 30/11/2009 à 09:53
LA GLOBULE
Ben utilise le code que t'a donné le site B.

D'après ce code, il fait un 'hit' (en utilisant la lib curl) sur une url de chez lui, avec certains paramètres qui font que B enregistrera le membre dans sa base de données.
gladiator2b
le 30/11/2009 à 13:21
gladiator2b
Bonjour La Globule merci pour la réponse mais comment faire pour que le site B enregistre le membre surtout que chez moi c'est username et sur le site B c'est login
gladiator2b
le 04/12/2009 à 21:00
gladiator2b
Bonsoir,

Est ce qu'il faut que je mette ça avant le fichier du site B

if(isset($values['leNomDeMaCase'])){
LA GLOBULE
le 04/12/2009 à 22:28
LA GLOBULE
Ben utilises le code que t'a donné le site.
Rempli le $coregData, et execute le curl.

Ton problème ce n'est pas que tu ne comprends pas le code ? Dans ce cas, que ne comprends tu pas ? As tu la documentation de la librairie curl ?
gladiator2b
le 04/12/2009 à 22:33
gladiator2b
Bonsoir,
Non je ne comprnds pas ce que je dois faire avec le code du site B et pour répondre à la derniere question non je n'ai pas de doc sur la librairie curl
Répondre
LoadingChargement en cours