Jump to content


  • Posts

  • Joined

  • Last visited

Posts 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): 
    must be compatible with 
    Cog\Contracts\YouTrack\Rest\Authenticator\Authenticator::authenticate   (Cog\Contracts\YouTrack\Rest\Client\Client $client): 
    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 = '';
    $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) {
            $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. 34 minutes ago, gw1500se said:

    Is this a one time load? If so does it matter? You could write a SQL file from the data then have MySQL read that in and do it all at once. You could then schedule it to be loaded into the database in background so your web page does not time out. Depending on your server I'm not sure inserting 900 records would really take that long but if it did you can increase the time out.

    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.. 

  5. 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)
    +Small: 50
    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.

  6. 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.


  7. 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">
    jquery ;
    var dataURL = $(this).attr('data-href');
    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">
    <div class="row" id="myproinfo">
    <!-- DATA GOES HERE -->
    <!-- jquery, bootstrap etc includes here -->
    $query = "Select * data .. etc.";
    echo " 
    <td><img src="'.$photo[$i].'" alt="IMG-PRODUCT"></td>

    How can I solve this?

    Thank you in advance for your replies.

  8. 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.

  9. 2 hours ago, ginerjm said:

    So - what have you done to get rid of the errors?  Do you have any to show us?  Them and the specific lines involved?

    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.

  10. 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.

  11. 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.

  12. 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.


    Found something that should help

    mysql> SELECT * FROM usertable;
    | userid | specs |
    |      1 | 1,2,3 |
    |      2 | 10,11 |
    2 rows in set (0.00 sec)
    mysql> SELECT * FROM spec;
    | specid | label      |
    |      1 | Football   |
    |      2 | Basketball |
    |      3 | Tennis     |
    3 rows in set (0.02 sec)
    mysql> SELECT ut.userid
        ->      , s.specid
        ->      , s.label
        -> FROM usertable ut
        ->      JOIN spec s ON FIND_IN_SET(s.specid, ut.specs);
    | userid | specid | label      |
    |      1 |      1 | Football   |
    |      1 |      2 | Basketball |
    |      1 |      3 | Tennis     |
    3 rows in set (0.00 sec)

    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 :)

  14. Because you didn't normalize you are running into problems like this, and that is a situation that won't go away. If only you had spent the time more wisely at an earlier stage.


    It shouldn't take you long to explode the values in PHP then write out to a normalized version of the table. You could have done that while you were posting here.

    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.

  15. Why don't you just correctly normalize the data and use SQL as it was designed to be used? Either that or stick with spreadsheets or text files.

    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.


    IN () takes a series of values separated by commas. Your specs field is a single string value which happens to contain commas.


    Those "specs" should be in a separate table with each value in a separate record with the owning userid

    userid | spec
      1    |   1
      1    |   2
      1    |   3
      2    |   10
      2    |   11

    Instead of creating a seperate table, is there any mysql-side solution? Like an explode function or something like that?

  17. Hello,


    I m a beginner level about writing mysql queries. Shortly and simply my tables are as follows;


    and my query is as follows;

    userTable ut, specsTable st
    ut.userid = 1 AND
    st.specid IN (ut.specs)

    and it gives me the wrong result like;


    where i need an output like this;


    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.

  18. 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.

  19. 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.

  20. the error message is probably coming from some other query in your code, perhaps after the one in question, if you don't for example have an exit; statement after a header() redirect.


    in any case, it would take seeing all your code, less any connection credentials, to be able to specifically help find the cause of the problem.


    btw - the old and obsolete php mysql extension has been removed from the latest php version and you should be updating your code to use either the php PDO extension (which is the best choice) or the php mysqli extension (turns out is not a good choice at all), and you should not be putting data values directly into the sql query statement, but using a prepared query, with place-holders in the sql statement for the data values, then supply the data when you execute the query.


    updating the code will also let you use exceptions to handle the database statement errors, so you can simply enable exceptions for the extension you end up using, let php catch the exception, where it will use its error_reporting, display_errors, and log_errors settings to control what happens with the actual error information, and you can then eliminate any error handling logic you have in your code, thereby reducing the amount of code you have to convert.

    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!

  21. 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()) )





  • 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.