Jump to content

Wha.... the heck


jkewlo

Recommended Posts

im trying to use ms acces and php to create a log in script

 

and let me tell u what it isnt very much fun.

 

i dont think access should be aloud to be used with php should be against the law to use with it

 

well this is my script

 

<?
session_start();

$email = @$_POST['email'];
$password = @$_POST['password'];

$conn = new COM('ADODB.Connection') or die('Could not make conn');
$rs = new COM('ADODB.Recordset') or die('Coult not make rs');

$connstring = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\\wamp\\www\\pro\\project\\Rainwater.mdb";


$conn->Open($connstring);
if (!$conn)
  {exit("Connection Failed: " . $conn);}
$sql="SELECT email, password 
FROM sign 
WHERE email = '".$email."' AND passsword = '".$password."'  
";
$rs->Open($sql, $conn);

if(odbc_num_rows($rs) != 1){
$error = "Error with the username and or password please go back";
header('location: signin.php');
}else {
    $_SESSION['email'] = "$email";
    header('location: profile.php');
}

?>

 

 

 

Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> Microsoft JET Database Engine<br/><b>Description:</b> No value given for one or more required parameters.' in C:\wamp\www\pro\project\check.php:20 Stack trace: #0 C:\wamp\www\pro\project\check.php(20): com->Open('SELECT email, p...', Object(com)) #1 {main} thrown in C:\wamp\www\pro\project\check.php on line 20

 

is the error code i have no idea

i see where it says no value given. which there is a value giving email and password from the form.

 

any one have any clue on what to do?

 

and there are like no good tutorials for MS ACCESS (odbc) tutorials on the net

Link to comment
Share on other sites

It would be helpful if you could mark which line is line 20, but just giving it a quick glance, you mistyped 'password' in your sql select statement.  Also, you really don't need all those quotes:

$sql="SELECT email, password FROM sign WHERE email = $email AND password = $password"; would work.

Link to comment
Share on other sites

It would be helpful if you could mark which line is line 20, but just giving it a quick glance, you mistyped 'password' in your sql select statement.  Also, you really don't need all those quotes:

$sql="SELECT email, password FROM sign WHERE email = $email AND password = $password"; would work.

 

shhhhhh lol

Link to comment
Share on other sites

its not me im helping a person that imd me. almost got it done.

 

<?
session_start();

$email = @$_POST['email'];
$password = @$_POST['password'];

$conn = new COM('ADODB.Connection') or die('Could not make conn');
$rs = new COM('ADODB.Recordset') or die('Coult not make rs');

$connstring = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\\wamp\\www\\pro\\project\\Rainwater.mdb";


$conn->Open($connstring);
if (!$conn)
  {exit("Connection Failed: " . $conn);}
$sql="SELECT email, password 
FROM sign 
WHERE email = '".$email."' AND password = '".$password."'  
";
$rs->Open($sql, $conn);

if(odbc_num_rows($rs) != 1){
$error = "Error with the email and or password please go back";
header('location: sign_in.php?error=1');
}else {
    $_SESSION['email'] = "$email";
    header('location: profile.php');
}

?>

no error's

but when the email and password are correct it still sends you to the sign_in.php

 

i guess she has no choice i wish it was MySQL id be done damnit. lol

Link to comment
Share on other sites

When variables are placed inside a double quoted string, think of it as a macro or text replacement. It will literally take the text or whatever that is in the variable and put it in there.

 

You need single quotes around your field values.

 

So ...

<?php
$email = "charlieholder@email.com";
$sql = "
SELECT * FROM table
WHERE email='$email'
";
echo $query;
?>

 

The output would be:

SELECT * FROM table WHERE email='charlieholder@email.com'

 

 

Link to comment
Share on other sites

nope sends me back to the sign_in.php!

 

sign_in.php

<?

session_start();
if (!isset($_SESSION['page_history'])) { $_SESSION['page_history'] = array(); } // Make the array if it hasn't been made
array_push($_SESSION['page_history'], 'Sign in | singin.php'); // Push the current page's title and URL to the array
if (count($_SESSION['page_history']) > 3) { array_shift($_SESSION['page_history']); } // If the array is getting too long, shorten it

