Jump to content

sleepnot

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Everything posted by sleepnot

  1. thanks! solved it should be 'root' and ''
  2. it says Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'username'@'localhost' (using password: YES) in C:\wamp\www\Forum\config.php on line 9 Call Stack # Time Memory Function Location 1 0.0009 396096 {main}( ) ..\index.php:0 2 0.0014 399640 include( 'C:\wamp\www\Forum\config.php' ) ..\index.php:3 3 0.0014 399840 mysql_connect ( ) ..\config.php:9 cannot connect <?php mysql_connect('localhost', 'username', 'password') or die("cannot connect"); mysql_select_db('db'); //Username of the Administrator $admin='admin'; //Forum Home Page $url_home = 'index.php'; //Design Name $design = 'default'; include('init.php'); ?>
  3. it says. Notice: Undefined index: logged in C:\wamp\www\WAR\luga\index.php on line 10 Notice: Undefined index: userlogin in C:\wamp\www\WAR\luga\index.php on line 54 Notice: Undefined index: password in C:\wamp\www\WAR\luga\index.php on line 54 wrong pawssword or username, please try againplease enter your login information to proceed with our site <html> <head> <title>login page</title> </head> <body bgcolor="white" style="color:black"> <form action="index.php" method=get> <h1 align="center" style="color:black" >Welcome to this simple application</h1> <?php session_start(); if( $_SESSION["logging"]&& $_SESSION["logged"]) { print_secure_content(); } else { if(!$_SESSION["logging"]) { $_SESSION["logging"]=true; loginform(); } else if($_SESSION["logging"]) { $number_of_rows=checkpass(); if($number_of_rows==1) { $_SESSION[user]=$_GET[userlogin]; $_SESSION[logged]=true; print"<h1>you have loged in successfully</h1>"; print_secure_content(); } else{ echo "wrong pawssword or username, please try again"; loginform(); } } } function loginform() { echo "please enter your login information to proceed with our site"; echo ("<table border='2'><tr><td>username</td><td><input type='text' name='userlogin' size'20'></td></tr><tr><td>password</td><td><input type='password' name='password' size'20'></td></tr></table>"); echo "<input type='submit' >"; echo "<h3><a href='registerform.php'>register now!</a></h3>"; } function checkpass() { $servername="localhost"; $username="root"; $conn= mysql_connect($servername,$username)or die(mysql_error()); mysql_select_db("uploads",$conn); $sql="select * from users where name='$_GET[userlogin]' and password='$_GET[password]'"; $result=mysql_query($sql,$conn) or die(mysql_error()); return mysql_num_rows($result); } function print_secure_content() { echo("<b><h1>hi mr.$_SESSION[user]</h1>"); echo "<br><h2>only a logged in user can see this</h2><br><a href='logout.php'>Logout</a><br>"; } ?> </form> </body> </html>
  4. this Nofications appear.. Notice: Undefined index: id in C:\wamp\www\WAR\up3\view.php on line 4 Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given in C:\wamp\www\WAR\up3\view.php on line 9 invalid id this is my code. <?php require ('dbconnect.php'); // Connect to database $id = $_GET['id']; // ID of entry you wish to view. To use this enter "view.php?id=x" where x is the entry you wish to view. $query = "SELECT data, filetype FROM uploads where uploadid=$id"; //Find the file, pull the filecontents and the filetype $result = MYSQL_QUERY($query); // run the query if($row=mysql_fetch_row($result)) // pull the first row of the result into an array(there will only be one) { $data = $row[0]; // First bit is the data $type = $row[1]; // second is the filename Header( "Content-type: $type"); // Send the header of the approptiate file type, if it's' a image you want it to show as one print $data; // Send the data. } else // the id was invalid { echo "invalid id"; } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.