Login From Another Site?
#21
Rohan Shenoy Wrote:
Hockey Foo Wrote:Still didn't work.
What didn't work out? logging out or setting the cookies?

I can't log in from another website without it taking me to the forum.
#22
Hockey Foo Wrote:
Rohan Shenoy Wrote:
Hockey Foo Wrote:Still didn't work.
What didn't work out? logging out or setting the cookies?

I can't log in from another website without it taking me to the forum.

You can't do that. The user will HAVE to be taken once to the forum to set the cookies.
#23
Rohan Shenoy Wrote:
Hockey Foo Wrote:
Rohan Shenoy Wrote:
Hockey Foo Wrote:Still didn't work.
What didn't work out? logging out or setting the cookies?

I can't log in from another website without it taking me to the forum.

You can't do that. The user will HAVE to be taken once to the forum to set the cookies.
OK, so now is there a way so that once they've logged in when they return to the page the logged in from is says something like "Hello, {USERNAME}!" and then has a log out button.
#24
I have done something similar for my website. Check the sidebar at http://www.biologyformhtcet.com. Here is the small part of script which I wrote for it:
Remember to change the following values in it:
1. The action attribute of the form to point it to your login script(login.php: Eg: http://domain/mybbforums/login.php).
2. The URL for registration. Point it to register.php( Eg: http://domain/mybbforums/member.php?action=register)
3. The URL in the last red line you see in the above code. It should point to private.php(Eg:http://domain/mybbforums/private.php )

I have not included a 'logout button here. Kindly note that.'
<?php
//Copyright 2008. Rohan Shenoy. rohanshenoy [at] bluebottle.com.
//Please do not remove this copyright notice.
$hostname="localhost";//Name of host. Mostly is localhost
$username="";//databse username 
$password="";// database password
$database="";//databse name
//If you used specific TABLE PREFIX in while installing your forums, please add them in the below values. Else leave the below $table values as it is.
$table1="mybb_users";// users table
$table2="mybb_threads";//threads
$table3="mybb_privatemessages";//privatemessages
$limit="6";//Shows 6 threads from your forum. Change limit as per your wish
function greet()
{
echo "<span class=\"greet\">Welcome <b>guest</b>.<br>Please Login or <a href=\"http://www.forum.biologyformhtcet.com/member.php?action=register\">register</a></span><br /><br />";
echo "<div class=\"login-box\" id=\"login-box\"><form action=\"http://www.forum.biologyformhtcet.com/member.php\" method=\"post\" target=\"_blank\">Username:<br><input type=\"text\" class=\"login-forint\" name=\"username\" size=\"15\" maxlength=\"30\"  value=\"username\"><br>password:<br><input type=\"password\" name=\"password\" size=\"15\"><br> <a href=\"http://www.forum.biologyformhtcet.com/member.php?action=lostpw\"><span> Lost your password?</span></a><br><input type=\"submit\" name=\"submit\" value=\"Login\" /><input type=\"hidden\" name=\"action\" value=\"do_login\"></form></div>";
}
mysql_connect("$hostname","$username","$password");
mysql_select_db("$database");
if(isset($_COOKIE["mybbuser"]))
{
$mybbuser=$_COOKIE["mybbuser"];
$exclk=explode("_",$mybbuser);
$uid=$exclk[0];
$clk=$exclk[1];
$query1="SELECT * FROM $table1 WHERE uid='$uid' AND loginkey='$clk'";
$result1=mysql_query($query1);
$udataholder=mysql_fetch_row($result1);
$uname=$udataholder[1];
echo "<span class=\"greet\">Welcome <b>$uname</b>!<br><br>";
$query3="SELECT * FROM $table3 WHERE uid='$uid' AND status='0'";
$unreadPMs=mysql_numrows(mysql_query($query3));
echo "You have <a href=\"http://www.forum.biologyformhtcet.com/private.php\">$unreadPMs</a> unread private messages in your inbox.</span><br><br>";
}
else
{
greet();
}

?>
#25
I get a ton of errors. Sad
#26
Can you show me where you have installed this script and what errors are you getting?
#27
Rohan Shenoy Wrote:Can you show me where you have installed this script and what errors are you getting?

I'll get that in a second.
Does it have to be a .php file? When I tried it as a .php I got more errors.

Here are the errors, view this website and it is in the blue box. http://thehockeyarena.ismywebsite.com
#28
1. Yes it has to end in .php extension
2. Since you are using free/shared hosting are you sure about your database name, username and password? It better to get them confirmed from their support team.
3. Please post the errors you are getting when using a .php extension.
#29
Rohan Shenoy Wrote:1. Yes it has to end in .php extension
2. Since you are using free/shared hosting are you sure about your database name, username and password? It better to get them confirmed from their support team.
3. Please post the errors you are getting when using a .php extension.

I created my own database and name and stuff, but I think I might have the MySQL wrong. It has to be MySQL correct?
#30
Yes you need to use a MySQL database with MyBB.
Dennis Tsang
Former MyBB Team Member
Web: http://dennistt.net


Forum Jump:


Users browsing this thread: 1 Guest(s)