Reply
Problem with mysql and tables in a php user script
Old 05-20-2008, 09:51 PM Problem with mysql and tables in a php user script
Junior Talker

Posts: 1
K people I just join about 5 minutes ago wandering if someone on this forum could help me after googling for about 10 minutes i found this forum.

My problem is if you go to my prototype layout of my website @ http://plasmasteelgames.zxq.net. you will see that in my navbar where it says "Welcome to Plasma Steel Games" and a login and register links it has two errors i have look at the code i don't know what to do to fix it and when you click on one of my link. let's say to register it opens the form up into the div object that the navbar is in and the navbar is gone. as you see the code for index.php the script uses the switch statement.

here's the script for the mysql errors:

config.php
Code:
<?php
ob_start();
//Allows us to use cookies on all of the pages

/*
iSuS - iScripting.net User System
v1.0 made by Panzer
http://www.iScripting.net
Copyright must stay intact
*/

//Get some additional functions
include('functions.php');
//*********************************************//
//Length Of Time Cookie Lasts - 1 week default
$cookieTime = time()+7*86400;
//***********************************************//
//Define The Salt
define('SALT', 'k589fhj45g4r45f2f14df1sd1'); //Example k483hl2948hHe73

//Path to index.php file , no following slash
//Eg, if the index file were located at http://iscripting.net/isus/index.php - you would enter http://iscripting.net/isus
$siteurl = "http://plasmasteelgames.zxq.net"; 

//Your Website name, not the <title>
$sitename = "Plasma Steel Games";

//The default membergroup when someone registers.
$defaultmembergroup = "user";

//Database information
$db_user = 'plasmasteelgames_zxq_net_admin';
$db_pass = '96498585';
$db_host = 'hosting.zymic.com';
$db_database = 'plasmasteelgames_zxq_net_users';
//**********************************************//

//Connect to the database
$connect = mysql_connect("$db_host","$db_user","$db_pass");

if (!$connect ) echo 'There was an error connecting to the database';

mysql_select_db("$db_database");


// Get and authenticate their cookie information.
$u1 = secure($_COOKIE['username']);
$p1 = secure($_COOKIE['password']);

//Check theyre logged in.
$logged = mysql_query("SELECT * FROM users WHERE username = '$u1' AND password = '$p1'");

$logged = mysql_fetch_array($logged, MYSQL_ASSOC);

//Rename some of the $logged['variables'] with easier names.
$uId = $logged['id'];
$uName = $logged['username'];
$uEmail = $logged['email'];
$uMsn = $logged['msn'];
$uIp = $logged['ip'];
$uSignup = $logged['signup'];
$uLevel = $logged['level'];
$uGtalk = $logged['gtalk'];
$uMsn = $logged['msn'];
$uAim = $logged['aim'];
$uLocation = $logged['location'];
$uBio = $logged['bio'];
$uGroup = $logged['gid'];
$uMembergroup = $logged['membergroup'];

//If the user isn't logged in, we'll set their name to guest and membergroup to guest as well so they don't screw anything up
if (!$uName) {

$uName = guest;
$uMembergroup = guest;

}
//Get the permissions sorted out.
$permquery1 = mysql_query("SELECT * FROM `permissions` WHERE mg_name = '$uMembergroup' ");
$userCan = mysql_fetch_assoc($permquery1);

$action = secure($_GET['action']);
$sa = secure($_GET['sa']);
$ssa = secure($_GET['ssa']);

?>
and here's the code for the index page

index.php
Code:
<html>
<head>
<title>Plasma Steel Games | Home</title>

</head>
<body BGcolor="#262626" text="#FFFFFF" LINK="#FF0000" VLINK="#FF0000" ALINK="#FF0000">

<div id="header" align="center">
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="1000" height="202" id="LOGO_F" align="middle">
    <param name="allowScriptAccess" value="sameDomain" />
    <param name="allowFullScreen" value="false" />
    <param name="movie" value="http://plasmasteelgames.zxq.net/header/LOGO_F.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" />    <embed src="http://plasmasteelgames.zxq.net/header/LOGO_F.swf" quality="high" bgcolor="#000000" width="1000" height="202" name="LOGO_F" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
    </object>
