Jump to content

ejay

Members
  • Posts

    21
  • Joined

  • Last visited

    Never

Posts posted by ejay

  1. It is. After having a look at your code (which is not complete, so the solution will be a guess), I think you'll need to do following 2 steps

     

     

    //1. add the named anchor above your div
    
    <a name="line1"></a>
    <div id="line1>hello</div>
    

     

    //2. add following code just above the closing body tag ( </body> )
    <?php
    if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($submit_line))
    {
    ?>
        <script type="text/javascript">window.location.hash = 'line1';</script>
    <?php
    }
    ?>
    

     

    I hope this works.

  2. headers don't have to do anything with it. You will not be using the div's ID but a named anchor just above the target div instead. Say you want to "redirect (as you say)" the user to a specific div element with id=line1, you do something like this

     

    //page test.php
    //...
    <a name="line1" />
    <div id="line1>hello</div>
    

     

    and then from the form submit handling script, redirect user to

    test.php#line1

    instead of just

    test.php

     

    The div's id is not bound to be same as named anchor's name.

  3. This might work

     

    --------------------------------------
    ATSnotes.php
    
    class ATSnotes extends ATSdb
    //...
    
        function getNotes($stationID = 0)
        {
            $col = $this->getColumnNames();
            if (count($col) > 0)
            {
            //...
            $yada = $this->query("SELECT * FROM " . $this->getTableName() . ($stationID > 0? " WHERE fldStationID = $stationID " : '') . " ORDER BY $col[2] DESC, $col[2] DESC");
            //...
    
    

     

    _________________________________________________ ____________________________________
    3. stationNotesEditDel.php
    
    //...
    //...
    unset ($dada);
    $dada = $db->getNotes($StationID);
    //...
    //...
    

  4. you may need to do

     

    <?php
    $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
    $domain_name = $_SERVER['HTTP_HOST'];
    $site_url = $protocol.$domain_name;
    ?>
    
    <link rel="stylesheet" href="<?php echo $site_url ?>/css/style.css">
    

  5. <?php
    
    if ($_SERVER['REQUEST_METHOD'] == 'POST')
    {
        if (isset($_POST["pokemon_id"]))
        {
            $result = mysql_query("SELECT * FROM firemap WHERE id = " . intval($_POST["pokemon_id"]));
    
            $row = mysql_fetch_assoc($result); // or whatever you do with plain mysql functions
    
            if (isset($row['id']))
            {
                echo "<div class=\"pokemonalign\">";
                echo $row['image'];
                echo "</br>";
                echo 'You have captured Wild';
                echo $row['name'] . "";
                echo "</div>";
                $add = mysql_query("INSERT INTO pokemon (pokedex_id, owner_id, type, nickname) VALUES ('$row[id]', '$id', '1', '$row[name]')");
            }
        }
    }
    else
    {
        $map = rand(1, 10);
        $result = mysql_query("SELECT * FROM firemap ORDER BY RAND() LIMIT 1");
        while ($row = mysql_fetch_array($result))
        {
            if ($map == 1)
            {
                echo "<br />";
                echo '<img src="' . $row['image'] . '" alt="" />';
                echo "<br />";
                echo "A wild ";
                echo $row['name'] . " Appeared. <br /> Level: " . $row['level'];
                echo "<br />";
                echo "<form action='map1.php' method='post'>";
                echo "<input type='hidden' name='pokemon_id' value='$row[id]' />";
                echo "<input type='submit' class='catchpokemon' value='Catch $row[name]' />";
                echo "</form>";
            }
            else
            {
                echo "<div class=\"pokemontext\">";
                echo "<b>No more wild Pokémon appeared.</b>";
                echo "<br />";
                echo "<i>Keep moving around to find one.</i>";
                echo "</div>";
            }
        }
    }
    ?>
    
    

  6. Following jesirose's suggestion, here's what you want (I'm bored to hell)

     

    <?php
    
    if (isset($_POST["pokemon_id"]))
    {
        $result = mysql_query("SELECT * FROM firemap WHERE id = " . intval($_POST["pokemon_id"]));
    
        $row = mysql_fetch_assoc($result); // or whatever you do with plain mysql functions
    
        if (isset($row['id']))
        {
            echo "<div class=\"pokemonalign\">";
            echo $row['image'];
            echo "</br>";
            echo 'You have captured Wild';
            echo $row['name'] . "";
            echo "</div>";
            $add = mysql_query("INSERT INTO pokemon (pokedex_id, owner_id, type, nickname) VALUES ('$row[id]', '$id', '1', '$row[name]')");
        }
    }
    
    
    $map = rand(1, 10);
    $result = mysql_query("SELECT * FROM firemap ORDER BY RAND() LIMIT 1");
    while ($row = mysql_fetch_array($result))
    {
        if ($map == 1)
        {
            echo "<br />";
            echo '<img src="' . $row['image'] . '" alt="" />';
            echo "<br />";
            echo "A wild ";
            echo $row['name'] . " Appeared. <br /> Level: " . $row['level'];
            echo "<br />";
            echo "<form action='map1.php' method='post'>";
            echo "<input type='hidden' name='pokemon_id' value='$row[id]' />";
            echo "<input type='submit' class='catchpokemon' value='Catch $row[name]' />";
            echo "</form>";
        }
        else
        {
            echo "<div class=\"pokemontext\">";
            echo "<b>No more wild Pokémon appeared.</b>";
            echo "<br />";
            echo "<i>Keep moving around to find one.</i>";
            echo "</div>";
        }
    }
    ?>
    

  7. Ok I got it resolved. It had nothing to do with ffmpeg.

    Originally the "$thumb" and "$source" strings were different than my original post. The string were in following form (notice the quotes)

    //original dev's code format
    $source = '"/home/test1/abc.mov"';
    $thumb = '"/home/test1/thumb.jpg"';
    

    Something on the server got updated (by admins) and the code stopped working :|

     

    I hope it helps somebody somehow.

    thanks.

  8. thanks for the quick reply.

    here's the code (I'm debugging atm)

     

    if (file_exists($thumb))
    {
        echo "<pre>thumb exists</pre>";
    }
    else
    {
        echo "<pre>thumb can not be accessed</pre>";
    }
    

     

    and I always get "thumb can not be accessed" :(

  9. Hello,

    I'm having a very strange issue which i'm unable to identify/resolve.

     

    I'm extracting an image using ffmpeg using following command

    $source = '/home/test1/abc.mov';
    $thumb = '/home/test1/thumb.jpg';
    system('ffmpeg -i "' . $source . '" -ss 6 -vcodec mjpeg -f image2 -s 180x100 ' . $thumb);
    

    This piece of code works fine and I can see the file, thumb.jpg, in the FTP fine. But if I run a

    file_exists($thumb);

    right after the above piece of code, PHP can't find the file. The image is created as is a valid jpg file (displays fine if downloaded via FTP)

    I'm able to access all other files in '/home/test1/' directory using file_get_contents(); and file_exists() without any issues.

    Any help would be appreciated.

    thanks

     

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