We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

How to use OW::getUser() | Forum

Topic location: Forum home » Support » General Questions
dev_kommunikatisten
dev_kommunikatisten Aug 17 '17
Hi,


always if i want to use OW::getUser() in a PHP Script i get a 500 Error ....


ich want login a user with:


OW::getUser()->login($user->id);


but it doesn't work



Can you help please?

Thank you

dev_kommunikatisten
dev_kommunikatisten Aug 17 '17
i have a seperate script with a small class with this lines:


$authAdapter = new BASE_CLASS_StandardAuth($username,$password);
$user = $authAdapter->getUser();


so i check, if the user exist .... i need here the login with the userId in oxwall and then i 

would reload the page with the startpage from oxwall.


so the user should be logged in.


Thank you for help

Paul
Paul Aug 17 '17
Nothing wrong with that:


OW::getUser() is an object, you get the userId with  OW::getUser()->getId(); 

dev_kommunikatisten
dev_kommunikatisten Aug 18 '17
OW::getUser() not works in a seperate Script .... 

I want login a user in oxwall with a seperate Script.



<?php

define('_OW_', true);
define('DS', DIRECTORY_SEPARATOR);
define('OW_DIR_ROOT', dirname(__FILE__) . DS);
require_once(OW_DIR_ROOT . 'ow_includes' . DS . 'init.php');
require_once(OW_DIR_ROOT . 'ow_system_plugins' . DS . 'base/classes/standard_auth.php');
require_once(OW_DIR_ROOT . 'ow_core' . DS . 'session.php');
require_once(OW_DIR_ROOT . 'ow_core' . DS . 'user.php');

OW::getSession()->start();

