Jump to content

audiokiwi

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Posts posted by audiokiwi

  1. From http://www.php.net/manual/en/language.types.string.php

    It is very important to note that the line with the closing identifier contains no other characters, except possibly a semicolon (;). That means especially that the identifier may not be indented, and there may not be any spaces or tabs after or before the semicolon. It's also important to realize that the first character before the closing identifier must be a newline as defined by your operating system. This is \r on Macintosh for example. Closing delimiter (possibly followed by a semicolon) must be followed by a newline too.

     

    If this rule is broken and the closing identifier is not "clean" then it's not considered to be a closing identifier and PHP will continue looking for one. If in this case a proper closing identifier is not found then a parse error will result with the line number being at the end of the script.

  2. There's a way to build extensions without recompiling PHP (unless you compiled it statically). To install 3rd-party extentions, go to the folder where you extracted the source. Run phpize, then ./configure, then make, and finally make install. (You need the php5-devel or similar package installled on Fedora) For a extension that comes with php (e.g. curl), then download the source, and then go to the folder of the extension (e.g. php-5.2.3/ext/curl) and run the commands above.

  3. First off, check to make sure you didn't misspell anything.

     

    From the PHP Manual

    The mime type of the file, if the browser provided this information. An example would be "image/gif". This mime type is however not checked on the PHP side and therefore don't take its value for granted.

     

    This means that the browser send the type. Some browsers don't send them. Try using a different browser.

     

    Type will be empty if there is an error uploading the file. Check the value of $_FILES['X']['error'] to make sure that everything is all good. See http://www.php.net/manual/en/features.file-upload.errors.php if there is an error.

     

    If none of the above, you'll need to post your code here so we can see it.

  4. Try this:

     

        function __construct($user = 'user, $password='pass', $database = 'data', $server = 'localhost')

        { //after loading default settings for database connection connect to server and

          // attach to database.

    @mysql_connect($server ,

    $user,$pass) or

    die( "unable to connect to database");

        @mysql_select_db($database) or die( "Unable to select database");

     

    The whole $parameters array is redundant. You are using it to store default variables, but adding default values to the constructor works better.

    You can't do this by making the array public, because when you initialize the class, it is already connected.

     

    i.e.:

     

    $db = new dbtools(); // The database is already connected. Changing the array does nothing now

    $db->parameters['username'] = "New User"

     

     

  5. <?php 
    include "connect.php";
        if($_REQUEST['submit']){
            if(trim($_REQUEST['name'])){
                $name = $_REQUEST['name'];
            }
            else {
                $error[] = 'Please enter an Album Name';
            }
            $artist = $_REQUEST['artist'];
            $genre = $_REQUEST['genre'];
            $rating = $_REQUEST['rating'];
            if(trim($_REQUEST['songs'])){
                $name = $_REQUEST['songs'];
            }
            else {
                $error[] = 'Please enter at least one song';
            }
            $songs = explode("\n",$_REQUEST['songs']);
            $serial = serialize($songs);
        }
        if(!$_REQUEST['sumbit'] || $error){
            if ($error){foreach ($error as $c){
            $str.= "<div style='background:#FF9999;padding:2px;margin:2px;'>$c</div>\n";
            }}
            $str .= "<form action='insertAlbum.php' method='post'><p>Album Artist: \n";
            $str .= "<select id='artist'>\n";
            $str .= "<option value='0'>Various Artists</option>\n";
            $result = $dbr->query("SELECT * FROM music_artists");
            while($row = $result->fetch_assoc())
            {
                $str .= "<option value='{$row['id']}'>{$row['name']}</option>\n";
            }
            $str .="</select>\n";
            $str .= "<br />Album Name: <input id='name' type='text' /><br />\n";
            $str .= "Genre: <select id='genre'\n>";
            $str .= "<option value='0'>None</option>\n";
            $result = $dbr->query("SELECT * FROM music_genres");
            while($row = $result->fetch_assoc())
            {
                $str .= "<option value='{$row['id']}'>{$row['name']}</option>\n";
            }
            $str .= "</select>";
            $str .= "<br />Rating: <select id='rating'>\n<option value='0.5'>0.5</option>\n<option value='1.0'>1.0</option>\n<option value='1.5'>1.5</option>\n<option value='2.0'>2.0</option>\n<option value='2.5'>2.5</option\n><option value='3.0'>3.0</option>\n<option value='3.5'>3.5</option>\n<option value='4.0'>4.0</option>\n<option value='4.5'>4.5</option>\n<option value='5.0'>5.0</option>\n</select><br />\nSong Names (One Name Per Line):<br />\n<textarea cols='40' rows='20' id='songs'></textarea><br />\n<input type='submit' id='submit' value='Submit' />\n";
            $str .= '</p></form>';
        }
    
    include "user.php";
    include "template.php";
    $section="main";
    $page= new Template("Music",TRUE);
    $page->pr_logo();
    $page->pr_leftnav();
    $page->pr_content(FALSE);
    $page->pr_entry("Add an Album",$str);
    $page->pr_content(TRUE);
    $page->pr_footer();
    ?>
    
    template.php:
    
    <?php
    class Template{
        public $xmlhtmlmode='text';
        function __construct($title,$validate = TRUE,$skipa=FALSE)
        {
            $doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">';
            $scs = "lang='eng' ";
            if($validate){   
                if (stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") || stristr($_SERVER['HTTP_USER_AGENT'],"W3C") ){
                    //header("Content-type: application/xhtml+xml");
                    $doctype = "\n" . '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">';
                    $scs = "";
                    $this->xmlhtmlmode = 'app';
                }
            }
            if (!$skipa)$title .= " | Audio Kiwi: Music and You";
            echo "$doctype\n<html xmlns='http://www.w3.org/1999/xhtml' {$scs}xml:lang='eng'>\n    <head>\n        <link rel='stylesheet' href='/style.css' />\n        <link rel='openid.server' href='http://www.myopenid.com/server' />\n        <link rel='openid.delegate' href='http://audiokiwi.myopenid.com' />\n        <title>$title</title>\n    </head>\n";
        }
        function pr_logo()
        {
            echo "    <body>\n        <div id='container'>\n            <div id='top'>\n                <img src='/images/logo.png' id='logo' alt='AudioKiwi | Music and You' />\n            </div>";
        }
        function pr_leftnav($sectionc=FALSE)
        {
            if (!$sectionc) global $section;
            else $section=$sectionc;
            echo "            <div id='bbg'>\n                <div id='leftnav'>\n                    <h2>Audio Kiwi</h2>\n                    <ul>\n";
            if ($section!="main") echo "                        <li><a href='/'>Home</a></li>\n";
            else echo "                     <li><span class='currse'>Home</span></li>\n";
            if ($section!="music") echo "                     <li><a href='/music'>Music</a></li>\n";
            else echo "                     <li><span class='currse'>Music</span></li>\n";
            if ($section!="blog") echo "                     <li><a href='/blog'>My Ramblings</a></li>\n";
            else echo "                     <li><span class='currse'>My Ramblings</span></li>\n";
                        echo "                  </ul>\n                    \n                </div>";    
        }
        function pr_content($end,$older=NULL,$newer=NULL)
        {
            if (!$end) echo "\n                <div id='content'>";
            else {      echo "                      <p class='pagenav'>";
            if ($older) {echo "<a href='$older'>Older entries</a>";}
            else {echo "Older Entries";}
            echo " | "; 
            if ($newer) {echo "<a href='$newer'>Newer entries</a>";}
            else {echo "Newer Entries";}
            echo "</p>\n                 </div>";}
        }
        function pr_entry($heading,$contents,$url="")
        {
            echo "\n                  <div class='entry'>\n                      <h2><a href='$url'>$heading</a></h2>\n$contents\n                  </div>";
        }
        function pr_footer(){
            echo "<div id='footer'>
    <h2 class='hide'>Site info</h2>
    <span>Audio Kiwi</span><br/>
    © ", @date("Y"), " Micah Makaiwi | Design by <a href='http://andreasviklund.com'>Andreas Viklund</a> | Valid: <a href='http://validator.w3.org/check?uri=referer'>XHTML 1.1</a> / <a href='http://jigsaw.w3.org/css-validator/check/referer'>CSS</a> / <a href='http://checker.atrc.utoronto.ca/servlet/Checkacc?file=http%3A%2F%2Faudiokiwi.blogdns.com",$_SERVER['REQUEST_URI'] ,"'>WCAG 2</a> / AA / 508
    </div>
    </div>
    </div>
    
    </body>
    </html>";
        }
    }
    ?>
    

  6. I have a form at the page http://audiokiwi.com/insertAlbum.php. No matter if the form is set to GET or POST, neither gets submitted (Under Firefox, IE, or Opera).

     

    Here is the output of LiveHTTPHeaders for POST:

    Sent:

    POST /insertAlbum.php HTTP/1.1

    Host: audiokiwi.com

    User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.4) Gecko/20070529 SUSE/2.0.0.4-8.1 Firefox/2.0.0.4

    Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5

    Accept-Language: en-us,en;q=0.5

    Accept-Encoding: gzip,deflate

    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

    Keep-Alive: 300

    Connection: keep-alive

    Referer: http://audiokiwi.com/insertAlbum.php

    Content-Type: application/x-www-form-urlencoded

    Content-Length: 0

     

    Recieved

    HTTP/1.x 200 OK

    Date: Wed, 20 Jun 2007 21:26:40 GMT

    Server: Apache/2.2.3 (Linux/SUSE)

    X-Powered-By: PHP/5.2.0

    Content-Length: 2838

    Keep-Alive: timeout=15, max=99

    Connection: Keep-Alive

    Content-Type: text/html; charset=iso-8859-1

     

    The values of $_REQUEST $_POST and $_GET are all empty arrays.

     

    Does anyone know what's going on?

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