Jump to content

techker

Members
  • Posts

    812
  • Joined

  • Last visited

Posts posted by techker

  1. the database entry is json format

     

    ["http:\/\/server:8080\/9Lx0YfoxZp\/DexfrUxcn\/2107"]  and has other fields like name......

    cause the panel fetched the info and encodes it in json for output to selected file needed...

    but i just noticed that it has all entries so database table can contain 15000 streams...

    so i would need to check and remove duplicates....

    or like you say i can use the existing api and read the json but it can take long time if to many results....

  2. hey guys i have a table streams

    that has multiple columns but i need one and brake the string?

    stream_source

    contains

    ["http:\/\/server:8080\/9Lx0YfoxZp\/DexfrUxcn\/2107"]

     

    so i need just http:\/\/server:8080 as dns   9Lx0YfoxZp as username  and DexfrUxcn as password

    i have tried a few was like this example..

     

    but no luck im guessing its because i first need to remove ["  ?

    SELECT SUBSTRING_INDEX(stream_source, '  \/ ', 1) AS dns, SUBSTRING_INDEX(SUBSTRING_INDEX(stream_source,'  \/ ', 2), ' ',-1) AS mname, SUBSTRING_INDEX(stream_source, ' \/ ', -1) as lname FROM streams;

  3. Hey guys i need to echo this:

    Quote

    {
       "error":false,
       "result":[{
      "apk_sign":"0F:19:F7:2D:F0:40:2C:FE:25R:C1:EB:80:0FF:FC:92:DA:4F:BE:2F:9F",
        "portal_url":"
       http://changeme.net:80,
        http://changeme2.net:80,
        http://changeme3.net:80
      "}]
      }

    Up to know i tried lots of combos but can seem to get the Array correctly?

    Quote

    $named_array3 = array(
             "error" => false,
             "result" => array(
                "apk_sign" => "0F:19:F7:2D:F0:40:2C:FE:25d:C1D:EB:80:0F:FCD:92:DA:46:BEF:23D:9DD",
                "portal_url" => "http:\/\/changeme.net:80,http:\/\/changeme.net:80,http:\/\/changeme.net:80")
    );

    it echos

    Quote

     

    {

       "error":false,
       "result":{      "apk_sign":"0F:19:F7:2D:F0:40:2C:FE:25:C1:EB:80:0F:FC:92:DA:46:BE:23:9D",
          "portal_url":[

           "http:\\\/\\\/changeme.net:80,http:\\\/\\\/changeme.net:80,http:\\\/\\\/changeme.net:80"    

    ]}

    }

     

    but the [ needs to be at results....

     

    Thx for the help

  4. Uhh stupid me lol

    So first issue was that i forgot to add  AND Status != 'Used' .  so it would update a used code..that is why i would not see it ..

     

    But the issue i have now is that if i select 1 credit it puts 2

    is it because it is like an array that 0 is 1 so it would do 0 then 1 so gives 2?

     

    have a feeling it is this:

    its were i add the user.it gets the amount of credits the user has(code) and puts them in a select for his to select the amount to transfer so he knows how many he can transfer..

    $range = range(1,$CreditCount);
    foreach ($range as $cm) {
      echo "<option value='$cm'>$cm</option>";
    }
    echo "</select>"; ?>

     

  5. same issue very odd...it does not update at all...

    require_once 'config/dbconnect.php';
    
      $userid = strip_tags($_GET['user']);
    	$subid = strip_tags($_GET['newUser']);
      $cr = strip_tags($_GET['cr']);
    	$userida = $DBcon->real_escape_string($userid);
      $subida = $DBcon->real_escape_string($subid);
      $cra = $DBcon->real_escape_string($cr);
    
    
    $stmt = $DBcon->prepare("UPDATE Codes SET UserID = ? WHERE UserID = ? LIMIT ?");
    $stmt->bind_param('iii', $subida, $userida, $cra);
    $stmt->execute();
    
    if(!$stmt->execute()) {
        echo "Error: " . mysqli_error($DBcon);
    }else{
        echo "Success adding user : $subida with : $cra  ";
    		echo "<meta http-equiv=Refresh content=1;url=Subseller.php?success=1 >";
    }

     

  6. ya its odd..why is it not working for me....

     

    ini_set("display_errors", 1);
    header("Refresh: 30");
    require_once 'config/dbconnect.php';
    
    $userid = $_POST['OwnerID'];
    $subid  =  $_POST['SubID'];
    $cr     = $_POST['credits'];
    
    $stmt = $DBcon->prepare("UPDATE Codes SET UserID = ? WHERE UserID = ? LIMIT ?");
    $stmt->bind_param('iii', $subid, $userid, $cr);
    $stmt->execute();
    
    echo "$userid<br /><br /><em>$cr Updated! $subid</em><br /><br />";
    echo "<meta http-equiv=Refresh content=1;url=SwapC.php?success=1 >";
    
    ?>

     

  7. not sure how to export it..lol

     

    so basically:

    CID    Value         DateIn            Status .       UserID .        DateSold

    1 .     24242        2019-11-11 .    0                     5                 null

    2.       24243        2019-11-11 .    0                     5                 null

    3 .     24244        2019-11-11 .    0                     5                 null

    4 .     24245        2019-11-11 .    0                     3                 null

    5 .     24246       2019-11-11 .    0                     3                null

    6.     24246       2019-11-11 .    0                     4               null

    7 .     24246       2019-11-11 .    0                     4                null

    user          is 5 .   want to give 2 codes(value) to user 3

    any value(code) 

    should be :

    CID    Value         DateIn            Status .       UserID .        DateSold

    1 .     24242        2019-11-11 .    0                     5                 null

    2.       24243        2019-11-11 .    0                     3                 null

    3 .     24244        2019-11-11 .    0                    3                 null

    4 .     24245        2019-11-11 .    0                     3                 null

    5 .     24246       2019-11-11 .    0                     3                null

    6.     24246       2019-11-11 .    0                     4               null

    7 .     24246       2019-11-11 .    0                     4                null

  8. what do you need??

    CREATE TABLE `Codes` (
      `CID` int(11) NOT NULL,
      `Value` varchar(100) NOT NULL,
      `DateIn` varchar(25) NOT NULL,
      `Status` varchar(25) NOT NULL,
      `UserID` varchar(25) NOT NULL,
      `DateSold` varchar(25) NOT NULL
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1;

  9. no lol

     

    CID  Value DateIn Status UserID DateSold

    i tried: but stays at same..

    $userid = mysqli_real_escape_string($DBcon, $_POST['OwnerID']);
    $subid  = mysqli_real_escape_string($DBcon, $_POST['SubID']);
    $cr     = mysqli_real_escape_string($DBcon, $_POST['credits']);
    
    $stmt = $DBcon->prepare("UPDATE Codes
                                SET UserID = ?
                            WHERE UserID = ?
                            LIMIT ?
                      ");
    $stmt->bind_param('iii', $subid, $userid, $cr);
    $stmt->execute();

     

  10. also tried

    $size = count($_POST['credits']);

    $i = 0;
    while ($i < $size) {
        $UserIDa= $_POST['OwnerID'][$i];
        $NewRIda = $_POST['SubID'][$i];

        $query = "UPDATE Codes SET UserID= '$UserIDa' WHERE UserID = '$NewRIda'";
        mysqli_query($DBcon,$query) or die ("Error in query: $query");
        echo "$UserIDa<br /><br /><em>Updated!</em><br /><br />";
        ++$i;
    }

    table code is set id value userid status dateSold

     

  11. hey ya thx

    $Cr = mysqli_real_escape_string($DBcon, $_POST['credits']);

    is the number of credits the guy wants to give the other guy.

    so lets say he has 20 codes and wants to give 10 to the other guy

     

    in my codes table i have column codes and and column userID were i put the guys id (owner)

    so now my issue is to take 10 codes out of 20 and swap his id to the new guys id

  12. Hey guys..i have an issue i can't seem to fix...

     

    i have a table with codes and userid to associate  the code to a user

    i need to make it that a user can give codes to another user.

    i have a form .  from user to other user with amount of codes

     

    so i have tried many combos..

    $UserID =   mysqli_real_escape_string($DBcon, $_POST['OwnerID']);
    $NewRId =   mysqli_real_escape_string($DBcon, $_POST['SubID']);
    $Cr =       mysqli_real_escape_string($DBcon, $_POST['credits']);
    
    tried with range
    
    $t = array();
    $counter = 0;
    foreach (range(0, $Cr) as $t) {
    	$sql = "UPDATE `Codes` SET `UserID`= '$NewRId' WHERE `UserID` = '$UserID'";
    	$counter ++;
    	echo $counter;
    }
    $result = mysqli_query($DBcon,$sql);
    	if (!$result) {
    	    trigger_error("UPDATE query failed: " . mysqli_error(), E_USER_ERROR);
    	}
    but it takes all the ocdes from user one to user two...
    
    tried also:
     foreach ($Cr as $t) {
    	$sql2 = "UPDATE `Codes` SET `UserID`= '$NewRId' WHERE `UserID` = '$UserID'";
     	if ($DBcon->query($sql2) === TRUE) {
         echo "<meta http-equiv=Refresh content=1;url=SwapC.php?success=1 >";
    	} else {
    		 echo "Error updating record: <br>" . $DBcon->error;
    	}
     }
    but does not work...

     

     

     

  13. Hey guys i got an api and it returns :

    [  
       {  
          "id":"1",
          "package_name":"1 Month Full + Adult - 2 Devices",
          "is_trial":"0",
          "is_official":"1",
          "trial_credits":"0",
          "official_credits":"1",
          "trial_duration":"24",
          "trial_duration_in":"hours",
          "official_duration":"1",
          "official_duration_in":"months",
          "groups":"[4,5,6,8]",
          "bouquets":"[27]",
          "can_gen_mag":"1",
          "only_mag":"0",
          "output_formats":"[1,2,3]",
          "is_isplock":"0",
          "max_connections":"2",
          "is_restreamer":"0",
          "force_server_id":"0",
          "can_gen_e2":"1",
          "only_e2":"0",
          "forced_country":"",
          "lock_device":"0"
       },......]

    	 
    	$json = file_get_contents(URL);
    	$data = json_decode($json,true);
    	$Decoded = $data['id'][0];       HERE no mater what i put i get and error Undefined index: id in /home/handshak/public_html/XC/get2.php on line 9
    	echo "<pre>";
    	print_r($Decoded);
    	exit;
    	

    What type of json structure is that?

    EDIT:

    if i use:

    $contents = file_get_contents($json); 
    $contents = utf8_encode($contents); 
    $results = json_decode($contents);

    i get:

    [14-Apr-2019 15:38:32 UTC] PHP Warning:  file_get_contents([{&quot;id&quot;:&quot;1&quot;,&quot;package_name&quot;:&quot;1 Month Full + Adult - 2 Devices&quot;,&quot;is_trial&quot;:&quot;0&quot;,&quot;is_official&quot;:&quot;1&quot;,&quot;trial_credits&quot;:&quot;0&quot;,&quot;official_credits&quot;:&quot;1&quot;,&quot;trial_duration&quot;:&quot;24&quot;,&quot;trial_duration_in&quot;:&quot;hours&quot;,&quot;official_duration&quot;:&quot;1&quot;,&quot;official_duration_in&quot;:&quot;months&quot;,&quot;groups&quot;:&quot;[4,5,6,8]&quot;,&quot;bouquets&quot;:&quot;[27]&quot;,&quot;can_gen_mag&quot;:&quot;1&quot;,&quot;only_mag&quot;:&quot;0&quot;,&quot;output_formats&quot;:&quot;[1,2,3]&quot;,&quot;is_isplock&quot;:&quot;0&quot;,&quot;max_connections&quot;:&quot;2&quot;,&quot;is_restreamer&quot;:&quot;0&quot;,&quot;force_server_id&quot;:&quot;0&quot;,&quot;can_gen_e2&quot;:&quot;1&quot;,&quot;only_e2&quot;:&quot;0&quot;,&quot;forced_country&quot;:&quot;&quot;,&quot;lock_device&quot;:&quot;0&quot;},{&quot;id&quot;:&quot;2&quot;,&quot;package_name&quot in /home/handshak/public_html/XC/get2.php on line 7
     

  14. odd so how come it is inserted like that..

    how can i make a function to edit this:

    "http:\/\/streams.com:\/live\/A245\/23424\/6207.ts","http:\/\/streams\/live\/123\/43r3222\/27357.ts"]

    guessing i need to remove the\/ and replace by // . and when i save i need to re add the \/

     

    im messing around with SELECT streams_source  REPLACE(streams_source,'\/','//') as output FROM Stream WHERE 1;

    but getting mysql errors ..

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