Jump to content

gongpex

Members
  • Posts

    360
  • Joined

  • Last visited

Posts posted by gongpex

  1. Hello everyone,

    Long time no see, how are you?

    Just ask I've follow these links to set SSL on nginx server localhost for windows :

    
    #user  nobody;
    worker_processes  1;
    
    #error_log  logs/error.log;
    #error_log  logs/error.log  notice;
    #error_log  logs/error.log  info;
    
    #pid        logs/nginx.pid;
    
    
    events {
        worker_connections  1024;
    }
    
    
    http {
        include       mime.types;
        default_type  application/octet-stream;
    
        #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
        #                  '$status $body_bytes_sent "$http_referer" '
        #                  '"$http_user_agent" "$http_x_forwarded_for"';
    
        #access_log  logs/access.log  main;
    
        sendfile        on;
        #tcp_nopush     on;
    
        #keepalive_timeout  0;
        keepalive_timeout  65;
    
        #gzip  on;
    
        server {
            listen       4000;
            server_name  localhost;
    
            #charset koi8-r;
    
            #access_log  logs/host.access.log  main;
    
            location / {
                root html;
                index index.php;
                #index index.php index.html index.htm;
                try_files $uri $uri/ /index.php?$query_string;
            }
    
            #error_page  404              /404.html;
    
            # redirect server error pages to the static page /50x.html
            #
            error_page   500 502 503 504  /50x.html;
            #location = /50x.html {
            #    root   html;
            #}
    
            # proxy the PHP scripts to Apache listening on 127.0.0.1:80
            #
            #location ~ \.php$ {
            #    proxy_pass   http://127.0.0.1;
            #}
    
            # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
            #
    
            location ~ \.php$ {
                try_files $uri /index.php =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                include        fastcgi_params;
            }
    
            # deny access to .htaccess files, if Apache's document root
            # concurs with nginx's one
            #
            location ~ /\.ht {
                deny  all;
            }
        }
    
    
        # another virtual host using mix of IP-, name-, and port-based configuration
        #
        #server {
        #    listen       8000;
        #    listen       somename:8080;
        #    server_name  somename  alias  another.alias;
    
        #    location / {
        #        root   html;
        #        index  index.html index.htm;
        #    }
        #}
    
    	######## Error when this code uncomment ########
    
        # HTTPS server
        #
        #server {
        #    listen       443 ssl;
        #    server_name  localhost;
    
        #    ssl_certificate      cert.pem;
        #    ssl_certificate_key  cert.key;
    
        #    ssl_session_cache    shared:SSL:1m;
        #    ssl_session_timeout  5m;
    
        #    ssl_ciphers  HIGH:!aNULL:!MD5;
        #    ssl_prefer_server_ciphers  on;
    
        #    location / {
        #        root   html;
        #        index  index.html index.htm;
        #    }
        #}
    
    }

    and this is my error log :

    
    2021/03/22 11:26:23 [notice] 10920#7164: signal process started
    2021/03/22 11:26:23 [error] 10920#7164: OpenEvent("Global\ngx_stop_9828") failed (5: Access is denied)
    2021/03/22 11:26:31 [notice] 10388#2948: signal process started
    2021/03/22 11:26:57 [error] 6464#9328: *26 connect() failed (10061: No connection could be made because the target machine actively refused it) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:4000"
    2021/03/22 11:26:59 [error] 6464#9328: *26 connect() failed (10061: No connection could be made because the target machine actively refused it) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:4000"
    2021/03/22 11:27:02 [error] 6464#9328: *26 connect() failed (10061: No connection could be made because the target machine actively refused it) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:4000", referrer: "http://localhost:4000/"
    2021/03/22 11:27:04 [error] 6464#9328: *26 connect() failed (10061: No connection could be made because the target machine actively refused it) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:4000", referrer: "http://localhost:4000/"
    2021/03/22 17:15:12 [error] 6464#9328: *336 connect() failed (10061: No connection could be made because the target machine actively refused it) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "POST /logout HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:4000", referrer: "http://localhost:4000/exchange-coins"
    2021/03/22 17:15:14 [error] 6464#9328: *336 connect() failed (10061: No connection could be made because the target machine actively refused it) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "POST /logout HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:4000", referrer: "http://localhost:4000/exchange-coins"

    Note : about cert.pem and cert.key I've generated it from openssl and then put it on folder conf where nginx.conf saved.

    Q : What's mistake on my configuration?

    Please help

    Thanks.

  2. Hello everyone,

    Long time no sees I hope y'all fine,

    I get some issue with regular expression if the pattern come from variable, these my codes

    var data_code = $("#phone).attr('data-code');
    var phone_number = '+61111111';
    
    //if I use code like these :
    
     phone_number = phone_number.replace(/^\+61/,'');
    console.log(phone_number)
    // would return 11111111 === this is expected result

    but when I tried

    var pattern = "^'\'"+data_code; //I assumed this equal with : ^\+61
    var regx = new RegExp(pattern,"g");
    phone_number = phone_number.replace(regx,'');

    would return '+61111111' in other there is no change,  my expectation it would return same if using usual pattern (^\+61),

    in variable data_code have value = '+61'

    Q : how to use regular expression's pattern from variable ?

    please someone help me

    Thanks.

  3. Hello everyone,

    I have code:

    $a = ' asasc #aaa cscv #ccc';
    
    if (preg_match('/\#(\w+)/',$a, $matches)) {
                print_r($matches);
     }

    this result are : 

    Array ( [0] => #aaa [1] => aaa )

    that result is not my expectation, my expectation if the result :

    Array ( [0] => #aaa [1] => #ccc )

    Q So in other word how to make so that preg_match return only the word start with # only.

    please someone help me

    Thanks

  4. Hello everyone,

    I've tried number of time to get json data using jsonp from another domain, here is my full code :

    <script type="application/javascript" src="https://i.instagram.com/api/v1/tags/search?q=burger&callback=mycallback"></script>
    <script type="text/javascript">
    	$(document).ready(function() {    
    		test();
    	});
    
    	function test()
    	{
    		$("#test").click(function(){
    			$.ajax({
    				crossDomain: true,
    				type: "GET",
    			    url: "https://i.instagram.com/api/v1/tags/search?callback=mycallback",
    			    dataType: "jsonp", // jsonp
    			    jsonp : 'callback',
    			    jsonpCallback: 'mycallback',
    			    data: {'q':'burger'},
    			    success: function (result, status, xhr) {
    			        console.log(result);
    			    },
    			})
    		});
    	}
    
    	//callback function
    	function mycallback(data) {
    	  //do stuff with JSON
    	  console.log(data);
    	}
      
    </script>

    It always return : Refused to execute script from 'https://i.instagram.com/api/v1/tags/search/?callback=mycallback&q=burger&_=1571650640228' because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled. 

    I know if MIME or header from i.instagram had set json, so I used callback and even set script application/javascript so that I can retrieve json data, but the result is always like on above.

    Please somebody help me.

    Thanks

     

  5. Hello everyone,

    I had used pregmatch to filter code calling with this code :

    	if(preg_match('/^[61][0-9]*$/',$number)){
        		echo 'sorry you cannot use +61 to enter phone number use 123xxxx instead';
        }

    it would filter if user giving number +61xxxxxx , but if they put number 2222222 it wouldn't filter and this is correct,

    the problem actually when user put number leading with 1 for example 12345678 it would filter or displaying echo.

    Q : How to filter so that when user put +61xxx  only not 1xxxxx it would be run?

    Note : I provided input field so that user put their number only not with calling code.

    Thanks.

  6. Hello, thanks for reply,

    8 hours ago, justsomeguy said:

    Well I bet you can access it just fine with ajax if you log in with that browser first.

    I've log in already when I used that ajax code, but still on the network XHR  result like on above, it need me to log in although I've logged in already,

    A : If you not objection please try it, if you have instagram account log in first and then use that code to access it to get some data.

    That's all I can ask from you..

    I would really appreciate it, because I really need this API.

    Many Thanks 

  7. 10 hours ago, justsomeguy said:

    The login page has a "sign up" link.

    Hello, thanks for reply,

    I've open according on that link but it redirect to www.instagram.com and my account.

    Note : When I tried this code I was logged in on my instagram account but it still said : login required, please see my network console :

    Request URL: https://i.instagram.com/api/v1/accounts/current_user?csrfKey=31611c89600aee8c6758f088c51bb00f
    Request Method: GET
    Status Code: 301 
    Remote Address: 157.240.13.52:443
    Referrer Policy: no-referrer-when-downgrade
    
    /* redirect to  */
    
    Request URL: https://i.instagram.com/api/v1/accounts/current_user/?csrfKey=31611c89600aee8c6758f088c51bb00f
    Request Method: GET
    Status Code: 403 
    Remote Address: 157.240.13.52:443
    Referrer Policy: no-referrer-when-downgrade
    
    /* response / results */
    
    {message: "login_required", error_title: "You've Been Logged Out", error_body: "Please log back in.",…}
    error_body: "Please log back in."
    error_title: "You've Been Logged Out"
    logout_reason: 2
    message: "login_required"
    status: "fail"

    this url (https://i.instagram.com/api/v1/fbsearch/places/?{'q':'london'}) could be opened on url address  browser if you had logged in on instagram account and the result was json, but cannot access in ajax.

    A : If y'all have some information or know about this API please let me know, because I really need it.

    Thanks

  8. 8 hours ago, Ingolme said:

    It looks pretty straightforward. It indicates the request method, headers and body as well as what responses you can expect. What more do you need?

    Hello thanks for reply,

    please use this code : 

    var settings = {
      "async": true,
      "crossDomain": true,
      "url": "https://i.instagram.com/api/v1/fbsearch/places",
      "method": "GET",
      "headers": {},
      "data": "{'q':'london'}"
    }
    
    $.ajax(settings).done(function (response) {
      console.log(response);
    });

    not entire code can be accessed, it need login, if this code executed it would result ajax response code 302 and then redirect to 301 finally 200 with link : 

    https://www.instagram.com/accounts/login/?next=/api/v1/fbsearch/places/%3Fq%3Dlondon%26%257B%257D

    N : thing what I need is how to access this instagram api account, from where I can register so that I can use this API.

    please help me

    Thanks

  9. Hello everyone

    First of all Happy New Year 2019 hope y'all successful to achieve y'all's target in this year.

    I created code to test namespace and use in php

    like this :

    <?php
    namespace Base;
    
    class Section{
    
    	function test(){
    		echo 'aaa';
    	}
    	
    }
    ?>

    file on above is Section.php

    <?php
    namespace Base2;
    
    class Base2 extends Base\Section {
    
    	function test(){
    		$class = new Section();
    		$class->aaa();
    	}
    	
    }
    $ans = new Base2();
    $ans->test();
    ?>

    this file is : Base2.php

    when I run Base2.php it always Fatal error: Class 'Base2\Base\Section' not found in C:\Apache24\htdocs\branch\learn\Base2.php on line 4

    Q : Is there something wrong with my code?

    please help

    Thanks

  10. Hello

    Thanks for reply.

    Today when I asked my hosting provider about why my ajax upload process is pending / staled they answered me :

    "are you using script to sending data? it's probably blocked by free hosting BOT blocked"

    Q : is this possible the main cause why my ajax process pending / stalled ?

    because when I run my code (used post method) on localhost it able to sent as well.

    please reply

    Thanks

  11. Hello everyone,

    it's possible or not to use 'GET' method to send data from ajax multipart form data like this :

    var formData = new FormData( $("#fm")[0]);
    
    $.ajax({
      type : "GET",
      cache: false,
      contentType: false,
      processData: false,
      url : "<?php echo base_url('index.php/update/do_update');?>",
      dataType : "json",
      data : formData,
      success : function(response){
      	alert('posted');
      }
    });

    Currently I used method 'POST' to send data, but it cause pending / stalled on XHR so all the process aborted.

    Q1 : if the method must be 'POST' only , could you tell me the solution to avoid pending on ajax request?

    Q2 : does the hosting provider have potential to influence the process? (currently I use free hosting to hosting my website)

    Please help me, because I can't upload anything if the process still pending / stalled.

    Thanks

     

  12. Hello, thanks for reply

    again unless they tell it to load the URL in the parent page

    Q : Which URL? did u mean URL from page inside iframe? 

    how about if put some script inside the iframe like this :

    <iframe id="myFrame" src="/default.asp" style="height:380px;width:100%">
    <script>
    document.getElementById("myFrame").contentWindow.onclick = test;
    function test() {
      var iframe = document.getElementById("myFrame");
      var elmnt = iframe.contentWindow;
      elmnt.document.body.style.backgroundColor = "yellow";
    }
    </script>
    </iframe>

    please help

    Thanks

  13. 10 hours ago, justsomeguy said:

    That click event is set on an element inside the iframe

    Hello,

    thanks for reply,

    Q : so in other word when client / user clicked on link and then jump to other page, it cause element inside the iframe changed also?

    actually my purpose is to make it able to fire the event,  although inside iframe.

    please help me how to fix this

    Thanks

  14. Hello everyone,

    Alright, I think it's hard to write my trouble here,

    so, please visit : https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_element_iframe

    And then just replace those code with these :

    <!DOCTYPE html>
    <html>
    <body>
    
    <iframe id="myFrame" src="/default.asp" style="height:380px;width:100%"></iframe>
    
    <p>Click the on the iframe to change w3schools background color</p>
    
    <script>
    document.getElementById("myFrame").contentWindow.onclick = test;
    function test() {
      var iframe = document.getElementById("myFrame");
      var elmnt = iframe.contentWindow;
      elmnt.document.body.style.backgroundColor = "yellow";
    }
    </script>
    
    </body>
    </html>

    These code runs well when I clicked on iframe once, but after I clicked another link page eg : Learn HTML

    these code didn't work. it looks if iframe / browser unable to caught event (onclick).

    Q : How to fix so that event still able to catch by contentWidth , though user click another link page?

    please help me.

    Thanks

  15. Hello everyone,

    Currently I looking for free domain / subdomain name and then I  found http://aa.am/ ,

    Q : does it spam ?

    if so, could you recommend me another free domain name provider?

    Note : please do not recommend me freenom, I had register so many domain name there, and I unable to register on it anymore.

    please help

    Thanks

     

  16. Hello everyone,

    It safe or not put php code on css file like this :

    <?php
       header("Content-type: text/css; charset: UTF-8");
      
       $db = new mysqli("host", "username", "password", "database");
       if ($db->connect_error) {
    		die("Connection failed: " . $db->connect_error);
       }
    ?>
    
    /* css code */
    

    Q : if not safe please tell me how to use php inside css.

    Thanks

  17. Hello everyone,

    In past I had experience like this :

    I have two tables on mysql db and these :

    • shops
    • shop_details

    the shops table contains orders from users like :

    • order_id
    • order_number
    • id_item

    the shop_details table contains detail orders from users like :

    • order_detail_id
    • order_id
    • item_price

    And to insert it I used some php code like this (this code just for mapping not actual code) :

    <?php
    	if($validation == true){
    		/* THIS JUST LOGIC MAPPING NOT ACTUAL CODE */
    		$sql = new mysql(host,user,passw,db);
    		$query = $sql->query("insert into shop");
    
    		/* LOGIC MAPPING FOR DETAIL */
    		if($query){
    			$sql->query("insert into shop_detail");
    		}
    	}
    ?>

    All user's orders were able to inserted on table shop,

    but not all user's detail orders were inserted to table shop_detail.

    so in other word not all data inserted on table shop_detail due mysql shutdown (maybe i don't know)

    Note : I used bot to insert all data for test

    Q : how to avoid mysql shutdown if much users do order?

    please help me

    Thanks

  18. Hello,

    thanks for reply,

    I just tried but the result still same :

    <style>
      .scroll-pane
      {
        width: 100%;
        height: 200px;
        overflow-x: hidden;
        overflow-y: auto; 
      }
    </style>
    
    <body>
    	<!-- iframe -->
    	<iframe class="scroll-pane" src="iframe_content1.html" frameborder="0">
    		<p>Your browser does not support iframes.</p>
    	</iframe>
    	
    	<script>
    	$(document).ready(function(){
    		$('.scroll-pane').jScrollPane({
    			contentWidth : 0
    		});
    	});
    	</script>
    </body>

    please help

    Thanks

  19. Hello,

    Thanks for reply,

    Today I used jscrollpane to made custom scrollbar on iframe, it's worked but unable to remove horizontal bar (always displayed both),

    this is my code :

    <style>
    		.scroll-pane
    		{
    			width: 100%;
    			height: 200px;
    			overflow: auto;
    		}
    		
    	</style>
    
    <body>
    	<!-- iframe -->
    	<iframe class="scroll-pane" src="iframe_content1.html" frameborder="0">
    		<p>Your browser does not support iframes.</p>
    	</iframe>
    	
    	<script>
    	$(document).ready(function(){
    		$('.scroll-pane').jScrollPane({
    			contentWidth: '0px'
    		});
    	});
    	</script>
    </body>

    contentWidth was according on : https://stackoverflow.com/questions/4404944/how-do-i-disable-horizontal-scrollbar-in-jscrollpane-jquery

    I've tried horizontalDragMaxWidth: 0 also, but the result was same.

    please help me

    Thanks

  20. Hello everyone,

    On modern browser commonly we put  :

    <input type="text" placeholder="Your Value" />

    To display placeholder's value.

    But how about in old browser such IE7?

    I've tried to made own code used jquery and these my code :

    HTML :

    <input type="text" class="form-control placeholder" watermark="Your Name" id="name" />

    JQUERY

    		function placeholder(){
    			var holder = $(".placeholder");
    			var content_holder = holder.attr("watermark");
    			holder.val(content_holder);
    			
    			holder.focus(function(){
    				$(this).selectRange(0,0);
    			});
    		
    			holder.keyup(function(){
    				if(holder.val().length == 0){
    					holder.val(content_holder);
    					$(this).selectRange(0,0);
    				} 
    			});
    			
    			holder.keypress(function(){
    				if(holder.val() == content_holder) {
    					holder.val("");				
    				} 
    			});
    		}
    		
    		
    		$.fn.selectRange = function(start, end) {
    				if(!end) end = start; 
    				return this.each(function() {
    					if (this.setSelectionRange) {
    						this.focus();
    						this.setSelectionRange(start, end);
    					} else if (this.createTextRange) {
    						var range = this.createTextRange();
    						range.collapse(true);
    						range.moveEnd('character', end);
    						range.moveStart('character', start);
    						range.select();
    					}
    				});
    		};

    my codes as far runs well but still have flaw (not like as properly placeholder).

    if you clicked on input, the cursor position still able go to last character from ("your name"), not at position 0,0 (first character).

    Q : how to make so that the cursor position at range 0,0 (first character) / same as properly placeholder?

    please help me

    Thanks

     

×
×
  • Create New...