Dynadot โ€” .com Registration $8.99

Php

Spaceship Spaceship
Watch

Coolprogram

Established Member
Impact
7
Hey can someone please help me on this PHP code please thank you it is a login fail form i think?
Code:
<?
include "session.php";

$dbservertype='mysql';
$servername='localhost';
// username and password to log onto db server
$dbusername='paintman_Admin';
$dbpassword='******';
// name of database
$dbname='paintman_signup';

////////////////////////////////////////
////// DONOT EDIT BELOW  /////////
///////////////////////////////////////
connecttodb($servername,$dbname,$dbusername,$dbpassword);
function connecttodb($servername,$dbname,$dbuser,$dbpassword)
{
global $link;
$link=mysql_connect ("$servername","$dbuser","$dbpassword");
if(!$link){die("Could not connect to MySQL");}
mysql_select_db("$dbname",$link) or die ("could not open db".mysql_error());
}
//////////////////////////////
?>
<!doctype html public "-//w3c//dtd html 3.2//en">

<html>

<head>
<title>Fail Login</title>
<meta name="GENERATOR" content="Arachnophilia 4.0">
<meta name="FORMATTER" content="Arachnophilia 4.0">
</head>

<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
<?
$userid=mysql_real_escape_string($userid);
$password=mysql_real_escape_string($password);

if($rec=mysql_fetch_array(mysql_query("SELECT * FROM plus_signup WHERE userid='$userid' AND password = '$password'"))){
	if(($rec['userid']==$userid)&&($rec['password']==$password)){
	 include "include/newsession.php";
            echo "<p class=data> <center>Successfully,Logged in<br><br><a href='logout.php'> Log OUT </a><br><br><a href=welcome.php>Click here if your browser is not redirecting automatically or you don't want to wait.</a><br></center>";
     print "<script>";
       print " self.location='welcome.php';"; // Comment this line if you don't want to redirect
          print "</script>";

				} 
		}	
	else {

		session_unset();
echo "<font face='Verdana' size='2' color=red>Wrong Login. Use your correct  Userid and Password and Try <br><center><input type='button' value='Retry' onClick='history.go(-1)'></center>";
		
	}
?>
Thank You,
-Coolprogram​
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Maybe could you explain more ? Any error message ?... We can't just run this script because it includes other files..
 
0
•••
It says this "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/paintman/public_html/loginck.php on line 48
Wrong Login. Use your correct Userid and Password and Try"

I have anothre one that i am having a problem with this "
Code:
<?

include "include/session.php";
session_unset();
session_destroy();

?>
<!doctype html public "-//w3c//dtd html 3.2//en">

<html>

<head>
<title>(Type a title for your page here)</title>

<meta name="GENERATOR" content="Arachnophilia 4.0">
<meta name="FORMATTER" content="Arachnophilia 4.0">
</head>

<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
<?

echo "<center><font face='Verdana' size='2' >Successfully logged out. <br><br> <a href=login.php>Login</a></font></center>";

?>
<center>
<br><br><a href='http://www.plus2net.com'>PHP SQL HTML free tutorials and scripts</a></center> 

</body>

</html>
The error is this "Warning: main(include/session.php): failed to open stream: No such file or directory in /home/paintman/public_html/logout.php on line 10

Warning: main(include/session.php): failed to open stream: No such file or directory in /home/paintman/public_html/logout.php on line 10

Warning: main(): Failed opening 'include/session.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/paintman/public_html/logout.php on line 10

Warning: session_destroy(): Trying to destroy uninitialized session in /home/paintman/public_html/logout.php on line 12
Successfully logged out.
 
0
•••
Is the file called "loginck.php" you paste in the first post ? Are you sure about your username/password and database name for your mysql database ? Maybe it's "paintman_admin" and not "paintman_Admin" ? Hope that can helps, but obviously it's a mysql connexion related problem.
 
0
•••
Yeah, the error is with this line:

PHP:
if($rec=mysql_fetch_array(mysql_query("SELECT * FROM plus_signup WHERE userid='$userid' AND password = '$password'"))){

You can seperate out the query and add an "or die" statement to it to get the actual error that's coming out... but just like your last request, does the table exist?

For the second error, do you have a file called session.php in the

/home/paintman/public_html/include

directory? Does that directory exist and is it in the right spot? If the file is there, and the path is correct, then check the permissions on the file. You might have to loosen them up a little or check the owner or yada yada yada...
 
0
•••
Dynadot โ€” .com Registration $8.99Dynadot โ€” .com Registration $8.99
Appraise.net
Unstoppable Domains
Domain Recover
DomainEasy โ€” Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back