Pagina niet beschikbaar

Gestart doorJoeri9 reacties17 weergaven

10 berichten · pagina 1 van 1

Joeri

Lid · Topicstarter

Berichten
5.737
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
hallo, ik ben voor mijn site een deel van een pagina aan het beveiligen dat je hem alleen kan bekijken als je admin rang hebt (rang 1), als je een andere hebt krijg je te zien dat je geen toegang hebt maar als je niet ingelogd bent krijg je deze error. Je hebt dan geen toegang voor zover ik weet maar je krijgt dan wel de error en daaronder de tekst dat je niet bevoegd bent

Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/sharpfmm/domains/vmovie.nl/public_html/pagina/trailer.php on line 127
je bent niet bevoegd om dit te zien

Ik denk dat het eraan ligt dat de mensen die niet ingelogd zijn totaal geen rang hebben maar ik vraag me af hoe ik dit op kan lossen?
Moet ik iedereen die online is dan een rang geven ofzo of het script aanpassen?

Hier is het script:

[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/session_start"]session_start[/URL][COLOR= #007700]();[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]../include/header.php[/COLOR][COLOR= #007700]);[/COLOR]
?>

  <div id="leftside">
    <div class="leftdata">
    [COLOR= #0000BB]<?php[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]trailer[/COLOR][COLOR= #007700]]))
    {[/COLOR]
    [COLOR= #0000BB]$trailerQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM trailers WHERE id="[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]trailer[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$trailerQuery[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700])
    {[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Deze video bestaat niet.[/COLOR][COLOR= #007700];
    }[/COLOR]
    [URL="http://www.php.net/else"]else[/URL]
    [COLOR= #007700]{[/COLOR]
        [COLOR= #0000BB]$trailer[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$trailerQuery[/COLOR][COLOR= #007700]);[/COLOR]
        ?>
        <h2>[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$trailer[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]];[/COLOR] ?></h2>
        <iframe width="560" height="315" src="http://www.youtube.com/embed/[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$trailer[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]yt[/COLOR][COLOR= #007700]];[/COLOR] ?>" frameborder="0" allowfullscreen></iframe>
        <hr /><h5><a style="color:green;" onclick="goed([COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$trailer[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];[/COLOR] ?>)">+1</a> ~ <a style="color:red;" onclick="slecht([COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$trailer[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];[/COLOR] ?>)">-1</a>
        <br />
        [COLOR= #0000BB]<?php[/COLOR]
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$trailer[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]stemmen[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700])
        {[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Er zijn nog geen stemmen uitgebracht[/COLOR][COLOR= #007700];
        }[/COLOR]
        [URL="http://www.php.net/else"]else[/URL]
        [COLOR= #007700]{[/COLOR]
            [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/round"]round[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$trailer[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]punten[/COLOR][COLOR= #007700]][/COLOR]/[COLOR= #0000BB]$trailer[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]stemmen[/COLOR][COLOR= #007700]]*[/COLOR][COLOR= #0000BB]10[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]2[/COLOR][COLOR= #007700]) >[/COLOR] [COLOR= #0000BB]10[/COLOR][COLOR= #007700])
            {[/COLOR]
                [COLOR= #0000BB]$iets[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]10[/COLOR][COLOR= #007700];
            }[/COLOR]
            [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/round"]round[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$trailer[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]punten[/COLOR][COLOR= #007700]][/COLOR]/[COLOR= #0000BB]$trailer[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]stemmen[/COLOR][COLOR= #007700]]*[/COLOR][COLOR= #0000BB]10[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]2[/COLOR][COLOR= #007700]) <[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700])
            {[/COLOR]
                [COLOR= #0000BB]$iets[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700];
            }[/COLOR]
            [URL="http://www.php.net/else"]else[/URL]
            [COLOR= #007700]{[/COLOR]
                [COLOR= #0000BB]$iets[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/round"]round[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$trailer[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]punten[/COLOR][COLOR= #007700]][/COLOR]/[COLOR= #0000BB]$trailer[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]stemmen[/COLOR][COLOR= #007700]]*[/COLOR][COLOR= #0000BB]10[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]2[/COLOR][COLOR= #007700]);
            }[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$iets[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]/10[/COLOR][COLOR= #007700];
        }[/COLOR]
        ?>
    <div class="leftinfo">
      <p>
        <br />
        [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [URL="http://www.php.net/nl2br"]nl2br[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$trailer[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]beschrijving[/COLOR][COLOR= #007700]]);[/COLOR] ?>
      </p>

      </div>
      <hr />
     <h1>Reactie</h1>
      <div class="leftinfo" id="reactie">
      [COLOR= #0000BB]<?php
    $reactieQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM reactie WHERE t_id="[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]trailer[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]" LIMIT 5"[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$reactie[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$reactieQuery[/COLOR][COLOR= #007700]))
    {[/COLOR]
        ?>
        <i><b>[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$reactie[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]user[/COLOR][COLOR= #007700]];[/COLOR] ?></b></i> zei om [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$reactie[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]date[/COLOR][COLOR= #007700]];[/COLOR] ?>
        <div class="leftinfo">
        [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [URL="http://www.php.net/nl2br"]nl2br[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$reactie[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]]);[/COLOR] ?>
        </div>
        [COLOR= #0000BB]<?php[/COLOR]
    [COLOR= #007700]}[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]uId[/COLOR][COLOR= #007700]]))
    {[/COLOR]
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]hoi[/COLOR][COLOR= #007700]]))
        {[/COLOR]
            [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700])
            {[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Vul een bericht in[/COLOR][COLOR= #007700];
            }[/COLOR]

            [URL="http://www.php.net/else"]else[/URL]
            [COLOR= #007700]{[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Uw reactie is geplaatst![/COLOR][COLOR= #007700];[/COLOR]
                [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO reactie (t_id,user,bericht,date) VALUES ("[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]trailer[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]", "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR]htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]])).[/COLOR][COLOR= #DD0000]", "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR]htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]])).[/COLOR][COLOR= #DD0000]", NOW())"[/COLOR][COLOR= #007700])[/COLOR]or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());
            }
        }[/COLOR]
        [URL="http://www.php.net/else"]else[/URL]
        [COLOR= #007700]{[/COLOR]
            ?>
            <br />
            <br />
            <div class="leftinfo">
                <form action="" method="post">
                    <textarea name="bericht" style="max-width:100%;"></textarea><br />

                    <input type="submit" name="hoi" value="post" />
                </form>
            </div>
            [COLOR= #0000BB]<?php[/COLOR]
        [COLOR= #007700]}
    }[/COLOR]
    ?>
    </div>
    [COLOR= #0000BB]<?php[/COLOR]
    [COLOR= #007700]}[/COLOR]
    ?>
        <div id="video"></div>
        <div id="test"></div>
        [COLOR= #0000BB]<?php[/COLOR]
    

    [COLOR= #007700]}[/COLOR]
    
    [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]add[/COLOR][COLOR= #007700]]))
    {[/COLOR]
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]add[/COLOR][COLOR= #007700]]))
        {[/COLOR]
            [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]yt[/COLOR][COLOR= #007700]] !=[/COLOR] [COLOR= #DD0000][/COLOR] [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]] !=[/COLOR] [COLOR= #DD0000][/COLOR] [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]beschrijving[/COLOR][COLOR= #007700]] !=[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700])
            {[/COLOR]
                [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO trailers (titel,beschrijving,yt,user) VALUES ("[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]", "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]beschrijving[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]", "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]yt[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]", "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]uId[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]")"[/COLOR][COLOR= #007700])[/COLOR]or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Toegevoegd![/COLOR][COLOR= #007700];
            }[/COLOR]
            [URL="http://www.php.net/else"]else[/URL]
            [COLOR= #007700]{[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Vul alle velden in[/COLOR][COLOR= #007700];
            }
        }[/COLOR]
        [URL="http://www.php.net/else"]else[/URL]
        [COLOR= #007700]{[/COLOR]
            ?>
            
                [COLOR= #0000BB]<?php    
$sQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT rang FROM users WHERE id = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]uId[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]");

$rang = mysql_result($sQuery, 0);

if ($rang == 1) {

?>

            <form action="" method="[/COLOR]post[COLOR= #DD0000]">
                <table>
                    <tr>
                        <td>Titel</td>
                        <td><input type="[/COLOR]text[COLOR= #DD0000]" name="[/COLOR]titel[COLOR= #DD0000]" /></td>
                    </tr>
                    <tr>
                        <td>www.youtube.com/watch?v=</td>
                        <td><input type="[/COLOR]text[COLOR= #DD0000]" name="[/COLOR]yt[COLOR= #DD0000]" /></td>
                    </tr>
                    <tr>
                        <td>Beschrijving</td>
                        <td><textarea name="[/COLOR]beschrijving[COLOR= #DD0000]" style="[/COLOR][URL="http://www.php.net/max"]max[/URL][COLOR= #007700]-[/COLOR]width[COLOR= #007700]:[/COLOR][COLOR= #0000BB]100[/COLOR][COLOR= #007700]%;[/COLOR][COLOR= #DD0000]"></textarea></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td><input type="[/COLOR]submit[COLOR= #DD0000]" name="[/COLOR]add[COLOR= #DD0000]" value="[/COLOR]voeg toe[COLOR= #DD0000]" /></td>
                    </tr>
                </table>
            </form>
            <?php
            }
            else
            { echo"[/COLOR]je bent niet bevoegd om dit te zien[COLOR= #DD0000]";
            }
        }
    }
    else
    {
        ?>
                <script type="[/COLOR]text/javascript[COLOR= #DD0000]">
                    traileroverzicht(1);
                </script>
                <?php
    }
    ?>
                <div id="[/COLOR]test[COLOR= #DD0000]"></div>
    </div>
    </div>
  <div id="[/COLOR]rightside[COLOR= #DD0000]">
    <div class="[/COLOR]rightdata[COLOR= #DD0000]">
        <h2>Top</h2>
        <p>
        <?php
        $topQuery = mysql_query("[/COLOR]SELECT [COLOR= #007700]*[/COLOR] FROM trailers ORDER BY punten DESC LIMIT [COLOR= #0000BB]5[/COLOR][COLOR= #DD0000]")or die(mysql_error());;
        while($top = mysql_fetch_assoc($topQuery))
        {
            ?><a href="[/COLOR][COLOR= #007700]..[/COLOR]/pagina/trailer[COLOR= #007700].[/COLOR]php[COLOR= #007700]?[/COLOR]id[COLOR= #007700]=[/COLOR][COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$top[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];[/COLOR] ?>">[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$top[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]];[/COLOR] ?></a>
            <br />
            [COLOR= #0000BB]<?php[/COLOR]
        [COLOR= #007700]}[/COLOR]
        ?>
                </p>
    </div>
    <div class="rightdata">
         <h2>Nieuwe films</h2>
        <p>
        [COLOR= #0000BB]<?php
        $nieuwQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM trailers ORDER BY id DESC LIMIT 5"[/COLOR][COLOR= #007700])[/COLOR]or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());;[/COLOR]
        [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$nieuw[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$nieuwQuery[/COLOR][COLOR= #007700]))
        {[/COLOR]
            ?><a href="../pagina/trailer.php?id=[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$nieuw[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];[/COLOR] ?>">[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$nieuw[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]];[/COLOR] ?></a>
            <br />
            [COLOR= #0000BB]<?php[/COLOR]
        [COLOR= #007700]}[/COLOR]
        ?></p>  
    </div>
    [COLOR= #0000BB]<?php[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]uId[/COLOR][COLOR= #007700]]))
    {[/COLOR]
        ?>
        <div class="rightdata">
         <h2>Mijn account</h2>
        <p>
        [COLOR= #0000BB]<?php
        $uQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM users WHERE id="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]uId[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700])[/COLOR]or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());;[/COLOR]
        [COLOR= #0000BB]$u[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$uQuery[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$reactieQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM reactie WHERE user="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$u[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$reactie[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$reactieQuery[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$stemmenQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM stemmen WHERE user="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$u[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$stemmen[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$stemmenQuery[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$procent1[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$reactie[/COLOR]/[COLOR= #0000BB]100[/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$procent2[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$stemmen[/COLOR]/[COLOR= #0000BB]100[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$procent1[/COLOR][COLOR= #007700]+[/COLOR][COLOR= #0000BB]$procent2[/COLOR] [COLOR= #007700]>[/COLOR] [COLOR= #0000BB]100[/COLOR][COLOR= #007700])
        {[/COLOR]
            [COLOR= #0000BB]$getal[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]100[/COLOR][COLOR= #007700];
        }[/COLOR]
        [URL="http://www.php.net/else"]else[/URL]
        [COLOR= #007700]{[/COLOR]
            [COLOR= #0000BB]$getal[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$procent1[/COLOR][COLOR= #007700]+[/COLOR][COLOR= #0000BB]$procent2[/COLOR][COLOR= #007700];
        }[/COLOR]
        ?>
        Welkom <i><b>[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$u[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]];[/COLOR] ?></b></i>
        <br />
        vPunten : [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$getal[/COLOR][COLOR= #007700];[/COLOR] ?>%
        <br />
        Stemmen :[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$stemmen[/COLOR][COLOR= #007700];[/COLOR] ?>
        <br />
        Reacties :[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$reactie[/COLOR][COLOR= #007700];[/COLOR] ?></p>  
    </div>
    [COLOR= #0000BB]<?php[/COLOR]
    [COLOR= #007700]}[/COLOR]
    [URL="http://www.php.net/else"]else[/URL]
    [COLOR= #007700]{[/COLOR]
    ?>
    <div class="rightdata">
         <h2>Login</h2>
        <form action="../pagina/login.php" method="post">
        <input type="text" name="naam" />
        <br />
        <input type="password" name="pass" />
        <br />
        <input type="submit" name="send" value="login" />
        </form>
    </div>
    [COLOR= #0000BB]<?php[/COLOR]
    [COLOR= #007700]}[/COLOR]
    ?>
  </div>
  <div id="footer">
    <p class="right">&copy; Joeri</p>
    </p>
  </div>
</div>
</body>
</html>
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
$sQuery = mysql_query("SELECT rang FROM users WHERE id = " . $_SESSION[uId]);

=

$sQuery = mysql_query("SELECT rang FROM users WHERE id = " . $_SESSION[uId].");

En zorgt voor FATSOENLIJKE foutafhandeling. Niemand gaat dood, jij ook niet als je iets fout doet, dus je script hoort ook niet dood te gaan.

Geen die() maar nette foutafhandeling met if- else.
0
Joeri

Lid · Topicstarter

Berichten
5.737
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Aarclay schreef:
$sQuery = mysql_query("SELECT rang FROM users WHERE id = " . $_SESSION[uId]);

=

$sQuery = mysql_query("SELECT rang FROM users WHERE id = " . $_SESSION[uId].");

En zorgt voor FATSOENLIJKE foutafhandeling. Niemand gaat dood, jij ook niet als je iets fout doet, dus je script hoort ook niet dood te gaan.

Geen die() maar nette foutafhandeling met if- else.
Heb dit gedaan en toen gaf hij dit aan :

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/sharpfmm/domains/vmovie.nl/public_html/pagina/trailer.php on line 135


Heb al wat andere dingen geprobeerd op lijn 135 maar zonder resultaat natuurlijk,
wat betreft dat die() het script is van iemand anders overgekocht en ik ben er gewoon wat in aan het prutsen, bedankt dat je me erop gewezen hebt en ik ga proberen om dit weg te halen, ik heb alleen nog geen idee hoe want de tutorial die ik op internet vind :

http://www.sitemasters.be/tutorials/2/1/498/MySQL/MySQL_Error_Handling

is volgens mij niet goed toe te passen. Volgens mij moet ik wel met elseif werken klopt dat?

Alvast bedankt
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
$sQuery = mysql_query("SELECT rang FROM users WHERE id = " . $_SESSION[uId]."");


Zo moet het beter werken?

En ja, je moet met if en else werken, elseif lijkt me niet echt logisch wink.
0
Joeri

Lid · Topicstarter

Berichten
5.737
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Aarclay schreef:
$sQuery = mysql_query("SELECT rang FROM users WHERE id = " . $_SESSION[uId]."");
Zo moet het beter werken?

En ja, je moet met if en else werken, elseif lijkt me niet echt logisch wink.

Quote:
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 5 in /home/sharpfmm/domains/vmovie.nl/public_html/pagina/trailer.php on line 129

Geeft hij nu aan, verder heb ik geen idee hoe ik dat die() moet vermijden en hoe ik dat aan kan geven want dan krijg je allemaal if/else door elkaar enzo en via internet KLIK had ik dat in een tut gevonden. bedankt smile
0
Berichten
8.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Joeri schreef:
Eerdere citaten tonen
Aarclay schreef:
$sQuery = mysql_query("SELECT rang FROM users WHERE id = " . $_SESSION[uId]."");
Zo moet het beter werken?

En ja, je moet met if en else werken, elseif lijkt me niet echt logisch wink.
Quote:
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 5 in /home/sharpfmm/domains/vmovie.nl/public_html/pagina/trailer.php on line 129

Geeft hij nu aan, verder heb ik geen idee hoe ik dat die() moet vermijden en hoe ik dat aan kan geven want dan krijg je allemaal if/else door elkaar enzo en via internet KLIK had ik dat in een tut gevonden. bedankt smile
Or die(mysql_error()) weghalen?
0
Joeri

Lid · Topicstarter

Berichten
5.737
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Vriendje schreef:
Eerdere citaten tonen
Joeri schreef:
Eerdere citaten tonen
Aarclay schreef:
$sQuery = mysql_query("SELECT rang FROM users WHERE id = " . $_SESSION[uId]."");
Zo moet het beter werken?

En ja, je moet met if en else werken, elseif lijkt me niet echt logisch wink.
Quote:
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 5 in /home/sharpfmm/domains/vmovie.nl/public_html/pagina/trailer.php on line 129

Geeft hij nu aan, verder heb ik geen idee hoe ik dat die() moet vermijden en hoe ik dat aan kan geven want dan krijg je allemaal if/else door elkaar enzo en via internet KLIK had ik dat in een tut gevonden. bedankt smile
Or die(mysql_error()) weghalen?

Ligt het aan mij of word de fout dan niet netjes afgehandeld?
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Totdat je netjes if-else gebruikt.
0
Berichten
8.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Joeri schreef:
Eerdere citaten tonen
Vriendje schreef:
Eerdere citaten tonen
Joeri schreef:
Eerdere citaten tonen
Aarclay schreef:
$sQuery = mysql_query("SELECT rang FROM users WHERE id = " . $_SESSION[uId]."");
Zo moet het beter werken?

En ja, je moet met if en else werken, elseif lijkt me niet echt logisch wink.
Quote:
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 5 in /home/sharpfmm/domains/vmovie.nl/public_html/pagina/trailer.php on line 129

Geeft hij nu aan, verder heb ik geen idee hoe ik dat die() moet vermijden en hoe ik dat aan kan geven want dan krijg je allemaal if/else door elkaar enzo en via internet KLIK had ik dat in een tut gevonden. bedankt smile
Or die(mysql_error()) weghalen?
Ligt het aan mij of word de fout dan niet netjes afgehandeld?

Hi vraagt hoe e die vermijdt, niet hoe je mooi afhandelt wink
If(!empty(mysql_error())) {
// lol
}
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
die() moet je vermijden, en mysql_error() juist niet.

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700]) {[/COLOR]
   [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Gelukt"[/COLOR][COLOR= #007700];
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
   [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Mislukt vanwege: "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]();
}[/COLOR]
?>


Ik vraag me af of mysql_error() wel altijd leeg is, als iets gelukt is?
Controleer liever op je result (de query), indien FALSE, dan is het niet gelukt, als je een resource terug krijgt (officieel kan je geen TRUE krijgen) dan is het goed.
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren