Jump to content

Rommeo

Members
  • Content Count

    312
  • Joined

  • Last visited

Everything posted by Rommeo

  1. But it looks like same : Here is Authenticator::authenticate() namespace Cog\Contracts\YouTrack\Rest\Authenticator; use Cog\Contracts\YouTrack\Rest\Client\Client as ClientContract; /** * Interface Authorizer. * * @package Cog\Contracts\YouTrack\Rest\Authenticator */ interface Authenticator { /** * Authenticate API Client. * * @param \Cog\Contracts\YouTrack\Rest\Client\Client $client * @return void * * @throws \Cog\Contracts\YouTrack\Rest\Authenticator\Exceptions\AuthenticationException */ public function authenticate(ClientContract $client): void; /** * Retrieve authentication token. * * @return string */ public function token(): string; }
  2. I'm getting an error like : Fatal error: Declaration of Cog\YouTrack\Rest\Authenticator\CookieAuthenticator::authenticate (Cog\Contracts\YouTrack\Rest\Client\Client $client): Cog\YouTrack\Rest\Authenticator\void must be compatible with Cog\Contracts\YouTrack\Rest\Authenticator\Authenticator::authenticate (Cog\Contracts\YouTrack\Rest\Client\Client $client): Cog\Contracts\YouTrack\Rest\Authenticator\void in /var/www/html/vendor/cybercog/youtrack-rest-php/src/Authenticator/CookieAuthenticator.php on line 24 my index file is : require_once 'vendor/autoload.php'; use Cog\YouTrack\Rest; // use Cog\Contracts\YouTrack\Rest\Authenticator\Authenticator; // Application configuration (replace with your YouTrack server values) $apiBaseUri = 'http://111.111.111.111:8080'; $apiUsername = 'username'; $apiPassword = 'password'; // Instantiate PSR-7 HTTP Client $psrHttpClient = new \GuzzleHttp\Client([ 'base_uri' => $apiBaseUri, 'debug' => true, ]); // Instantiate YouTrack API HTTP Client $httpClient = new Rest\HttpClient\GuzzleHttpClient($psrHttpClient); // Instantiate YouTrack API Cookie Authenticator $authenticator = new Rest\Authenticator\CookieAuthenticator(); CookieAuthenticator.php file is : namespace Cog\YouTrack\Rest\Authenticator; use Cog\Contracts\YouTrack\Rest\Authenticator\Authenticator as AuthenticatorContract; use Cog\Contracts\YouTrack\Rest\Client\Client as ClientContract; /** * Class CookieAuthenticator. * * @package Cog\YouTrack\Rest\Authenticator */ class CookieAuthenticator implements AuthenticatorContract // <--line 24 where the error is { /** * @var string */ private $username = ''; /** * @var string */ private $password = ''; /** * @var string */ private $cookie = ''; /** * Determine is trying to authenticate. * * @var bool */ private $isAuthenticating = false; /** * CookieAuthenticator constructor. * * @param string $username * @param string $password */ public function __construct(string $username, string $password) { $this->username = $username; $this->password = $password; } /** * Authenticate client and returns cookie on success login. * * @param \Cog\Contracts\YouTrack\Rest\Client\Client $client * @return void * * @throws \Cog\Contracts\YouTrack\Rest\Authenticator\Exceptions\AuthenticationException */ public function authenticate(ClientContract $client): void { $client = new ClientContract; if ($this->cookie !== '' || $this->isAuthenticating) { return; } $this->isAuthenticating = true; $response = $client->request('POST', '/user/login', [ 'login' => $this->username, 'password' => $this->password, ]); $this->isAuthenticating = false; if ($response->isStatusCode(200)) { $this->cookie = $response->cookie(); } } /** * Retrieve authentication token. * * @return string */ public function token(): string { return $this->cookie; } } Why I'm getting this error? I think there is something wrong with CookieAuthanticator.php file but unfortunately I could not find it
  3. Hello, In one project I'm working on, all the tables' engine is MyISAM, and due to some reasons a friend of mine told me that InnoDB would be better in the project, so if I click operations in phpmyadmin and change myisam to innodb for all the tables, would it cause any trouble? (Would I have to change the queries etc?)
  4. Thank you Barand. I m working on it.
  5. Well It's not actually 900, // So the loop is gonna be something like; for( <"900 data") { $query1 = "insert a data of 900" $query2 = "select productid of data where = product_code" || "take the last inserted row". for(<"count of stock lets say 5") $query insert productid,stock; for(<"count of photos lets say 6") $query insert productid,photoname; } Well, I thought about it but I wanna see if there is any better alternatives..
  6. Thank you for the suggestion. What I actually wonder is; how to insert that amount of data? Should I put in a loop and insert? That may take time and cause an error 500 maybe?
  7. Hi, I have two xml files, one has 750 products, and the other one has 900 products (including product informations, stock information, sizes and photos) so shortly one product in xml file is like this; product_name: x t-shirt product_code: x-t-shirt-101 (Alphanumerical) Stocks(loop): +Small: 50 +Large:200 Photo1 : http://....../main.jpg Photo2: http://....../2.jpg And my tables are like this: Product (product_id (numerical), product_code (alphanumerical), name) Photos (product_id, id.. ) Stocks (product_id, id..) (So that I need to insert one product in my db, and take the id, and insert the xml-photos-data with the correct product_id to photos table, same goes with the stocks table) So I m thinking about the easiest and most healthy way to import this amount of data, and I need to update it daily or weekly (planning to do it by cron jobs for now). I have found some solutions but since I have not done this before could not decide which is the most secure way. Need to add that I can have other xml files from different companies to import later on, so I think I should code for long term. Thank you in advance for your help.
  8. Hello, I m working on a VPS and will use this server for many subdomains. And I want to use these domains with SSL support (free ones, self or let's encrypt etc) So my question is; Can I use one certificate for many subdomains?(By adding the certificate directories links into apache virtual hosts .conf files) (if yes: is it good or bad?) Or should I create certificate for each of the domains? (So that there will be unique certificate link for each domain in virtual hosts' .conf files) Thank you in advance.
  9. I m trying to use a template, in one of the page there is a modal inserted in the code, so it works correctly if i just unzip the template and click an item ( a modal pop up window appears and all buttons work well. ) But I need to use the db, so that I have tried to fill the modal from an external php file, it also works, I m able to fill the fields in modal, but jquery/bootstrap buttons not working at this time. Here is my code; html: (where I call the model ) <a href="#" data-href="http://www.mywebsite.com/info.php?id=4" class="block2-btn flex-c-m stext-103 cl2 size-102 bg0 bor2 hov-btn1 p-lr-15 trans-04 js-show-modal1"> Check </a> jquery ; $('.js-show-modal1').on('click',function(e){ e.preventDefault(); var dataURL = $(this).attr('data-href'); $('#myproinfo').load(dataURL,function(e){ $('.js-modal1').addClass('show-modal1'); }); }); $('.js-hide-modal1').on('click',function(){ $('.js-modal1').removeClass('show-modal1'); }); modal : <!-- content tables are here --> <!-- modal part here --> <div class="wrap-modal1 js-modal1 p-t-60 p-b-20"> <div class="overlay-modal1 js-hide-modal1"></div> <div class="container"> <div class="bg0 p-t-60 p-b-30 p-lr-15-lg how-pos3-parent"> <button class="how-pos3 hov3 trans-04 js-hide-modal1"> <img src="images/icons/icon-close.png" alt="CLOSE"> </button> <div class="row" id="myproinfo"> <!-- DATA GOES HERE --> </div> </div> </div> </div> <!-- jquery, bootstrap etc includes here --> info.php; $query = "Select * data .. etc."; for($i=0) echo " <tr> <td><img src="'.$photo[$i].'" alt="IMG-PRODUCT"></td> <td>'$name[$i]'</td> <td>'$title[$i]'</td> </tr> How can I solve this? Thank you in advance for your replies.
  10. Thank you so much Barand, I really appreciate it.
  11. The question is still "if i just write "mysqli_real_escape_string" would be enough?..Well this is what I wonder actually.".. Well I m not able to re-code everything, as I said this is just a favor that I m doing for my customer. So now my question is still: if i just write "mysqli_real_escape_string" would it be enough?.. If you think you are wasting time, you don't need to reply Barand, I'm not forcing you, thank you for the suggestions in your first post though.
  12. lol, the question is very simple: "if i just write "mysqli_real_escape_string" would be enough?..Well this is what I wonder actually.". I have no time for chatting -sorry.
  13. Thank you for your replies, I ll definitely search more about using PDO. But for my case now, I have a script that my customer has sent me and that was coded ages ago by anyone else that we can not reach now. And my customer is saying that sometimes the script gives errors, and when I check the code, I could not find any check process before inserting the data into db. I m not gonna change the whole script, as a favor and for to help him I just want to add the functions to secure the script and since I m not a php expert, I just wondered what should I write before inserting the text into db? I don't know if i just write "mysqli_real_escape_string" would be enough?..Well this is what I wonder actually.
  14. What is the best way for form validation before inserting the data into db? ( Let's say the field is textarea which is the "Bio" part of the user & html tags are allowed) According to w3schools, this may be enough; function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } But some say " mysqli_real_escape_string " is needed also, so should i add that one too? function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); $data = mysqli_real_escape_string($dblink,$data); return $data; } So as a newbie, I m wondering the best and most secure way for validation before inserting the data into db. Thanks in advance.
  15. Hi, I have been using Hostgator (shared) for years. Recently, last 4 weeks, almost every week for a day when ever I enter my websites, they give me an error like "Error: No Database Connection", then everytime I contact to Hostgator support and they fix it, but they don't tell me what is really going on with my database system. (They just say my websites are not hacked or something they are doing some update, that is the reason.) So my questions are; 1- What can be the problem that I always have an database connection error and my websites are down for some hours everyweek? (I m not a db expert, so can't figure it out) Is it same with other hostings too? (I have not used any others before) 2- Hostgator users: Do you face this kind of problems too? 3- I have seen the "Web Host List" topic, but i don't know if the list was updated, so I would like to know if you have any hosting suggestions that you don't face this kind of problems. Thank you in advance for your replies.
  16. Thank you so much Barand! I really appreciate it, I was about to start solving it by php and you saved my life. I'll definitely normalize the table as soon as possible. Thanks
  17. Well Barand thank you for your suggestions but I need to know if it can be done by sql for now. It's not that easy as you say, it will take time since the tables are in use by other scripts and applications created by other developers. So as you can guess any update in the structure can cause problems for other applications to work.
  18. That's what i m planning to do for long term, but for now I need to solve this by sql codes (if possible) (or by php which i don't prefer) since I have very limited time now and normalizing will take time.
  19. Instead of creating a seperate table, is there any mysql-side solution? Like an explode function or something like that?
  20. Hello, I m a beginner level about writing mysql queries. Shortly and simply my tables are as follows; userTable userid-specs 1-1,2,3 2-10,11 specsTable specid-label 1-football 2-basketball 3-tennis and my query is as follows; SELECT * FROM userTable ut, specsTable st WHERE ut.userid = 1 AND st.specid IN (ut.specs) and it gives me the wrong result like; userid_specs_specid_label 1_1,2,3_1_football where i need an output like this; userid_specs_specid_label 1_1,2,3_1_football 1_1,2,3_2_basketball 1_1,2,3_2_tennis actually output like this would be better (if it can be done) (At the end I m gonna print it like this) [userid:1] can play football,basketball,tennis So my question is, what is it i m missing and it gives me the wrong result? Thank you in advance for your help.
  21. My mistake. I was gonna say a simple php file. I meant (i m not a php expert), at the last place I was working, we were creating simple php files, set the values in and call the classes and functions and see the results. It was a small company. It sounded me weird too when the guy told me that, I don't need to make the class abstract to test the code (as far as i know). So what's the point. Well I think he does not know what he talks about.
  22. Hello, I went to a new job meeting today and the guy there told me that they use abstract classes for testing classes/codes. Well I would create a simple html file and test the classes and functions if they return me the correct values. So why would i need an abstract class for testing purpose? Is there any point that i am missing, or he does not know what he talks about? Thank you in advance for your replies.
  23. You are perfect! I checked every single item, and found the error, Noticed that it was not in this query. When I use exit it was working well. Problem was I forgot to unset the values that i have used in the array, when i find the line i fixed it. Thank you so much!
  24. Hi, I have a very simple query, which is; UPDATE Vendor SET Name = '22' , Phone = '22' , Info = '22' , Rating = '20' , Status = 'active' WHERE 1=1 AND venid = '2' The weird thing is, it updates the row but it also gives me an error like; (I have the column venid in the table) Unknown column 'venid' in 'where clause' Also, when i use the query in "sql" section of phpmyadmin, it works well and does not give me any problem. Why can it be? I would be glad if anyone can help. Thanks in advance. PS: (i m using the query like : mysql_query($query) or die(mysql_error()) )
  25. Hello, My first question is; if there is a class, and i dont want this class to be instantiated anywhere? How can i do this? What are the ways/keywords for this? My second question is; Are there type of classes that can't be instantiated? What are the names of these classes? Thanks in advance.
×
×
  • 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.