1
Hello,
i wanted to add a user in XOOPS using Snoopy class found at:
http://sourceforge.net/projects/snoopy/i was able to successfully login as admin using this code.. but when i got into the AddUser page and then submitted, i got a message "Taking you back to where you were....":
include "Snoopy.class.php";
$snoopy = new Snoopy;
$submit_url = "http://myxoopssite.com/user.php";
//these are the form elements
$submit_vars["uname"] = "admin";
$submit_vars["pass"] = "secret:P";
$submit_vars["op"] = "login";
$submit_vars["xoops_redirect"] = "/user.php";
$submit_vars["submit"] = "User Login";
if($snoopy->submit($submit_url,$submit_vars))
{
while(list($key,$val) = each($snoopy->headers))
echo $key.": ".$val."
n";
echo "n"
;
echo ""
.htmlspecialchars($snoopy->results)."n";
//echo $snoopy->results;
}
else
echo "error fetching document: ".$snoopy->error."n";
//do this so that the cookies/something remains after login...
$snoopy->setcookies ();
$submit_url="http://myxoopssite.com/modules/system/admin.php";
//$submit_url="http://myxoopssite.com/modules/system/admin/users/users.php";
$submit_vars['username']="aaa_test";
$submit_vars['name']="This is the first name of the test user";
$submit_vars['email']="aaa_test@nemco.edu.ph";
$submit_vars['umode']="nest";
$submit_vars['uorder']=0;
$submit_vars['notify_method']=1;
$submit_vars['notify_mode']=0;
$submit_vars['timezone_offset']=8;
$submit_vars['user_mailok']=1;
$submit_vars['password']="aaa_test";
$submit_vars['pass2']="aaa_test";
$submit_vars['fct']="users";
$submit_vars['op']="addUser";
$submit_vars['groups']=2;
//$submit_vars['XOOPS_TOKEN_REQUEST']="700bb7cce1f7e90e73a4fb50b6f9e338";
$submit_vars["submit"] = "Submit";
$snoopy->setcookies ();
if($snoopy->submit($submit_url,$submit_vars))
{
while(list($key,$val) = each($snoopy->headers))
echo $key.": ".$val."
n";
echo "n"
;
echo ""
.htmlspecialchars($snoopy->results)."n";
//echo $snoopy->results;
}
else
echo "error fetching document: ".$snoopy->error."n";
?>
im thinking that it has something to do with the XOOPS Token system... how do i go around it?