nicx Posted December 2, 2008 Share Posted December 2, 2008 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. Quote Link to comment Share on other sites More sharing options...
Psycho Posted December 2, 2008 Share Posted December 2, 2008 What is the full error message witht he line number? Quote Link to comment Share on other sites More sharing options...
nicx Posted December 2, 2008 Author Share Posted December 2, 2008 Parse error,sintax error: unexpected T_IF, expecting T_Function on line 81. Thats the complete warning.Plz help Quote Link to comment Share on other sites More sharing options...
nicx Posted December 2, 2008 Author Share Posted December 2, 2008 Thats the full error message,pliz help me Quote Link to comment Share on other sites More sharing options...
waynew Posted December 2, 2008 Share Posted December 2, 2008 To be honest with you, the code is very messy and it lacks any indentation. Use proper indentation and I'm sure that you'll find the problem. Quote Link to comment Share on other sites More sharing options...
Psycho Posted December 2, 2008 Share Posted December 2, 2008 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); } // ???????????? Quote Link to comment Share on other sites More sharing options...
nicx Posted December 3, 2008 Author Share Posted December 3, 2008 Hmm okay.. Thankz. I will try it Quote Link to comment Share on other sites More sharing options...
nicx Posted December 3, 2008 Author Share Posted December 3, 2008 Why with the correct sintax code?? Please help...To write the right codes. Im very confusing Quote Link to comment Share on other sites More sharing options...
Psycho Posted December 3, 2008 Share Posted December 3, 2008 I didn't correct your code. I only formatted it so the prolem was apparent - which is there is a closing curly bracket "}" without a corresponding opening bracket. I don't know how your class and functions are supposed to be configured. Quote Link to comment Share on other sites More sharing options...
nicx Posted December 3, 2008 Author Share Posted December 3, 2008 How to make it correct? Quote Link to comment Share on other sites More sharing options...
haku Posted December 3, 2008 Share Posted December 3, 2008 Make sure you have the same number of opening and closing curly braces. Quote Link to comment Share on other sites More sharing options...
nicx Posted December 3, 2008 Author Share Posted December 3, 2008 Ok,i will check and try again..Thankz Quote Link to comment Share on other sites More sharing options...
nicx Posted December 3, 2008 Author Share Posted December 3, 2008 Thanks it can correct now. Thanks all Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.