redirect_to_alias() redirects to admin login :/

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
unnamed7
Forum Members
Forum Members
Posts: 42
Joined: Tue Dec 05, 2006 1:53 pm

redirect_to_alias() redirects to admin login :/

Post by unnamed7 »

Hi, what can be wrong with my code here ?
[php]
DoAction('login_form', $id, $params, $loginpage);
}
    $loginone = $params['login'];
$passone = md5($params['pass']);
$db = &$this->GetDB();
$query = "SELECT * FROM ".cms_db_prefix()."module_Clients WHERE login='$loginone'";
$result = $db->Execute($query);
if(!$result) die($db->ErrorMsg());
$row = $result->FetchRow();
$login = $row['login'];
$pass = $row['pass'];
$params['login'] = $row['login'];
if($login == $loginone && $pass == $passone){
    $_SESSION['logged'] = true;
$_SESSION['user'] = $login;
                redirect_to_alias($login);
}else{
echo "error";
}

?>
[/php]

when i comment  redirect_to_alias($login); and for example write echo $login; everything works fine, so, why  redirect_to_alias($login); redirects to admin area, but wont redirect to page ?
when i'am logged to admin panel it works fine...

cant figure it out, please help.
and sorry for my poor english :)
NaN

Re: redirect_to_alias() redirects to admin login :/

Post by NaN »

Could you please give a short explanation what your'e trying to do?
I don't know in what context you use that code.
Is it a module, an UDT or a plugin?
unnamed7
Forum Members
Forum Members
Posts: 42
Joined: Tue Dec 05, 2006 1:53 pm

Re: redirect_to_alias() redirects to admin login :/

Post by unnamed7 »

it's a module, i just want to redirect to another (alias same as username) page after login :)
NaN

Re: redirect_to_alias() redirects to admin login :/

Post by NaN »

Did you try $this->redirect_to_alias() ?
unnamed7
Forum Members
Forum Members
Posts: 42
Joined: Tue Dec 05, 2006 1:53 pm

Re: redirect_to_alias() redirects to admin login :/

Post by unnamed7 »

if i try $this-> i get error
[php]Fatal error: Call to undefined method Clients::redirect_to_alias() in /home/users/test/public_html/inetic/modules/Clients/action.login_user.php on line 22[/php]

without $this->, redirect_to_alias works fine, but only when i'am logged to admin panel, something like this happend to my for example when i used CreateLink and had bad returnid... but  redirect_to_alias should work i think...

damn, maybe u know some workaround ? i just need to simply redirect to another page... simple, yet hard for me :/
Last edited by unnamed7 on Thu Sep 11, 2008 8:25 pm, edited 1 time in total.
unnamed7
Forum Members
Forum Members
Posts: 42
Joined: Tue Dec 05, 2006 1:53 pm

Re: redirect_to_alias() redirects to admin login :/

Post by unnamed7 »

anyone ?
NaN

Re: redirect_to_alias() redirects to admin login :/

Post by NaN »

What is "Clients"?
How did you integrate that Module/Class?
I'm not that familiar with object oriented programming but if you use $this->GetDB or $this->DoAction you should also be able to use all functions that are in the module api.
I'm not sure at the moment but is redirect_to_alias a regular function of the module api?
If it is called from the frontend "directly" e.g. by a plugin it should work.
But if you're calling from a module try this:

$this->RedirectContent($content_id)

or this one:

$this->RedirectForFrontEnd ($id, $returnid, $action, $params)

(http://www.cmsmadesimple.org/apidoc/CMS ... ectContent)
Post Reply

Return to “Developers Discussion”