Skip to content

(s)ecure (f)orms (w)ith (c)emil is a tiny php library for preventing CSRF attacks

License

Notifications You must be signed in to change notification settings

okulbilisim/sfwc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hardly in development

#SFWC

SFWC is a tiny php library for preventing CSRF attacks.

##example usage on forms

###handler

<?php
include '/home/yunusemre/sfwc/sfwc.php';

SFWC::get()->initToken('login_form');

if($_POST) {
    if(SFWC::get()->controlToken($_POST["csrf_token"], 'login_form')) {
        echo "yello there, thanks for your login information.";
    }
    else {
        echo "thanks for your effort but i cannot accept this POST request.";
    }
}

?>

###form

<form method="POST">
  <input type="text" value="username"> username <br />
  <input type="text" value="password"> password <br />
  <?php echo SFWC::get()->getTokenAsHtml() ?>
  <input type="submit" value="submit">
</form>

About

(s)ecure (f)orms (w)ith (c)emil is a tiny php library for preventing CSRF attacks

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published