PHP - Chrome Issue
Hi, I'm not sure where the problem is here. Right now this site works fine in IE and FF, but then I try to load data from the database into the cart, it get's screwed up in Chroms and Safari.
FF loads
<img src="inventory_images/11.jpg" alt="Some item" id="11" class="cartImages" border="1">While Chrome loads this <img src="inventory_images/url(http://localhost/Online/inventory_images/11.jpg).jpg" alt="" id="url(http://localhost/Online/inventory_images/11.jpg)" class="cartImages" border="1">From this if(isset($_POST['miniCartRequest'])){ include "/storescript/connect_to_mysql.php"; $cartOutput = ""; $cartTotal = ""; $product_name=""; $price=""; if(!isset($_SESSION['cart']) || count($_SESSION['cart'])<1){ $cartOutput = "<h2 align='center' style='color:white;'>Your cart is empty</h2>"; } else { $i = 0; foreach($_SESSION['cart'] as $each_item){ $item_id = $each_item['item_id']; $sql = $mysqli->query("SELECT * FROM products WHERE id='$item_id' LIMIT 1"); while($row = $sql->fetch_array()){ $product_name = $row['product_name']; $price = $row['price']; $details = $row['details']; $size = $row['size']; } $pricetotal = $price*$each_item['quantity']; $cartTotal = $pricetotal + $cartTotal; setLocale(LC_ALL, 'en_GB.utf8', 'en_GB'); $pricetotal = number_format($pricetotal, 2); $x = $i + 1; $cartOutput .= "<img src='inventory_images/" . $item_id . ".jpg' alt='" . $product_name . "' id='" . $item_id . "' class='cartImages' border='1' />"; $i++; } } echo $cartOutput; }Can I create an alternative line of code specificall for Chrome/safari to remove the excess characters? And why exactly are they reading the files with the full source locations vs firefox reading only the local location? It's completely unable to read the $product_name aswell. A bit strange, I take it those browsers process the specific information differently? Edited by 7blake, 05 January 2015 - 02:56 AM. Similar TutorialsI'm not sure if this is an HTML or browser issue... But single quotes in strings from database don't work for me in Chrome for some reason. To mine or any other computers. Every other browser detects these quotes. I'm outputting an SQL result containing strings like: Texas Hold'em or America's Cup and I get Texas Hold America The font is looking weird and not smooth as compared to Firefox: Chrome screenshot: Firefox: This is my CSS: @font-face { font-family: 'Aldrich'; font-style: normal; font-weight: 400; src: local('Aldrich'), url(../font.woff) format('woff'); } body,input{ font-family: 'Aldrich', sans-serif; font-size:12px; }Any idea? Why is the font not smoothed out on Chrome (for font-weight:bold) properties? Chrome is the browser I use, I have it set up so that the script detects safari and chrome as separate entities. When I browse to it, it shows: You are using Windows XP with a Chrome Web Browserwith a Safari Web Browser now I know stristr() is a case-insensitive version of strstr(), which will find the first form of a word in a string. The problem is that when I use it, the rest of the script doesn't work... it goes to the part as if nothing is there, and shows the text on the bottom. I can't figure out why. Can someone help me, is there a chrome/safari level of priority or am I just missing something? Code: [Select] <?php //Booleans to set OS and Browser to False. $os = false; $browser = false; //Booleans for Web Browser & OS Functions. $xp = xp(); $vista = vista(); $win7 = win7(); $ubuntu = ubuntu(); $chrome = chrome(); $safari = safari(); $firefox = firefox(); $ie9 = ie9(); $ie8 = ie8(); //Operating Systems function xp(){return(preg_match("/Windows NT 5.1/", $_SERVER['HTTP_USER_AGENT']));} function vista(){return(preg_match("/Windows NT 6.0/", $_SERVER['HTTP_USER_AGENT']));} function win7(){return(preg_match("/Windows NT 6.1/", $_SERVER['HTTP_USER_AGENT']));} function ubuntu(){return(preg_match("/Ubuntu/", $_SERVER['HTTP_USER_AGENT']));} //Web Browsers function chrome(){return(preg_match("/Chrome/", $_SERVER['HTTP_USER_AGENT']));} function safari(){return(preg_match("/Safari/", $_SERVER['HTTP_USER_AGENT']));} function firefox(){return(preg_match("/Firefox/", $_SERVER['HTTP_USER_AGENT']));} function ie9(){return(preg_match("/MSIE 9.0/", $_SERVER['HTTP_USER_AGENT']));} function ie8(){return(preg_match("/MSIE 8.0/", $_SERVER['HTTP_USER_AGENT']));} // If you have one of the valid Operating System. if($ubuntu){echo 'You are using Ubuntu Operating System ';} if($xp){echo 'You are using Windows XP ';} if($vista){echo 'You are using Windows Vista Operating System ';} if($win7){echo 'You are using Windows 7 Operating System ';} // If you have one of the valid Web Browser. if($chrome){echo 'with a Chrome Web Browser';} if($firefox){echo 'with an Firefox Web Browser';} if($safari){echo 'with a Safari Web Browser';} if($ie8){echo 'with an Internet Explorer 8 Web Browser';} if($ie9){echo 'with an Internet Explorer 9 Web Browser';} //If OS or Browser not found in list. if ($ubuntu || $xp || $vista || $win7) $os = true; if($firefox || $chrome || $safari || $ie9 || $ie8) $browser = true; if(!$browser || !$os){ echo'<strong>'; echo '<br />' . $_SERVER['HTTP_USER_AGENT'] . '<br /><br />Administrator someone in your work force is using an unsupported browser or OS, please email this information to the developer of the NCMR software you are using. It will allow your browser/OS combination to be used correctly. Sorry for the inconvenience.</strong> <br /><br />Please copy and paste the text above and send it to your web administrator. It will explain everything he/she needs to do.<br />';} ?> Is there a Chrome tag like this IE one <!--[if IE]> <![endif]--> <!--[if !IE]><!--> <!--<![endif]--> I have use the above tag in my wordpress site, and the only browser it doesn't work in is Google Chrome. Hey everyone, I haven't been working with php long and that my be the root of the problem here but your help is very appreciated. Here is the problem: I have created a login system for a website everything seems to be working great in Chrome and FF. However IE8 is giving some problems. It acts as if my $username and $password variables don't get set. However, I have tried using echo and they print out just fine. I have tried rearranging my code and checking the variables with inset() ...nothing I try seems to work. Maybe I'm doing something wrong you guys can help with. Thanks. (Code below) Code: [Select] <?php session_start(); // Connect to database code here (left out for obvious reasons) ****** ****** //get user name and password before we try and connect $username = $_POST['username']; $password = $_POST['password']; //if username and password suck go back to login screen otherwise check against database. if(!$username && !$password) { header( 'refresh: 2; url=login.html' ); die("username and password could not be verified"); } else { ////here is where i would check database =p } ....... Hey guys, i've made a script to display a random image. Works perfect on firefox, ie but not chrome =/. Rotate.php <?php // rotate images randomly but w/o dups on same page - format: // <img src='rotate.php?i=0'> - rotate image #0 - use 'i=1' // for second, etc // (c) 2004 David Pankhurst - use freely, but please leave in my credit $images=array( // list of files to rotate - add as needed "images/1.jpg", "images/2.jpg", "images/3.jpg", "images/4.jpg", "images/5.jpg", "images/6.jpg", "images/7.jpg", "images/8.jpg", "images/9.jpg" ); $total=count($images); $secondsFixed=2; // seconds to keep list the same $seedValue=(int)(time()/$secondsFixed); srand($seedValue); for ($i=0;$i<$total;++$i) // shuffle list 'randomly' { $r=rand(0,$total-1); $temp =$images[$i]; $images[$i]=$images[$r]; $images[$r]=$temp; } $index=(int)($_GET['i']); // image index passed in $i=$index%$total; // make sure index always in bounds $file=$images[$i]; header ("Location: $file"); header ("Content-Length: 0"); exit; ?> and then to call it, script.php <img src='rotate.php?i=0' width="90%" height="90%" alt="" /> Yesterday I had this problem - I created this website in wordpress www.porthopehealthcentre.com It displayed correct in firefox but not ie. There was an extra closing </div> tag in my header php. When I deleted it, it displayed correct in ie but not firefox. So I added the below tag to my header.php file. It now displays correct in all browsers except google chrome, latest version. What can I do to fix this so it displays correct in google chrome - anybody? Thanks in advance - I really appreciate it. <!--[if IE]> <![endif]--> <!--[if !IE]><!--> </div> <!--<![endif]--> Not sure where in the forum to put this one. Has any noticed when you use pagination with Chrome 18, it tries to display a link to the next page and display what it thinks is the next page? It really shows the last page and is confusing to viewers. Is it possible to have Chrome ignore pages? <?PHP include("include/session.php"); ?> <html> <head> <title></title> <style type="text/css"> .auto-style1 { text-align: center; } .auto-style2 { border: 2px solid #3366FF; } .auto-style3 { font-family: "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif; } </style> </head> <body style="background-color: #AAC6FF"> <?PHP if(isset($_SESSION['useredit'])){ unset($_SESSION['useredit']); echo "<h1><center>User Account Edit Success!</center></h1>"; echo "<p><b><center>$session->username</b>, your account has been successfully updated. " ."<a href=\"javascript:window.close();\">Close Window</a>.</p></center>"; }else{ ?> <?PHP if($session->logged_in){ ?> <h1 class="auto-style1"><span class="auto-style3">User Account Edit :</span> <? echo $session->username; ?></h1> <?PHP if($form->num_errors > 0){ echo "<td><font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font></td>"; } ?> <form action="process.php" method="POST"> <div align="center"> <table class="auto-style2" style="width: 300px"> <tr> <td>Current Password:</td> <td> <input name="curpass" style="width: 150px" type="password" value="<? echo $form->value("curpass"); ?>"></td> <td><? echo $form->error("curpass"); ?></td> </tr> <tr> <td>New Password:</td> <td> <input name="newpass" style="width: 150px" type="password" value="<? echo $form->value("newpass"); ?>"></td> <td><? echo $form->error("newpass"); ?></td> </tr> <tr> <td>Current Email:</td> <td><input name="email" style="width: 150px" type="text" value="<? if($form->value("email") == ""){ echo $session->userinfo['email']; }else{ echo $form->value("email"); } ?>"></td> <td><? echo $form->error("email"); ?></td> </tr> <tr> <td> </td> <td> <form method="post"> <input type="hidden" name="subedit" value="1"> <input name="submit" type="submit" value="submit"></form> </td> </tr> </table> </div> </form> <?PHP } } ?> </body> </html> This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=351832.0 This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=320768.0 This topic has been moved to CSS Help. http://www.phpfreaks.com/forums/index.php?topic=357315.0 <?PHP require("../fpdf/fpdf.php"); include("db.classes.php"); $g = new DB(); $g->connection(); class PDF extends FPDF { .....codes..... } $pdf = new PDF(); .....codes..... $pdf->SetFont('Arial','',14); $pdf->AddPage('L', 'Legal'); $pdf->SetXY(20,20); $pdf->image('../images/DCWD Watermark.png'); $pdf->SetY(35); // call the table creation method $pdf->SetFont('Arial','B',16); $pdf->Cell(0,10,$plateNo); $pdf->SetY(45); $pdf->SetFont('Arial','B',16); $pdf->Cell(0,10,$model); $pdf->SetXY(310, 45); $pdf->SetFont('Arial','B',16); $pdf->Cell(0,10,date("m/d/Y")); $pdf->SetY(55); $pdf->BuildTable($header,$data); $pdf->Output(); ?>Why is FPDF's Output not working? or is something wrong with my browser? I already tried putting paramaters on it but still no go I tried Output('foo.pdf','I') not working but if i itegrate my chrome withIDM it just downloads but when i disable integrationnothing happens. hi, I try to login through a form but when I click the button it does nothing in firefox7 and chrome. It works fine in IE. here's the code: Code: [Select] $a=""; $b=""; if ($_POST) { $a=trim($_POST["id"]); $b=trim($_POST["password"]); $a=str_replace("'","",$a); $b=str_replace("'","",$b); $a=str_replace("\"","",$a); $b=str_replace("\"","",$b); } if ($a=="" || $b=="") { if ($_SESSION["id_session"]=="" || $_SESSION["password_session"]=="") { ?> <form action=members.php method=post> <br><br><Center><table><tr><td colspan=2 align=center><h3>Members Login Area</h3></td></tr> <tr><td>Member's ID</td><td><input type=text name=id></td></tr> <tr><td>Password</td><td><input type=password name=password></td></tr> <tr><td> </td><td> <a href="forgot.php" onclick="doexit=false;"><font face="Verdana,Arial,Helvetica" size="1" color="#000000"><b>Forgot Your Password?</b></font></a></td></tr> <tr><td colspan=2 align=center><input type=submit value="Log In"></td></tr> </table></form> <? } else { middle(); } } else { $check=0; $id=$_POST["id"]; $rs = mysql_query("select * from members where ID='$id'"); if ($rs) { $arr=mysql_fetch_array($rs); $n2=$arr['Password']; if ($n2==$b) { $check=1; $_SESSION["id_session"]=$arr[0]; $_SESSION["password_session"]=$arr[9]; middle(); } } if ($check==0) { print "<h2>Invalid User Id or Password</h2>"; ?> <form action=members.php method=post> <br><br><Center><table><tr><td colspan=2 align=center><h3>Members Login Area</h3></td></tr> <tr><td>Member's ID</td><td><input type=text name=id></td></tr> <tr><td>Password</td><td><input type=password name=password></td></tr> <tr><td> </td><td> <a href="forgot.php" onclick="doexit=false;"><font face="Verdana,Arial,Helvetica" size="1" color="#000000"><b>Forgot Your Password?</b></font></a></td></tr> <tr><td colspan=2 align=center><input type=submit value="Log In"></td></tr> </table></form> <? } } thanks Hi,
I'm newbie. My requirement is to open network shared folder from PHP.
This works fine in IE but not in Chrome.
Can anyone please help me ....
Thanks
I have this form action that checks for errors, if none are found it should go to the confirmation page. Works well in Firefox, however Chrome stays perpetually on the register page. Is there any way to make this work in Chrome as well? Does anyone have any explanation? Thank you very much for your time. Code: [Select] <form action="<?php if(!empty($errors)){ echo "confirmation.php"; } else { echo "register.php"; } ?>" method="POST"> I have a Create new account page. The form is in page named Register.php and once user submit it, it will go to Confirm.php, where it validates the field if everything is correct shows the " Account Created " Message. In Chrome. The error message is shown in Register.php and once all fields are filled then only will show confirm.php. But in Mozilla, it goes to Confirm.php and shows a blank page. My code for Register.php is : Code: [Select] <div class="signup_form"> <form action="confirm.php" method="post" > <?php session_start(); if(isset($_SESSION['error'])) { echo '<p>'.$_SESSION['error']['username'].'</p>'; echo '<p>'.$_SESSION['error']['email'].'</p>'; echo '<p>'.$_SESSION['error']['password'].'</p>'; unset($_SESSION['error']); } ?> <p> <font size="3" face="arial" color="gray"> <label for="username"><b> UserName*</b> </label> </font> <input name="username" type="text" id="username" input style="height:33px" size = "50" size="30"/> </p> <p> <font size="3" face="arial" color="gray"> <label for="email"><b> E-mail Address*</b> </label> </font> <input name="email" type="text" id="email" input style="height:33px" size = "50" size="30"/> </p> <p> <font size="3" face="arial" color="gray"> <label for="password"><b> Password*</b> </label> </font> <input name="password" type="password" id="password" input style="height:33px" size = "50" size="30"/> </p> <p> <input name="submit" type="image" src="images/submit.gif" value="submit"/> </p> </form> </div> and for Confirm.php code is : Code: [Select] <?php session_start(); include('configdb.php'); if(isset($_POST['submit'])) { if($_POST['username'] == '') { $_SESSION['error']['username'] = "User Name is required."; } if($_POST['email'] == '') { $_SESSION['error']['email'] = "E-mail is required."; } else { if(preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/", $_POST['email'])) { $email= $_POST['email']; $sql1 = "SELECT * FROM user WHERE email = '$email'"; $result1 = mysqli_query($mysqli,$sql1) or die(mysqli_error($mysqli)); if (mysqli_num_rows($result1) > 0) { $_SESSION['error']['email'] = "This Email is already used."; } } else { $_SESSION['error']['email'] = "Your email is not valid."; } } if($_POST['password'] == '') { $_SESSION['error']['password'] = "Password is required."; } if(isset($_SESSION['error'])) { header("Location: register.php"); exit; } else { $username = $_POST['username']; $email = $_POST['email']; $password = $_POST['password']; $sql2 = "INSERT INTO users (username, email, password) VALUES ('$username', '$email', '$password')"; $result2 = mysqli_query($mysqli,$sql2) or die(mysqli_error()); if($result2) { echo '<div>Your account is now active. You may now <a href="login.php">Log in</a></div>'; This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=316303.0 |