Input wordt niet verzonden

Gestart doorPropje4 reacties51 weergaven

5 berichten · pagina 1 van 1

Propje

Lid · Topicstarter

Berichten
2.517
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hallo,

Ik ben ergens mee scripten maar er lukt iets niet,

hij geeft de errors niet weer zoals bericht succesvol gestuurd bericht is niet verstuurd etc

hier het stukje code:

function sendsms() {
        $out = "GET /smsapi.php?api&number=".$this->number."&message=".$this->message." HTTP/1.1
";
        $out .= "Host: ".$this->host."
";
        $out .= "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
";
        $out .= "Connection: Close

";
        fwrite($this->fp, $out);
        $this->buffer = "";
        while (!feof($this->fp)) {
            $this->buffer .= fgets($this->fp, 128);
        }
        fclose($this->fp);
    }
    function check() {
        $output = explode("
",$this->buffer);
        return $output[8];
    }
}
$i=0;
    $api = new sms;
    $api->setconfig(naamloos, sss, .$_POST["nummer"]., .$_POST["bericht"].);
    $api->connect();
    $api->sendsms();
          echo <form action="" method="GET">
<table width="350" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="93">Nummer:</td>
    <td width="257"><label>
      <input type="text" name="nummer" id="nummer">
    </label></td>
  </tr>
  <tr>
  </tr>
  <tr>
    <td>Bericht:</td>
    <td><label>
      <textarea name="bericht" id="bericht" cols="45" rows="5"></textarea>
    </label></td>
  </tr>
  <tr>
    <td><input name="submit" type="submit" value="Verstuur sms" /></td>
    <td>&nbsp;</td>
  </tr>
</table>

</form>;
         if(isset($_POST[submit])) { 
         if(strlen($api->check()) < 0) {
         $error .= succesvol verstuurd;
        }
         if(strlen($api->check()) < 1) {
         $error .= bericht telang;
        }
         if(strlen($api->check()) < 2) {
         $error .= je hebt geen bericht ingevuld;
        }
          if(isset($error)) {
         echo Er zijn fouten opgetreden: .$error. ;
        }
        }
    $i++;


Kan iemand me helpen ? gr propje
0
Berichten
5.274
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien

Eindhoven, Nederland

Dit gaat zowiezo niet heel goed.

if(strlen($api->check()) < 0) {
         $error .= succesvol verstuurd;
        }
         if(strlen($api->check()) < 1) {
         $error .= bericht telang;
        }
         if(strlen($api->check()) < 2) {
         $error .= je hebt geen bericht ingevuld;
        }


Dus als $api->check() onder 0 is, dan komt er succesvol, als hij onder 1 is komt er succesvol, dus als er 0 komt, dan worden de laatste 2 errors weergegeven.
beter maak je er elseif van.

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$api[/COLOR][COLOR= #007700]->[/COLOR]check[COLOR= #007700]()) <[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700])[/COLOR] [COLOR= #FF8000]//Als die onder 0 is dan.. (Wat niet kan? miss een boolean.)[/COLOR]
[COLOR= #007700]{[/COLOR]
    [COLOR= #0000BB]$error[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #DD0000]succesvol verstuurd[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$api[/COLOR][COLOR= #007700]->[/COLOR]check[COLOR= #007700]()) <[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700])[/COLOR] [COLOR= #FF8000]//Als hij dus 0 is.[/COLOR]
[COLOR= #007700]{[/COLOR]
    [COLOR= #0000BB]$error[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #DD0000]bericht telang[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$api[/COLOR][COLOR= #007700]->[/COLOR]check[COLOR= #007700]()) <[/COLOR] [COLOR= #0000BB]2[/COLOR][COLOR= #007700])[/COLOR] [COLOR= #FF8000]//als hij 1 is.[/COLOR]
[COLOR= #007700]{[/COLOR]
    [COLOR= #0000BB]$error[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #DD0000]je hebt geen bericht ingevuld[/COLOR][COLOR= #007700];
}[/COLOR]
?>


Even doorgekeken, maar dat van mij klopt ook niet yummie.
Waarom check je de string lenght? Wat zijn de outputs ervan?

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$api[/COLOR][COLOR= #007700]->[/COLOR]check[COLOR= #007700]()) ==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700])[/COLOR] [COLOR= #FF8000]//Als hij 0 is dan, want strlen kan niet lager dan 0 terug geven.[/COLOR]
[COLOR= #007700]{[/COLOR]
    [COLOR= #0000BB]$error[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #DD0000]succesvol verstuurd[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$api[/COLOR][COLOR= #007700]->[/COLOR]check[COLOR= #007700]()) ==[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700])[/COLOR] [COLOR= #FF8000]//Als hij dus 1 is dan.[/COLOR]
[COLOR= #007700]{[/COLOR]
    [COLOR= #0000BB]$error[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #DD0000]bericht telang[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$api[/COLOR][COLOR= #007700]->[/COLOR]check[COLOR= #007700]()) ==[/COLOR] [COLOR= #0000BB]2[/COLOR][COLOR= #007700])[/COLOR] [COLOR= #FF8000]//als hij 2 is dan.[/COLOR]
[COLOR= #007700]{[/COLOR]
    [COLOR= #0000BB]$error[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #DD0000]je hebt geen bericht ingevuld[/COLOR][COLOR= #007700];
}[/COLOR]
?>


komt meer in de buurt.
0
Propje

Lid · Topicstarter

Berichten
2.517
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nee, werkt NOG STEEDS NIET confused
0
Berichten
5.274
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien

Eindhoven, Nederland

Wat return die api check?
0
Berichten
4.912
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
je mag er best wel boven aan het script neerzetten dat het door daiman is gemaakt je hebt zijn hele copyricht weg gehaald.
en ik weet niet eens of daiman het wil dat je dit script op het forum pleurt.
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren