Search the Community
Showing results for tags 'php error'.
-
I have a error in line 24 on my code Code error on website: Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /core/init.php on line 24 Here's the code: <?php session_start(); $GLOBALS['config'] = array( 'mysql' => array( 'host' => 'i added my host here', 'username' => 'i added my username', 'password' => 'and pass', 'db' => 'and password' ), 'remember' => array( 'cookie_name' => 'hash', 'cookie_expiry' => 604800 ), 'session' => array( 'session_name' => 'users', 'token_name' => 'token' ) ); error here: spl_autoload_register(function($class) { require_once 'classes/' . $class . '.php'; }); require_once 'functions/sanatize.php'; I don't know what it means by the error. But its around where i said the error is.
- 4 replies
-
- php error
- syntax error
-
(and 1 more)
Tagged with:
-
This PHP program has been haunting IT around the world, see if you can correct it? Its open source code! Errors: Notice: Uninitialized string offset: 0 in C:\wamp\www\language_files\language.inc.php on line 33 Notice: Undefined offset: 2 in C:\wamp\www\language_files\language.inc.php on line 50 Code: <?php $strLangShort = $_REQUEST['language']; if ($strLangShort == '') { $strLangShort = $_REQUEST['strLanguage']; } $strFilename = 'gui_'.$strLangShort.'.langprop'; $strLanguagePath = "../language_files/".$strFilename; $pFile = @fopen($strLanguagePath, "r"); if ($pFile == null) { $strLanguagePath = "language_files/".$strFilename; $pFile = @fopen($strLanguagePath, 'r'); if ($pFile == null) { $strLanguagePath = "../../language_files/".$strFilename; $pFile = @fopen($strLanguagePath, 'r'); } } $arrTranslation; if (null != $pFile) { while (!feof ($pFile)) { $strLine = trim(fgets($pFile, 4096)); if ( ($strLine[0] != "#") && (strlen($strLine) > 0) && (substr($strLine,0,5)!="_jotl")) { $nPos = strpos($strLine, "="); $strId = substr($strLine, 0, $nPos); $strRest = trim(substr($strLine, $nPos+1)); $arrInfos = explode("@@@", $strRest); $strValue = $arrInfos[0]; $arrTranslation[$strId] = $strValue; } else { $nPos = strpos($strLine, "="); $strConfig = substr($strLine, 0, $nPos); $splitConfig = explode (".", $strConfig); if ($splitConfig[2] == 'encoding') { $DEFAULT_CHARSET = trim(substr($strLine, $nPos+1)); } } } fclose($pFile); } $CIRCULATION_MNGT_ADDCIRCULATION; foreach($arrTranslation as $key => $value) { $$key = $value; } function escapeSingle($string) { return str_replace("'", "\\'", $string); } function escapeDouble($string) { return str_replace("\"", "\\\"", $string); } ?>
-
Hello everyone! I'm new in this forum. I'm having a problem with my coding : when I execute the code below >> $cek_login=mysql_num_rows($login); if (empty($cek_login)) { echo ""; echo ""; } else { //daftarkan ID jika user dan password BENAR while ($row=mysql_fetch_array($login)) { //$id=$row[0]; //session_register('id'); //CHANGE 1: //--------- $_SESSION["id"] = $row[0]; } echo ""; echo ""; } ?> ' target='_blank'>session_start(); session_destroy(); include "koneksi.php"; $login=mysql_query("SELECT * FROM admin WHERE username='$_POST[username]' AND password='$_POST[password]'"); $cek_login=mysql_num_rows($login); if (empty($cek_login)) { echo ""; echo ""; } else { //daftarkan ID jika user dan password BENAR while ($row=mysql_fetch_array($login)) { //$id=$row[0]; //session_register('id'); //CHANGE 1: //--------- $_SESSION["id"] = $row[0]; } echo ""; echo ""; } ?> After that this error come out : warning:mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\project\cek_login.php on line 7
-
Hello everyone! Nice forum, runs real smooth I'm receiving the following error message: Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given (this is on line 6) Warning: mysqli_fetch_row() expects parameter 1 to be mysqli_result, null given (this is on line 14) The error is related to the following code: $sql = "SELECT username, avatar FROM users WHERE avatar IS NOT NULL AND activated='1' ORDER BY RAND () LIMIT 32"; $query = mysqli_query($db_conx, $sql); $userlist = ""; while ($row = mysqli_fetch_array($query, MYSQLI_ASSOC)) { (this is line 6) $u = $row["username"]; $avatar = $row["avatar"]; $profile_pic = 'user/'.$u.'/'.$avatar; $userlist .= '<a href="user.php?u='.$u.'" title="'.$u.'"><img src="'.$profile_pic.'" alt="'.$u.'" style="width: 100px; height: 100px; margin: 10px;"></a>'; } $sql = "SELECT COUNT (id) FROM users WHERE activated='1'"; $query = mysqli_query($db_conx, $sql); $row = mysqli_fetch_row ($query); (this is line 14) $usercount = $row [0]; I'm not sure what's causing it, I know it seems to be a problem with a parameter that's not working right, I looked over the code, couldnt find it. I'm wondering if it could be a database issue? but I don't think so. This is a script to show user avatar images in a area of the page. It tells the system to show random user profile pictures if they are registered, activated and have an avatar image. ANY help would be highly appreciated, been trying to solve this for a while now, the rest of the website and script works perfectly so far and there's ALOT of it
-
Hi there, After battling this problem for hours I have bitten the bullet and am asking for HELP! My contact form is not working, it was working, then wasn't...then was and now its definately not! The thankyou page is appearing when I have filled in the details and click SUBMIT- I am just not receiving the email. Here is my form HTML coding (I have highlighted the code that I think is making the form work and not work- as explained below! (file name contactus.html) <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Contact Us</title> <link href="layout.css" rel="stylesheet" type="text/css"> <link href="slider.css" rel="stylesheet" type="text/css"> <link href="fonts.css" rel="stylesheet" type="text/css"> <link href="fonts/sourcecode/stylesheet.css" rel="stylesheet" type="text/css"> <link href="fonts/umbrage/stylesheet.css" rel="stylesheet" type="text/css"> <link href="fonts/maidenorange/stylesheet.css" rel="stylesheet" type="text/css"> <link href="fonts/helvetica/stylesheet.css" rel="stylesheet" type="text/css"> <!--Internet Explorer Script start--> <script> function check(input) { if (input.value != document.getElementById('email_addr').value) { input.setCustomValidity('The two email addresses must match.'); } else { // input is valid -- reset the error message input.setCustomValidity(''); } } </script> <script> document.createElement("article"); document.createElement("footer"); document.createElement("header"); document.createElement("section"); document.createElement("nav"); </script> <!--Internet Explorer Script end--> <script type="text/javascript" src="js/jquery-1.3.1.min.js"></script> <script type="text/javascript" src="js/jquery.scrollTo.js"></script> <script> $(document).ready(function() { $('a.panel').click(function () { $('a.panel').removeClass('selected'); $(this).addClass('selected'); current = $(this); $('#wrapper').scrollTo($(this).attr('href'), 800); return false; }); $(window).resize(function () { resizePanel(); }); }); function resizePanel() { width = $(window).width(); height = $(window).height(); mask_width = width * $('.item').length; $('#debug').html(width + ' ' + height + ' ' + mask_width); $('#wrapper, .item').css({width: width, height: height}); $('#mask').css({width: mask_width, height: height}); $('#wrapper').scrollTo($('a.selected').attr('href'), 0); } </script> <style type="text/css"> body section { color: #000; } body section p { color: #000; text-align: center; } #outersection article form table { font-size: 18px; } </style> </head> <body> <!--start navigation--> <nav> <ul> <li><a href="index.html">home</a> </li> <li><a href="aboutus.html">about us</a></li> <li><a href="products.html">products</a> </li> <li><a href="demos.html">demos</a></li> <li><a href="contactus.html">contact us</a> </ul> </nav> <!--end navigation--> <!--start header--> <section> <header> <h1>Order online here</h1> </header> </section> <section id ="outersection"> <article> <form name="html_form_send" method="post" action="thankyou.html"> <table width="450px"> </tr> <tr> <td valign="top"> <label for="first_name">First Name *</label> </td> <td valign="top"> <input type="text" name="first_name" maxlength="50" size="30"> </td> </tr> <tr> <td valign="top"> <label for="last_name">Last Name *</label> </td> <td valign="top"> <input type="text" name="last_name" maxlength="50" size="30"> </td> </tr> <tr> <td valign="top"> <label for="email">Email Address *</label> </td> <td valign="top"> <input type="text" name="email" maxlength="80" size="30"> </td> </tr> <tr> <td valign="top"> <label for="telephone">Telephone Number</label> </td> <td valign="top"> <input type="text" name="telephone" maxlength="30" size="30"> </td> </tr> <tr> <td valign="top"> <label for="comments">Products Requested*</label> </td> <td valign="top"> <textarea name="comments" maxlength="1000" cols="25" rows="6"></textarea> </td> </tr> <tr> <td colspan="2" style="text-align:center"> <input type="submit" value="Submit"></td> </tr> </table> </form> </article> </section> <section> <p>Have any further queries or questions we can assist you with? Email us <a href="mailto:sales@xxxxxxx">HERE</a></p> </section> <!-- start small section--> <article id= "information"> <h1> Thankyou for visiting us at Autolecs.com.au</h1> </article> <!--end small section--> <!-- start footer--> <footer> <p></p> </footer> <!--end footer--> </body> </html> AND my php coding; (file name send_form_email.php) <?php if(isset($_POST['email'])) { // EDIT THE 2 LINES BELOW AS REQUIRED $email_to = "sales@xxxxxxxxxx"; $email_subject = "Order Received"; function died($error) { // your error code can go here echo "We are very sorry, but there were error(s) found with the form you submitted. "; echo "These errors appear below.<br /><br />"; echo $error."<br /><br />"; echo "Please go back and fix these errors.<br /><br />"; die(); } // validation expected data exists if(!isset($_POST['first_name']) || !isset($_POST['last_name']) || !isset($_POST['email']) || !isset($_POST['telephone']) || !isset($_POST['comments'])) { died('We are sorry, but there appears to be a problem with the form you submitted.'); } $first_name = $_POST['first_name']; // required $last_name = $_POST['last_name']; // required $email_from = $_POST['email']; // required $telephone = $_POST['telephone']; // not required $comments = $_POST['comments']; // required $error_message = ""; $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/'; if(!preg_match($email_exp,$email_from)) { $error_message .= 'The Email Address you entered does not appear to be valid.<br />'; } $string_exp = "/^[A-Za-z .'-]+$/"; if(!preg_match($string_exp,$first_name)) { $error_message .= 'The First Name you entered does not appear to be valid.<br />'; } if(!preg_match($string_exp,$last_name)) { $error_message .= 'The Last Name you entered does not appear to be valid.<br />'; } if(strlen($comments) < 2) { $error_message .= 'The Comments you entered do not appear to be valid.<br />'; } if(strlen($error_message) > 0) { died($error_message); } $email_message = "Form details below.\n\n"; function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } $email_message .= "First Name: ".clean_string($first_name)."\n"; $email_message .= "Last Name: ".clean_string($last_name)."\n"; $email_message .= "Email: ".clean_string($email_from)."\n"; $email_message .= "Telephone: ".clean_string($telephone)."\n"; $email_message .= "Comments: ".clean_string($comments)."\n"; // create email headers $headers = 'From: '.$email_from."\r\n". 'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); ?> <!-- include your own success html here --> <title>contactform</title> <h1>Thank you for your order - one of our friendly sales team will confirm your order soon</h1> Plus I have a confirmation page (file named thankyou.html) <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>THANKYOU!</title> <link href="layout.css" rel="stylesheet" type="text/css"> <link href="fonts.css" rel="stylesheet" type="text/css"> <link href="fonts/sourcecode/stylesheet.css" rel="stylesheet" type="text/css"> <link href="fonts/umbrage/stylesheet.css" rel="stylesheet" type="text/css"> <link href="fonts/maidenorange/stylesheet.css" rel="stylesheet" type="text/css"> <!--Internet Explorer Script start--> <script> document.createElement("article"); document.createElement("footer"); document.createElement("header"); document.createElement("section"); document.createElement("nav"); </script> <!--Internet Explorer Script end--> <style type="text/css"> #outersection #information h1 { color: #FF0; } </style> </head> <body> <!--start navigation--> <nav> <ul> <li><a href="index.html">home</a> </li> <li><a href="aboutus.html">about us</a></li> <li><a href="products.html">products</a> </li> <li><a href="demos.html">demos</a></li> <li><a href="contactus.html">contact us</a> </li></ul> </nav> <!--end navigation--> <!--start header--> <!--end header--> <!--start main section--> <!--end main section--> <!-- start small section--> <section id ="outersection"> <article id= "information"> <h1> </h1> <h1> </h1> <h1> </h1> <h1> </h1> <h1> </h1> <h1>Thankyou - your order has been received and</h1> <h1>you will be contacted shortly by one of our </h1> <h1>friendly sales team!</h1> </article> </section> <!--end small section--> <!-- start footer--> <footer> <p></p> </footer> <!--end footer--> </body> </html> Now, the problem (I think) lies in the highlighted row of HTML code. When I changed it to this the EMAIL worked, but the thankyou page did not appear- just basic text on a blank screen that when clicked 'back' from you are sent back to the form or if closed, closed the whole browser. When changed back to the orginal the thankyou page appeared but no email... Is there a simple answer to get BOTH actions working?! I would be forever thankful for anyone's assistance, this is my first live site and my client has been very patient so far...but time is ticking! Thanking anyone for any assistance! PS- I am a beginner, this is my first live site- go easy on me!
- 13 replies
-
- contact form
- thankyou page
-
(and 3 more)
Tagged with: