News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Need a little help..

Started by Onepamopa, March 25, 2011, 02:39:49 PM

Previous topic - Next topic

Onepamopa

Hi all. I dont know if this is the right place to discuss this, if it isnt - move the topic, I wont mind :)
Now.. I have a home-made php webpage that uses forum auth (it's punbb).
I want to use SMF2.0 instead, but I'm having problems adapting login/logout procedures to smf standarts.

Here's my code:

session_start();
define('FORUM_ROOT', 'forum/');
require FORUM_ROOT.'include/common.php';
// Where will we go after login?
$forum_page['redirect_url'] = 'http://testpage.eu';
$forum_page['form_action'] = forum_link($forum_url['login']);
$forum_page['hidden_fields'] = array(
    'form_sent' => '<input type="hidden" name="form_sent" value="1" />',
    'redirect_url' => '<input type="hidden" name="redirect_url" value="'.forum_htmlencode($forum_page['redirect_url']).'" />',
    'csrf_token' => '<input type="hidden" name="csrf_token" value="'.generate_form_token($forum_page['form_action']).'" />'
);


Here's the actual login form:


                    <div id="lpanel">
                        <?
                        if (!$forum_user['is_guest'])
                        {
                            echo "<div class=\"usermenu\">";
                            echo "<a href=\"myhome\"><img src=\"images/button1.png\" width=\"90\" height=\"23\" alt=\"\" /></a><br />";
                            echo "<a href=\"forum/pun_pm/inbox/\"><img src=\"images/button2.png\" width=\"90\" height=\"23\" alt=\"\" /></a><br />";
                            echo "<a href=\"forum/logout/".$forum_user['id']."/".$forum_user['csrf_token']."/\"><img src=\"images/button3.png\" width=\"90\" height=\"23\" alt=\"\" /></a>";
                            echo "</div><div id=\"ltext\" style=\"padding-top: 5px;\">";
                            echo "Logged in as: <a href=\"forum/user/".$forum_user['id']."\">".$forum_user['username']."</a>";
                            if($forum_user['is_admmod']==1){
                                echo " | <a href=\"admin\">Admin Panel</a>";
                            }
                            echo "</div>";
                        }
                        else
                        {

                            ?>
                        <form action="<?php echo $forum_page['form_action'?>" method="post">
                            <?php echo implode("\n\t\t"$forum_page['hidden_fields'])."\n" ?>
                            <table border="0">
                                <tr><td width="10"><img class="img" src="images/user.png" width="17" height="19" alt="" /></td><td><input type="text" name="req_username" id="userinput" /></td></tr>
                                <tr><td width="10"><img class="img" src="images/pass.png" width="17" height="19" alt="" /></td><td><input type="password" name="req_password" id="passinput" /></td></tr>
                            </table>
                            <input type="submit" name="submit" value="" id="login" />
                            <a href="forum/register/" id="register"><img src="images/register.png" alt="" border="0" /></a>
                            <div id="ltext">
                                <a href="forum/request/password/">Forget Password?</a>
                            <input type="checkbox" id="input" name="save_pass" value="1" /><span>Remember me</span></div>
                        </form>
                        <? } ?>
                    </div>


If someone is willing to help me adapt this code to smf standarts, I'd be grateful.
Thanks already
Dobri Dobrev

NanoSector

Allright.....

Ever took a lesson with SMF-development before beginning?
$forum_***['index'] isn't correct.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Onepamopa

I havent used smf before today. I know that the hooks I pasted @ my message are wrong, of course - they are punbb's..
that's what I'm trying to say - I need help converting it to smf.

Arantor

Since I don't know PunBB, not having used it in 5 years, would you mind explaining what it is you're trying to achieve?

Onepamopa

well, my php homepage uses punbb to achieve login/register.
I want to make it use smf instead - mainly cause smf's is like "top-of-the-line" forum, and punbb isnt.

So, the 1st code is located @ top of index.php
and the 2nd - is in a <div> box located somewhere @ the page.
when I login/logout, it redirects me back to my webpage. I need this using smf.

Since I know almost nothing about smf and it's hooks, I'm looking for help here...


Illori

please do not bump your topic within 24 hours yet not even 1 hour. we are all volunteers and will reply if and when we know the answer.

Arantor

I'm sorry that you know, I had to step away to do things like eat. Patience is normally desired here.

More reading:
SSI Readme
How to use the SMF user system outside of SMF
How do I integrate SMF into my PHP coded website?

In other words, start by including SSI.php and not starting a session, and going from there.

Onepamopa

Thanks, I'm already modifying SSI.php, after that I'll make separate functions for what I need and include them @ SSI.php. :)

NanoSector

Quote from: Onepamopa on March 25, 2011, 04:28:09 PM
Thanks, I'm already modifying SSI.php
:o

HALT, HU, STOP!

Why do you want to modify SSI.php at first?

It almost provides every function SMF has...
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Arantor

Quote from: Onepamopa on March 25, 2011, 04:28:09 PM
Thanks, I'm already modifying SSI.php, after that I'll make separate functions for what I need and include them @ SSI.php. :)

And it'll be overwritten when you upgrade to 2.0 final. There should be no need to modify it at all.

Advertisement: