ace
02-12-2002, 08:17 AM
Ok, I'm on a mission to expand my knowledge of PHP and MySQL. So as a project, i decided to try and integrate vB (Yes I am Licensed! Check my records :D) with a news script written by a friend of mine. now this is my problem(s).
My friend's News script uses sessions (vB uses Sessions for admin and cookies for users) and only supports one news poster (the admin).
So I was thinking that if i could modify this enough, i could get it to work with vB. What I'm planning to do is use the usergroupid variable from vB and create a newsposter's group and then multiple people would be able to post news and not just the admin.
The problem i ran into was that when i tried to login, it would not accept my password. I think this has something to do with the MD5 encryption that vB uses on their passwords. How would I be able to do this?
adminlogin.php
<?php
include("../config.php");
include("../global.php");
session_start();
if(!isset($uid)) {
?>
<html><head>
<title>X-Gate admin</title></head>
<body leftmargin="10" topmargin="10" marginwidth="10" marginheight="10">
<br><br><br>
<table cellpadding="1" cellspacing="0" border="0" align="center" width="450" bgcolor="<?=$menucolor1?>">
<tr><td><table cellpadding="4" cellspacing="0" border="0" width="100%">
<tr><td><font size='2'><b><font size="3" face="Arial" color="#000000">Please Log in:</font></b></font></td>
</tr><tr>
<td align="center" nowrap bgcolor="<?=$leftcontentmenu?>">
<p><font face="Arial" size="2" color="#000000">You are either not a valid administrator or have not logged in.<br>
</font>
<form method="post" action="<?=$PHP_SELF?>">
<table cellpadding="0" cellspacing="1" border="0">
<tr><td><input type="text" name="uid"></td>
<td><input type="password" name="pwd"></td>
<td><input type="submit" value="Log in"></td>
</tr><tr><td><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#000000">Username</font></td>
<td colspan="2"><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#000000">Password</font></td>
</tr></table>
</form>
</td></tr></table>
</td></tr></table>
<p align="center"><font size="1" face="Verdana"><b>X-Gate v1.3 Administrator Control Panel</b></font></p>
</body></html>
<?php
exit;
}
session_register("uid");
session_register("pwd");
mysql_select_db("auspc_net");
$sql = "SELECT * FROM user WHERE username = '$uid' AND password = '$pwd'";
$result = mysql_query($sql);
if ($number = mysql_num_rows($result) == 0) {
session_unregister("uid");
session_unregister("pwd");
?>
<br>
<meta http-equiv ="Refresh" content = "0 ; URL=<?=$HTTP_REFERER?>">
<?php
exit;
}
$adminname = mysql_result($result,0,"userid");
$adminemail = mysql_result($result,0,"email");
$password = mysql_result($result,0,"password");
?>
global.php
<?php
mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database");
mysql_select_db ($DBname);
$result = mysql_db_query($DBname, "SELECT * FROM newsoptions");
$row = mysql_fetch_array($result);
$adminname = $row["adminname"];
$adminemail = $row["adminemail"];
$welcome_msg = $row["welcomemsg"];
$boxxnet_site = $row["xgate"];
$sitename5 = $row["sitename"];
$backgroundcolor = $row["color1"];
$menucolor1 = $row["color2"];
$textcolor = $row["textcolor"];
$leftcontentmenu = $row["color3"];
$footer = $row["footer"];
$logoimage = $row["logoimage"];
$siteurl = $row["siteurl"];
$titlecolor = $row["titlecolor"];
$titlebgcolor = $row["titlebgcolor"];
$version = $row["version"];
$leftmwidth = $row["leftmwidth"];
?>
Any help GREATLY appreciated.
Cheers
My friend's News script uses sessions (vB uses Sessions for admin and cookies for users) and only supports one news poster (the admin).
So I was thinking that if i could modify this enough, i could get it to work with vB. What I'm planning to do is use the usergroupid variable from vB and create a newsposter's group and then multiple people would be able to post news and not just the admin.
The problem i ran into was that when i tried to login, it would not accept my password. I think this has something to do with the MD5 encryption that vB uses on their passwords. How would I be able to do this?
adminlogin.php
<?php
include("../config.php");
include("../global.php");
session_start();
if(!isset($uid)) {
?>
<html><head>
<title>X-Gate admin</title></head>
<body leftmargin="10" topmargin="10" marginwidth="10" marginheight="10">
<br><br><br>
<table cellpadding="1" cellspacing="0" border="0" align="center" width="450" bgcolor="<?=$menucolor1?>">
<tr><td><table cellpadding="4" cellspacing="0" border="0" width="100%">
<tr><td><font size='2'><b><font size="3" face="Arial" color="#000000">Please Log in:</font></b></font></td>
</tr><tr>
<td align="center" nowrap bgcolor="<?=$leftcontentmenu?>">
<p><font face="Arial" size="2" color="#000000">You are either not a valid administrator or have not logged in.<br>
</font>
<form method="post" action="<?=$PHP_SELF?>">
<table cellpadding="0" cellspacing="1" border="0">
<tr><td><input type="text" name="uid"></td>
<td><input type="password" name="pwd"></td>
<td><input type="submit" value="Log in"></td>
</tr><tr><td><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#000000">Username</font></td>
<td colspan="2"><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#000000">Password</font></td>
</tr></table>
</form>
</td></tr></table>
</td></tr></table>
<p align="center"><font size="1" face="Verdana"><b>X-Gate v1.3 Administrator Control Panel</b></font></p>
</body></html>
<?php
exit;
}
session_register("uid");
session_register("pwd");
mysql_select_db("auspc_net");
$sql = "SELECT * FROM user WHERE username = '$uid' AND password = '$pwd'";
$result = mysql_query($sql);
if ($number = mysql_num_rows($result) == 0) {
session_unregister("uid");
session_unregister("pwd");
?>
<br>
<meta http-equiv ="Refresh" content = "0 ; URL=<?=$HTTP_REFERER?>">
<?php
exit;
}
$adminname = mysql_result($result,0,"userid");
$adminemail = mysql_result($result,0,"email");
$password = mysql_result($result,0,"password");
?>
global.php
<?php
mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database");
mysql_select_db ($DBname);
$result = mysql_db_query($DBname, "SELECT * FROM newsoptions");
$row = mysql_fetch_array($result);
$adminname = $row["adminname"];
$adminemail = $row["adminemail"];
$welcome_msg = $row["welcomemsg"];
$boxxnet_site = $row["xgate"];
$sitename5 = $row["sitename"];
$backgroundcolor = $row["color1"];
$menucolor1 = $row["color2"];
$textcolor = $row["textcolor"];
$leftcontentmenu = $row["color3"];
$footer = $row["footer"];
$logoimage = $row["logoimage"];
$siteurl = $row["siteurl"];
$titlecolor = $row["titlecolor"];
$titlebgcolor = $row["titlebgcolor"];
$version = $row["version"];
$leftmwidth = $row["leftmwidth"];
?>
Any help GREATLY appreciated.
Cheers