IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

PHP & Base de données Discussion :

nous avons un problème de boucle [MySQL]


Sujet :

PHP & Base de données

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre habitué
    Profil pro
    Inscrit en
    Mai 2007
    Messages
    9
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2007
    Messages : 9
    Par défaut nous avons un problème de boucle
    bonjour a tous et tres bonne année.

    nous avons un petit problème de boucle de type while
    nous voulons que le programme boucle si condition >
    voici notre programme et recommance au point de depard

    merci
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
     
    <!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=ISO-8859-1" />
    <title>Untitled Document</title>
    </head>
     
    <body>
     
     
     
    <?php 
     
     
     
    $ciblefin = $_POST['$ciblefin'];
    $cible = $_POST['$cible'];
    Define('AUTHENTIFICATION', 'http://------------------------------------------------/');
    Define('COOKIE_FILE','cookie.txt');						
    Define('EMPTY_FILE',"emptyfile.txt");					
    Define('USER_AGENT','Mozilla/5.0');						
    Define('LOGIN','---------');							
    Define('PASSWORD','-------');
     
     
     
     
    $message = "bla bla blllllllllllllllllllllllaaaaaaaaaaaaaaaaaa";
    $image =  "image1.jpg";
    if(send_sms($cible,$message,$image)) echo("sms ok au : $cible");
    else echo("Impossible de trouver le token ou message trop long. Message non transmis. Mauvais logins ?");
     
    /
    function send_sms($cible,$message,$image)
    {
    	//Encodage d
    	$message = utf8_decode($message);
     
    	$ch = curl_init();
     
    	// set url
    	curl_setopt($ch, CURLOPT_URL, AUTHENTIFICATION);
    	curl_setopt($ch, CURLOPT_COOKIEJAR, realpath(COOKIE_FILE));
    	curl_setopt($ch, CURLOPT_COOKIEFILE, realpath(COOKIE_FILE));
    	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
    	curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE);
    	curl_setopt($ch, CURLOPT_USERAGENT, USER_AGENT);
    	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     
    	// $output contains the output string
    	$output = curl_exec($ch);
     
    	curl_close($ch);
     
    	$ch = curl_init();
    	curl_setopt($ch, CURLOPT_URL, "https://www.------------------------------spring_cas_security_check");
    	curl_setopt($ch, CURLOPT_POST, TRUE);
    	curl_setopt($ch, CURLOPT_POSTFIELDS,"target=&_eventId=&currentPage=&username=".LOGIN."&password=".PASSWORD);
    	curl_setopt($ch, CURLOPT_COOKIEJAR, realpath(COOKIE_FILE));
    	curl_setopt($ch, CURLOPT_COOKIEFILE, realpath(COOKIE_FILE));
    	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
    	curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE);
    	curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
    	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     
    	$ret = curl_exec($ch);
     
    	curl_setopt($ch, CURLOPT_URL, "----------/index.do");
     
     
    	$ret = curl_exec($ch);
     
    	if ($ret === FALSE) {
    	    die(curl_errno($ch));
    	}
     
    	preg_match("!\"CSRFToken\" value=\"([0-9]*)!",$ret,$out);
     
    	if(!isset($out[1]))
    	{
    		return 0;
    	}
     
    	$token = $out[1];
     
    	$array = Array(
    	"CSRFToken" => $token,
    	"idMessage" => '',
    	"submitMethod" => 'web',
    	"todo" => '',
    	"boxId" => 'sent',
    	'galleryItem' => '-1',
    	'msisdns' => $cible,
    	'emails' => '',
    	'emoticones' => ':)',
    	'message' => $message,
    	'file' => '@'.realpath(EMPTY_FILE)
    	);
     
    	curl_setopt($ch, CURLOPT_URL, "http://www.-------------------------------------------/submit.do");
    	curl_setopt($ch, CURLOPT_COOKIEJAR, realpath(COOKIE_FILE));
    	curl_setopt($ch, CURLOPT_COOKIEFILE, realpath(COOKIE_FILE));
    	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
    	curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE);
    	curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
    	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    	curl_setopt($ch, CURLOPT_POST, TRUE);
    	curl_setopt($ch, CURLOPT_POSTFIELDS,$array);
    	$ret = curl_exec($ch);
     
    	preg_match("!\"CSRFToken\" value=\"([0-9]*)!",$ret,$out);
    	$token = $out[1];
     
    	//Confirmation
    	$array = Array(
    	"CSRFToken" => $token,
    	"idMessage" => '',
    	"submitMethod" => 'web',
    	"todo" => '',
    	"boxId" => 'sent',
    	'emoticones' => ':)',
    	'mms' => 'false',
    	'message' => $message
    	);
     
    	curl_setopt($ch, CURLOPT_URL, "http://www.-----------------------------------------------------------------");
    	curl_setopt($ch, CURLOPT_POST, TRUE);
    	curl_setopt($ch, CURLOPT_POSTFIELDS,$array);
    	$ret = curl_exec($ch);
    	curl_close($ch);
     
    	if(strpos($ret,"Le Texto a &eacute;t&eacute; exp&eacute;di&eacute; avec succ&egrave;s&nbsp;!") === false) return 0;
    	else return 1;
     
    	return 1;
     }	
     
     
     
    ?>
     
     
     
    </body>
    </html>

  2. #2
    Membre confirmé
    Étudiant
    Inscrit en
    Janvier 2010
    Messages
    73
    Détails du profil
    Informations personnelles :
    Âge : 37

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2010
    Messages : 73
    Par défaut
    tu peux décrire plus et mettre la partie ou tu plantes?

  3. #3
    Membre habitué
    Profil pro
    Inscrit en
    Mai 2007
    Messages
    9
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2007
    Messages : 9
    Par défaut
    Citation Envoyé par ridick Voir le message
    tu peux décrire plus et mettre la partie ou tu plantes?
    tel que le programme est rien ne plante mais j'ai enlever les donnée sensible

    en faite je voudrais faire une boucle a partir de define
    ciblefin = $_POST['$ciblefin']; compteur de fin
    $cible = $_POST['$cible']; compteur debut

    la boucle doit donner +1 a $cible jusqu'a > que cible fin

    et si < ont recommence a define

    mais voila le ????

    return 1 et 0

  4. #4
    Modératrice
    Avatar de Celira
    Femme Profil pro
    Développeuse PHP/Java
    Inscrit en
    Avril 2007
    Messages
    8 633
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Développeuse PHP/Java
    Secteur : Industrie

    Informations forums :
    Inscription : Avril 2007
    Messages : 8 633
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    $ciblefin = $_POST['ciblefin']; //compteur de fin
    $cibledebut = $_POST['cible']; //compteur debut
    for ($cible = $cibledebut ; $cible < $ciblefin; $cible++)
    {
      $message = "bla bla blllllllllllllllllllllllaaaaaaaaaaaaaaaaaa";
      $image =  "image1.jpg";
      if(send_sms($cible,$message,$image)) 
        echo("sms ok au : $cible");
      else 
        echo("Impossible de trouver le token ou message trop long. Message non transmis. Mauvais logins ?");
    }
    Modératrice PHP
    Aucun navigateur ne propose d'extension boule-de-cristal : postez votre code et vos messages d'erreurs. (Rappel : "ça ne marche pas" n'est pas un message d'erreur)
    Cherchez un peu avant poser votre question : Cours et Tutoriels PHP - FAQ PHP - PDO une soupe et au lit !.

    Affichez votre code en couleurs : [CODE=php][/CODE] (bouton # de l'éditeur) et [C=php][/C]

  5. #5
    Membre habitué
    Profil pro
    Inscrit en
    Mai 2007
    Messages
    9
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2007
    Messages : 9
    Par défaut merci a tous
    merci mais j'ai trouver
    pour la boucle et le programme marche tres bien et seul pour 1 M envoie 48 h
    merci de vous très important service et de votre compétence en php
    pierre mafarette

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 4
    Dernier message: 02/03/2015, 11h37
  2. Problème de boucle
    Par TheUltimaSephiroth dans le forum C
    Réponses: 8
    Dernier message: 10/10/2005, 13h58
  3. Problème de boucle
    Par Louis-Guillaume Morand dans le forum Langage SQL
    Réponses: 3
    Dernier message: 25/09/2005, 09h10
  4. Problème de boucle
    Par basclln dans le forum C++
    Réponses: 19
    Dernier message: 02/04/2005, 09h13

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo