Jump to content

cearlp

Members
  • Posts

    20
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

cearlp's Achievements

Member

Member (2/5)

0

Reputation

  1. Moorcam, here is the entire code: infoauthex.txt
  2. Sorry about the code block. I'm also sorry that by not using a code block I made a mistake in the coding I showed. There is no single quote in the line <td><input size="20" maxlength="20" name="password" value'" "></td> It is a fat finger on my typing. It is as shown but without the single quote after value. I couldn't drag a file or even part of a file because the program code is not on this machine.
  3. Validate function is within a <script language=javascript> and is ----- function Validate() { if (document.form1.password.value == "zxyzz") { window.location="<?php echo 'disp.php'; ?>"; return(false); } else { window.location="<?php echo 'displess.php'; ?>"; return(false); } } Body is--- <body onload="self.focus();document.form1.password.focus()" > <form name= "form1" method="post" onsubmit="return Validate()"> <table width="1000" border="0" cellspacing="1" cellpadding="0"> <tr> <td align= "right">Password: </td> <td><input size="20" maxlength="20" name="password" value'" "></td> </tr> </table> </form> </body> Problem is that under Firefox it always goes to displess.php but under Safari typing in zxyzz it goes to disp.php, anything else goes to displess.php Any suggestions or evidence of errors will be appreciated.
  4. Thanks all for the replies.
  5. Is an error obvious in the following code. It worked okay until just recently. Could a Ubuntu update to 22.04 have changed something i neew to change in the PHP coding? body { font-family: Georgia, "Times New Roman", Times, serif; color: maroon; background-color: #daa520 } h2 { padding-left: 8em } p { font-size: 13.5pt; text-indent: 5em } a:link { color:blue; text-decoration: none } a:visited { color:purple; text-decoration: none } </style> <script language=javascript> function Validate() { if (document.form1.password.value == "fredpeabody") { window.location="<?php echo 'sxdisp.php'; ?>"; return(false); } else { window.location="<?php echo 'sxdispunprotect.php'; ?>"; return(false); } } </script> </head> <body onLoad="self.focus();document.form1.password.focus()" > <div id="main-content"> <p> Enter the Password to search and display all the information on the Sigma Database. </p> <p> Otherwise only the unprotected information will be displayed.</p> <form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']?>" onsubmit="return Validate()"> <table width="1000" border="0" cellspacing="1" cellpading="0"> <tr> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td align="right">Password: </td> <td><input size="20" maxlength="20" name="password" value=" "> </td> </tr> </table> </form> </div> </body>
  6. Thank you mac_gyver... Finding out the errors showed me that it was a connection to the database that failed due to a password change that was not accounted for in the code.
  7. I tried the following after researching mysqli exceptions and the result was the same,,,first two echos are displayed, no error printout but the echo "after conn" was not displayed. function conn($sql) { $host = "localhost"; $user = "root"; $pass = "xxx"; valid root password for database $db = "xxx"; looking at database with PHPMYADMIN seems okay echo "in conn--- "; echo "HOST $host, USER $user, PASS $pass, DB $db"; $con = new mysqli($host, $user, $pass, $db); if ($con->connect_errno) { printf("connect failed: %s\n" , $con->connect_error()); exit(); } echo "after conn"; }
  8. No error or any message. The program seems to finish normally except nothing was available to be displayed from the database. The code: if (!($conn=mysqli_connect($host, $user, $psss, &db))) { printf("error connecting to DB by user = $user"); exit; }
  9. After years of working, the call to mysql_connect does nothing. Software installed is: Server: Localhost via UNIX socket Server type: MariaDB Server version: 10.6.18-MAriaDB-0ubuntu0.22.04.1 Protocol version: 10 Apache/2.4.52 (Ubuntu) Database client version: libmysql - mysqlind 8.1.2-1ubuntu2.18 PHP extension: mysqli curl mbstring PHP version: 8.1.2-1ubuntu2.18 What have I missed, some update or could the database be corrupted?
  10. My BAD! The code is mysqli_error() not mysql_errno(). BUT, adding the $conn to the mysqli_error($conn) produces a valid and informative error message. Many thanks for the help.
  11. Two identical php programs doing a mysqli_query, but on different databases. One succeeds and the other fails. The one that fails returns no errno. Could the cause be the databases? If so, what could be the problem? They are real similar in construction, one has more fields than the other, but almost the same data in both. $conn = use, passwd, database $sql = insert into members (name,addr,city,state) values('Joe','123 St','Somecity','CA') $result = mysqli_query($conn, $sql) or die (Can't run query because " . mysql_errno());
  12. Thanks, I will post to the javascript forum.
  13. I wasn't looking at it that way. My flow is like this: As stated, the function is in the <head> section of the file. A form is displayed and if the submit button is selected the page reloads itself. If isset($_POST['submit'] is true certain fields are checked for being blank. If they are, an alert box is displayed and the form is re-displayed with the data that has already been filled in. If the fields are not blank processing continues and later in the process flow a database is going to be updated. At this point I want to call a confirm function to display a confirm box and need the response of either OK or Cancel to either continue the update or re-display the form. Does this make sense?
  14. I define a Javascript in the <head> section of a .php file and call it from the <body> section with the following: echo "<script language='javascript'>function();</script>". The function displays a confirm box with the normal Cancel and OK buttons just fine, but I want to capture the function return of true or false for which button was selected. So far I haven't found a way to get return a value from the function. Any ideas???
  15. Thanks for the help Crayon Violent. I can get by be calling the script with onsubmit but can a javascript be called from anywhere in a php script?
×
×
  • 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.