Jump to content

imgrooot

Members
  • Posts

    383
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by imgrooot

  1. I talked to my web hosting provider and it was the mistake with the SSL certificate itself. When I bought the certificate, I apparently put mysite.com domain when i should have done www.mysite.com. I am currently waiting for them to issue a new certificate with new domain.
  2. I am using the same Rewrite on another site and it works fine. But not on this new site. I did do a basic test by following their example @ https://docs.bolt.cm/3.3/howto/making-sure-htaccess-works I do get an internal error when I input "Test." on the first line of .htaccess. So it is working.
  3. If I go to "http://mysite.com", it'll redirect me to ""mysite.com"". And if I go to "www.mysite.com", it'll show me "www.mysite.com".
  4. Correct. If i type in my domain like this "mysite.com", "www.mysite.com", or "http://mysite.com"; it won't show the secure thing. But If i type it like this "https://mysite.com", it will show the secure thing.
  5. Yes it is being read. Here's my full .htaccess file. #AuthName "Secure Area" #AuthType Basic #AuthUserFile /home/mysite/public_html/protected/.htpasswd #require valid-user RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteCond %{HTTP_HOST} ^(www\.)?mysite\.com RewriteRule ^(.*)$ https://mysite.com/$1 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*)$ $1.php [L] # 480 weeks <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$"> Header set Cache-Control "max-age=290304000, public" </FilesMatch> # 2 DAYS <FilesMatch "\.(xml|txt)$"> Header set Cache-Control "max-age=172800, public, must-revalidate" </FilesMatch> # 2 HOURS <FilesMatch "\.(html|htm)$"> Header set Cache-Control "max-age=7200, must-revalidate" </FilesMatch> <ifModule mod_gzip.c> mod_gzip_on Yes mod_gzip_dechunk Yes mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$ mod_gzip_item_include handler ^cgi-script$ mod_gzip_item_include mime ^text/.* mod_gzip_item_include mime ^application/x-javascript.* mod_gzip_item_exclude mime ^image/.* mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* </ifModule> <IfModule mod_deflate.c> # Compress HTML, CSS, JavaScript, Text, XML and fonts AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/vnd.ms-fontobject AddOutputFilterByType DEFLATE application/x-font AddOutputFilterByType DEFLATE application/x-font-opentype AddOutputFilterByType DEFLATE application/x-font-otf AddOutputFilterByType DEFLATE application/x-font-truetype AddOutputFilterByType DEFLATE application/x-font-ttf AddOutputFilterByType DEFLATE application/x-javascript AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE font/opentype AddOutputFilterByType DEFLATE font/otf AddOutputFilterByType DEFLATE font/ttf AddOutputFilterByType DEFLATE image/svg+xml AddOutputFilterByType DEFLATE image/x-icon AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/javascript AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/xml # Remove browser bugs (only needed for really old browsers) BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\.0[678] no-gzip BrowserMatch \bMSIE !no-gzip !gzip-only-text/html Header append Vary User-Agent </IfModule>
  6. I have a domain where I installed a SSL certificate. It works if I type in the domain like this "https://mysite.com". But if i go to the domain with www or without www, the SSL secure certificate won't show in the top bar. The site loads up fine. Here is my .htaccess code. Am I doing something wrong? RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteCond %{HTTP_HOST} ^(www\.)?mysite\.com RewriteRule ^(.*)$ https://mysite.com/$1 [R=301,L]
  7. I am trying to using this API. https://www.blocktrail.com/api/docs I can retrieve the first layer value using this. $global_trans_id = $client->transaction($post_transid); $api_transaction_id = $global_trans_id['hash']; echo $api_transaction_id; As you see "hash" is the first layer below. But what if I want to retrieve the second layer such as a value from "Inputs" or "Outputs" like "$global_trans_id['address'];". How would that look? { "hash": "c326105f7fbfa4e8fe971569ef8858f47ee7e4aa5e8e7c458be8002be3d86aad", "first_seen_at": "2014-03-11T08:27:57+0000", "last_seen_at": "2014-03-11T08:27:57+0000", "block_height": 290000, "block_time": "2014-03-11T08:27:57+0000", "block_hash": "0000000000000000fa0b2badd05db0178623ebf8dd081fe7eb874c26e27d0b3b", "confirmations": 31130, "is_coinbase": false, "estimated_value": 70000000, "total_input_value": 70070000, "total_output_value": 70030000, "total_fee": 40000, "estimated_change": 30000, "estimated_change_address": "19M1EraiuAvZp8ZV7QJHH2LVkYm8ECufCJ", "high_priority": false, "enough_fee": true, "contains_dust": false, "inputs": [ { "index": 0, "output_hash": "d283ab6edd394b8a69d6943ea3a29a679d92176b112b1f69ffb9b70cf27dec5a", "output_index": 2769, "value": 2730000, "address": "19M1EraiuAvZp8ZV7QJHH2LVkYm8ECufCJ", "type": "pubkeyhash", "multisig": null, "script_signature": "0x49 0x3046022100bb3d102afd0d57be618aeaa7432bc038dea928bec0af6b8cba37c7ec85701e3d022100c467073956b385f08fbfbc2e130d8f76deb7c5436ba245afca4678200b127c2001 0x21 0x02aa6584518e528be497be65fba84913b7d0cb55158f4e7922298923286a7f6156" }, { "index": 1, "output_hash": "b350de75f9c27b457fa6cefb7072af8aa94de53ccedff4ec06ce885d63645e1d", "output_index": 2764, "value": 2740000, "address": "19M1EraiuAvZp8ZV7QJHH2LVkYm8ECufCJ", "type": "pubkeyhash", "multisig": null, "script_signature": "0x48 0x3045022059c6cc77c0a7c3a3a1ab0678690178750f2b5e442dc6f9331835be4cdb087cc00221008fca79860ab8f15acba61522b4f8482909cadfdf79dca7790efabf71c7c12d3701 0x21 0x02aa6584518e528be497be65fba84913b7d0cb55158f4e7922298923286a7f6156" }, { "index": 2, "output_hash": "fa3f040de013ddbe4a5746c89d32de2cac147845682e7d26119fd686a57e0b65", "output_index": 2549, "value": 2930000, "address": "19M1EraiuAvZp8ZV7QJHH2LVkYm8ECufCJ", "type": "pubkeyhash", "multisig": null, "script_signature": "0x47 0x304402207266d8c69d2c28e4050a90f48209768554e1470999a2259b000fd3c096edc39f02207b7f6a6b7ca7952249a1a1f3064e6a3f573fcd6700084e2fe71ce8f3d3f2be8301 0x21 0x02aa6584518e528be497be65fba84913b7d0cb55158f4e7922298923286a7f6156" }, { /* ... */ } ], "outputs": [ { "index": 0, "value": 70000000, "address": "1JSywyhFSvCC4NGALvKoyX5xng86QaigAN", "type": "pubkeyhash", "multisig": null, "script": "DUP HASH160 0x14 0xbf641337e3ab4eaae788a72bafedb965749882b2 EQUALVERIFY CHECKSIG", "script_hex": "76a914bf641337e3ab4eaae788a72bafedb965749882b288ac", "spent_hash": "71acf863d37d9d18524607e3dd68128b91ddc43dfe32f620ec124ceff3bb3295", "spent_index": 34 }, { "index": 1, "value": 30000, "address": "19M1EraiuAvZp8ZV7QJHH2LVkYm8ECufCJ", "type": "pubkeyhash", "multisig": null, "script": "DUP HASH160 0x14 0x5b8986608535c96923769138ad5be236a091b791 EQUALVERIFY CHECKSIG", "script_hex": "76a9145b8986608535c96923769138ad5be236a091b79188ac", "spent_hash": "400f77fff18e24d1a770c0e1ca85434ca5e4cd0f6e1489e5849256cc71f9ec0a", "spent_index": 2 }, { /* ... */ } ] }
  8. Say I have this records table. RECORDS TABLE record_id | sponsor_id | user_id | plan_id ------------------------------------------------------------------------------ 1 user5 user6 5 // I am this user. 2 user3 user5 3 3 user3 user4 4 4 user2 user3 4 5 user2 user2 2 6 user0 user1 5 I am "user6" and my sponsor is "user5". What I want to do is find the same "plan_id" from my sponsors, no matter how far up I have to do. For eg. My current plan id is "5". My sponsor is "user5". If I look for "user5" in the user_id column, I would find that he only has plan "3" id. So I go to his sponsor, which is "user3" and find him in the user_id column. That user's plan id is "4" so it does not match my plan id either. I repeat the same process by going to his sponsor and his sponsor and so on until I find the plan id that matches me. So for this table example, that would be "user1". I only want to retrieve the first result that matches my plan id. How do I go on about coding this function? Normally I can do these queries to go up limited amount. But I am looking for a more proper function that lets me search my sponsors unlimited times. $find_plan_id = $db->prepare("SELECT sponsor_id, plan_id FROM records WHERE user_id = :user_id"); $find_plan_id->bindParam(':user_id', $user_id); $find_plan_id->execute(); $result_find_plan_id = $find_plan_id->fetchAll(PDO::FETCH_ASSOC); if(count($result_plan_id) > 0) { foreach($result_plan_id as $row) { $get_sponsor_id_1 = $row['sponsor_id']; $get_plan_id_1 = $row['plan_id']; } if($get_plan_id_1 == $my_plan_id) { echo 'Plan id matches.'; } else { $find_plan_id_2 = $db->prepare("SELECT sponsor_id, plan_id FROM records WHERE user_id = :user_id"); $find_plan_id_2->bindParam(':user_id', $get_sponsor_id_1); $find_plan_id_2->execute(); $result_plan_id_2 = $find_plan_id_2->fetchAll(PDO::FETCH_ASSOC); if(count($result_plan_id_2) > 0) { foreach($result_plan_id_2 as $row) { $get_sponsor_id_2 = $row['sponsor_id']; $get_plan_id_2 = $row['plan_id']; } if($get_plan_id_2 == $my_plan_id) { echo 'Plan id matches.'; } else { // repeat the process } } } }
  9. Normally yes but sometimes I don't put quotes if it's just integers like "if($number == 124)". Should I be?
  10. The date is coming from MySQL database. I just like to know what the best way to check if that date is empty.
  11. Say I have a simple date like this. $date = 2017-08-10 00:06:10; I would like to have an if statement that tells me whether or not the date is empty. These are my methods but I'm not sure if it's the proper way of doing it. . if(empty($date)) { // do nothing } else { // do something } if($date == 0000-00-00 00:00:00) { // do nothing } else { // do something }
  12. Alright so I figured out why it was giving me that error. The reason I was getting the above error was because the wallet address I had in the call was EMPTY. It had no transactions sent or received so it was returning the default error. All I have to do now is set up my own custom error if the wallet is empty.
  13. The error says invalid credentials, I assume it means my API key. I double checked it and it's the correct key. I am testing it on a test.php page with this code . require_once 'composer/vendor/autoload.php'; use \Blocktrail\SDK\BlocktrailSDK; $client = new BlocktrailSDK("0012a34a76bf10cf01c53d0c6059fc84a22f8e9d", "22250773dfde8f4ed0a0252a299549e9c024b132", "BTC", true /* testnet */); $address = $client->address('1NcXPMRaanz43b1kokpPuYDdk6GGDvxT2T'); $latestBlock = $client->blockLatest(); var_dump($address['balance'], $latestBlock['hash']); And this is the error i receive. Fatal error: Uncaught Blocktrail\SDK\Connection\Exceptions\ObjectNotFound: The object you've tried to access does not exist. in C:\xampp\htdocs\gift\composer\vendor\blocktrail\blocktrail-sdk\src\Connection\RestClient.php:336 Stack trace: #0 C:\xampp\htdocs\gift\composer\vendor\blocktrail\blocktrail-sdk\src\Connection\RestClient.php(306): Blocktrail\SDK\Connection\RestClient->responseHandler(Object(GuzzleHttp\Psr7\Response)) #1 C:\xampp\htdocs\gift\composer\vendor\blocktrail\blocktrail-sdk\src\Connection\RestClient.php(173): Blocktrail\SDK\Connection\RestClient->request('GET', 'address/1NcXPMR...', NULL, NULL, NULL, NULL, NULL) #2 C:\xampp\htdocs\gift\composer\vendor\blocktrail\blocktrail-sdk\src\BlocktrailSDK.php(162): Blocktrail\SDK\Connection\RestClient->get('address/1NcXPMR...') #3 C:\xampp\htdocs\gift\test.php(7): Blocktrail\SDK\BlocktrailSDK->address('1NcXPMRaanz43b1...') #4 {main} thrown in C:\xampp\htdocs\gift\composer\vendor\blocktrail\blocktrail-sdk\src\Connection\RestClient.php on line 336
  14. Other files like include init.php include_once 'metas.php'; include_once 'analyticstracking.php'; and so on. They are non related to the API.
  15. I actually did tried this on a test page outside of the normal site and it gives me this error. I'm pretty sure I installed it correctly using composer. Fatal error: Uncaught Blocktrail\SDK\Connection\Exceptions\ObjectNotFound: The object you've tried to access does not exist. in C:\xampp\htdocs\gift\composer\vendor\blocktrail\blocktrail-sdk\src\Connection\RestClient.php:336 Stack trace: #0 C:\xampp\htdocs\gift\composer\vendor\blocktrail\blocktrail-sdk\src\Connection\RestClient.php(306): Blocktrail\SDK\Connection\RestClient->responseHandler(Object(GuzzleHttp\Psr7\Response)) #1 C:\xampp\htdocs\gift\composer\vendor\blocktrail\blocktrail-sdk\src\Connection\RestClient.php(173): Blocktrail\SDK\Connection\RestClient->request('GET', 'address/1NcXPMR...', NULL, NULL, NULL, NULL, NULL) #2 C:\xampp\htdocs\gift\composer\vendor\blocktrail\blocktrail-sdk\src\BlocktrailSDK.php(162): Blocktrail\SDK\Connection\RestClient->get('address/1NcXPMR...') #3 C:\xampp\htdocs\gift\test.php(28): Blocktrail\SDK\BlocktrailSDK->address('1NcXPMRaanz43b1...') #4 {main} thrown in C:\xampp\htdocs\site\composer\vendor\blocktrail\blocktrail-sdk\src\Connection\RestClient.php on line 336
  16. Line 12 is the "use Blocktrail\SDK\BlocktrailSDK;" code listed above it.
  17. I am using this API https://github.com/blocktrail/blocktrail-sdk-php. I am suppose to add this to top of my directory where I want to initialize the API. require 'vendor/autoload.php'; use Blocktrail\SDK\BlocktrailSDK; But the second line gives me an error. use Blocktrail\SDK\BlocktrailSDK; Parse error: syntax error, unexpected 'use' (T_USE) in C:\xampp\htdocs\site\templates\header.php on line 12 Is the "use" a correct syntax for php? Why is it giving me an error?
  18. I have a query below where I want to search a table to find the top row with 1 or 2 empty positions. But it never returns the correct "referral_id". If I remove the "ref_user_1" and "ref_user_2" conditions from the query, then of course it will return the correct referral id. But those conditions are important for me to have. Is having "AND" and "OR" conditions in the same query against the rules? If so what's the solution for this problem? $find_sponsor = $db->prepare("SELECT * FROM referrals WHERE referred_by = :referred_by AND ref_user_1 = :ref_user_1 OR ref_user_2 = :ref_user_2 ORDER BY referral_id ASC LIMIT 1"); $find_sponsor->bindValue(':referred_by', 2); $find_sponsor->bindValue(':ref_user_1', 0); $find_sponsor->bindValue(':ref_user_2', 0); $find_sponsor->execute(); $result_sponsor = $find_sponsor->fetchAll(PDO::FETCH_ASSOC); if(count($result_sponsor) > 0) { foreach($result_sponsor as $row) { $get_referral_id = $row['referral_id']; $get_ref_1 = $row['ref_user_1']; $get_ref_2 = $row['ref_user_2']; } echo $get_referral_id; // this always returns the wrong referral id } // Table referral_id referred_by ref_user_1 ref_user_2 1 2 20 21 2 2 23 24 3 2 25 0 4 2 0 0 As per my table above, what would my new query look like if I want to retrieve #3 as my referral id?
  19. The last record WILL have the biggest amount. Anyways, I have solved this issue.
  20. Nice. "Group By" gives me single results of same name. One thing. The "Max" won't work if i have it like this "Max(records.record_amount)". I want to make sure it works if I have multiple tables joining.
  21. Say I have a records table with multiple records. There could be multiple records with the same name but different amounts. For Eg. Looking at the table below, the results should retrieve newest record-1 and record-2 because their amount is equals to or greater than 5.00. Record-3 is not selected because it falls below 3.00. record_id record_name record_amount 1 record-1 4.00 2 record-1 3.00 3 record-2 2.00 4 record-1 5.00 5 record-2 6.00 6 record-3 3.00 $get_records = $db->prepare("SELECT record_id, record_name FROM records WHERE record_amount >= :record_amount ORDER BY record_id DESC"); $get_records->bindValue(':record_amount', 5.00); $get_records->execute(); $result_records = $get_records->fetchAll(PDO::FETCH_ASSOC); if(count($result_records) > 0) { foreach($result_records as row) { $record_id = $row['record_id']; $record_name = $row['record_name']; echo $record_name; } } Currently the query above outputs ALL the rows that matches the >=. What I want to do is select only ONE row of each unique record name that matches the criteria. And that row is typically the last row that was inserted. So the output would be like only these two. How do I do that? 4 record-1 5.00 5 record-2 6.00
  22. Good to know. Thanks for the info. I will keep it in mind.
×
×
  • 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.