function display_breadcrumbs() {
    foreach ($_SESSION['page_history'] as $page) {
         $page_parts = explode(' | ', $page);
         echo ' > <a href="'.$page_parts[1].'">'.$page_parts[0].'</a>';
     }     
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Rain Water</title>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>

<body onLoad="MM_preloadImages('buttons/artanddesignover.gif','new%20buttons/art&designover.gif','new%20buttons/achiover.gif','new%20buttons/businessover.gif','new%20buttons/childover.gif','new%20buttons/computingover.gif','new%20buttons/crimeover.gif','new%20buttons/educationover.gif','new%20buttons/fictionover.gif','new%20buttons/foodover.gif','new%20buttons/healthover.gif','new%20buttons/historyover.gif','new%20buttons/homeover.gif','new%20buttons/mindover.gif','new%20buttons/musicover.gif','new%20buttons/poetryover.gif','new%20buttons/philoover.gif','new%20buttons/reigionover.gif','new%20buttons/romanceover.gif','new%20buttons/scienceover.gif','new%20buttons/sportover.gif','new%20buttons/travelover.gif')">
<table width="1024" border="0" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  <tr>
    <td height="290" colspan="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td width="1024" height="123"><a href="index.php?"><img src="logo.gif" width="1100" height="290" border=0></a></td>
      </tr>
    </table>    </td>
  </tr>
  <tr>
    <td width="193" rowspan="3" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
         <td><a href="master.php?id=General_Art" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('art','','new%20buttons/art&designover.gif',1)"><img src="new%20buttons/art&design.gif" name="art" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Architecture" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('achi','','new%20buttons/achiover.gif',1)"><img src="new%20buttons/achi.gif" name="achi" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Business_Finanace" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('busi','','new%20buttons/businessover.gif',1)"><img src="new%20buttons/business.gif" name="busi" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Children" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('child','','new%20buttons/childover.gif',1)"><img src="new%20buttons/child.gif" name="child" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Computing" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('comp','','new%20buttons/computingover.gif',1)"><img src="new%20buttons/computing.gif" name="comp" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Crime_Mystery" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('crime','','new%20buttons/crimeover.gif',1)"><img src="new%20buttons/crime.gif" name="crime" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Education" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('educ','','new%20buttons/educationover.gif',1)"><img src="new%20buttons/education.gif" name="educ" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Fiction" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('fic','','new%20buttons/fictionover.gif',1)"><img src="new%20buttons/fiction.gif" name="fic" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Food_Drink" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('food','','new%20buttons/foodover.gif',1)"><img src="new%20buttons/food.gif" name="food" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Health" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('hea','','new%20buttons/healthover.gif',1)"><img src="new%20buttons/health.gif" name="hea" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=History" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('his','','new%20buttons/historyover.gif',1)"><img src="new%20buttons/history.gif" name="his" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Home_Garden" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('home','','new%20buttons/homeover.gif',1)"><img src="new%20buttons/home.gif" name="home" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Horror" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('horro','','new%20buttons/horrorover.gif',1)"><img src="new%20buttons/horror.gif" name="horro" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Mind_body_Spirit" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('mind','','new%20buttons/mindover.gif',1)"><img src="new%20buttons/mind.gif" name="mind" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Music_Stage_Screen" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('music','','new%20buttons/musicover.gif',1)"><img src="new%20buttons/music.gif" name="music" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Poetry_Drama" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('poerty','','new%20buttons/poetryover.gif',1)"><img src="new%20buttons/poetry.gif" name="poerty" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Philosophy_Politics" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('philo','','new%20buttons/philoover.gif',1)"><img src="new%20buttons/philo.gif" name="philo" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Religion" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('reli','','new%20buttons/reigionover.gif',1)"><img src="new%20buttons/reigion.gif" name="reli" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Romance" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('rom','','new%20buttons/romanceover.gif',1)"><img src="new%20buttons/romance.gif" name="rom" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Science_Fiction" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('sci','','new%20buttons/scienceover.gif',1)"><img src="new%20buttons/science.gif" name="sci" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Sport" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('spo','','new%20buttons/sportover.gif',1)"><img src="new%20buttons/sport.gif" name="spo" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="master.php?id=Travel_Holiday" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('tra','','new%20buttons/travelover.gif',1)"><img src="new%20buttons/travel.gif" name="tra" width="193" height="19" border="0"></a></td></      </tr>
    </table>    </td>
    <td height="57" colspan="4" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td width="327" height="38" valign="top"><? display_breadcrumbs(); ?></td>
          <td width="372" valign="top"><Form method="get" action="search.php?search=">
              <div align="right">
                <input type="Text" name="search" id="search" />
                <input type="submit" value="Search" />
              </div>
          </Form></td>
        <td width="58" rowspan="2" valign="top"><div align="right"><font size="3"><a href="index.php?"><font color="#000000">Home</font></a><font color="#000000"> </font></font></div></td>
        <td width="73" rowspan="2" valign="top"><div align="right"><font size="3"><a href="sign_in.php?"><font color="#000000">Sign In</font></a><font color="#000000"> </font></font></div></td>
        <td width="107" rowspan="2" valign="top"><div align="right"><font size="3"><a href="MyAccount.php?"><font color="#000000">My Account</font></a><font color="#000000"> </font></font></div></td>
    <td width="128" rowspan="2" valign="top"><div align="right"><font size="3"><a href="my_basket.php?"><font color="#000000">My Basket</font></a><font color="#000000"> </font></font></div></td>
        </tr>
      <tr>
        <td height="19"></td>
        <td> </td>
        <td></td>
      </tr>
    </table>    </td>
  </tr>
  <tr>
    <td width="48" height="68"> </td>
    <td colspan="2" valign="top"><center>
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <!--DWLayoutTable-->
        <tr>
          <td width="576" height="68" valign="top" bgcolor="#C6FC48">Sign in using your username and password
	  <?
	  $error = @$_POST[error];
	  echo "<br><font color=red>$error</font>";
	  ?>
	  <form method="post" action="check.php?">
	  Email: <input type="text" name="email" id="email" /><br />
	  Password: <input type="password" name="password" id="password" /><br />
	  <input type="submit" value="Log in" /></form>Not <a href="signup.php?">Registerd?</a>
	  </td>
          </tr>
        </table>
    </center></td>
    <td width="231"> </td>
    <td width="90"> </td>
  </tr>
  <tr>
    <td height="323"> </td>
    <td width="7"> </td>
    <td width="569"> </td>
    <td> </td>
    <td> </td>
  </tr>
  
  
  
  
  
  
  

  <tr>
    <td height="38"></td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
  </tr>
  <tr>
    <td height="117"></td>
    <td> </td>
    <td> </td>
    <td colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td width="428" height="22"> <div align="center"><BR>
  <BR>
   © <FONT FACE ='Arial' size="2" > Rainwater Limited </FONT> <BR>
  <BR>
  <table width="800" border="0">
        <tr>
          <td><div align="center">
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="85" height="13">
            <param name="movie" value="text15.swf">
            <param name="quality" value="high">
            <param name="base" value=".">
            <param name="scale" value="exactfit">
            <embed src="text15.swf" base="."  quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" scale="exactfit" width="85" height="13" ></embed> 
          </object>
        </div></td>
          <td><div align="center">
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="93" height="14">
            <param name="movie" value="text16.swf">
            <param name="quality" value="high">
            <param name="base" value=".">
            <param name="scale" value="exactfit">
            <embed src="text16.swf" base="."  quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" scale="exactfit" width="93" height="14" ></embed> 
          </object>
        </div></td>
          <td><div align="center">
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="57" height="14">
            <param name="movie" value="text17.swf">
            <param name="quality" value="high">
            <param name="base" value=".">
            <param name="scale" value="exactfit">
            <embed src="text17.swf" base="."  quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" scale="exactfit" width="57" height="14" ></embed> 
          </object>
        </div></td>
          <td><div align="center">
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="71" height="16">
            <param name="movie" value="text18.swf">
            <param name="quality" value="high">
            <param name="base" value=".">
            <param name="scale" value="exactfit">
            <embed src="text18.swf" base="."  quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" scale="exactfit" width="71" height="16" ></embed> 
          </object>
        </div></td>
          <td><div align="center">
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="99" height="16">
            <param name="movie" value="text19.swf">
            <param name="quality" value="high">
            <param name="base" value=".">
            <param name="scale" value="exactfit">
            <embed src="text19.swf" base="."  quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" scale="exactfit" width="99" height="16" ></embed> 
          </object>
        </div></td>
        </tr>
      </table>
  <BR>
</div></td>
      </tr>
    </table>    </td>
    <td> </td>
  </tr>
</table>
</body>
</html>

 

check.php

<?
session_start();

$email = @$_POST['email'];
$password = @$_POST['password'];

$conn = new COM('ADODB.Connection') or die('Could not make conn');
$rs = new COM('ADODB.Recordset') or die('Coult not make rs');

$connstring = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\\wamp\\www\\pro\\project\\Rainwater.mdb";


$conn->Open($connstring);
if (!$conn)
  {exit("Connection Failed: " . $conn);}
$sql="SELECT email, password
FROM sign
WHERE email = '.$email.' AND password = '.$password.' 
";
$rs->Open($sql, $conn);

if(odbc_num_rows($rs) != 1){
$error = "Error with the email and or password please go back";
header('location: sign_in.php?error=There was a Problem with your email and or password.');
}else {
    $_SESSION['email'] = "$email";
    header('location: profile.php');
}

?>

 

if the user is registerd it will send them to profile if something is wrong send them to sign_in.php?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.