The online racing simulator
Quote from Victor :I've just tried it with the original web php files that are still in the actual prism release and it worked there for me. Both HTTP Auth and regular login via the webpage itself.

So maybe you can explain a bit more about what you're trying and what exactly doesn't work? Which type of login are you trying? (ok the webpage type duh Maybe post some code?

i got it to a point where it logs in, but it does not store session data it seems... like if i was to make a page that gives your session info, it would be empty
I've just ran through the PRISM code that handles the session storage (prism_phpparser.php), but i don't see anything wrong with it so far. And the session info in the default web pages seems to work as well.

So, just to make sure, have you read the part about sessions in the "creating_html_pages.txt" file, located in your PRISM/docs/ folder?

If so and if you think you're doing it as described, then what would really help is seeing what you write to $_SESSION and how. Then I may be able to reproduce it and fix the problem.
Quote from Victor :I've just ran through the PRISM code that handles the session storage (prism_phpparser.php), but i don't see anything wrong with it so far. And the session info in the default web pages seems to work as well.

So, just to make sure, have you read the part about sessions in the "creating_html_pages.txt" file, located in your PRISM/docs/ folder?

If so and if you think you're doing it as described, then what would really help is seeing what you write to $_SESSION and how.

I copied exactly from the old website and replaced the website code... i don't know if i copied something wrong or what..

i now get this: PHP NOTICE: Undefined index: counter in C:\...\PRISM 0.3.3\modules\prism_phpparser.php(43) : eval()'d code on line 84
I don't think you copied anything wrong, unless your not using Ctrl+C, Ctrl+V. I think it might just be what Victor said. Are you using the sessions correctly? Because PRISM programming for the website interface is not like programing for a normal PHP site. EVERYTHING is persistent. You can't just include a file and expect it to work because it becomes re-entrant that way, you must separate your startup work (placing them in include_once or require_once files) from your presentation work that can be execute on every page view.

Have you read the documentation, creating_html_pages.txt? Because Victor, who wrote the phpparser module, wrote that out for people who are making the website front end. It's kind of important.
i read that, i am slowly getting it to work, but i still cant get it to display the username in the header

Edit: seems like the sessions arn't being transfered between pages...

I even reverted back to the default one and it still had a problem with storing session data
is your browser accepting cookies for your admin page / site? Prism sends your browser a session cookie, so that on the next page load Prism knows which session to reactivate again. So without a cookie, it will not reinstate the session.
I just tried it with IE, firefox it works... but it doesn't work with chrome, any idea?

also, how do i check if a plugin is used? For the menu of the new web front end i want to have it check if PRISM uses a specific plugin
If chrome is the issue, I would think that you should really check that the domain is correct and that the path is correct for the cookie.


<?php 
in_array
('pluginname'$PRISM->plugins->getPlugins());
?>

You can also just foreach $PRISM->plugins->getPlugins(); and it will give you the list of plugins loaded. It will not tell you the servers the plugins are active on, but it will give you a list of the loaded plugins.
Quote from Dygear :If chrome is the issue, I would think that you should really check that the domain is correct and that the path is correct for the cookie.


<?php 
in_array
('pluginname'$PRISM->plugins->getPlugins());
?>

You can also just foreach $PRISM->plugins->getPlugins(); and it will give you the list of plugins loaded. It will not tell you the servers the plugins are active on, but it will give you a list of the loaded plugins.

i looked, and it seems that its not even saving the cookie...

and it also seems that in_array always returns false... worse comes to worse i will make my own
I'll ask one more time : show us your sessions code, so that we may be able to help. Otherwise you're going to have to figure it out yourself.
I've tested everything on all browsers and everything works fine. But you're not giving us any information to debug your problem, so we can't help you. I'm not going to guess all the time about what the problem might be, when you could show us the code and have the problem fixed in 5 minutes probably.
Quote from Victor :I'll ask one more time : show us your sessions code, so that we may be able to help. Otherwise you're going to have to figure it out yourself.
I've tested everything on all browsers and everything works fine. But you're not giving us any information to debug your problem, so we can't help you. I'm not going to guess all the time about what the problem might be, when you could show us the code and have the problem fixed in 5 minutes probably.

login.php

<?php 
php
if (!isset($_SESSION['user'])){
if (isset(
$_POST['login'])){


$adminUser = isset($_POST['loginUser']) ? $_POST['loginUser'] : '';
$adminPass = isset($_POST['loginPass']) ? $_POST['loginPass'] : '';

if (
$adminUser && $adminPass){
    if (
$PRISM->admins->isPasswordCorrect($adminUser$adminPass)){

        if (!isset(
$_SESSION)){
            
$_SESSION = array('counter' => 1'staticvar' => 'mooh''lasttime' => time());
        }
        
$_SESSION['user'] = $adminUser;

<
class="msg info">You are now logged in!</p>
php
    
}

}

}else{


        <
h3 class="tit">Login</h3>
        <
form method="post" action="login.php">
        <
label for="username">Username: </label> <input type="text" name="loginUser" size="20" class="input-text">
        <
label for="password">Password: </label><input type="password" name="loginPass" size="20" class="input-text"><br><br
        <
label for="autologin">Remember Me?: </label><input type="checkbox" name="autologin"
        <
input type="submit" value="Log In" name="login">
        </
form>
php
}}else{

<
class="msg info">Your Already logged in.</p>
php
}

?>

sessions.php

<?php 
php
    
if (isset($SERVER['PHP_AUTH_USER']))
    {
        if (!isset(
$_SESSION))
            
$_SESSION = array('user' => $SERVER['PHP_AUTH_USER'], 'counter' => 0);
        else
            
$_SESSION['user'] = $SERVER['PHP_AUTH_USER'];
        
$_SESSION['autoLogin'] = TRUE;
    }
    else
    {
        if (isset(
$_SESSION['autoLogin'])) unset($_SESSION['autoLogin']);
    }

?>

Cookie settings for all other pages?

<?php 
php
if (isset($_SESSION))
{
    
$_SESSION['counter']++;
    
$_SESSION['lasttime'] = time();
}
else
{
    
$_SESSION = array
    (
        
'counter' => 1
        
'staticvar' => 'mooh'
        
'lasttime' => time()
    );
}

?>

Would it also be possible for me/us to get a test account, to try logging in?
You can pm me the details if you don't want to create a public account.

And I suppose you simply use $_SESSION['user'] to determine on the main page if someone's logged in?
Quote from Victor :Would it also be possible for me/us to get a test account, to try logging in?
You can pm me the details if you don't want to create a public account.

sure can,

URL: http://just4fun.servequake.com:8888
User: Victor
Pass: Test123
thanks - i'm just having dinner now but will continue to look after that.
Quote from Victor :thanks - i'm just having dinner now but will continue to look after that.

ok, sounds fine
Ok, found the problem.
Chrome doesn't seem to like it when it receives a localised timestamp (ie. with PST like you had) in a cookie header. I think it just read it like it was GMT, so on every page load, the cookie would have expired immediately. Resulted in not being able to stay logged in.

Can you try this fix please :

Open the prism module file "prism_http.php", go to line 1727 and change

<?php 
date
('l, d-M-y H:i:s T', (int) $v[1])
?>

to

<?php 
gmdate
('l, d-M-y H:i:s T', (int) $v[1])
?>

Then try to login with chrome again. In my test it seemed to fix the problem.
Quote from Victor :Ok, found the problem.
Chrome doesn't seem to like it when it receives a localised timestamp (ie. with PST like you had) in a cookie header. I think it just read it like it was GMT, so on every page load, the cookie would have expired immediately. Resulted in not being able to stay logged in.

Can you try this fix please :

Open the prism module file "prism_http.php", go to line 1727 and change

<?php 
date
('l, d-M-y H:i:s T', (int) $v[1])
?>

to

<?php 
gmdate
('l, d-M-y H:i:s T', (int) $v[1])
?>

Then try to login with chrome again. In my test it seemed to fix the problem.

That indeed fixed it! Thanks!!, now onto the rest of the site

this really isn't a high priority, but i still can't seem to get this to work... (all its gonna be used for is to see if it needs to be displayed in the menu)

Quote from Dygear :

<?php 
in_array
('pluginname'$PRISM->plugins->getPlugins());
?>


Edit: at the latest i should have the site up on git... but i have a question... how do I add files?
Quote from Victor :Open the prism module file "prism_http.php", go to line 1727 ...

Are you willing to submit that patch to github Vic? If not I'll get around to it after I'm done with my rotations. If so, send me a pull request, and I'll submit it for the next version.

Quote from T3charmy :all its gonna be used for is to see if it needs to be displayed in the menu


<?php 
foreach ($PRISM->plugins->getPlugins() as $plugin)
{
    
var_dump($plugin::NAME);
}
?>

Quote from Dygear :

<?php 
foreach ($PRISM->plugins->getPlugins() as $plugin)
{
    
var_dump($plugin::NAME);
}
?>


what i need it to do is, this...


<?php 
php
$NavLinks 
= array(
                            array(
'File' => 'cruise.php''LinkText' => 'Cruise''Plugin' => 'Cruise')
                        );

?>


<?php 
        php
        
Foreach($NavLinks as $info){
        if(
in_array($info['Plugin'], $PRISM->plugins->getPlugins()) ){
        echo(
"<li".(( basename($SERVER["SCRIPT_NAME"]) == $info["File"] ) ? ' id="menu-active"' '')."><a href=\"{$info["File"]}\"><span>{$info["LinkText"]}</span></a></li>");
        }}
        
?>

but it ALWAYS returns false :/
So, $PRISM->plugins->getPlugins() always returns false?
Quote from Dygear :So, $PRISM->plugins->getPlugins() always returns false?

In_array does... i tried it another way but it didn't work either
Quote from Dygear :Are you willing to submit that patch to github Vic? If not I'll get around to it after I'm done with my rotations. If so, send me a pull request, and I'll submit it for the next version.

i think i'll submit a patch. Gotta look at some other locations which may have the same problem, but don't really know yet. So I'll have a look and submit a patch later on.
I'm about ready to get back into doing this again. I just finished my Paramedic Final Exam, for the class, I have some rotations left over (6x12 hour Amublance tours, 1x10 hours ER, 1x8 hours ED Eval.) after that I'll be free as a bird to do go back to my normal life. But I'm still pretty good as far as getting things done. As some of you know I got a Cr-48 from Google, and I have been giving feedback on the device and it's OS. I installed Ubuntu on this thing in a dual boot and I can dev on rotations now as I take it with me. So I should be able to do commits from here on out.

@T3, I hope all of the work you have done is in a new branch, so that I can download it and start giving you patches for the things you need for the web interface to work better. You should upload what you have to github, and send me a pull request for your branch so that I download it and start submitting patches to you.
Quote from Dygear :
@T3, I hope all of the work you have done is in a new branch, so that I can download it and start giving you patches for the things you need for the web interface to work better. You should upload what you have to github, and send me a pull request for your branch so that I download it and start submitting patches to you.

i wish i had an idea how to add files to github :P
What ever you have right now, make a new branch and then push that branch to your repo.

Read this thread and go to all of the links provided there. You'll get a much better idea on how to use git and git hub.

FGED GREDG RDFGDR GSFDG