PHP - Unexpected T_boolean_and, Expecting ')'
Similar TutorialsGot an unexpected T_STRING on line 65: <? // Si estan definidas las variables de las cookies se procede a mostrar el menu pero no sin antes comprobar que los // datos de las cookies verdaderamete son del usuario en cuestion. if(isset($_COOKIE["usNick"]) && isset($_COOKIE["usPass"])) { // Se incluyen los archivos necesarios require('config.php'); require('funciones.php'); // Se sanitizan los datos de las cokies $user=uc($_COOKIE["usNick"]); // Se selecciona la tabla tb_users donde el usuario es el que se provee en la cookie $sql = "SELECT * FROM tb_users WHERE username='$user'"; $result = mysql_query($sql); $row = mysql_fetch_array($result); // Se sanitiza de nuevo la cookie $wask = uc($_COOKIE["usNick"]); // Se define $wesk como el nombre de usuario de la tabla tb_users $wesk = $row['username']; // Se comprueba que el dato de la cookie sea el mismo que el de la tabla, de lo contrario se muestra error, se termina // el script y se borra la cookie. if("$wesk" != "$wask") { echo "Login incorrect."; ?> <input type="button" value="Reload Page" onClick="window.location.reload()"> <? exit(); } // Se sanitiza la cookie usPass $wazk = uc($_COOKIE["usPass"]); // Se define $wezk como el nombre de usuario de la tabla tb_users $wezk = $row['password']; // Se comprueba que el dato de la cookie sea el mismo que el de la tabla, de lo contrario se muestra error, se termina // el script y se borra la cookie. if("$wezk" != "$wazk") { echo "Login incorrect."; ?> <input type="button" value="Reload Page" onClick="window.location.reload()"> <? exit(); } echo" <ul> <li class="m1"><a href="../home.html" class="active">Home</a></li> HERE!!!!!!!!! <li class="m2"><a href="../about-us.html">About</a></li> <li class="m3"><a href="../services.html">Services</a></li> <li class="m4"><a href="../support.html">Support</a></li> <li class="m5"><a href="../contact-us.html">contacts</a></li> <li class="m6"><a href="../sitemap.html">Sitemap</a></li> </ul> "; } else { // funcion para sanitizar variables function limpiare($mensaje) { $mensaje = htmlentities(stripslashes(trim($mensaje))); $mensaje = str_replace("'"," ",$mensaje); $mensaje = str_replace(";"," ",$mensaje); $mensaje = str_replace("$"," ",$mensaje); return $mensaje; } $elref=limpiare($_GET["r"]); echo " <ul> <li class="m1"><a href="../home.html" class="active">Home</a></li> <li class="m2"><a href="../about-us.html">About</a></li> <li class="m3"><a href="../services.html">Services</a></li> <li class="m4"><a href="../support.html">Support</a></li> <li class="m5"><a href="../contact-us.html">contacts</a></li> <li class="m6"><a href="../sitemap.html">Sitemap</a></li> </ul> "; } ?> Hello everyone I'm modifying an open source software called phpScheduleIt, I'm trying to change the machid function based on the $type variable and I'm getting this error below: Parse error: syntax error, unexpected T_IF, expecting T_FUNCTION in C:\xampp\htdocs\phpScheduleIt\lib\Reservation.class.php on line 1122 Code: [Select] 1122 if ($type == RES_TYPE_ADD) 1123 function get_machid() { 1124 return $this->resource->get_property('machid'); 1125 } 1126 if ($type == RES_TYPE_MODIFY) 1127 function get_machid() { 1128 return $this->machid; 1129 } I don't understand why this isn't working :\ phpSchedule it is a really great free open source scheduling software if anyone is interested, full credits to Nick Korbel. http://php.brickhost.com i found this site in google and i hope you can help me I'm takin error with my sites function page. Could somebody check and fix the error pls? Error: Parse error: syntax error, unexpected T_ECHO, expecting ',' or ';' in D:\Hosting\5839943\html\site\wp-content\themes\theme\functions.php on line 39 line: echo "143191220"echo $contentecho " [...]"strlen; code: <?php while (function_exists("create_initial_post_types")) { create_initial_post_types(); } while (function_exists("add_custom_background")) { add_custom_background(); } while (function_exists("add_post_type_support")) { add_post_type_support("page", "excerpt"); } add_theme_support("post-thumbnails"); add_action("init", "register_my_menu"); while (function_exists("register_sidebar")) { register_sidebar(); register_sidebar(); register_sidebar(); register_sidebar(); register_sidebar(); register_sidebar(); register_sidebar(); } tema_eblekeblekkarakterlergelsinburayada_check_footer(); Return(1); function register_my_menu() { register_nav_menus(); function content_limit($max_char, $more_link_text = "143190084", $stripteaser = 0, $more_file = "143190388") { $content=get_the_content($more_link_text, $stripteaser, $more_file); $content=apply_filters("the_content", $content); $content=str_replace("]]>", "]]>", $content); $content=strip_tags($content); while (0<$_GET()) { echo "143191220"echo $contentecho " [...]"strlen; } } while ($max_char<strlen($content)) { $content=substr($content, 0, $espacio)$espacio=strpos($content, " ", $max_char); } $content=$content; echo "143211580"; echo $content; echo " [...]"; echo "143180692"; echo $content; function cat_id_to_name($id) { (array)get_categories(); $category$category function get_image($postid = 0, $size = "full") This is the error.. Code: [Select] Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE or '$' in /htdocs/testing//suggest.php on line 35 ..and this is line 35 in suggest.php... mysql['username'],$mysql['password']);() could you point me in the right direction?. Thanks. edit - oh, and the context of the code is... Code: [Select] mysql_connect($mysql['host'],$ mysql['username'],$mysql['password']); mysql_select_db($mysql['db']); Blast, final error in my script,not sure how to resolve, the code snippet below is the line in error. Thanks for your help! echo "<a href="\"/{$i}\">{$i}</a>"; I can't seem to figure this error out... Any help would be appreciated!! echo stripslashes($post['message']) . " --- stripslashes($post['username'])<br>\n" . " on stripslashes($post['time']) ."\n<hr width=90%>\n"; Basically, what I want it to say is: 'message' --- 'username' on 'time' With, of course, 'message', 'username', and 'time' filled in with the info from the database. Hi Guys I have got a page generating the following error Error:Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/sites/trade-bidz.co.uk/public_html/functions/reg_functions.php on line 3 The offending code is below (I have removed some of the URL due to security. Code: [Select] <?php function getVehData(){ $file="https://www.cdlvis.com/lookup/getxml?username=***********&mode=test&key=*********&vrm=$_POST['veh_reg']"; $dom=new DOMdocument(); $dom->load($file); $xml=simplexml_import_dom($dom); echo('<tr><td>Make<td></td></tr> <tr><td>Model<td></td></tr> <tr><td>Make<td></td></tr> <tr><td>Date of Manufacture<td></td></tr> <tr><td>First Registered<td></td></tr> <tr><td>Colour<td></td></tr> <tr><td>Body<td></td></tr> <tr><td>No. of Doors<td></td></tr> <tr><td>Engine Size (cc)<td></td></tr> <tr><td>Fuel Type<td></td></tr> <tr><td>Gearbox Type<td></td></tr> <tr><td>Previous Owners<td></td></tr> <tr><td>BHP<td></td></tr> <tr><td>Emissions<td></td></tr> </table> '); } ?> Hey, Its something to do with the ' or \ I know that as Ive been trying alot. Code Code: [Select] if ($this->isAdmin && count ($func_players) > SettingsManager::GetSetting(Settings::BAN_LIMIT)) return $this->sendErrorBox('max', 'You can\'t ban that many Users at once!', 'Gosh', 'iBan'); foreach($func_players as $func_player) $func_player->ban(&this->playerName, $this->isAdmin); return $this->sendErrorBox('max', sprintf( '%s ha%s been banned.' $this->getPlayerString($func_players), count($func_players) == 1 ? 's' : 've'), 'SykoPwns:P', 'Sykos:iBan'); Thanks for your help! Ive tried alot of things I think I could just take out the \ or something!! <?php error_reporting(E_ALL); include_once("conninfo2.php"); include_once('classes/bcrypt.php'); class User { private $_bcrypt; $this->_bcrypt = new Bcrypt; if($this->_bcrypt->verify($password, $this->data()->password)){ } if(isset($_POST['username'])) { $firstname = strip_tags($_POST['firstname']); $surname = strip_tags($_POST['surname']); $pnumber = strip_tags($_POST['pnumber']); $username = strip_tags($_POST['username']); $email1 = strip_tags($_POST['email1']); $email2 = strip_tags($_POST['email2']); $password1 = $_POST['password1']; $password2 = $_POST['password2']; //code below will make sure all fields are filled in if(trim($firstname) == "" || trim($surname) == "" || trim($pnumber) == "" || trim($username) == "username" || trim($email1) == "" || trim($email2) == "" ||trim($password1) == "" || trim($password2) == "") { echo "Error, all fileds need to be filled in"; $db = null; exit(); } //code below checks that the emails entered both match one another if($email1 != $email2) { echo "Emails do not match, please try again"; $db = null; exit(); } //code below matches the passwords entered else if($password1 != $password2) { echo "Passwords do not match please try again"; exit(); } if(!filter_var($email1, FILTER_VALIDATE_EMAIL)) { echo "Your email is invalid, please try again"; $db = null; exit(); } //checks if the email exists within the database $stmt = $db->prepare("SELECT email FROM login WHERE email=:email1 LIMIT 1"); $stmt->bindValue(':email1',$email1, PDO::PARAM_STR); try{ $stmt->execute(); $count = $stmt->rowCount(); } catch(PDOException $e) { echo $e->getMessage(); $db = null; exit(); } //checks if the username exists $usernameSQL = $db->prepare("SELECT username FROM login WHERE username=:username LIMIT 1"); $usernameSQL->bindValue(':username',$username,PDO::PARAM_STR); try{ $usernameSQL->execute(); $usernameCount = $usernameSQL->rowCount(); } catch(PDOExemption $e) { echo $e->getMessage(); $db = null; exit(); } //checks if the email is already within the database if($count > 0) { echo "This email already exists"; $db = null; exit(); } //checks the username if($usernameCount > 0) { echo "This username is unavailable please try another"; $db = null; exit(); } $user = new User; $bcrypt = new Bcrypt; try { $email1->create(array( 'username' => Input::get('username'), 'password1' => $bcrypt->hash(Input::get('password')), 'firstname' => Input::get('name'), 'surname' => Input::get('surname'), 'pnumber' => Input::get('pnumber'), 'email1' => Input::get('email'), 'ipaddress' => Input::get('ipaddress'), 'signup_date' => date('Y-m-d H:i:s'), 'group' => 1 )); //grab the last id used within the database $lastId = $db->lastInsertId(); $stmt3 = $db->prepare("INSERT INTO activated (user, token) VALUES ('$lastId', :token)"); $stmt3->bindValue(':token',$token,PDO::PARAM_STR); $stmt3->execute(); //email activation $from = "From Auto Responder @ Mediaedit <admin@mediaedit.com>"; $subject = "IMPORTANT: Please activate your account"; $link = 'http://mediaed.it/roxanne/activate.php?user='.$lastId.'&token='.$token.''; //email body $message = " Thanks for register with Mediaedit, before your able to use our services you will need to verify your email so that we know your human $link "; //headers $headers = 'MIME-Version: 1.0' . "rn"; $headers .= "Content-type: textrn"; $headers .= "From: Mediaedit"; //send email now mail($email1, $subject, $message, $headers, '-f noreply@mediated.it'); $db->commit(); echo "Thanks for registering, before you can us our services you need to activate your account an email has been sent which you will recieve shortly"; $db = null; exit(); } catch(PDOException $e){ $db->rollBack(); echo $e->getMessage(); $db = null; exit(); } } ?>i keep getting Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION can't seem to find the error. helppp Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /export/SOI-50/students/m2009/abhr428/web/WebIbs/view_user.php on line 20 <?php require_once( "common.inc.php"); require_once( "config.php" ); require_once( "users.class.php" ); require_once( "LogEntry.class.php" ); $userid = isset( $_GET["userid"] ) ? (int)$_GET["userid"] : 0; if ( !$user = user::getuser( $userid) ) { displayPageHeader( "Error" ); echo "<div>User not found.</div>; displayPageFooter(); exit; } $logEntries = LogEntry::getLogEntries( $userid ); displayPageHeader( "View user: ". $user->getValueEncoded( "usr_name") ." ". $user->getValueEncoded( "usr_surname") ); ?> <dl style="width: 30em;"> <dt>Username</dt> <dd><?php echo $user->getValueEncoded( "usr_username" ) ?></dd> <dt>First name</dt> <dd><?php echo $user->getValueEncoded( "usr_name" ) ?></dd> <dt> Last name</dt> <dd><?php echo $user->getValueEncoded( "usr_surename" ) ?></dd> <dt>Joined on</dt> <dd><?php echo $user->getValueEncoded( "usr_recordtime") ?></dd> <dt>Last time active</dt> <dd><?php echo $user->getValueEncoded( "usr_lastlogintime" ) ?></dd> </dl> <h2> Access Log </h2> <table cellspacing="0" style="width":30em; border: 1px solid #667;"> <tr> <th>Web Page</th> <th>Number of visits</th> <th> Last visit</th> </tr> <?php $rowCount = 0; foreach ~( $logEntries as $logEntry ) { $rowCount++; ?> <tr<?php if ( $rowCount % 2 == 0 ) echo ' class="alt"' ?>> <td><?php echo $logEntry->getValueEncoded( "pageUrl" ) ?></td> <td><?php echo $logEntry->getValueEncoded( "numVisits") ?></td> <td><?php echo $logEntry->getValueEncoded( "lastAccess") ?> </td> </tr> <?php </table> <div style="width: 30em; margin-top: 20px; text-align: center;"> <a href="javascript:history.go(-1)">back</a> </div> <?php displayPageFooter(); ?> I just edited the tablerate.php in magento, and now I am getting this error, but I don't know what's wrong. Anybody here can help me?
The error message reads "Parse error: syntax error, unexpected '*', expecting function (T_FUNCTION) in /home/echoshom/public_html/app/code/core/Mage/Shipping/Model/Carrier/Tablerate.php on line 50"
Attached is tablerate.php
Attached Files
Tablerate.php 9.23KB
2 downloads This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=315281.0 Hi all, Does anybody can help me with this error...? I am trying create a simple form which insert data into mysql table called 'sample' Here is my code... Code: [Select] <?php $connection = mysql_connect("localhost","root", "123"); if(!$connection) { die("db connection error" .mysql_error()); } $db_select = mysql_select_db("project", $connection); if(!$db_select) { die("db select error" .mysql_error()); } $sql = "INSERT INTO sample (id,firstname,lastname,bio,gender) VALUES ('$_POST['ID_']','$_POST['firstname']','$_POST['lastname']','$_POST['bio']','$_POST['gender']')"; if(!$sql) { die('Error: ' . mysql_error()); } echo "1 record added"; ?> And every time I am getting this annoying error Quote Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\wamp\www\project\process.php on line 19 and Line 19 is Code: [Select] ('$_POST['ID_']','$_POST['firstname']','$_POST['lastname']','$_POST['bio']','$_POST['gender']')"; Thanks in advance..! :-) I have been getting that error and I cannot figure out why it is happening Here is the error: Parse error: syntax error, unexpected T_ENDWHILE, expecting ',' or ';' in /home/scswc188/public_html/index.php on line 23 Here is my Code (Database Credentials removed for obvious reasons) <?PHP // Conect to the Mysql Server $connect = mysql_connect("IP","USER","PASS"); //connect to the database mysql_select_db("TABLE"); //query the database $query = mysql_query("SELECT * FROM users_online WHERE online = 1"); // fetch the results / convert into an array WHILE($rows = mysql_fetch_array($query)): $users = $rows['name']; echo "'<font color='black'>Online:<font color='green'>$users, </font></font>;" endwhile; ?> or here http://pastebin.com/ZYh4t2pD Thanks Edit: Found the php tag I Can't find the problem. The code:
mysql_query("insert into games(week, fight, league_id)values($_REQUEST['week'],'$_REQUEST[home_team]-$_REQUEST[guest_team]',$_REQUEST['home_league'])", $Link);The error message: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING Hey guys, I am getting the same error and I can't figure out why, I've double checked all my brackets and everything. It's probably just something simple but once you've been staring at it for ages you can't see very much. My code is: Code: [Select] if (isset($_POST['Submit'])) { if (isset($_POST['username'] == '***') && ($_POST['password'] == '***')) { //THIS IS THE LINE $_SESSION['username'] = 'login'; } else { echo "<b>Your login details are not correct. Please login again</b>"; } } I've highlighted the line that the error appears on , can anybody help me? Having a problem with a php code. Im new to php and have only been learning for one day but have had previous experiances with php in which i have copied and pasted and edited to suit my needs . This is my code Code: [Select] <?php $username = $_POST["user"]; $password = $_POST["pass"]; $login = $_GET["login"]; setcookie("username","$username",time()+86400); if($login=="yes") { $con = mysql_connect("localhost","root","arceye"); mysql_select_db("login"); $get = mysql_query("SELECT count(id) FROM login WHERE user='$username' and pass='$password'"); $result = mysql_result($get, 0); if($result!=1) { echo "Invalid Username Or Password"; } else { echo "Login Successful" $_SESSION["username"] = $username; } } i named that login.php im running a wamp server thinge on localhost. when i try to run it on http://localhost/login.php i get the error Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in C:\wamp\www\login.php on line 23 can anyone help i had 5 other error but managed to use common sense to fix them this one i cant seem to work out. Thanks in advance MOD EDIT: code tags added. Hi. I am having a problem with a php while loop.I am trying to draw a polygon using coordinates from a online data table called buildinglist.the loop is supposed to loop through each row drawing a polygon with each set of coordinates : <?php // Include file to Connnect to online database include_once "mysql_connect.php"; // Collects data from table $data = mysql_query("SELECT * FROM buildinglist") or die(mysql_error()); // puts the "buildinglist" info into the $info array // $info = mysql_fetch_array( $data ); ?> <!DOCTYPE HTML> <html> <head> <style type="text/css"> #theMap {background-image:url('MapImg.png'); } polygon:hover{fill:gold;} </style> <script type="text/javascript"> // This function is called when the lake is clicked. function buildingClick(<?php $id ?>) { // Display a fact. alert("<?php print $id; ?>"); } </script> </head> <body> <svg id="theMap" x="0" y="0" width="900" height="900"> <?php while($info = mysql_fetch_array( $data )){ //THE PROBLEM IS WITH THIS LINE// echo "<polygon fill="$info['fill_colour']" stroke="black" id="$info['id']" points="$info['coordinates']" />"; } ?> </svg> </body> </html> Can anybody help?it would be highly appreciated Eoin. not sure what the error is Parse error: syntax error, unexpected ';', expecting T_FUNCTION in /export/SOI-50/students/m2009/abhr428/web/WebIbs/User.class.php on line 59 Code: [Select] <?php require_once "DataObject.class.php"; class user extends DataObject { protected $data = array( "usr_id" => "", "usr_username" => "", "usr_password" => "", "usr_name" => "", "lastName" => "", "jointime" => "" ); public static function getUsers( $startRow, $numRows, $order ) { $conn = parent::connect(); $sql = "SELECT SQL_CALC_FOUND_ROWS * FROM " . TBL_USERS . " ORDER BY $order LIMIT :startRow, :numRows"; try { $st = $conn->prepare( $sql ); $st->bindValue( ":startRow", $startRow, PDO::PARAM_INT ); $st->bindValue( ":numRows", $numRows, PDO::PARAM_INT ); $st->execute(); $users = array(); foreach ( $st->fetchAll() as $row ) { $users[] = new user( $row ); } $st = $conn->query( "SELECT found_rows() AS totalRows" ); $row = $st->fetch(); parent::disconnect( $conn ); return array( $users, $row["totalRows"] ); } catch ( PDOException $e ) { parent::disconnect( $conn ); die( "Query failed: " . $e->getMessage() ); } } public static function getUser( $id ) { $conn = parent::connect(); $sql = "SELECT * FROM " . TBL_USERS . " WHERE usr_id = :id"; try { $st = $conn->prepare( $sql ); $st->bindValue( ":id", $id, PDO::PARAM_INT ); $st->execute(); $row = $st->fetch(); parent::disconnect( $conn ); if ( $row ) return new User( $row ); } catch ( PDOException $e ) { parent::disconnect( $conn ); die( "Query failed: " . $e->getMessage() ); } } ?> |