- Check if IPB session is valid?
- Check if IPB session is valid?
-
Check if IPB session is valid?
I know the function, but I'll be damned if I know how to use it properly, lol. I'm making a script to check if a user is logged in, and there is one bump in the road I can't resolve: how to check if an IPB session is valid. Here's what I have so far: // User ID $user_id = isset($_COOKIE['member_id']) ? $_COOKIE['member_id'] : ""; // Check if logged in $cook_session = $_COOKIE['session_id']; $cook_hash = $_COOKIE['pass_hash']; if (!empty($cook_session) && !empty($cook_hash)){ if ($cook_session != "0" && $cook_hash != "0"){ $ipb_session = mysql_result(mysql_query(sprintf("SELECT id FROM ". $ipb_prefix ."_sessions WHERE member_id='%s'", mysql_real_escape_string($user_id))),0); $ipb_hash = mysql_result(mysql_query(sprintf("SELECT member_login_key FROM ". $ipb_prefix ."_members WHERE id='%s'", mysql_real_escape_string($user_id))),0); if ($cook_session = $ipb_session && $cook_hash = $ipb_hash){ if (session_is_registered(/* what to put here? */)){ $logged_in = true; } else { $logged_in = false; } } else { $logged_in = false; } } else { $logged_in = false; } } else { $logged_in = false; } The rest of the script works fine, there are some kinks, but the main functionality is good. It's just that, when you log into an IPB forum, a session is created. Now if you are inactive on the forum for a certain amount of time, the session is destroyed and you are logged out. The problem with my script is that it doesn't know when the session is destroyed therefore it still thinks you're logged in when you aren't.
-
Curly Brackets
I use Notepad++. It's got everything I need/want plus more!
-
.htaccess not working
Also make sure you have permission to use .htaccess, it's always a bitch when you don't.
-
Databse Query Function
Those variables are set when the function is called. eg: function test($test){ echo "testing function". $test ."testing function"; } test("abcd"); would be the same as this: echo "testing function abcd testing function"; Oh I see... I haven't learnt how to do arrays properly yet, lol. It's something I'm going to have to get around to. Anyway, now my script is working well, if anyone wants to know how to detect if you are logged on to an IPB forum externally, let me know, lol.
-
Databse Query Function
Well the main point of creating the function was so I didn't have to keep creating extra variables for every query I made, so I think it'll be easier just to use variables like this: $ipb_session = mysql_result(mysql_query(sprintf("SELECT id FROM ". $ipb_prefix ."_sessions WHERE member_id='%s'", mysql_real_escape_string($user_id))),0); Thanks for your help though.
-
Databse Query Function
Doesn't show anything. I've just discovered that mysql_result only fails in a function for some reason. If I use that coding outside a function it works, but if it's in a function I get this error: Warning: mysql_result(): supplied argument is not a valid MySQL result resource in * on line *
-
Databse Query Function
Ok, so I'm coding this script, and I need to see if a member is logged in to an IPB forum. I know how to do that and all, but one function I need in order to majorly simplify and shorten the script, is refusing to work. Basically it's a database query, anyway have a look at what I've got and you should be able to figure out what I want to do, and hopefully where I went wrong. function query_ibf($table,$field){ $query = sprintf("SELECT ". $field ." FROM ". $table); $result = mysql_query($query); echo $result; // I'm almost certain this is the problem } I call the function, but nothing happens. Also, don't psyc out at me for trying to echo the result, lol. It was a last resort as I've also tried mysql_fetch_array, mysql_fetch_assoc and mysql_result but they all returned errors. If you're a little confused still, here's how I used it. $ipb_session = query_ibf("sessions","id"); Thanks to anyone who can help!
-
What bugs you with this page?
Ahh, ok.
-
What bugs you with this page?
That design looks much better. But I'm not really digging the color scheme. Maybe try some shades of brown similar to the other one?
-
What bugs you with this page?
Here are some pointers: - make the whole thing a bit wider - make everything just a little bit closer together - make the banner a little smaller heightwise, and make it less blurry - make the Folded cards >> General part the same width as the part above it - use the same font all the way through the website - make the copyright text a little smaller - put a little but of margin at the top, like it is at the bottom - make the whole thing have rounded corners - instead of using hover images in the nav table, just make the background image change for each row on hover and use plain text
-
Which Forum Software
IPB all the way, it's brilliant. You only have to pay once for a license, and you can use it forever. There are tonnes of forums around for free mods and free skins, it's really customizable, powerful, everything.
-
How do I prevent hotlinking pics?
I can't seem to get it to work properly. :\ I can block an image, but when I try to get it to be replaced by another image it still only blocks it.
-
How do I prevent hotlinking pics?
Thanks, I'll have a try of that tomorrow.