Jump to content

Brian W

Members
  • Posts

    867
  • Joined

  • Last visited

Posts posted by Brian W

  1. do you have error reporting on in your INI?

    if not, add this to the top:

    <?php error_reporting(E_ALL); ?>

    This ran by itself should not work because $result doesn't exist...

    <?php    
    echo "<table align=\"left\" border=\"1\" cellspacing=\"0\" cellpadding=\"3\">\n";
       echo "<tr><td><font size=\"2\">\n";
       for($i=0; $i<$num_rows; $i++){
          $uname = mysql_result($result,$i,"username");
    
          echo "<a href=\"userinfo.php?user=$uname\">$uname</a> / ";
       }
       echo "</font></td></tr></table><br>\n"; 
       ?>

  2. <?php
    session_start();
    include "db_connect.php";
    
    if($_SESSION['id'])
    {
       $sql = "SELECT username FROM `users` WHERE `id`='".$_SESSION['id']."'";
       $res = mysql_query($sql) or die(mysql_error());
       
       if(mysql_num_rows($res) != 1)
       {
          session_destroy();
          echo "<script language=\"Javascript\" type=\"text/javascript\">document.location.href='login.php'</script>";
       }
       else
       {
       $row = mysql_fetch_assoc($res);
       
       $title = protect($_POST['title']);
       
       if(!$title)
       {
          echo "<script language=\"Javascript\" type=\"text/javascript\">
                alert(\"You must choose a title for your music!\")
                document.location.href='editmusic.php'</script>";
          
       }
       
       $target = $row['username'];
       if(!is_dir($target)) @mkdir($target);
       $target = $target . '/music';
       
       if(!is_dir($target)) @mkdir($target);
       
          $target = $target."/".basename($_FILES['music']['name']) ;
          $size = $_FILES['music']['size'];
          $music = $_FILES['music']['name'];
          $type = $_FILES['music']['type'];
          $max_file_size=10485760;
    
    if($size > $max_file_size){   
    	echo "<script language=\"Javascript\" type=\"text/javascript\">
              alert(\"You may not upload files over 10mb\")
              document.location.href='editmusic.php'</script>";
    } else {   
          if($type == "audio/mpeg" || $type == "audio/x-wav" || $type == "audio/x-ms-wma" || $type == "audio/mp3" || $type == "audio/mpeg3")
          {
                
             $sql2= "INSERT INTO `user_music` (`profile_id`,`title`,`size`,`type`,`reference`)
             VALUES ('".$_SESSION['id']."','$title','$size','$type','$music'); ";
             
             move_uploaded_file($_FILES['music']['tmp_name'], $target);
             $res2 = mysql_query($sql2) or die(mysql_error());
             
                   echo "<script language=\"Javascript\" type=\"text/javascript\">
                   alert(\"Your Music has been uploaded\")
                   document.location.href='editmusic.php'</script>";
                   }
          else
                {
                   echo "<script language=\"Javascript\" type=\"text/javascript\">
                   alert(\"Wrong file format. Please upload only .mp3, .wav or .wma files\")
                   document.location.href='editmusic.php'</script>";
                }
            }
    }
    }
    else echo "<script language=\"Javascript\" type=\"text/javascript\">document.location.href='login.php'</script>";
    
    ?>

  3. Short tags are bad practice for a couple of reasons. Serious application developers recommend not using short tags, which was good enough for me, they know what they are doing.

    <?php
    include("../include/session.php");
    
    if(!$session->isAdmin()){
       header("Location: ../index.php");
    }
    else{
    ?>
    
    <title>MyVee! User Online</title>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <link href="../Style4.css" rel="stylesheet" type="text/css">
    <div id="wrapper">
    <div id="Layer4">
      <div style="color:WHITE;">
    <script type="text/javascript">
    var d=new Date()
    var weekday=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
    var monthname=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
    document.write(weekday[d.getDay()] + " ")
    document.write(d.getDate() + ". ")
    document.write(monthname[d.getMonth()] + " ")
    document.write(d.getFullYear())
    </script>
    </div></div>
    <div id="Layer2"></div>
    <div id="Layer1"></div>
    <div id="Layer3">
      <p>[ <a href="http://www.myvee.co.uk">Back</a> ]<br>
      <p>
      <?php
    include("../include/view_active_admin.php");
    ?>
      </html>
    </div>
    </div>
    <?php } ?>

    If you try that and you are still getting the error, the problem is in one of your include files.

  4. oh, I see what you are talking about. Well, there isn't a good way of doing this without using JavaScript.

    Your going to need to grab the input values from your main form and place em in some hidden fields in the add form. One hidden field foreach input in the other form. Then, when they submit the add from, the values of the other from will be in the query string where then you can use em like $_GET['temp_name'] or something like that.

  5. the $_SESSION array is pulled from a temporary file on the server in which can only be modified by applications on the server. If someone can use an external program to modify the sessions, then you have larger issues. If your on a shared host, I'm not 100% sure that the sessions are safe from someone on the same server grabbing em.

  6. echo'<P>JOB ID:</P>' . $data['job_id'];
    echo'<P> JOB NAME:</P>' . $data['job_name'];

     

    You had a semi-colon after the echo statement, instead use a period for concatenation and it should work for you.

    This is true of all of them... you need to combine the strings using a dot, not a semicolen. But you will need to end those lines with a semi colen. Use the example from cobalt-rose

  7. line 60, its fubar

    I think you intended

    $query = $db->execute("select `id`, `username`, `level`, `money` from `players` order by `level` desc limit 50");

    but you are still missing the last_active field in your list.... you need:

    $query = $db->execute("select `id`, `username`, `level`, `money`, `last_active` from `players` order by `level` desc limit 50");

  8. go ahead and get rid of this

    $query = "SELECT * FROM players";
    $result = mysql_query($query) OR die(mysql_error());
    while ($row = mysql_fetch_assoc($result)) 
    {
       $lastactive = $row['last_active'];
    }

    change the other query to:

    "select `id`, `username`, `level`, `money`, `last_active` from `players` order by `level` desc limit 50"

    (Added last_active to field list)

    See if that works

  9. if you use the code tags around your php or even html snipits, you will likely get more help

    [ code ]Like this but without the spaces in the tags[ /code ]

    would be

    Like this but without the spaces in the tags

     

    In what way did it not work? Did it give you an error or did you simply not get the results you expected?

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