<br>
</div>

<div align="left">
<b>Login</b>
<br>
<form method="post" action="index.php?action=login">

    <b>Username:</b><input type="text" name="username"><br />
<br>
    <b>Password:</b><input type="password" name="password"><br />
    
    <input type="submit" name="login" value="Login">
</form>
</div>

<br>
<div id="navbar" align="left"
<?php
/*
iSuS - iScripting.net User System
v1.0 made by Panzer
http://www.iScripting.net
Copyright must stay intact
*/

// Get the configuration file
include ('config.php');

//Set the navigation up, secure it's input.
$nav = $_GET['action'];
secure($nav);

//Use a switch statement to go through the URLS.
switch($nav)

    {
        case "login":
            include('login.php');
        break;
        
        case "logout":
            include ('logout.php');
            break;
            
        case "editprofile":
            include ('editprofile.php');
            break;    
            
        case "memberlist":
            include ('memberlist.php');
            break;
            
        case "register":
            include ('register.php');
            break;    
            
            
    
    
        default:
echo "Welcome to $sitename $uName <br /><br />";
if($uId) {
echo "<b>Site Links</b><br /><br />";
if($userCan['viewprofile']) 
echo "<a href='$siteurl/index.php?action=memberlist'>View Memberlist</a><br /><br /><br />";


echo "<b>User Links</b><br />";

echo "<a href='$siteurl/index.php?action=home'>Home</a><br />";
echo "<a href='$siteurl/index.php?action=downloads'>Downloads</a><br />";
echo "<a href='$siteurl/index.php?action=music'>Music</a><br />";
echo "<a href='$siteurl/index.php?action=videos'>Videos</a><br />";
echo "<a href='$siteurl/index.php?action=animations'>Animations</a><br />";
echo "<a href='$siteurl/index.php?action=polls'>Polls</a><br />";
echo "<a href='$siteurl/index.php?action=contact'>Contact Us</a><br />";

echo "<a href='$siteurl/index.php?action=logout'>Logout</a><br />";

if($userCan['editprofile'])
echo "<a href='$siteurl/index.php?action=editprofile'>Edit Profile</a><br />";
} else {

echo "    <a href='$siteurl/index.php?action=login'>Login</a><br />
        <a href='$siteurl/index.php?action=register'>Register</a><br /> ";

            break;
    }
}
?>
</div>

<br>
<div id="counter" align="left">
<a href="http://www.website-hit-counters.com/website-statistics.html" target="_blank">
<img src="http://www.website-hit-counters.com/cgi-bin/image.pl?URL=55882-1649" alt="website statistics counter" border="0" >
</a>
<br>
<font style="font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 9px; color: #330006; text-decoration: none;">
<a href="http://www.website-hit-counters.com/website-statistics.html" target="_blank" style="font-family: Geneva, Arial, Helvetica, sans-serif; 
font-size: 9px; color: #555556; text-decoration: none;" title="web analytics">web analytics
</a>
</font>
</div>
</body>
</html>
plasmagames is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 05-20-2008, 10:41 PM Re: Problem with mysql and tables in a php user script
JeremyMiller's Avatar
Full-Time TeraTasker

Posts: 984
Name: Jeremy Miller
Location: Reno, NV
Your problem is at
PHP Code:
$permquery1 mysql_query("SELECT * FROM `permissions` WHERE mg_name = '$uMembergroup' ");
$userCan mysql_fetch_assoc($permquery1); 
Try adding echo mysql_error(); under each to see what the database is complaining about.
__________________
Jeremy Miller - TeraTask Technologies, LLC
Content Farmer - Automated Posting for Content & Blog Sites
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Reply     « Reply to Problem with mysql and tables in a php user script
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11340 seconds with 12 queries