|
Re: PHP help
[Re: Blade280891]
#202215
04/13/08 20:54
04/13/08 20:54
|
Joined: Oct 2004
Posts: 4,134 Netherlands
Joozey
Expert
|
Expert
Joined: Oct 2004
Posts: 4,134
Netherlands
|
What input field does refer to "dbhost"? I can't see it, and I don't know what this variable should contain (as the name is not very descriptive)... At least your problem is that the 'dbhost' variable is empty since it is not filled in by the form. EDIT: what broozar said
Click and join the 3dgs irc community! Room: #3dgs
|
|
|
Re: PHP help
[Re: Blade280891]
#202216
04/13/08 20:55
04/13/08 20:55
|
Joined: Jan 2008
Posts: 1,580
Blade280891
OP
Serious User
|
OP
Serious User
Joined: Jan 2008
Posts: 1,580
|
Ok, soz my mistake , i missed a $_POST thing. SO again problem sovled
My Avatar Randomness V2"Someone get me to the doctor, and someone call the nurse And someone buy me roses, and someone burned the church"
|
|
|
Re: PHP help
[Re: Blade280891]
#202225
04/13/08 21:41
04/13/08 21:41
|
Joined: Jan 2008
Posts: 1,580
Blade280891
OP
Serious User
|
OP
Serious User
Joined: Jan 2008
Posts: 1,580
|
Does anyone no how to set user rights/classes? My idea was to add a value to them in the MySql database and then each time someone logs in check for that value. I also have this code
<?php
// Random Game Design: PHP Website Template
// Version 1
// Copyright Dean Whitehouse, 2008
include 'db_connect.php';
include 'config_table.inc.php';
$sql_user = "CREATE TABLE $user(
user_id int(10) AUTO_INCREMENT NOT NULL PRIMARY KEY,
user_name varchar(100) NOT NULL,
user_password varchar(100) NOT NULL,
user_email varchar(100) NOT NULL,
user_timezone char(3) NOT NULL,
user_hideemail tinyint(3) unsigned NOT NULL,
user_ip varchar(20) NOT NULL,
user_ban tinyint(3) unsigned NOT NULL,
user_realname varchar (40) NOT NULL,
user_age int(10) unsigned NOT NULL,
user_class varchar(100) NOT NULL,
userlevel tinyint(1) unsigned NOT NULL
)";
$make_user= mysql_query($sql_user);
$checkifexist = mysql_query ("SELECT * FROM '$user' LIMIT 0,1");
if ($make_user)
{
echo("'$user' Table Created. <form action='make_admin.php'>
<input type='submit' value='Continue' name='check'>
</form>");
}
else
{
echo("Table all ready exists. Please go back and enter a different name.<FORM>
<form action='name_tables.php'>
<INPUT TYPE='submit' VALUE='Back'></FORM>");
}
mysql_close();
?>
but the back button doesn't work. the address changes from create_tables.php?check=Continue to create_tables.php?
Last edited by Blade28081991; 04/13/08 21:54.
My Avatar Randomness V2"Someone get me to the doctor, and someone call the nurse And someone buy me roses, and someone burned the church"
|
|
|
Re: PHP help(urgent)
[Re: Blade280891]
#202607
04/15/08 23:01
04/15/08 23:01
|
Joined: Jan 2008
Posts: 1,580
Blade280891
OP
Serious User
|
OP
Serious User
Joined: Jan 2008
Posts: 1,580
|
This code, below is supposed to check the database for the user level, if the level = 1, this would be given the admin cookie. If the level = 0 , this would get given the user cookie, but i can't get it to work. If anyone knows it would really help.
<?php
include '../includes/db_connect.php';
include '../includes/config_table.inc.php';
$user_name = $_POST["user_name"];
$user_password = $_POST["user_password"];
if ($user_name && $user_password)
{
$salt = substr($user_password, 0, 2);
$userPswd = crypt($user_password, $salt);
$login_check = mysql_num_rows(mysql_query("SELECT * FROM `$user` WHERE user_name='$user_name' AND user_password='$userPswd'" ));
$check_ad = mysql_query("SELECT * FROM `$user` WHERE userlevel = '0'");
$check_us = mysql_query("SELECT * FROM `$user` WHERE userlevel = '1");
if ($login_check == 1 && $check_ad)
{
echo "Logged In Sucessfully. Please wait while you are redirected";
echo "<meta http-equiv='refresh' content='2; url=setadmincookie.php?&u=$username&p=$user_password'>";
}
else
if ($login_check == 1 && $check_us)
{
echo "Logged In Sucessfully. Please wait while you are redirected";
echo "<meta http-equiv='refresh' content='2; url=setcookie.php?&u=$username&p=$user_password'>";
}
else
{
echo 'Login failed. Username and Password did not match database entries.';
}
}
else
{
echo "Form was not completed. Please go back and make sure that the form was fully completed.";
}
mysql_close();
?>
My Avatar Randomness V2"Someone get me to the doctor, and someone call the nurse And someone buy me roses, and someone burned the church"
|
|
|
|