PHP Version 5.6 to 7

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    The msql.php code that you provided never worked bro just kept getting 500 error tried putting it on all pages even the core and also tried it by adding it to config and it never worked

    Comment


      #17
      Think i may have to start from scratch lol already getting problems converting the database lol
      function connectbase() {

      global $dbname, $dbuser, $dbhost, $dbpass;
      $conms = @mysqli_connect($dbhost,$dbuser,$dbpass);
      if(!$conms) return false;
      $condb = @mysqli_select_db($dbname);
      if(!$condb) return false;
      return true;
      }

      Comment


        #18
        I'm not sure why the above script is causing a 500, I'm guessing placed in wrong place.

        your code should be:
        PHP Code:
        function connectbase() {
            global 
        $dbname$dbuser$dbhost$dbpass;
            
        $conms = @mysqli_connect($dbhost,$dbuser,$dbpass);
            if(!
        $conms) return false;
            
        $condb = @mysqli_select_db($conms,$dbname);
            if(!
        $condb) return false;
            return 
        true;

        However you need the string $conms in every mysqi function. Which will be a problem seeming it is inside a function.
        So to get it out of the function you can either return $conms:
        PHP Code:
        function connectbase() {
            global 
        $dbname$dbuser$dbhost$dbpass;
            
        $conms = @mysqli_connect($dbhost,$dbuser,$dbpass);
            if(!
        $conms) return false;
            
        $condb = @mysqli_select_db($conms,$dbname);
            if(!
        $condb) return false;
            return 
        $conms;

        and then use:

        $conms = connectbase();

        then you can use it inside mysqli functions such as:
        PHP Code:
        $id mysqli_fetch_array(mysqli_query($conms"SELECT id FROM ibwf_users WHERE name='".$name."'")); 


        or alternatively you could use it outside of the function eg:
        PHP Code:
        $conms = @mysqli_connect($dbhost,$dbuser,$dbpass);

        function 
        connectbase() {
            global 
        $conms$dbname;
            if(!
        $conms) return false;
            
        $condb = @mysqli_select_db($conms,$dbname);
            if(!
        $condb) return false;
            return 
        true;

        Last edited by something else; 30.12.18, 20:15.

        Comment


          #19
          Thanks bro which means i have to edit the entire script lol

          Comment


            #20
            And the problem lies at the core.php file also if the function is created in the core how can i use $conms = connectbase(); to cover other functions within the core?

            Comment


              #21
              You either have to pass it into the function via its variables:
              PHP Code:
              function doSomething($sid$conms) {


              (This means you have to change it everywhere that function is used)

              or a quicker method would be to use a global variable:
              [php]
              PHP Code:
              function doSomething($sid)  {
              global 
              $conms;


              (This means you do not have to update the function everywhere it is used)

              Comment


                #22
                tupac I missed the other question as I was away (seen it on mobile but had forgotten login details.).

                Comment


                  #23
                  The question was is it possible to add voicenotes to lavalair?

                  Comment


                    #24
                    It will fade and you will resign the php to 7 it will not be hard ;) just holes people getting hacked though php 5.7 soon enough php_shell can't be used..
                    Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
                    Visit: WapMasterz Coming Back Soon!
                    _______
                    SCRIPTS FOR SALE BY SUBZERO
                    Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
                    FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
                    _______
                    Info & Tips
                    php.net
                    w3schools.com

                    Comment


                      #25
                      Thanks subz

                      Comment

                      Working...
                      X