Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    Yes, if you have administrator rights, you can put any arbitrary thing you like into it.

    Thread Starter aladinDr

    (@aladin007463)

    please can you help me to make this code working , in first time it was working well , but then when i add the method of coockies for make user can just one time to click the button ..
    <?php if(!isset($_COOKIE[$cookie_name])){ ?>
    <html>
    <body>
    <form method=”get”>
    <input type=”submit” name=”oui” value=”oui” id=”submit1″>
    <input type=”submit” name=”non” value=”non” id=”submit2″>
    </form>
    </body>
    </html>
    ?>}
    <?php
    $cookie_name = “user”;
    $cookie_value = “user2”;
    if(isset($_GET[‘oui’])) {
    onFunc();
    setcookie($cookie_name, $cookie_value, time() + (86400 * 30), “/”);
    }
    if(isset($_GET[‘non’])) {
    offFunc();
    }
    function onFunc(){
    global $current_user;
    get_currentuserinfo();
    if((user_can($current_user ,’7eme’))
    {
    // Remove role
    $current_user->remove_role( ‘7eme’ );
    // Add role
    $current_user->add_role( ‘contributor’ );
    echo “..votre niveau scolaire maintenant est 8ème année de base”;
    }
    }
    function offFunc(){
    echo “Bonne chance la deuxième fois”;
    }?>
    now the error displaying like this :
    Parse error: syntax error, unexpected ‘{‘ in C:\xampp\htdocs\wptest\wp-content\plugins\php-code-widget\execphp.php(27) : eval()’d code on line 25

    Plugin Author Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    The error message tells you where the problem is. Line 25 of your code.

    Probably the extra parenth you have here:

    if((user_can($current_user ,’7eme’))

    Thread Starter aladinDr

    (@aladin007463)

    i resolved the error but <form method=”get” id=”form1″ <?php if(isset($_GET[$cookie_name])) {echo ” style=’display: none'”; } ?>>
    <input type=”submit” name=”on” value=”on”>
    <input type=”submit” name=”off” value=”off”>
    </form>

    <?php
    $cookie_name = “user”;
    $cookie_value = “user2″;

    if(isset($_GET[‘on’])) {
    onFunc();
    setcookie($cookie_name, $cookie_value, time() + (86400 * 30), “/”);

    }
    if(isset($_GET[‘off’])) {
    offFunc();
    }
    function onFunc() {
    global $current_user;
    get_currentuserinfo();
    if(user_can($current_user ,”7eme”)) {
    // Remove role
    $current_user->remove_role( “7eme” );
    // Add role
    $current_user->add_role( “contributor” );
    echo “..votre niveau scolaire maintenant est 8ème année de base”;
    }
    }

    function offFunc(){
    echo “Bonne chance dans le prémiére fois”;
    }?> ,

    then when i click to the button on , error display like this
    Warning: Division by zero in C:\xampp\htdocs\wptest\wp-content\plugins\php-code-widget\execphp.php(27) : eval()’d code on line 12
    // so please can you tell me what i should modify to the methode setcoockie for make that error resolve thanks and sorry for any disturbing ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Question’ is closed to new replies.