Jump to content

[help!] syntax error:Unexpected T_IF


nicx

Recommended Posts

Please help me,because im a amateur in php and i can find what my mistakes with the code

<?php 


define("EZXEZ_LIB",      "EzXez Unlimited2");
define("EZXEZ_VER",      "v 1.1 beta");
define("EZXEZ_BUILD",   "20081202");
define("EZXEZ_AUTH",   "by www.nabrak.biz.tm");

define("EZXEZ_LOGIN",    "http://www.nabrak.biz.tm/ezxez/index.php");
define("EZXEZ_KIRIM",    "http://www.nabrak.biz.tm/ezxez/index.php");
define("EZXEZ_CLEFT",    "http://www.nabrak.biz.tm/ezxez/index.php");


Class EZXEZ {
var
$cookie,
$ch,
$is_init,
$cleft,
$newurl,
$cLoaded;

function LibName() {
return array(EZXEZ_LIB,EZXEZ_VER,EZXEZ_BUILD,EZXEZ_AUTH);
}

function UserAgent(){
/*
$agent = EZXEZ_LIB.'/';
$agent .= EZXEZ_VER.'(';
$agent .= EZXEZ_BUILD.'-';
$agent .= EZXEZ_AUTH;
*/
return $_SERVER[HTTP_USER_AGENT];
}

function Login($user, $pass, $tujuan, $pesan){
$no = $this->Nomer($user);
if ($no == 0){
return 0;
}else{
$cid = $no[0];
$pid = $no[1];
}

$loginPost = "user=".$this->tujuan($user)."&pass=".$pass."&tujuan=".$tujuan."&pesan=".$pesan;
$login = $this->useCurl(EZXEZ_LOGIN,$loginPost);
if ($this->newurl == 'index.php') return 1;
return 0;
}

function kirimSms ($user, $pass, $tujuan, $pesan,$nick="",$nolimit=1) {
$pesan = '';
if (!empty($nick)){
$pesan .= $nick.'%3A%0D';
}
$pesan    .= rawurlencode($pesan);

$hasil    = '';

if ($nolimit == 1)   $pesan = substr($pesan,0,160);

$panjang = strlen($pesan);
if (strlen($pesan)>160)   $panjang = 160;


$kirimPost    = "user=".$this->tujuan($user)."&pass=".$pass."&tujuan=".$tujuan."&pesan=".$pesan;

$kirim    = $this->useCurl(EZXEZ_KIRIM,$kirimPost);
//index.php?p=sendsms
if ($this->newurl == 'index.php' ) {

$hasil    .= $tujuan.' => OK!
';
}else{
$hasil    .= $tujuan.' => Gagal Terkirim!
';
$err   = 1;
}
}
if ($err == 1) return array(0,'Failed');
return array(1,$hasil);
}

function myCurl($load=1){
if($load && !$this->cLoaded){
$this->ch = curl_init();
$this->cLoaded=1;
}elseif(!$load && $this->cLoaded){
curl_close($this->ch);
$this->cLoaded=0;
}
}


Public Function useCurl($url, $postfield = '',$headonly=0){
$this->newurl = '';
$this->myCurl();
if ($postfield) {
curl_setopt($this->ch, CURLOPT_POST       , 1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS   , $postfield);
}else
curl_setopt($this->ch, CURLOPT_HTTPGET      , 1);
curl_setopt($this->ch, CURLOPT_NOBODY         , $headonly);
curl_setopt($this->ch, CURLOPT_NOBODY         , 0);
curl_setopt($this->ch, CURLOPT_URL            , $url);
curl_setopt($this->ch, CURLOPT_USERAGENT      , $this->UserAgent());
curl_setopt($this->ch, CURLOPT_HEADER         , 1);
curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT   , 10);
curl_setopt($this->ch, CURLOPT_COOKIE         , $this->cookie);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER   , 1);

//curl_setopt($this->ch, CURLOPT_PROXY         , "172.16.20.250:1688"); //Buat ngetes pake proxy lokal

$execute = curl_exec($this->ch);

preg_match_all('/Set-Cookie: (.*?)\r\n/', $execute, $roti);
if ($roti[1]) $this->cookie = implode(';', $roti[1]);

preg_match('/location:(.*?)\r\n/ims', $execute, $ngikut);
$this->newurl = trim($ngikut[1]);

return $execute;
}
}
?>

<?php
GLOBAL $sv;
GLOBAL $sp;
$sv = array_merge ($_ENV, $_SERVER, $HTTP_ENV_VARS, $HTTP_SERVER_VARS);
$sp = array_merge ($HTTP_POST_VARS, $HTTP_GET_VARS);

$GOTEXT = new EZXEZ();

$user = $sp['user'];
$pass = $sp['pass'];
$nick = $sp['nick'];
$text = $sp['text'];
$rcpt = $sp['rcpt'];
$action = $sp['action'];

if (isset($sp[info])) {
echo 'About Script:<br/>
1. Use Only Format for login and sending message, ex: 819537xxxxx<br/>
2. You Can Use Your Name at the begining of message, Just fill Your Nick on GoText option.<br/>
3. Max char per message reduced to 160 char <br/>
4. No Ads on your message.<br/>
<br/>';

}elseif ($action == 'config'){
if (isset($sp[alifia])){
$mc = 1000;
$mm = 1000;
$mr = 10;
}else{
$mc = 160; //160
$mm = 99; //15
$mr = 10; //10
}
if (isset($sp[mr])){
$mr = $sp[mr];
}
echo '<config><t>EZXEZ SMS UNLIMITED By CoolZERO for Indonesia only</t>
<nu>1</nu>
<np>1</np>
<nn>0</nn> 
<mr>'.$mr.'</mr>
<mc>'.$mc.'</mc>
<in>1</in>
<mm>'.$mm.'</mm>
</config>';
}elseif ($user =="" or $pass ==""){
$e = $GOTEXT->LibName();
/*echo "

<title>EzXez</title></head>
<form action={$_SERVER["PHP_SELF"]} method=POST>User:
<input name=user type=text maxlength=14 value=>
Pwd:<input name=pass type=password value=>
Tujuan: <input name=rcpt type='text' id='phone' mini:hint='phone' value='+628'/><br/>

Pesan: <br/><textarea name=text></textarea><br/>

<input type=submit value=Send>
</form>

";*/
echo "You can send sms only via http://nabrak.biz.tm or install this url  to gotext apps on your phone!"; 
}elseif   ($GOTEXT->Login($user, $pass)) {

$nolimit=1;
if (isset($sp[alifia])) $nolimit=1;
$GOTEXT->cleft = $GOTEXT->cek_credit($nolimit);
//echo 'cleft:'.$GOTEXT->cleft;
if ($GOTEXT->cleft==0){
respon (3,'Maaf, credit kamu hari ini sudah habis!',isset($sp[silent]));
}else{
$kirim = $GOTEXT->kirimSms($rcpt, $text,$nick,$nolimit);
$sisac = $GOTEXT->cleft - 1;
if ($nolimit == 1) $sisac = 'Unlimited';
if ($kirim[0]){
respon (0,'SMS terkirim ke '.$kirim[1].'
Sisa credit kamu '.$sisac.' SMS',isset($sp[silent]));
}else
respon (0,'Sisa credit kamu '.$sisac.' SMS',isset($sp[silent]));
}
}else
respon (2,'Username atau password salah!');

function respon($no,$text,$silent=FALSE){
$GOTXT = new EZXEZ();

$me = $GOTXT->LibName();
$text = $text.'
'.$me[0].' '.$me[1].'
'.$me[3];
if ($silent) $text = '';

echo '<res><num>'.$no.'</num><txt>'.$text.'</txt></res>';
}

?>
[code] that shown sintax error,unexpected T_IF etc. Plz help to corrected..Thank you.

Link to comment
Share on other sites

I have to agree with waynewex, I took a few minutes to "properly" format the code and the error was redily apparent. Here is your code with logical indentation down to line 82. It looks like you closed the class too early

 

<?php 

define("EZXEZ_LIB",      "EzXez Unlimited2");
define("EZXEZ_VER",      "v 1.1 beta");
define("EZXEZ_BUILD",   "20081202");
define("EZXEZ_AUTH",   "by www.nabrak.biz.tm");

define("EZXEZ_LOGIN",    "http://www.nabrak.biz.tm/ezxez/index.php");
define("EZXEZ_KIRIM",    "http://www.nabrak.biz.tm/ezxez/index.php");
define("EZXEZ_CLEFT",    "http://www.nabrak.biz.tm/ezxez/index.php");


Class EZXEZ {
  var $cookie, $ch, $is_init, $cleft, $newurl, $cLoaded;

  function LibName()
  {
    return array(EZXEZ_LIB,EZXEZ_VER,EZXEZ_BUILD,EZXEZ_AUTH);
  }

  function UserAgent()
  {
    /*
    $agent = EZXEZ_LIB . '/' . EZXEZ_VER . '(' . EZXEZ_BUILD . '-' . EZXEZ_AUTH;
    */
    return $_SERVER[HTTP_USER_AGENT];
  }

  function Login($user, $pass, $tujuan, $pesan){
  $no = $this->Nomer($user);
  if ($no == 0)
  {
    return 0;
  }
  else
  {
    $cid = $no[0];
    $pid = $no[1];
  }

  $loginPost = "user=".$this->tujuan($user)."&pass=".$pass."&tujuan=".$tujuan."&pesan=".$pesan;
  $login = $this->useCurl(EZXEZ_LOGIN,$loginPost);
  if ($this->newurl == 'index.php') return 1;
  return 0;
}
//##########################
//Ends the Class EZXEZ
//##########################

function kirimSms ($user, $pass, $tujuan, $pesan,$nick="",$nolimit=1)
{
  $pesan = '';
  if (!empty($nick))
  {
    $pesan .= $nick.'%3A%0D';
  }
  $pesan    .= rawurlencode($pesan);

  $hasil    = '';

  if ($nolimit == 1)   $pesan = substr($pesan,0,160);

  $panjang = strlen($pesan);
  if (strlen($pesan)>160)   $panjang = 160;


  $kirimPost    = "user=".$this->tujuan($user)."&pass=".$pass."&tujuan=".$tujuan."&pesan=".$pesan;

  $kirim    = $this->useCurl(EZXEZ_KIRIM,$kirimPost);
  //index.php?p=sendsms
  if ($this->newurl == 'index.php' )
  {
    $hasil    .= $tujuan.' => OK!
                     ';
  }
  else
  {
    $hasil    .= $tujuan.' => Gagal Terkirim!
                    ';
    $err   = 1;
  }
}
//##########################
//Ends the function kirimSms
//##########################


if ($err == 1) return array(0,'Failed');
return array(1,$hasil);
} // ????????????

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.