Jump to content

rubing

Members
  • Posts

    366
  • Joined

  • Last visited

    Never

Posts posted by rubing

  1. Yes I meant i wanted php as the backend.  Basically i need my mp3 player to query the php page, which will then return the url of the song to play.

     

    still not sure where to get started.  i am using soundmanager 2 as my mp3 player, which is a javascript interface to flash.  do i have to incorporate this functionality to the player itself?

     

    maybe i should just learn flash?  can't flash query my php page directly and then play the resulting url.  sorry i now realize this is not an explicit php question and maybe should've been posted in another forum.

     

     

  2. Hey fellow phpers,

     

    I am hoping someone can advise me on an application i am trying to build.  Let me try explaining this as clearly as possible:

     

    I have a page with a list of items (songs) each linked to a php page.  The client requests one of these items and the php script determines the appropriate item to return (correct version of the song to play) for this user.  The item is served (song is played) asynchronously. 

     

     

    Maybe this is something I should be doing with Flash??  or Ajax??

     

    thanks for any advice!!!!

  3. I am trying to code a script that stops running when there are no results found in my table.  When i run this it says that the result set is 0, but it keeps executing.

     

     

                            $count =1;
    		while ($count=1)
    			{
    		 	$api=mt_rand(10000000,99999999);
    			$query="SELECT * FROM api WHERE api=".$api."";
    			if ($results=$conn->query($query))
    				{
    				$row_cnt = $results->num_rows;
    				printf("Result set has %d rows.\n", $row_cnt);
    				if($row_cnt==0)
    				    {
    				           $count=0;
    				    }
    				$results->close();
    				}

  4. i'm not trying to hack my way to a solution.  I am trying to learn something about coding php and taking advantage of its built-in functions.

     

    Maybe, I'm not doing something right, maybe there's something that can be done with the optional flags.  I don't ven know what there there for or how to set them.  I find that gap in my knowledge disturbing and so am asking for help.

     

    now, i just found out that the Validate url filter is no different than the parse_url function.

  5. I need to validate a URL coming from a form (method=post),  so I am using the following code:

     

    $validurl=filter_input(INPUT_POST,'website', FILTER_VALIDATE_URL);
    
               if ($validurl ===FALSE)
    		{
    			throw new InvalidInputException();
    		}

     

    It doesn't do as good of a job as I'd expect.  (i know, i know, i could use pear RFC validation, blah blah blah...), If I pass in something like xkjvi://mymamma.comlhj , it is accepted without a problem.  

     

    the documenation says that the following optional flags:  

     

    FILTER_FLAG_PATH_REQUIRED & FILTER_FLAG_QUERY_REQUIRED

     

    ,but im not sure what they do or how i would set them, since the manual just says:

     

    Associative array of options or bitwise disjunction of flags. If filter accepts options, flags can be provided in "flags" field of array.

     

    And I have no idea what that means

  6. hey php crew,

     

    Several months ago I was on the planet-php.net site, a great collection of php blogs  (in case you didn't know).  And saw a really cool php project, which was basically an alternative to a full blown LAMP, but nonetheless would interpret and let you view your php code as a web page.  For the life of me I can't remember what this project was called and now I can't find it anywhere.  Does anyone know what i am talking about??

  7. sorry thorpe.  yes i am just looking to extract the url from the line of interest.  I think I can work with what you wrote here. 

     

    using sed is also seems a good idea, but would prefer quick and dirty since i've been told it has a steep learning curve.

     

    thx all!

  8. I am using grep to try and find a url in a text file.  typically i only know a single pattern in the url (e.g. 'tresure.com')

     

     

    So, Grep does a  great job of finding the line which contains the pattern (e.g.  'come to our site: www.buried-treasure.com')  However, I would like to extract/parse just the url. from this line, that grep is detecting.

  9. OK, so I changed it as follows:

    ini_set ('upload_max_filesize','25M');
    ini_set('post_max_size','25M');

     

    Yet, this still doesn't work! (only on smaller files)  here are the errors i get:

    Array ( [uploadedfile] => Array ( [name] => 01-Kushee Maanao-Aural Mix-Solace.mp3 [type] => [tmp_name] => [error] => 1 => 0 ) )

     

     

     

  10. I am trying to upload files to my server (shared hosting).  The size limit for uploaded files is 2M (default).  Well, of course I am super greedy and want to upload HUGE files!!!  

     

    so, I tried amending the max size permitted as follows:

    ini_set ('upload_max_filesize','25M');

     

    Yet this has no effect.  Any suggestions?

     

     

  11. I use the improved mysql functions to escape my data prior to insertion (e.g. mysqli_real_escape_string), so a subtle question arises.

     

    Do I query as follows:

     

    $query="SELECT cola FROM table.a WHERE colb='$var'";
    $conn->query($query);
    

     

    Or like this:

    $var = $mysqli->real_escape_string($var);
    $query="SELECT cola FROM table.a WHERE colb='$var'";
    $conn->query($query);
    

     

  12. OK, so I changed my code to the following:

     

    $handle=fopen($mp3,'a');
    fseek($handle,200000);
    ftruncate($handle,260000);

     

    Yet this still truncates the file from the beginning till the 260000 byte.  I thought specifying the file pointer with fseek would start the truncate in the middle of the file.  Is there a way to do this in php without using some foreign class?

  13. hey all,

     

    i want to pass a url as the parameter in a $_GET variable (e.g)

     

    http://www.example.com/pass.php?id=7&limit=1&url=http://www.doesntwork.com/howtofix.php?works=yes&lastchar=broke

     

    These $_GET varialbles will be truncated.  The variable: 

    http://www.doesntwork.com/howtofix.php?works=yes&lastchar=broke

     

    has an '&' character which is interrupreted instead of being included.

     

    Basically I am asking, how do you escape the '&' character in a GET query???

     

    So that it's not interpretted as the end of the variable??

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