$username = $_GET['username]';$password = $_GET['password]';
$language = OW::getLanguage();
$authAdapter = new BASE_CLASS_StandardAuth($username,$password);$user = $authAdapter->getUser();

?>

So it works .... if a user exist with this username / password, i get the userdata from the oxwall system.

And now i want register or login the user with a active session an start the /oxwall/index.php and the user can see the dashboard view.

Do you know what i mean? I need a seperate login script ...

The Forum post is edited by dev_kommunikatisten Aug 18 '17
Mike
Mike Aug 21 '17
Hey,

to login a user you have to use the "authenticate" function from the user-Object:

$result = OW::getUser()->authenticate(new BASE_CLASS_StandardAuth($identity, $password));


If you have a look at the StandardAuth Class you will see it only returns an OW_AuthResult.
Just replace StarndardAuth with an success response:

new OW_AuthResult(OW_AuthResult::SUCCESS, $userId, array("Just a text you logged in..."));


To keep the user logged in (remember him) you have to set a cookie:

$loginCookie = $this->saveLoginCookie(OW::getUser()->getId());
setcookie('ow_login', $loginCookie->getCookie(), (time() + 86400 * 7), '/', null, null, true);
donna
donna Oct 22 '22

Glad you set up this retro bowl forum. It is very useful for everyone.

Miss surbhi
Miss surbhi Nov 24 '22
Delhi Escort Service rate for Single Shot. Single Shot: Delhi Escorts price depends on the service quality and based on the call girl. We have made the price structure very simple and tried to make it unchanged based on the escort service category in Delhi. Our Escort service price is pocket-friendly, but the escort service quality is best among other Delhi Escorts Agency. Kindly visit the Delhi Escort Service rate page for more detailsDelhi Escort Service rate for the double shot. Double Shot: Our double shot is shallow among the other Delhi escort competitors. Although the price depends on service quality and the demand for call girls, we have made it very simple and tried to make it unchanged based on theDelhi Independent Escort Service category. Our Escort service price is very pocket-friendly, but we have not compromised the escort service quality. It is best among otherDelhi Escorts. Kindly click the link to know the Escort Service rate page for more details.Delhi Model Escorts service rate for a full night. Full Night: This is the most demanding Service in Delhi vip Escorts. But we also controlled the price, made it very simple, and tried to make it unchanged based on the Delhi Escort service category because we believe in a long-term business relationship. Our Escort service price is pocket-friendly, but the escort service quality is best among other Delhi Female escorts. Kindly go through our escort service rate page for more details. Delhi Escort rate for InCall Service. Are you aware of the word “InCall”? Most of the time, the answer is “NO”! Don’t worry, our Delhi Escort Service Agency will make you understand? The word “InCall” means the Escort Agency will arrange a hotel room; in other words, the client has to go to the call girl’s place. We provide excellent hotel rooms all over Delhi City. We have done tie-ups with primarily three stars rated, and five stars rated hotels. We will take care of all the worries, and you will get only pleasure. Delhi cheap Escort rate for OutCall Service. “OutCall” term is the exact opposite of “InCall,” in this, Delhi model Escort Service Agency (Call girl) will come to you to provide you with the Service. Sometimes the client doesn’t want to go to an unknown place or has his place. Both the service types are in demand and based on the client’s convenience they choose. Out-call type service is slightly cheaper than the In-call type service because the escort agency is not bearing the hotel charges, Delhi premium escorts. Both the service type is well based on your preference, select one, and have fun. ???
Metro Shoes
Metro Shoes May 10 '23
Metro shoes offer their customers the highest quality Shoes for men, Formal shoes, Casual shoes, and sandals for men. Get the best available men’s sandals in Pakistan, today. So, buy only the best shoes online from Metro shoes. We bring you only the highest quality men’s shoes.
Chinyere
Chinyere May 11 '23
Pakistani brands ready to wear are becoming increasingly popular throughout the world. Offering a variety of stylish and affordable apparel, Chinyere is offering best ready to wear clothes in good range. So, get your favorite clothes now!
RichardGravener
RichardGravener May 11 '23

I'm sorry to hear that you're experiencing an issue with using OW::getUser() in your PHP script, resulting in a 500 error. While I can provide some general troubleshooting tips, please note that without further details about your specific environment and error message, it may be challenging to pinpoint the exact cause. However, here are a few suggestions to help you troubleshoot the issue: Glamgossiper

  1. Check error logs: The first step is to check the error logs of your web server or PHP to get more information about the error. The error logs can provide specific details that will help you identify the issue, such as syntax errors, missing dependencies, or permission problems.

  2. Verify library and framework dependencies: Ensure that all the required libraries and frameworks, including the one providing the OW::getUser() method, are properly installed and up to date. Check for any potential conflicts or missing dependencies that may be causing the error.

  3. Review configuration files: Double-check the configuration files related to your script or the framework you're using. Make sure the necessary settings are correctly configured, such as database connection details and session management.

  4. Verify user authentication and permissions: Ensure that the user authentication process is functioning correctly and that the user you're trying to log in has the necessary permissions to perform the login operation. Check if there are any custom restrictions or requirements for user authentication in your application.

  5. Test with a simplified script: Create a simplified version of your script that focuses solely on the login operation using OW::getUser()->login($user->id). This can help isolate the issue and determine if it's related to this specific function call or if there are other factors at play.

  6. Seek support from the library or framework community: If you're using a specific library or framework that provides the OW::getUser() method, consider reaching out to their official support channels or community forums for assistance. They may have more specific insights into common issues or potential solutions related to that particular function.

By following these troubleshooting steps and providing more specific details about the error message or any relevant code snippets, you'll have a better chance of resolving the issue.

Qhaaf Bedding
Qhaaf Bedding Aug 16 '23
Discover the allure of Pakistan bed sheets by Qhaaf Bedding. Elevate your sleep space with elegance and style. Embrace the art of relaxation and indulgence.
Panache Apparel
Panache Apparel Aug 17 '23
Panache Apparel brings you the epitome of style with their enchanting floral dresses Pakistan. Elevate your fashion game as you embrace the beauty of nature's blooms, courtesy of Panache Apparel.
Aspire Bedding
Aspire Bedding Aug 17 '23
Experience the perfect blend of luxury and relaxation with Aspire Bedding's premium online bed sheets in Pakistan. Upgrade your bedding for ultimate comfort.
kalvindarwan
kalvindarwan Dec 22 '23
This whether you’re broken down on a back-street at 2AM, or on the middle of the freeway during rush hour. Bakersfield Mobile Truck Repair
James Walter
James Walter Jan 3
With years of experience and trained automotive professionals, your vehicle will be up and running again in no time. Sioux Falls Mobile Mechanic