Jump to content

vickie

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

vickie's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks roopurt18 for the warning, I will check into that. This is the "current and working page" that I've been updating to new code due to a server move which resulted in the page I posted earlier. So where is the problem, there wasn't a whole lot changed.... <head> <?php require('admin2/admin2.php'); $sql=new MySQL_class; $sql->Create("nae"); ?> <!-- Member log in --> <?if ($submit) {$query="select * from members where ID='$id'"; $data = $sql->Query($query); if ($sql->rows>0 && $pass) {if ($pass!=$repass) {echo" Your password fields do not match, please <a href='javascript:history.back()'>click here</a> to go back.";} else{$cpass=crypt($pass, substr($pass,0,2)); echo" Welcome aboard..please <a href='../membersmenu.phtml'>click here</a> to log into members area"; $email="info@website "; $mailstuff="member $id has just became active"; mail($email, "A new member just signed up", $mailstuff, "From: autoresponder\n");} }else{ echo" Either Your ID # does not exist in our database, or you did not fill out password fields, <a href='javascript:history.back()'> click here to go back</a>. If the problem persists please email us at: info@website "; } }else{?> <form action="membersmenu.phtml" method="post" > <table width="100%" border="0" cellspacing="5" cellpadding="0" > <tr> <td><h1 class="color_b">Members Log In</h1></td> </tr> <tr> <td class="style46">Member ID <input name="id" type="text" class="input" size="10" maxlength="20" /></td> </tr> <tr> <td><span class="style46">Password </span> <input name="pass" type="password" size="10" maxlength="20" class="input" /></td> </tr> <tr> <td class=""><input type="submit" name="submit" value="Sign in" class="button" style="background-color: #f5deb3" /> <a href="http://website/members/id_pass_change.phtml" class="style46"><span style="font-size: 80%;">forgot password?</span></a></td> </tr> </table> </form> </div> <div id="footer"> <?php @readfile('http://www.website/ssi/ssi-footer.html'); ?> </div> <? } ?> </div></div></div> </body> </html>
  2. And there is this file, if it will provide any clues...?? <? /* * Utility routines for MySQL. */ class MySQL_class { var $db, $id, $result, $rows, $data, $a_rows; var $user, $pass, $host; /* Make sure you change the USERNAME and PASSWORD to your name and * password for the DB */ function Setup ($user, $pass) { $this->user = $user; $this->pass = $pass; } function Create ($db) { if (!$this->user) { $this->user = "user"; } if (!$this->pass) { $this->pass = "pass"; } $this->db = $db; $this->id = @mysql_connect($this->host, $this->user, $this->pass) or MySQL_ErrorMsg("Unable to connect to MySQL server: $this->host : '$SERVER_NAME'"); $this->selectdb($db); } function SelectDB ($db) { @mysql_select_db($db, $this->id) or MySQL_ErrorMsg ("Unable to select database: $db"); } # Use this function is the query will return multiple rows. Use the Fetch # routine to loop through those rows. function Query ($query) { $this->result = @mysql_query($query, $this->id) or MySQL_ErrorMsg ("Unable to perform query: $query"); $this->rows = @mysql_num_rows($this->result); $this->a_rows = @mysql_affected_rows($this->result); } # Use this function if the query will only return a # single data element. function QueryItem ($query) { $this->result = @mysql_query($query, $this->id) or MySQL_ErrorMsg ("Unable to perform query: $query"); $this->rows = @mysql_num_rows($this->result); $this->a_rows = @mysql_affected_rows($this->result); $this->data = @mysql_fetch_array($this->result) or MySQL_ErrorMsg ("Unable to fetch data from query: $query"); return($this->data[0]); } # This function is useful if the query will only return a # single row. function QueryRow ($query) { $this->result = @mysql_query($query, $this->id) or MySQL_ErrorMsg ("Unable to perform query: $query"); $this->rows = @mysql_num_rows($this->result); $this->a_rows = @mysql_affected_rows($this->result); $this->data = @mysql_fetch_array($this->result) or MySQL_ErrorMsg ("Unable to fetch data from query: $query"); return($this->data); } function Fetch ($row) { @mysql_data_seek($this->result, $row) or MySQL_ErrorMsg ("Unable to seek data row: $row"); $this->data = @mysql_fetch_array($this->result) or MySQL_ErrorMsg ("Unable to fetch row: $row"); } function Insert ($query) { $this->result = @mysql_query($query, $this->id) or MySQL_ErrorMsg ("Unable to perform insert: $query"); $this->a_rows = @mysql_affected_rows($this->result); } function Update ($query) { $this->result = @mysql_query($query, $this->id) or MySQL_ErrorMsg ("Unable to perform update: $query"); $this->a_rows = @mysql_affected_rows($this->result); } function Delete ($query) { $this->result = @mysql_query($query, $this->id) or MySQL_ErrorMsg ("Unable to perform Delete: $query"); $this->a_rows = @mysql_affected_rows($this->result); } } /* ******************************************************************** * MySQL_ErrorMsg * * Print out an MySQL error message * */ function MySQL_ErrorMsg ($msg) { # Close out a bunch of HTML constructs which might prevent # the HTML page from displaying the error text. echo("</ul></dl></ol>\n"); echo("</table></script>\n"); # Display the error message $text = "<font color=\"#ff0000\" size=+2><p>Error: $msg :"; $text .= mysql_error(); $text .= "</font>\n"; die($text); } ?>
  3. Here is the code: <head> <?php require('admin2/admin2.php'); $sql=new MySQL_class; $sql->Create("nae"); ?> HTML/CSS... <!-- Member log in --> <?php if (isset($_POST['submit'])) { $query="SELECT * from members WHERE id = $_GET[id]"; $data = $sql->Query($query); if ($sql->rows>0 && $pass) {if ($pass!=$repass) {echo" Your password fields do not match, please <a href='javascript:history.back()'>click here</a> to go back.";} else{$cpass=crypt($pass, substr($pass,0,2)); echo" Welcome aboard..please <a href='../membersmenu.phtml'>click here</a> to log into members area"; $email="website "; $mailstuff="member $id has just became active"; mail($email, "A new member just signed up", $mailstuff, "From: autoresponder\n");} }else{ echo" Either Your ID # does not exist in our database, or you did not fill out password fields, <a href='javascript:history.back()'> click here to go back</a>. If the problem persists please email us at: info@website "; } }else{?> <form action="membersmenu.phtml" method="post" > <table width="100%" border="0" cellspacing="5" cellpadding="0" > <tr> <td><h1 class="color_b">Members Log In</h1></td> </tr> <tr> <td class="style46">Member ID <input name="id" type="text" class="input" size="10" maxlength="20" /></td> </tr> <tr> <td><span class="style46">Password </span> <input name="pass" type="password" size="10" maxlength="20" class="input" /></td> </tr> <tr> <td class=""><input type="submit" name="submit" value="Sign in" class="button" style="background-color: #f5deb3" /> <a href="http://www.website/members/id_pass_change.phtml" class="style46"><span style="font-size: 80%;">forgot password?</span></a></td> </tr> </table> </form> </div> <!-- End log in --> HTML/CSS... <div id="footer"> <?php @readfile('http://www.website/ssi/ssi-footer.html'); ?> </div> <? } ?> </div></div></div> </body> </html>
  4. The username is correct. How do I check for the database, dumb question...but I really don't know what to do next. Could the code I changed the other day have an effect on the database? When I talked with the ISP, they said the localhost needed to read as the server. Does that make sense? BTW, Ken, I sent you an email message.
  5. After using MAMP to update old code and testing, I uploaded all the changed pages to our server. Now, the error message reads: Error: Unable to connect to MySQL server: : '' :Access denied for user 'xxxx'@'localhost' (using password: YES) I don't recall where I change the localhost to point to our server? Anyone have a guess? Yes, I'm new to this and it's trial by fire right now.
  6. Making progress...thanks for your continued help! Now the error reads: Error: Unable to perform query: select * from members where ID='9000' :Table 'name' doesn't exist So does this have to do with the code at the top of this page? <?php require('admin2/admin2.php');$sql=new MySQL_class;$sql->Create("xxx"); ?> Do I need to look at admin2.php for old code???
  7. Okay, figured out the brackets...still a recurring error below. What am I doing wrong? Please enter valid ID click here to go back Notice: Undefined variable: id in /Applications/MAMP/htdocs/...on line 78 Error: Unable to perform query: select * from members where ID='' :Table 'members' doesn't exist Line 78: { $query="select * from members where ID='$id'"; So I tried the backslash to separate the quotes: Line 78: { $query="select * from members where ID=\'$id\'"; But that resulted in this error: Please enter valid ID click here to go back Notice: Undefined variable: id in /Applications/MAMP/htdocs/xxxxl on line 78 Error: Unable to perform query: select * from members where ID=\'\' :You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\'\'' at line 1 I'm using 5.1.44 mysql. Any advice?
  8. So much fun...figuring out this outdated code. I'm now getting a parse error: syntax error, unexpected $end --which is the last line of code. The only other code is what follows at the end of the page...any suggestions? <div id="footer"> <?php @readfile('http://www.website/ssi/ssi-footer.html'); ?></li> <?php { echo" Password is not valid. Please re-enter your password <A href='javascript:history.back()'>click here</A> to go back"; } ?> </div> </body> </html>
  9. <?php if (!isset($_POST['submit'])) { ?> <table cellspacing="2" align="center" valign="center" bgcolor="f5f5dc"> <form action="?p=login" method="post" > <align="center">Members <br /><br /><tbody ><td> Enter Your Member ID </td> <td><input type="text" name="id" size="15" /> </td> </tr> <tr> <td class="name"> Enter Password </td> <td> <input type="password" name="pass" size="15" /> </td> </tr> <tr> <td> <input type="submit" value="Submit" name="submit" /><br /><br /> </td> </tr> </form> </table> <?php } ?> <?php { echo" Please enter valid ID <A href='javascript:history.back()'>click here</A> to go back"; } { $query="select * from members where ID='$id'"; $data = $sql->Query($query); for ($i = 0; $i < $sql->rows; $i++) { $sql->Fetch($i); $dpass=$sql->data[1]; } $cpass=crypt($pass, substr($pass,0,2)); if ($dpass==$cpass) { ?>
  10. Ken, making progress...I changed the table as you suggested, but what do I do about this code below which is at the bottom of the table? When I process the page, the error is: Notice: Undefined variable: id.....line 77 which is this: { $query="select * from members where ID='$id'"; "; } elseif (!$id) { echo" Please enter valid ID <A href='javascript:history.back()'>click here</A> to go back"; } elseif ($id) { $query="select * from members where ID='$id'"; $data = $sql->Query($query); for ($i = 0; $i < $sql->rows; $i++) { $sql->Fetch($i); $dpass=$sql->data[1]; } $cpass=crypt($pass, substr($pass,0,2)); if ($dpass==$cpass) { ?>
  11. Thanks for your continued help Ken. Here is the code that I'm struggling to update: <?if (!$submit) {echo" <table cellspacing=2 align=center valign=center bgcolor=f5f5dc> <form action="?p=login" method="post" > <align=center>xx title xx <br /><br /><tbody ><td> Enter Your Member ID </td> <td><input type=text name=id size=15 /> </td> </tr> <tr> <td class=name> Enter Password </td> <td> <input type=password name=pass size=15 /> </td> </tr> <tr> <td> <input type=submit value=Submit name=submit /><br /><br /> </td> </tr> </form> </table> "; } elseif (!$id) { echo" Please enter valid ID <A href='javascript:history.back()'>click here</A> to go back"; } elseif ($id) { $query="select * from members where ID='$id'"; $data = $sql->Query($query); for ($i = 0; $i < $sql->rows; $i++) { $sql->Fetch($i); $dpass=$sql->data[1]; } $cpass=crypt($pass, substr($pass,0,2)); if ($dpass==$cpass) { ?> ----content---- footer and end code: <div id="footer"> <?php @readfile('http://www.website.com/ssi/ssi-footer.html'); ?></li> <?}else echo" Password is not valid. Please re-enter your password <A href='javascript:history.back()'>click here</A> to go back";} ?>
  12. Thanks for the quick reply! One down.... it worked, and one still needs some help: still get parse error: Parse error: syntax error, unexpected '=' for this code: <form action="?p=login" method="post"> I tried spacing but that didn't work. Any ideas?
  13. I've made some headway updating old code, but still have 2 problems. Can someone tell me what is wrong with the code lines below? First error: Parse error: syntax error, unexpected '?' ....line xx line xx: <form action="<?php echo $_SERVER['PHP_SELF']; ?>?p=login" method="post"> Second error: Notice: Undefined variable: submit in .... on line xxx line xxx: <?if ($submit) {$query="SELECT * from members WHERE id = $_GET[id]";.......
  14. Thanks for the quick reply! I always wondered why the site was created using that php3 extension, and that it worked. But I did change all the extensions and references from php3 to php...and it helped. Now, my next question: does this language still apply: <form action=\"$PHP_SELF\" method=post > ? For some reason the members page won't activate after I log in as a member on the homepage, it just reverts to a login page and not revealing the member resources. And then when logging in on this second login page, it fails and remains on this page.
  15. Really need help with a client's website utilizing old code. The site has to be moved to a new server with updated code: Current Server web1 New Server web2 MySQL 4.0.18 MySQL 5.1.42 PHP 4.3.11 PHP 5.3.1 Perl 5.8.3 Perl 5.10.0 Fedora Core 1 Fedora 12 I believe the primary problem is php code since the two primary pages with php are not working on the new server. (I had the site moved back to the old server for now). I have researched the code upgrades and believe I have it fixed but how do I test it? I use Snow Leopard Mac and have installed MAMP. But I get a white screen when I call up the pages in question "http://localhost:8888/xxx.phtml". The basic code is below...what am I doing wrong? Current code: <?php require("admin2/admin2.php3"); $sql=new MySQL_class; $sql->Create("database-name"); ?> <div id="footer"> <?php @readfile('http://www.website.com/ssi/ssi-footer.html'); ?> </div> <? } ?>
×
×
  • 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.