Jump to content


  • Posts

  • Joined

  • Last visited

realeez's Achievements


Member (2/5)



  1. Dear Friends, I am alot before doing the mixed content of php and HTML in single variable in PHP.. I could not get the data even though there is not SYNTAX error.. please look my code and advise $htmlcontent .=" <tr> <td colspan=\"8\">".$details."></td> </tr>"; for($k=0;$k<count($reg_years[$details]);$k++) { $year = (int)($reg_years[$details][$k]); $singlecount[$year] = array_filter($result[$details],function($details1) use ($year){ return ($details1['reg_year'] == $year && $details1['bench_type'] == 1); }); $divisioncount[$year] = array_filter($result[$details],function($details2) use ($year){ return ($details2['reg_year'] == $year && $details2['bench_type'] == 2); }); $fullcount[$year] = array_filter($result[$details],function($details3) use ($year){ return ($details3['reg_year'] == $year && $details3['bench_type'] >= 3); }); $rpcount[$year] = array_filter($result[$details],function($rp) use ($year){ return ($rp['reg_year'] == $year && $rp['bench_type'] == 'RP'); }); $mjccount[$year] = array_filter($result[$details],function($mjc) use ($year){ return ($mjc['reg_year'] == $year && $mjc['bench_type'] == 'MJC'); }); $cocount[$year] = array_filter($result[$details],function($co) use ($year){ return ($co['reg_year'] == $year && $co['bench_type'] == 'X'); }); $total = 0; $total = (int)(count($singlecount[$year])+count($divisioncount[$year])+count($fullcount[$year])+count($rpcount[$year])+count($mjccount[$year])+count($cocount[$year])); $htmlcontent .=" <tr> <td>".$year."</td> <td align=\"center\"> if(count($singlecount[$year])>0) { echo (count($singlecount[$year])); } else { echo "-"; } </td> <td align=\"center\"> if(count($divisioncount[$year])>0) { ".count($divisioncount[$year])." } else { "-" } </td> <td align=\"center\"> if (count($fullcount[$year]) > 0) { echo (count($fullcount[$year])); } else { echo "-"; } </td > < td align =\"center\"> if(count($rpcount[$year])>0) { echo (count($rpcount[$year])); } else { echo " - "; } </td> <td align=\"center\"> if(count($mjccount[$year])>0) { echo (count($mjccount[$year])); } else { echo " - "; } </td> <td align=\"center\"> if(count($cocount[$year])>0) { echo (count($cocount[$year])); } else { echo " - "; } </td> <td align=\"center\"> echo $total; </td> </tr>"; } } $htmlcontent .= "</tbody></table>"; $mpdf = new \Mpdf\Mpdf(); $mpdf->WriteHTML($htmlcontent); $mpdf->Output(); Waiting for FAST reply Thanks Anes
  2. Dear Friends , I am working on a simple python instantiation program given below. I got name error. class adder: result = 0 def __init__(self, number1, number2): #self.result = int( number1 ) + int( number2 ) self.number1 = number1 self.number2 = number2 def giveResult(self): #return str(self.result) return self.number1 + self.number2 endIt = False while ( endIt == False ): print "Please input two intergers you wish to add: " number1 = raw_input( "Enter the first number: " ) number2 = raw_input( "Enter the second number: " ) print number1 print number2 try: thistime=adder(int(number1),int(number2)) except NameError: print "Some error" print "Sorry, one of your values was not a valid integer." continue print "Your result is: " + thistime.giveResult() goagain = raw_input( "Do you want to eXit or go again? ('X' to eXit, anything else to continue): " ) if ( goagain == "x" or goagain == "X" ): endIt = True I got error as Enter the first number: 90 Enter the second number: 78 90 78 Some error Sorry, one of your values was not a valid integer. Please input two intergers you wish to add: Please advise Thanks Anes
  3. Hi Friends, I am using CI 2 for my admin dashboard . My normal login page include username/password . If 3 login fail , need to show a captcha and make it necessary for further checking . I implemented same . But my captcha is not a good one (Not legible and not change text after continuous attempt). Please advise how i can use Google Recaptcha for same ..... Waiting your help. Thanks, Anes
  4. Dear pals, I am searching a payment gateway which can do Credit/Debit/Internet banking in a single system. Do you know any thing in current existing system . Let me know and advise Thanks anes
  5. Dear friends, I am using Wordpress 3.6 . I need to integrate an alert system(to send email notification) to users when a preference value (Reach price of onion 40 $/kg). Is stored procedure can do any thing with it? Please advise how it is feasible. Thanks, Anes
  6. Dear pals, I need to implement the REST service which explain in Simple-rest. I create a file with name xyz.php with code <?php if(isset($_POST['type']) && (isset($_POST['id']))) { $type = $_POST['type']?$_POST['type']:"undefined"; $id = $_POST['id']?$_POST['id']:"undefined"; //echo "val is :".$type." id is ".$id; } else { $type = "table"; $id = 2; } ?> <?php require_once("wp-load.php");?> <?php //get_header(); wp_head(); ?> <?php if($type=="chart" && $id!="undefined") { $kk_chart = get_html_4_chart(intval($id)); echo $kk_chart; } if($type=="table" && $id!="undefined") { $kk_table = get_html_4_table(intval($id)); echo $kk_table; } wp_footer(); ?> in root folder work fine . But i need to make it in a controller method. So I create a folder named "services" in root of WP and create a controller with name "chart" and write code as include_once("../wp-load.php"); wp_head(); wp_footer(); class Controllers_Chart extends RestController { public function get() { //$this->response = array('TestResponse' => 'I am GET response. Variables sent are - ' . http_build_query($this->request['params'])); //$this->responseStatus = 200; $kk_chart = get_html_4_chart(2); return $kk_chart; } } I just include the relevant get() method only . But I got some unexpected error like Warning: include(Translation/Entry.php): failed to open stream: No such file or directory in C:\wamp\www\wp-oscar\services\index.php on line 22 Warning: include(): Failed opening 'Translation/Entry.php' for inclusion (include_path='C:\wamp\www\wp-oscar\services;.;C:\php\pear') in C:\wamp\www\wp-oscar\services\index.php on line 22 alot of warning like this and a Fatal error as Fatal error: Call to a member function set_filenames() on a non-object in C:\wamp\www\wp-oscar\wp-content\plugins\wp-business-intelligence-lite\functions\functions.php on line 174 please advise me a method to call WordPress Business Intelligence intelligence as a REST service . Waiting your reply Thanks, Anes
  7. @kick,@trq Thanks for your advise dears. I figure out my solution as below: $ch = curl_init(); $data = array( 'username' => 'foobar', 'password' => 'bar' ); curl_setopt($ch, CURLOPT_URL, "http://localhost/simple_rest_master/test?".http_build_query($data)); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HTTPGET ,1); $contents = curl_exec($ch); curl_close($ch); echo $contents; Thanks, Anes
  8. Dear pals, I am newbie in RESTful services . I need to call a GET Verb in Server . I know 2 methods 1. Ajax Call we can write it as $.ajax({ url: url, dataType: "html", type: 'GET', data: "id="+id+"&type="+type, success: function(data){ //$("#content").html(data); alert(data); $('table #sample-boxed-2-pagination th a').each(function(){ //this.href = this.href.replace(sub_url, main_url); var value = this.href.split('?'); //alert(value[0]); if(value[0]!=sub_url) { this.href = this.href.replace(value[0], sub_url); } }); } }); }); But I know it's not working in Cross domain scenario . Please advise a method to work same in all domains . 2. Using file_get_contents() function like $response = file_get_contents('https://kkl.com/graph/call?parm1=9'); I know I can call POST verb using cURL as $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://localhost/simple_rest_master/test"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); $data = array( 'username' => 'foo', 'password' => 'bar' ); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $contents = curl_exec($ch); curl_close($ch); echo $contents; // manipulate response Do you can advise the syntax of GET call using cURL ? Waiting your fast reply Thanks, Anes
  9. Dear pals, I am using Wordpress 3.6 for my activity logging purpose . I need to authenticate user from REST , using their username/password . But Wordpress use a framework named "phpass" . I cannot identify how to compare my given password with database table password . Please advise a method to compare it. Thanks, Anes
  10. Dear friends, I am using the XML-RPC Server to implement a simple login authentication as a web service . So I wrote a function in wp-includes\class-wp-xmlrpc-server.php like function web_auth($host, $db, $dbuser, $dbpass, $username, $password) { $dbhandle = mysql_connect($host, $dbuser, $dbpass) or die("Unable to connect to MySQL"); $selected = mysql_select_db($db,$dbhandle) or die("Could not select database"); //$md5_password = md5($password); $md5_password = wp_hash_password($password); $result = mysql_query("SELECT count(*) AS total FROM wp_users WHERE user_login='$username' AND user_pass='$md5_password' AND user_status=0"); $data=mysql_fetch_assoc($result); //echo "SELECT count(*) AS total FROM wp_users WHERE user_login='$username' AND user_pass='$md5_password' AND user_status=0"; //die($data['total']); if($data['total'] == 1) { return true; } return false; } But the password hash mechanism is not make things proper. Please help me to find the exact password in line $md5_password = wp_hash_password($password); Waiting your fast reply Thanks, Anes
  11. Dear pals, I am using the tutorial code of "xmlrpc in wordpress" in URL http://wp.tutsplus.com/tutorials/creative-coding/xml-rpc-in-wordpress/ , but it shows result as blank in my local wamp but it work fine on another local pc. I attach the code and preview of the problem. Please check and help me. Code ===== <?php class XMLRPClientWordPress { var $XMLRPCURL = ""; var $UserName = ""; var $PassWord = ""; // constructor public function __construct($xmlrpcurl, $username, $password) { $this->XMLRPCURL = $xmlrpcurl; $this->UserName = $username; $this->PassWord = $password; } function send_request($requestname, $params) { $request = xmlrpc_encode_request($requestname, $params); $ch = curl_init(); curl_setopt($ch, CURLOPT_POSTFIELDS, $request); curl_setopt($ch, CURLOPT_URL, $this->XMLRPCURL); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 1); $results = curl_exec($ch); curl_close($ch); return $results; } function create_post($title,$body,$category,$keywords='',$encoding='UTF-8') { $title = htmlentities($title,ENT_NOQUOTES,$encoding); $keywords = htmlentities($keywords,ENT_NOQUOTES,$encoding); $content = array( 'title'=>$title, 'description'=>$body, 'mt_allow_comments'=>0, // 1 to allow comments 'mt_allow_pings'=>0, // 1 to allow trackbacks 'post_type'=>'post', 'mt_keywords'=>$keywords, 'categories'=>array($category) ); $params = array(0,$this->UserName,$this->PassWord,$content,true); return $this->send_request('metaWeblog.newPost',$params); } function create_page($title,$body,$encoding='UTF-8') { $title = htmlentities($title,ENT_NOQUOTES,$encoding); $content = array( 'title'=>$title, 'description'=>$body ); $params = array(0,$this->UserName,$this->PassWord,$content,true); return $this->send_request('wp.newPage',$params); } function display_authors() { $params = array(0,$this->UserName,$this->PassWord); return $this->send_request('wp.getAuthors',$params); } function sayHello() { $params = array(); return $this->send_request('demo.sayHello',$params); } } $objXMLRPClientWordPress = new XMLRPClientWordPress("http://localhost/wp_latest/xmlrpc.php" , "admin" , "admin"); echo '<table border="1" cellpadding="10">'; echo '<tr>'; echo '<td>Request Name</td>'; echo '<td>Result</td>'; echo '</tr>'; echo '<tr>'; echo '<td>demo.sayHello</td>'; echo '<td>'.$objXMLRPClientWordPress->sayHello().'</td>'; echo '</tr>'; echo '<tr>'; echo '<td>metaWeblog.newPost</td>'; echo '<td>'.$objXMLRPClientWordPress->create_post('Hello WordPress XML-RPC', 'This is the content of post done via XML-RPC','').'</td>'; echo '</tr>'; echo '<tr>'; echo '<td>wp.newPage</td>'; echo '<td>'.$objXMLRPClientWordPress->create_page('WordPress XML-RPC page', 'This is the content of First Page done via XML-RPC').'</td>'; echo '</tr>'; echo '<tr>'; echo '<td>wp.getAuthors</td>'; echo '<td>'. $objXMLRPClientWordPress->display_authors().'</td>'; echo '</tr>'; echo '</table>'; ?> Preview(Blank) ============ Thanks, Anes
  12. Dear trq, My issue is How the OAuth2.0 authentication can apply to a REST API Web Service. I attached the basic implementation of REST API. The code of attached "simple_rest_client->index.php" as follows: <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://localhost/simple_rest_master/test"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); $data = array( 'username' => 'foo', 'password' => 'bar' ); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $contents = curl_exec($ch); curl_close($ch); echo $contents; ?> Here the client call the Controller method "Test" as in cURL http://localhost/simple_rest_master/test. It's URL in localhost is : http://localhost/simple_rest_client/ I also add the code of "Server" in zip file "simple_rest_master.zip". In this case I need to implement the authentication using OAuth2.0 . I looked the RFC standard for it here : http://tools.ietf.org/html/rfc6749 Please help, Thanks, Anes
  13. Dear Friends, I am using Simple-REST Library for my REST Web service purpose . I need to integrate "OAuth2" with my REST API skeleton. I attached the REST - API Client & Server for your reference . Please check it and help me with a good solution for implementation. Thanks, Anes simple_rest_client.zip simple_rest_master.zip
  14. Dear pals, I really love your REST based library , from URL :https://github.com/deepeshmalviya/simple-rest simple and understandable . But I need an authentication mechanism in it. I plan to use api for User based access . I need to take data we must use GET method . Passing username/password as GET (or even as POST) is not safe . Do you can suggest a good solution for this library . I am waiting for your fast reply. Thanks, Anes
  • 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.