Jump to content

jubba890

Members
  • Posts

    28
  • Joined

  • Last visited

Posts posted by jubba890

  1.  

     

    Does ones refer to group or servers?

     

    Ones refer to the servers

     

     

     

    Both have same ID value

     

    My bad, the second group is supposed to have the ID of 2

     

     

     

    Your server and group entities both have type attributes. To which does type refer?

     

    Both, a group with "type" of web cannot have a server whom's "type" is mysql

     

     

     

    another group in respect to what? Is there pre-selection of a group to process?

     

    If there are 2 groups: G1 and G2. and there was 1 server (S1), you would not see S2 on G2's list if it was already in G1 and vise-versa.

     

     

    Mix of AND and OR - is that

    A OR (B AND C)

    (A OR B) AND C

     

    If server is not in another group AND the server types match (for group and server) AND they are not already in the group.

  2. Hi! I have 2 tables

     

    servers:

     

    ID | IP | NAME | TYPE | STATUS

     

    serversgroups:

     

    ID | NAME | TYPE

     

    servergroupsdata:

     

    GROUPID | SERVERID

     

     

     

    On the page I have 2 listbox's and on the left is available ones, and on the right is the ones in the group, I need the ones on the 'available' ones to NOT show if they are in another group OR if they are in the current group you are editing AND they have to be the same type.

     

    Example:

     

    TestServer:

      - ID: 1

      - TYPE: webserver

     

    OtherServer:

      - ID: 2

      - TYPE: randomserver

     

    FinalServer:

      - ID: 3

      - TYPE: webserver

     

    ################

     

    TestGroup:

      - ID: 1

      - TYPE: webserver

     

    TestGroup:

      - ID: 1

      - TYPE: webserver

     

    ################

     

    Row1:

      - GROUPID: 1

      - SERVERID: 1

     

    ROW2:

      - GROUPID: 2

      - SERVERID: 3

     

    Expected in 'available' for groupID 1:

      ##NOTHING##

     

    Expected in 'in the group' for groupID 1:

      - TestServer [With ID of 1]

     

    Is this a confusing way to do a simple task? Anything will help, I tried to fetch the array and then do
    while($var = mysqli_fetch_Array($query)

     

    but I ended up with 3 of those and a bunch of IF statements and I'm just really irritated right now.

     

    ANY help is MUCH appreciated :)

  3. try naming it index.php instead of index.tpl.  Or add a AddType handler to your apache.conf (assuming you're using apache) and allow the .tpl extension to be processed as php.

     

    It's a template system so I don't want it .php

  4. In index.php I have this code

    <?php
    $HTML = str_replace('{$template}', 'TEMPLATES/' . $template, file_get_contents('TEMPLATES/' . $template . '/index.tpl'));
     echo $HTML;
    ?>
    

    so everytime I call {$template} it replaces it with the directory, this works and all until I need PHP in my template.

     

    How can I get PHP code to execute so say if I have this in my template

    <?php
    echo "Test";
    ?>
    

    It will show Test instead of the whole code, thanks!

  5. Hi guys! I am working to create a new front end for WHMCS using the backend. Here is what I have so far:

     

    http://inzernettechnologies.com/login.php

     

    http://inzernettechnologies.com/register.php

     

    http://inzernettechnologies.com/clientarea.php

     

    http://inzernettechnologies.com/resetPassword.php

     

    e-mail: cody-admin@inzernettechnologies.com

    password: cmr432we

     

    (To login to the login and to get to the client area, I know it isn't much but this is what I got done in a couple hours)

     

    I am wondering if someone would like to help with this project with me :)

    I was planning on selling this, so you could get some of the money from sales if you want. If you are interested, please let me know! Thanks!

  6. I am using WHMCS API and It gives me an array for the first name, last name, etc for the client information

     

    Here is the code I have so far

     

    checkLogin.php

    <?php 
     session_start(); 
     echo "ID: " . $_SESSION['clientID']; 
     $postfields = array(); 
     $postfields["action"] = "getclientsdetails"; 
     $postfields["clientid"] = $_SESSION['clientID']; 
     $postfields["stats"] = true; 
     $postfields["responsetype"] = "xml"; 
     echo "<br>"; 
     include('XMLAPI.php'); 
     ?>
    

    XMLAPI.php

    <?php 
     /* *** WHMCS XML API Sample Code *** */ 
      
     $url = "http://inzernettechnologies.com/billing/includes/api.php"; # URL to WHMCS API file 
     $username = "user"; # Admin username goes here 
     $password = "pass"; # Admin password goes here 
    
     $postfields["username"] = $username; 
     $postfields["password"] = md5($password); 
    
     $query_string = ""; 
     foreach ($postfields AS $k=>$v) $query_string .= "$k=".urlencode($v)."&"; 
      
     $ch = curl_init(); 
     curl_setopt($ch, CURLOPT_URL, $url); 
     curl_setopt($ch, CURLOPT_POST, 1); 
     curl_setopt($ch, CURLOPT_TIMEOUT, 30); 
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
     curl_setopt($ch, CURLOPT_POSTFIELDS, $query_string); 
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); 
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 
     $xml = curl_exec($ch); 
     if (curl_error($ch) || !$xml) $xml = '<whmcsapi><result>error</result>'. 
     '<message>Connection Error</message><curlerror>'. 
     curl_errno($ch).' - '.curl_error($ch).'</curlerror></whmcsapi>'; 
     curl_close($ch); 
      
     $arr = whmcsapi_xml_parser($xml); # Parse XML 
      
     print_r($arr); # Output XML Response as Array 
      
     /* 
     Debug Output - Uncomment if needed to troubleshoot problems 
     echo "<textarea rows=50 cols=100>Request: ".print_r($postfields,true); 
     echo "\nResponse: ".htmlentities($xml)."\n\nArray: ".print_r($arr,true); 
     echo "</textarea>"; 
     */ 
      
     function whmcsapi_xml_parser($rawxml) { 
         $xml_parser = xml_parser_create(); 
         xml_parse_into_struct($xml_parser, $rawxml, $vals, $index); 
         xml_parser_free($xml_parser); 
         $params = array(); 
         $level = array(); 
         $alreadyused = array(); 
         $x=0; 
         foreach ($vals as $xml_elem) { 
           if ($xml_elem['type'] == 'open') { 
              if (in_array($xml_elem['tag'],$alreadyused)) { 
                  $x++; 
                  $xml_elem['tag'] = $xml_elem['tag'].$x; 
              } 
              $level[$xml_elem['level']] = $xml_elem['tag']; 
              $alreadyused[] = $xml_elem['tag']; 
           } 
           if ($xml_elem['type'] == 'complete') { 
            $start_level = 1; 
            $php_stmt = '$params'; 
            while($start_level < $xml_elem['level']) { 
              $php_stmt .= '[$level['.$start_level.']]'; 
              $start_level++; 
            } 
            $php_stmt .= '[$xml_elem[\'tag\']] = $xml_elem[\'value\'];'; 
            @eval($php_stmt); 
           } 
         } 
           return($params); 
     } 
      
     ?>
    

    It outputs:

    ID: 1
    Array ( [WHMCSAPI] => Array ( [ACTION] => getclientsdetails [RESULT] => success [CLIENT] => Array ( [USERID] => 1 [ID] => 1 [FIRSTNAME] => Cody [LASTNAME] => Robinson [FULLNAME] => Cody Robinson [COMPANYNAME] => InZernet Technologies [EMAIL] => cody-admin@inzernettechnologies.com [ADDRESS1] => Address [ADDRESS2] => [CITY] => 11 [FULLSTATE] => Michigan [STATE] => Michigan [POSTCODE] => 11111 [COUNTRYCODE] => US [COUNTRY] => US [STATECODE] => MI [COUNTRYNAME] => United States [PHONECC] => 1 [PHONENUMBER] => 1111111111 [PHONENUMBERFORMATTED] => 11111111 [BILLINGCID] => 0 [NOTES] => [PASSWORD] => PASSWORD [TWOFAENABLED] => [CURRENCY] => 1 [DEFAULTGATEWAY] => [CCTYPE] => [CCLASTFOUR] => [SECURITYQID] => 29 [SECURITYQANS] => Rogers [GROUPID] => 0 [STATUS] => Active [CREDIT] => 0.00 [TAXEXEMPT] => [LATEFEEOVERIDE] => [OVERIDEDUENOTICES] => [SEPARATEINVOICES] => [DISABLEAUTOCC] => [EMAILOPTOUT] => 0 [OVERRIDEAUTOCLOSE] => 0 [LANGUAGE] => [LASTLOGIN] => Date: 07/10/2014 17:43
    IP Address: xx.xx.xx.xx.xx
    Host: xx.xx.xx.xx.xx.xx.xx [CUSTOMFIELDS1] => Other [CUSTOMFIELDS] => Array ( [ID] => 1 [VALUE] => Other ) [CURRENCY_CODE] => USD ) [STATS] => Array ( [NUMDUEINVOICES] => 0 [DUEINVOICESBALANCE] => $0.00 USD [INCOME] => $0.00 USD [INCREDIT] => [CREDITBALANCE] => $0.00 USD [NUMOVERDUEINVOICES] => 0 [OVERDUEINVOICESBALANCE] => $0.00 USD [NUMPAIDINVOICES] => 0 [PAIDINVOICESAMOUNT] => $0.00 USD [NUMUNPAIDINVOICES] => 0 [UNPAIDINVOICESAMOUNT] => $0.00 USD [NUMCANCELLEDINVOICES] => 0 [CANCELLEDINVOICESAMOUNT] => $0.00 USD [NUMREFUNDEDINVOICES] => 0 [REFUNDEDINVOICESAMOUNT] => $0.00 USD [NUMCOLLECTIONSINVOICES] => 0 [COLLECTIONSINVOICESAMOUNT] => $0.00 USD [PRODUCTSNUMACTIVEHOSTING] => 0 [PRODUCTSNUMHOSTING] => 0 [PRODUCTSNUMACTIVERESELLER] => 0 [PRODUCTSNUMRESELLER] => 0 [PRODUCTSNUMACTIVESERVERS] => 0 [PRODUCTSNUMSERVERS] => 0 [PRODUCTSNUMACTIVEOTHER] => 0 [PRODUCTSNUMOTHER] => 0 [PRODUCTSNUMACTIVE] => 0 [PRODUCTSNUMTOTAL] => 0 [NUMACTIVEDOMAINS] => 0 [NUMDOMAINS] => 0 [NUMACCEPTEDQUOTES] => 0 [NUMQUOTES] => 0 [NUMTICKETS] => 0 [NUMACTIVETICKETS] => 0 [NUMAFFILIATESIGNUPS] => 0 ) ) )
    

    How would I get that information into a variable

    I tried $params[1];

    and that didn't work

    I tried to remove the return($params);

    and use it in CheckLogin.php and did

    echo $params;

    but it didn't work

    Any help appreciated!!!!!

  7. I am looking for a PHP developer to develop an application in which is almost completed. I can pay, but I expect HIGH quality work like my other PHP Developer. Here is a link to the project that needs to be finished: http://inzernettechnologies.com/StreamIT

     

    Please contact me ASAP! Thanks

     

    Skype: inzernettechnologies.admin

    E-Mail: cody-admin@inzernettechnologies.com

    Contact form: http://inzernettechnologies.com/store/contact.php

  8. Your problems (probably) start at

    <script type="text/javascript">
    var isPaused = 0;
    var loopType = 'none';
    var lastSong = -1;
    var playlist = new Array("<?php echo $songs; ?>");
     
    <!-- Still HTML yet you start PHP out of nowhere -->
    
    $db = new mysqli(HOST.COM,USER,PASS,StreamIT); // use your credentials
    $sql = "SELECT Songs FROM Main";
    $playlist = array();
    $res = $db->query($sql);
    while ($row = $res->fetch_assoc()) {
    $playlist[] = $row['Songs'];
    }
    $songs = join('","', $playlist);
    ?>
    

    I stopped looking after that.

    You were right, I accidentally deleted the <?PHP and not that I inserted it correctly, it shows - only

  9. ... and it might be a good idea to create the $songs variable before you try and put it in the JS array.

     

    I originally used SocialCloud's code. which had the $song variable in it, I am not sure how to use the $song varible and where it fits into play here

  10.  

    Something like this

    <?php
    $db = new mysqli(HOST,USERNAME,PASSWORD,DATABASE); // use your credentials
    
    $sql = "SELECT songtitle FROM mytable";
    $playlist = array();
    $res = $db->query($sql);
    while ($row = $res->fetch_assoc()) {
        $playlist[] = $row['songtitle'];
    }
    $songs = join('","', $playlist);
    ?>
    
    <script type='text/javascript'>
    var playlist = new Array("<?php echo $songs; ?>");
    </script>
    

     

    So far my code is:

    <?PHP
    
      //### Start the session
      session_start();
      
      //### Make sure the user is logged in
    
    //  if(!isset($_SESSION['streamit_user'])) {
    //    header('Location: login.php');
    //    exit;
    //  }
    
      if($_SERVER['HTTP_HOST'] == 'localhost') {
        $settings['base_path'] = 'XXX';
      } else {
        $settings['base_path'] = 'XXX';
      }
      
    ?>
    <!DOCTYPE html>
    <html lang="en" dir="ltr">
      <head>
        <title>Web Player</title>
        <base href="<?PHP echo $settings['base_path'];?>"><!--[if IE]></base><![endif]-->
        <link href="includes/css/main_style.css?<?PHP echo microtime(true);?>" rel="stylesheet" type="text/css">
        <link href="http://fonts.googleapis.com/css?family=Ubuntu" rel="stylesheet" type="text/css">
        <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
        
        <!-- Player Files -->
        <link href="includes/css/player.css?<?PHP echo microtime(true);?>" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="includes/js/jquery.jplayer.js"></script>
        <script type="text/javascript" src="includes/js/jplayer.playlist.js"></script>
        <!--[if IE 7]>
          <style>
            #jp_container_1{padding-bottom:-10px;margin-bottom:0;}
          </style>
        <![endif]-->
        <script type="text/javascript">    
          $(document).ready(function(){
    	      new jPlayerPlaylist({
    		        jPlayer: "#inzernet_player",
    		        cssSelectorAncestor: "#jp_container_1"
    	      }, [{ }], {
    		        swfPath: "includes",
    		        supplied: "mp3",
    		        wmode: "window",
    		        smoothPlayBar: true,
    		        keyEnabled: true,
    		        volume: 1
    	      });
    	
            $("#inzernet_player").bind($.jPlayer.event.ended, function() {
              playNext('loop');
            });
      
            $("#inzernet_player").jPlayer({"solution": navigator.userAgent.indexOf("Trident/5")>-1 ? "flash" : "html,flash"});
            
            if(navigator.appVersion.indexOf("MSIE 7.")!=-1){ 
              $('.frame_loader').css('margin-left', '0');
            }
          });
        </script>
      </head>
      
      <body>
      
        <div id="main_wrap">
          <div class="top_element">
            <div class="top_links top_left">
              <span><a href="#">Home</a></span>
              <span><a href="#">Latest News</a></span>
              <span><a href="#">My Account</a></span>
              <span><a href="#">Playlists</a></span>
              <span><a href="#">Upload</a></span>
            </div>
          
            <div class="top_links top_right">
              <span><a href="login.php" target="main_frame" onClick="loadPage(this);">Log In</a></span>
              <span><a href="register.php" target="main_frame">Register</a></span>
            </div>
          
            <div style="clear:both;"></div>
          </div>
           
          <div class="content_limiter" id="player_el">
            <div class="player_playlist">
              <div class="playlist_content">          
                Playlist <br><br>
                
                <div id="playlist_items"></div>
              </div>
            </div>
            <div class="frame_loader"> <img src="images/loading.gif"> </div>
            <iframe src="frame_index.php" class="main_frame" name="main_frame" id="main_frame" frameBorder="0" allowTransparency="true" onLoad="hideLoader();"></iframe>   
            
            <div style="clear:both;"></div>      
          </div>
      
          <div class="top_element" style="height: 10px;"></div>
        
          <div class="content_limiter" id="player_element">
          <!--- Player Start --->
            <div id="inzernet_player" class="jp-jplayer"></div>
    
            <div id="jp_container_1" class="jp-audio">
              <div class="jp-type-playlist">
                <div class="jp-gui jp-interface">
                  <ul class="jp-controls">
                    <li><a href="javascript:;" class="jp-previous player_button" tabindex="1" style="margin-left:10px;" onClick="playPrevious(); return false;">previous</a></li>
                    <li><a href="javascript:;" class="jp-play player_button" tabindex="1" onClick="playSong(); return false;">play</a></li>
                    <li><a href="javascript:;" class="jp-pause player_button" tabindex="1" onClick="pauseSong(); return false;">pause</a></li>
                    <li><a href="javascript:;" class="jp-next player_button" tabindex="1" onClick="playNext('button'); return false;">next</a></li>
                    <!--<li><a href="javascript:;" class="jp-stop player_button" tabindex="1">stop</a></li>-->
                    <li><a href="javascript:;" class="jp-mute " tabindex="1" title="mute">mute</a></li>
                    <li><a href="javascript:;" class="jp-unmute" tabindex="1" title="unmute">unmute</a></li>
                    <li><a href="javascript:;" class="jp-volume-max" tabindex="1" title="max volume">max volume</a></li>
                  </ul>				
                  
                  <div class="player_right">
                      <div class="loop player_button" onClick="loop();"></div>
                    </div>
    					
    					    <div style="float: left;">				
    					      <div id="current_song" class="song_title"> No Song Selected </div>
    					      
                    <div class="jp-current-time"></div>
                    
                    <div class="jp-progress">
                      <div class="jp-seek-bar">
                        <div class="jp-play-bar"></div>
                      </div>
                    </div>					
                    <div class="jp-duration"></div>
    					
                    <div class="jp-volume-bar">
                      <div class="jp-volume-bar-value"></div>
                    </div>
    
                    <div style="clear:both;"></div>
                  </div>
    					    <div style="clear:both;"></div>
    
                  <div class="jp-playlist">
                    <ul>
                      <li></li>
                    </ul>
                  </div>
                  
                  <div class="jp-no-solution">
                    <span>Update Required</span>
                    To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
                  </div>
                </div>
                <div style="clear:both;"></div>
              </div>
    		      <!--- Player End --->
            </div>
          </div>
            
          <div class="top_element" style="height: 10px;"></div>      
        </div>
    
        <script type="text/javascript">
          var isPaused = 0;
          var loopType = 'none';
          var lastSong = -1;
          var playlist = new Array("<?php echo $songs; ?>");
    
    $db = new mysqli(HOST.COM,USER,PASS,StreamIT); // use your credentials
    $sql = "SELECT Songs FROM Main";
    $playlist = array();
    $res = $db->query($sql);
    while ($row = $res->fetch_assoc()) {
        $playlist[] = $row['Songs'];
    }
    $songs = join('","', $playlist);
    ?>
    
    
    //      var playlist = new Array();
    //          playlist[0] = 'Avicii - Levels';
    //          playlist[1] = 'Flo Rida - Good Feeling';
    //          playlist[2] = 'H3Ctic - Far away';
    //          playlist[3] = 'Hans Zimmer - Time';
    //          playlist[4] = 'Lana Del Rey - Summertime Sadness';
    //          playlist[5] = 'M4sonic - Weapon';
    //          playlist[6] = 'Extan - New World (feat. RomyHarmony)';
    //          playlist[7] = 'Nicki Minaj - Five-O';
    //          playlist[8] = 'Beautiful Sinner';
    //          playlist[9] = 'Cockiness';
    //          playlist[10] = 'Skrillex - Dirty Vibe';
    
          $(document).ready(function(){        
            $('.player_button').on({
              mouseenter: function() {
                $(this).addClass('player_button_hover');//.addClass($(this).attr('id')+'_hover');
              }, mouseleave: function() {
                $(this).removeClass('player_button_hover');//.removeClass($(this).attr('id')+'_hover');
              }
            });       
                    
            $(document).bind('contextmenu', function(e){
              //return false;
            });
            
            $('.top_element span> a').each(function(index, link){
              $(this).click(function(){
                //alert('You clicked "'+$(this).text()+'".');
                return false;
              });
            });
            
            createPlaylist();
          });
          
          function hideLoader() {
            $('.frame_loader').hide();
          }
          
          function loadPage(t) {
            if($('#main_frame').attr('src') != t.href) {
              $('.frame_loader').show();
              $('#main_frame').attr('src', t.href);
            }     
          }
          
          function createPlaylist() {
            for(i=0; i<playlist.length; i++) {
              $('#playlist_items').append('<div class="playlist_item" id="playlist_item_'+i+'"> - <span onClick="playThis(\''+playlist[i]+'\');">'+playlist[i]+'</span></div>');
            }
          }
          
          function reloadThis() {
            window.location.href = window.location.href.split('#')[0];
          }
              
          function playSong() {
            isPaused = 0;
            $('#inzernet_player').jPlayer('play');
          }
              
          function pauseSong() {
            isPaused = 1;
            $('#inzernet_player').jPlayer('pause');
          }
              
          function loop() {   
            if(loopType == 'all') {
              $('.loop').removeClass('loop_single').removeClass('loop_all');
              loopType = 'none';
            } else if(loopType == 'none') {
              $('.loop').addClass('loop_single').removeClass('loop_all');
              loopType = 'single';
            } else if(loopType == 'single') {
              $('.loop').removeClass('loop_single').addClass('loop_all');
              loopType = 'all';
            }
          }
              
          function playNext(type){          
            if(lastSong < 0){ //### No song has been played, we don't know what "next" is
              return;
            }
                
            //### Check to see if we are looping a single song
            if(loopType == 'single') {
              setTimeout(function(){ playThis(playlist[lastSong]); }, 100);
              return;
            }
                
            //### Stop the player, to stop the cross over of 2 songs
            $('#inzernet_player').jPlayer('stop');
               
            //### Now we work out which song to play next
            if(lastSong >= playlist.length) {
              setTimeout(function(){ playThis(playlist[0]); }, 100);
            } else {
              if(lastSong+1 >= playlist.length) { //### Check if the next song is the start of the playlist
                if(type == 'loop') { //### Looper function is triggered
                  if(loopType == 'all') { //### Check to see if looped is true
                    lastSong = 0;
                  } else { //### Looped isn't true, don't play first
                    return;
                  }
                } else { //### Button pressed so go back to the start
                  lastSong = 0;
                }
              } else { //### Not the end of the playlist, play next
                lastSong+=1;
              }
              setTimeout(function(){ playThis(playlist[lastSong]); }, 100);
            }
                
            //### Show "loading" while we wait for the next song to be set
            $('#current_song').text('Loading...');
          }
              
          function playPrevious(){
            if(lastSong < 0) { //### No song has been played, we don't know what "previous" is
              return;
            }
                
            //### Stop the player, to stop the cross over of 2 songs
            $('#inzernet_player').jPlayer('stop');
               
            //### Now we work out which song to play next
            if(lastSong == 0) {
              setTimeout(function(){ playThis(playlist[(playlist.length-1)]); }, 100);
            } else {
              lastSong = (lastSong-1 < 0) ? playlist.length-1 : lastSong-=1;
              setTimeout(function(){ playThis(playlist[lastSong]); }, 100);
            }
                
            //### Show "loading" while we wait for the next song to be set
            $('#current_song').text('Loading...');
          }
              
          function playThis(songTitle){
            var musicFile = '<?PHP echo $settings['base_path'];?>media/music/'+songTitle+'.mp3';
                lastSong  = include(playlist, songTitle);
                   
            $('.playlist_item').removeClass('playing');
            $('#playlist_item_'+lastSong).addClass('playing');
                
            $('#current_song').text(songTitle);
             
            $('#inzernet_player').jPlayer("setMedia", {                  
              mp3:musicFile
            });
                
            if(isPaused != 1) {
              $('#inzernet_player').jPlayer('play');
            }
          }
              
          function include(arr, obj) {
            for(var i=0; i<arr.length; i++) {
              if (arr[i] == obj) return i;
            }
          }
        </script>
        
      </body>
    </html>
    

    It just shows up blank

  11. Hi,

     

    So I have an array 

    var playlist = new Array();
    

    And in it I have songs as so:

    playlist[0] = 'Avicii - Levels';
              playlist[1] = 'Song';
              playlist[2] = 'Song';
              playlist[3] = 'Song';
              playlist[4] = 'Song';
              playlist[5] = 'Song';
              playlist[6] = 'Song';
              playlist[7] = 'Song';
              playlist[8] = 'Song';
              playlist[9] = 'Song';
              playlist[10] = 'Song';
    

    Now I'm not an expert at MySQL so I was wondering if there would be an easier way to do this with MySQL instead if adding playlist[number] = 'Song"; after every line. It would search the MySQL database for a column named songs and it would automatically put them into the array 'playlist'. Also code examples or a finished product would be VERY helpful!

     

    Thanks

  12. Okay so what is supposed to happen is that whatever the user selects in the listbox the song is supposed to then play, but I cannot even get that far because I get an error.

    <!DOCTYPE html>
    <html>
    <head><title>Test Music App/title></head>
    <body>
    
    <select name="Songs" multiple="multiple" onchange="playsong($song)">
        <option>Nicki Minaj - Five-O.mp3</option>
        <option>text2</option>
        <option>text3</option>
        <option>text4</option>
        <option>text5</option>
     </select>
    <?php>
    function playsong($song);
    {
    <audio controls>
      <source src="http://www.inzernettechnologies.com/StreamIT/media/music/$song.mp3" type="audio/mpeg">
      <embed height="150" width="400" src="http://www.inzernettechnologies.com/StreamIT/media/music/$song.mp3">
    </audio>
    }
    ?>
    
    </body>
    </html>
    
  13. You're going to have to be much more specific. Is it an image? If so, just echo the path in an <img src="">

     

    The second question...is not specific at all. What is Item supposed to be?

    No it is not an image. It is a list of items. The item is song names like:

     

    Hello

    Brainless

     

    and so on. It is the user's favorite songs

  14. I need something to be uploaded and then echoed. Could it be in like a textbox or something?

     

    I have been trying for like 2 days now, but I can't figure it out. Also for MySQL what would be good for holding information like this:

    Item1
    Item2
    Item3
    

    And so on.

     

    Thanks for any help :)

  15. So I have this code in my members only page.

    <?PHP
    
      //### Start the session
      session_start();
      
      //### If the user is not logged in, then we re-direct them to log in
      if(!isset($_SESSION['inzernet_user'])) {
        header('Location: /login.php');
        exit;
      }
      
      //### Check if the user wants to log out
      if(isset($_GET['action']) && $_GET['action'] == 'logout') {
        session_destroy();
        session_start();
        header('Location: /login.php'); exit;
      }
      
      //### Include database connection file
      include('functions/m_connect.php');
      
      //### Select user information from database
      $selectUserQuery = "SELECT `username` FROM `user_accounts` WHERE `id` = '{$_SESSION['inzernet_user']}'";
      $selectUser      = mysqli_query($mysqli, $selectUserQuery);
      
      //### Assign user data to variable
      $user = mysqli_fetch_assoc($selectUser);
      
    ?>
    
    Hello <?PHP echo $user['username'];?>! <a href="?action=logout">Log out?</a>
    

    I want it to display the username and password and other fields I tried adding:

    echo $user['password'];
    

    But that did not work.

     

    Thanks!

  16. What have you tried so far? No one is going to sit here and write it completely. The best you'll get is a template. Here's a thing to consider:

     

    20000 bytes is 0.02MB (give or take). That will deny most if not all music files.

    It was a test file I didnt want to upload a file that was 10MB for the sake of time. I am a newbie at this so I don't know where to start.

  17. Hi all once again! I would just like to say this forum is amazing!  :happy-04:

     

    I need to upload a file to my server in /StreamIT/media/music

    And in the page where you select the file I need there to be some boxes you need to fill in

    Song:

    Artist:

    Album:

    Category [This needs to be dropdown box]

    Is it clean? [A yes/no type thing]

     

    This needs to be on one page and I need it too add those fillouts to a MYSQL database

     

    I also need a php script to get all the fields from the MYSQL database

     

     

    The code I have so far: [Does not work]

     

    upload_file.php

    <?php
    $allowedExts = array("mp3");
    $temp = explode(".", $_FILES["file"]["name"]);
    $extension = end($temp);
    if ((($_FILES["file"]["type"] == "mp3")
    && ($_FILES["file"]["size"] < 20000)
    && in_array($extension, $allowedExts))
      {
      if ($_FILES["file"]["error"] > 0)
        {
        echo "Return Code: " . $_FILES["file"]["error"] . "<br>";
        }
      else
        {
        echo "Upload: " . $_FILES["file"]["name"] . "<br>";
        echo "Type: " . $_FILES["file"]["type"] . "<br>";
        echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
        echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br>";
    
        if (file_exists("music/" . $_FILES["file"]["name"]))
          {
          echo $_FILES["file"]["name"] . " already exists. ";
          }
        else
          {
          move_uploaded_file($_FILES["file"]["tmp_name"],
          "upload/" . $_FILES["file"]["name"]);
          echo "Stored in: " . "music/" . $_FILES["file"]["name"];
          }
        }
      }
    else
      {
      echo "Invalid file";
      }
    ?>
    

    And uploadm.php [Works]

    <html>
    <body>
    
    <form action="upload_file.php" method="post"
    enctype="multipart/form-data">
    <label for="file">Filename:</label>
    <input type="file" name="file" id="file"><br>
    <input type="submit" name="submit" value="Submit">
    </form>
    
    </body>
    </html>
    

    I know I am asking a lot. Thank you guys!

  18.  

    I'm happy to hear that, to get the other fields in th DB we use mysql_fetch_assoc()

     

    Add these lines in checklogin.php

    // If result matched $myusername and $mypassword, table row must be 1 row
    if($count==1){
    
    // Fetch the result to get the users information
    $userInfo = mysql_fetch_assoc($result);
    
    // Register $myusername, $mypassword and redirect to file "login_success.php"
    $_SESSION['email'] = $userInfo['email'];
    // and so on ...
    $_SESSION['myusername'] = $myusername;
    $_SESSION['mypassword'] = $mypassword;
    header("location:login_success.php");
    }
    

    Remember that the index email in $userInfo is a the field name from the table  Login, so now you may replace

    $_SESSION['myusername'] = $myusername;
    $_SESSION['mypassword'] = $mypassword;
    

    With

    $_SESSION['myusername'] = $userInfo['username'];
    $_SESSION['mypassword'] = $userInfo['password'];
    

    I figured it out you need to have " instead of ' for $userInfo['password']

    Thank you so much!

  19.  

    I'm happy to hear that, to get the other fields in th DB we use mysql_fetch_assoc()

     

    Add these lines in checklogin.php

    // If result matched $myusername and $mypassword, table row must be 1 row
    if($count==1){
    
    // Fetch the result to get the users information
    $userInfo = mysql_fetch_assoc($result);
    
    // Register $myusername, $mypassword and redirect to file "login_success.php"
    $_SESSION['email'] = $userInfo['email'];
    // and so on ...
    $_SESSION['myusername'] = $myusername;
    $_SESSION['mypassword'] = $mypassword;
    header("location:login_success.php");
    }
    

    Remember that the index email in $userInfo is a the field name from the table  Login, so now you may replace

    $_SESSION['myusername'] = $myusername;
    $_SESSION['mypassword'] = $mypassword;
    

    With

    $_SESSION['myusername'] = $userInfo['username'];
    $_SESSION['mypassword'] = $userInfo['password'];
    

    I did what you suggested and it did not work

    here is the code for checklogin.php

    <?php
    session_start();
    $host="host"; // Host name
    $username="user"; // Mysql username
    $password="pass"; // Mysql password
    $db_name="main13"; // Database name
    $tbl_name="Login"; // Table name
    
    // Connect to server and select databse.
    mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
    mysql_select_db("$db_name")or die("cannot select DB");
    
    // username and password sent from form 
    $myusername=$_POST['myusername'];
    $mypassword=$_POST['mypassword']; 
    
    // To protect MySQL injection (more detail about MySQL injection)
    $myusername = stripslashes($myusername);
    $mypassword = stripslashes($mypassword);
    $myusername = mysql_real_escape_string($myusername);
    $mypassword = mysql_real_escape_string($mypassword);
    $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
    $result=mysql_query($sql);
    
    // Mysql_num_row is counting table row
    $count=mysql_num_rows($result);
    
    // If result matched $myusername and $mypassword, table row must be 1 row
    // If result matched $myusername and $mypassword, table row must be 1 row
    if($count==1){
    
    // Fetch the result to get the users information
    $userInfo = mysql_fetch_assoc($result);
    
    // Register $myusername, $mypassword and redirect to file "login_success.php"
    $_SESSION['email'] = $userInfo['e-mail'];
    // and so on ...
    $_SESSION['myusername'] = $myusername;
    $_SESSION['mypassword'] = $mypassword;
    header("location:login_success.php");
    }
    else {
    echo "Wrong Username or Password";
    sleep(2);
    header("location:main_login.php");
    }
    ?> 

    and for login_success.php

    <?php
    session_start();
    if(!isset($_SESSION['myusername']) || !isset($_SESSION['mypassword'])) {
         header("location:main_login.php");
    }
    ?>
    
    <html>
    <body>
    Login Successful <br />
    Your username is : <?php echo $_SESSION["myusername"]."<br />"; ?>
    Your email is : <?php echo $_SESSION["email"]."<br />"; ?>
    </body>
    </html>
    

    It does not display the username or email. It dosent even get to that part. I also tried replacing

    $_SESSION['myusername'] = $myusername;
    $_SESSION['mypassword'] = $mypassword; 

    With

    $_SESSION['myusername'] = $userInfo['username'];
    $_SESSION['mypassword'] = $userInfo['password'];
    

    This just cleared the fields. I am pretty sure it didn't get the data from the table

  20. Hi jubba890,

     

    I made a mistake in checklogin.php, add session start at line two

    <?php
    session_start();
    $host="host"; // Host name
    ...... 
    ?>
    

    And in checklogin.php change

    $_SESSION['myusername'] = $_POST['myusername'];
    $_SESSION['mypassword'] = $_POST['mypassword'];
    

    To

    $_SESSION['myusername'] = $myusername;
    $_SESSION['mypassword'] = $mypassword;
    

    I copied your code, made these changes and worked !, if you have any other problem please post it.

    It worked perfectly! How would I get the value for other things like their first name and e-mail. I think I got how to display it on login_success.php

  21. Well, clearing a table fiedls has something to do with an update code maybe in other page, review your code again, explain more.

     

    did login_successful.php print the users name ?

     

    After displaying the Login Successful message, what page is requested, can you paste the code ???

    login_success.php did not even get displayed

     

    Here is the code:

     

    checklogin.php

    <?php
    
    $host="host"; // Host name
    $username="user"; // Mysql username
    $password="pass"; // Mysql password
    $db_name="main13"; // Database name
    $tbl_name="Login"; // Table name
    
    // Connect to server and select databse.
    mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
    mysql_select_db("$db_name")or die("cannot select DB");
    
    // username and password sent from form 
    $myusername=$_POST['myusername'];
    $mypassword=$_POST['mypassword']; 
    
    // To protect MySQL injection (more detail about MySQL injection)
    $myusername = stripslashes($myusername);
    $mypassword = stripslashes($mypassword);
    $myusername = mysql_real_escape_string($myusername);
    $mypassword = mysql_real_escape_string($mypassword);
    $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
    $result=mysql_query($sql);
    
    // Mysql_num_row is counting table row
    $count=mysql_num_rows($result);
    
    // If result matched $myusername and $mypassword, table row must be 1 row
    if($count==1){
    
    // Register $myusername, $mypassword and redirect to file "login_success.php"
    $_SESSION['myusername'] = $_POST['myusername'];
    $_SESSION['mypassword'] = $_POST['mypassword'];
    header("location:login_success.php");
    }
    else {
    echo "Wrong Username or Password";
    sleep(2);
    header("location:main_login.php");
    }
    ?>
    

    login_success.php

    <?php
    session_start();
    // Comment this part
    // if(!session_is_registered(myusername)){
    // header("location:main_login.php");
    // }
    // Try this 
    if(!isset($_SESSION['myusername']) || !isset($_SESSION['mypassword'])) {
         header("location:main_login.php");
    }
    ?>
    
    <html>
    <body>
    Login Successful <br />
    Your username is : <?php echo $_SESSION["myusername"]."<br />"; ?>
    </body>
    </html>
    
×
×
  • 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.