Jump to content

bravo14

Members
  • Content Count

    289
  • Joined

  • Last visited

Community Reputation

0 Neutral

About bravo14

  • Rank
    Advanced Member

Profile Information

  • Gender
    Not Telling
  1. Hi all I am having problems with a script that uploads photo and adds watermarks to them. Whenever I try and upload a photo I get the following error Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 24576 bytes) in /home/sites/4a/1/13cb47e429/public_html/control/photos/processProduct.php on line 163 Line 163 is $image = imagecreatefromstring(file_get_contents($photo)); Let me know if you need the entire function for this and I will add it, but not sure what is wrong with the script, I have never seen this error before.
  2. Hi I am using the javascript below to carry put an ajax call. $('#tokenfield') .on('tokenfield:createdtoken', function (e) { $.ajax({ url: 'processProduct.php?action=addTag', type: 'post', data: {tag:e.attrs.value ,photo:83}, }); }); .tokenfield({ autocomplete: { source: function (request, response) { jQuery.get("processProduct.php?action=getTags", { query: request.term }, function (data) { data = $.parseJSON(data); response(data); }); }, delay: 100 }, showAutocompleteOnFocus: true }); When the page loads I get the following error in the console yntaxError: expected expression, got '.' [Learn More] index.php:416 the unexpected '.' is the following line .tokenfield({ I am sure that the answer is really simple, but I can't figure it out at the moment, any hepp would be fantastic
  3. Hi I am trying to use SimpleXML to parse the wordpress export XML file, but when parsing it I am not able to view all elements of the file. Each 'item' is made up in the XML as follows <item> <title></title> <link>http://www.dannykingracing.co.uk/?p=396</link> <pubDate>Fri, 21 Oct 2016 10:48:48 +0000</pubDate> <dc:creator><![CDATA[@dmin]]></dc:creator> <guid isPermaLink="false">http://46.32.240.33/dannykingracing.co.uk/?p=396</guid> <description></description> <content:encoded><![CDATA[ ]]></content:encoded> <excerpt:encoded><![CDATA[]]></excerpt:encoded> <wp:post_id>396</wp:post_id> <wp:post_date><![CDATA[2016-10-21 11:48:48]]></wp:post_date> <wp:post_date_gmt><![CDATA[2016-10-21 10:48:48]]></wp:post_date_gmt> <wp:comment_status><![CDATA[closed]]></wp:comment_status> <wp:ping_status><![CDATA[closed]]></wp:ping_status> <wp:post_name><![CDATA[396]]></wp:post_name> <wp:status><![CDATA[publish]]></wp:status> <wp:post_parent>0</wp:post_parent> <wp:menu_order>1</wp:menu_order> <wp:post_type><![CDATA[nav_menu_item]]></wp:post_type> <wp:post_password><![CDATA[]]></wp:post_password> <wp:is_sticky>0</wp:is_sticky> <category domain="nav_menu" nicename="menu"><![CDATA[Menu]]></category> <wp:postmeta> <wp:meta_key><![CDATA[_menu_item_type]]></wp:meta_key> <wp:meta_value><![CDATA[post_type]]></wp:meta_value> </wp:postmeta> <wp:postmeta> <wp:meta_key><![CDATA[_menu_item_menu_item_parent]]></wp:meta_key> <wp:meta_value><![CDATA[0]]></wp:meta_value> </wp:postmeta> <wp:postmeta> <wp:meta_key><![CDATA[_menu_item_object_id]]></wp:meta_key> <wp:meta_value><![CDATA[395]]></wp:meta_value> </wp:postmeta> <wp:postmeta> <wp:meta_key><![CDATA[_menu_item_object]]></wp:meta_key> <wp:meta_value><![CDATA ]></wp:meta_value> </wp:postmeta> <wp:postmeta> <wp:meta_key><![CDATA[_menu_item_target]]></wp:meta_key> <wp:meta_value><![CDATA[]]></wp:meta_value> </wp:postmeta> <wp:postmeta> <wp:meta_key><![CDATA[_menu_item_classes]]></wp:meta_key> <wp:meta_value><![CDATA[a:1:{i:0;s:0:"";}]]></wp:meta_value> </wp:postmeta> <wp:postmeta> <wp:meta_key><![CDATA[_menu_item_xfn]]></wp:meta_key> <wp:meta_value><![CDATA[]]></wp:meta_value> </wp:postmeta> <wp:postmeta> <wp:meta_key><![CDATA[_menu_item_url]]></wp:meta_key> <wp:meta_value><![CDATA[]]></wp:meta_value> </wp:postmeta> </item> however when parsing it all I get is [title] => SimpleXMLElement Object ( ) [link] => http://www.dannykingracing.co.uk/?p=396 [pubDate] => Fri, 21 Oct 2016 10:48:48 +0000 [guid] => http://46.32.240.33/dannykingracing.co.uk/?p=396 [description] => SimpleXMLElement Object ( ) [category] => Menu the code I am using is: <?php $items = $xml->channel->item; foreach ($items as $item){ print_r($item); } ?> My question is how can I view all of the elements of the XML file, I am clearly missing somethin I just can't figure it out.
  4. Hi I have an XML file listing vehicle details, one record looks like <VehicleDataFeed> <VehicleRecord> <GUID>0dc50ce0-32e2-4785-a6a5-266071944792</GUID> <ReferenceID>0002878523</ReferenceID> <CompanyID>2</CompanyID> <DivisionID>2</DivisionID> <BranchID>2</BranchID> <Location>Auction</Location> <VehicleRecordID>890058</VehicleRecordID> <StockNumber>BU101206</StockNumber> <RegistrationNumber>SL61 TUA</RegistrationNumber> <RegistrationDate>2011-09-29T00:00:00+01:00</RegistrationDate> <MakeDescription>ALFA ROMEO</MakeDescription> <ModelDescription>GIULIETTA</ModelDescription> <SpecDescription>Veloce Tb</SpecDescription> <Colour>Silver</Colour> <BodyStyle>5 Door</BodyStyle> <Transmission>Manual</Transmission> <EngineSize>1368</EngineSize> <FuelType>Petrol</FuelType> <Mileage>40610</Mileage> <RetailPrice>7500.00</RetailPrice> <RetailPricePreVAT>7500.00</RetailPricePreVAT> <VehicleType>Passenger</VehicleType> <Qualifying>N</Qualifying> <Profile>Trade</Profile> <InternetPrice>7500.00</InternetPrice> <Options> <option>ABS</option> <option> Alloy Wheels</option> <option> Adjustable Steering Colmn</option> <option> Air Conditioning</option> <option> C D Player</option> <option> Height Adjustable Drivers Seat</option> <option> Multiple Airbags</option> <option> Remote Central Locking</option> </Options> <InternetNotes /> <PreviousOwners>1</PreviousOwners> <VehicleCode /> </VehicleRecord> I am trying to search for a record on vehicle record id using the following <?php if(!isset($_GET['GUID']) && ($_GET['REF']) && ($_GET['VehID'])){ header('Location: Vehicles.php'); } else{ $guid = $_GET['GUID']; $ref = $_GET['REF']; $vId = $_GET['VehID']; } ?> <?php $url = "url to xml file"; //echo $url; $vehicles =simplexml_load_file($url); $value = $vehicles->xpath("string(//VehicleRecord/VehicleRecordID[contains(text(), $vId)]"); if(count($value) ==0) { // if found header('Location:Vehicles.php'); } ?> But am getting the following errors Warning: SimpleXMLElement::xpath(): Invalid expression in /Applications/MAMP/htdocs/VehicleSearch/vehicle.php on line 19 Warning: SimpleXMLElement::xpath(): xmlXPathEval: evaluation failed in /Applications/MAMP/htdocs/VehicleSearch/vehicle.php on line 19
  5. Hi I am using a datetimepicker in bootstrap and the date format being displayed is dd/mm/yyyy H:i I need it converted to yyyy-mm-dd H:i The code I am using is $newsdate = strtotime($_POST['txtDate']); $news_date = date('Y-m-d H:i:s', $newsdate); However on date like to day 10th April which I would have as 10/04/2017 the code is converting that to 2017-10-04 instead of 2017-04-10 How can I get the dates converted correctly?
  6. Hi I have a mysql query that generates a league table based on wins, losses and draws etc, but also points difference between how many they score and how many are scored against them. The query works except for the points difference part, the offending part of the query is shown below @F:=SUM(IF(tbl_clubs.club_id = tbl_fixtures.away,tbl_fixtures.awayscore,0)) + SUM(IF(tbl_clubs.club_id = tbl_fixtures.home,tbl_fixtures.homescore,0)) as `F`, @A:=SUM(IF(tbl_clubs.club_id = tbl_fixtures.home,tbl_fixtures.awayscore,0)) + SUM(IF(tbl_clubs.club_id = tbl_fixtures.away,tbl_fixtures.homescore,0)) as `A`, SUM(@F - @A) as `PtsDiff`, Using the code above I am getting NULL as a result even though there should be a figure calculated.
  7. Hi all I have a xml file that builds a league table, but want to provide other sites with access to it for a charge. Is there a way I can check the domain using the xml file has permission to do so? I intended on keeping a key in a database with the URL but how can I get the URL using the xml file?
  8. bravo14

    Building bootstrap nav from mysql

    Think part of my problem is on some parts of the menu I will need to get menu options from a different table as well as the pages menu if that makes sense.
  9. Hi all Trying to build a multi level nav for bootstrap from a database below is the code I am using <?php $table = 'tbl_pages_'.$lang; $sql = "SELECT * FROM $table where parent_id = 0 and visible = 1 order by `order` asc"; //echo $sql; $result = mysqli_query($dbConn,$sql) or die(mysqli_error($dbConn)); if(mysqli_num_rows($result)>0){ ?> <nav class="navbar navbar-default navbar-fixed-top"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <div id="navbar" class="navbar-collapse collapse"> <ul class="nav navbar-nav navbar-right"> <?php while($row = mysqli_fetch_assoc($result)){ if($row['page'] == 'riders'){ $pageId = $row['page_id']; //get rider information $table = 'tbl_riders_'.$lang; $sql2 = "SELECT * FROM $table where active = 1 order by `sort` asc"; $result2 = mysqli_query($dbConn,$sql2) or die(mysqli_error($dbConn)); if(mysqli_num_rows($result2) >0){ if($page == $row['page']){ echo '<li class="active dropdown">'; } else{ echo '<li class="dropdown">'; } echo '<a href="'.$shopConfig['url'].$row['link'].'" class="dropdown-toggle " data-hover="dropdown" data-toggle="dropdown">'.$row['menu_display']; echo '<b class="caret"></b></a>'; echo '<ul class="dropdown-menu">'; while($row2 = mysqli_fetch_assoc($result2)){ echo '<li><a href="'.$shopConfig['url'].$row['link'].'/'.$row2['id'].'/'.$row2['identifier'].'">'.$row2['rider_name'].'</a></li>'; } $table = 'tbl_pages_'.$lang; $sql3 = "SELECT * FROM $table where parent_id = $pageId and visible = 1 order by `order` asc"; //echo $sql3; $result3 = mysqli_query($dbConn,$sql3) or die(mysqli_error($dbConn)); if(mysqli_num_rows($result3)>0){ while($row3 = mysqli_fetch_assoc($result3)){ echo '<li><a href="'.$shopConfig['url'].$row3['link'].'">'.$row3['menu_display'].'</a></li>'; } } echo '</ul>'; echo '</li>'; } echo ''; } if(($row['page'] != 'shop') && ($row['page'] !='riders')){ $pageId = $row['page_id']; $pagetable = 'tbl_pages_'.$lang; $dropdown = ''; $subSQL = "SELECT * FROM $pagetable where parent_id = $pageId and visible =1 order by `order` asc"; //echo $subSQL; $subresult = mysqli_query($dbConn,$subSQL) or die(mysqli_error($dbConn)); $subRows = mysqli_num_rows($subresult); if($page == $row['page']){ if($subRows >0){ $dropdown = ' dropdown'; } echo '<li class="active'.$dropdown.'">'; } else{ if($subRows >0){ $dropdown = ' class="dropdown"'; } echo '<li'.$dropdown.'>'; } if($subRows > 0){ echo '<a href="'.$shopConfig['url'].$row['link'].'" class="dropdown-toggle " data-hover="dropdown" data-toggle="dropdown">'.$row['menu_display'].' <b class="caret"></b></a>'; echo '<ul class="dropdown-menu">'; while($row3 = mysqli_fetch_assoc($result3)){ echo '<li><a href="'.$shopConfig['url'].$row3['link'].'">'.$row3['menu_display'].'</a></li>'; } echo '</ul>'; } else{ echo '<a href="'.$shopConfig['url'].$row['link'].'">'.$row['menu_display'].'</a>'; } } } echo '</li>'; } else{ if($row['page'] =='shop' && $shopConfig['shop'] == 1 && $shopConfig['shop_status']=='2'){ if($page == 'shop'){ echo '<li class="active">'; } else{ echo '<li>'; } echo '<a href="'.$shopConfig['url'].$row['link'].'">'.$row['menu_display'].'</a></li>'; } ?> </ul> </div><!--/.nav-collapse --> </div> </nav> <?php } ?> this is the HTML it is rendering [code] <nav class="navbar navbar-default navbar-fixed-top"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <div id="navbar" class="navbar-collapse collapse"> <ul class="nav navbar-nav navbar-right"> <li><a href="http://www.plymouthdevils.co/">Home</a><li><a href="http://www.plymouthdevils.co/sponsors">Sponsors</a><li class="active"><a href="http://www.plymouthdevils.co/news">News</a><li><a href="http://www.plymouthdevils.co/photos">Photos</a><li class="dropdown"><a href="http://www.plymouthdevils.co/riders" class="dropdown-toggle " data-hover="dropdown" data-toggle="dropdown">Riders<b class="caret"></b></a><ul class="dropdown-menu"><li><a href="http://www.plymouthdevils.co/riders/1/lee-smart">Lee Smart</a></li><li><a href="http://www.plymouthdevils.co/riders/2/henry-atkins">Henry Atkins</a></li><li><a href="http://www.plymouthdevils.co/riders/3/callum-walker">Callum Walker</a></li><li><a href="http://www.plymouthdevils.co/riders/4/richard-andrews">Richard Andrews</a></li><li><a href="http://www.plymouthdevils.co/riders/5/saul-bulley">Saul Bulley</a></li><li><a href="http://www.plymouthdevils.co/riders/6/steve-boxall">Steve Boxall</a></li></ul></li><li><a href="http://www.plymouthdevils.co/fixtures">Fixtures</a><li><a href="http://www.plymouthdevils.co/season-tickets">Season Tickets</a></li> </div> </div> [/code] I't's probably something obvious I've missed, but can't spot it.
  10. HI all Probable a very simple answer but I am struggling, I have a .htaccess file with specific rules, but I also want a line on there for any pages that aren't captuured by the previous rules. I currently have the following .htaccess RewriteRule ^news$ news.php [L] RewriteRule ^gallery$ gallery.php[L] RewriteRule ^fixtures$ fixtures.php [L] RewriteRule ^about-us$ profile.php [L] RewriteRule ^sponsors$ sponsors.php [L] RewriteRule ^contact$ contact-us.php [L] RewriteRule ^gallery/([^/\.]+)/([^/\.]+)?$ gallery.php?id=$1&identifier=$2 [L] RewriteRule ^news/([^/\.]+)/([^/\.]+)?$ news.php?id=$1&identifier=$2 [L] RewriteRule ^feed$ rss.php?lang=en [L] RewriteRule ^kids-club$ kids-club.php [L] RewriteRule ^business-club$ business-club.php [L] RewriteRule ^merchandise$ shop.php [L] RewriteRule ^ticket-office$ tickets.php [L] RewriteRule ^my-first-skid$ my-first-skid.php [L] RewriteRule ^riders$ riders.php [L] RewriteRule ^riders/([^/\.]+)/([^/\.]+)?$ riders.php?id=$1&identifier=$2 [L] RewriteRule ^wall-of-honour$ wall-of-honour.php [L] RewriteRule ^commercial$ commercial.php [L] RewriteRule ^travel$ travel.php [L] RewriteRule ^supporters-club$ supporters-club.php [L] RewriteRule ^live$ live.php [L] Rewrit­eRule ^([A-Z­a-z­0-9­-]+)$ page.p­hp?­page=$1 [L] All of them work except the bottom one, so if I was to type in the url of domain.com/season-tickets, I would want that rewritten to domain.com/page.php?page=season-tickets Any help would be great Thanks
  11. Hi all I am trying to update field values using AJAX and json. the ajax call is made using this code <script type="text/javascript"> $(document).ready(function() { $("#cboShipping").change(function() { var data = { subTotal:25, discount:0, shippingOption: $('#cboShipping').val() } $.ajax({ type:"POST", url:"library/setPostage.php", data: data, dataType:'json', success: function(data){ $('#hidshippingCost').val(shippingCost); $('#total').val(totalDisplay); $('#hidTotal').val(total); } }); }); }); </script> The PHP is <? require_once('config.php'); print_r($_POST); $zone = $_POST['shippingOption']; $query="SELECT * FROM tbl_shipping_zones where id = $zone"; echo $query; $result=mysqli_query($dbConn,$query); $row=mysqli_fetch_array($result); $shippingCost = $row['shipping_cost']; echo $shippingCost; $shippingZone = $row['name']; echo $shippingZone; $total = $_POST['subTotal'] + $shippingCost - $_POST['discount']; echo $total; $array=array( 'shippingCost' => $shippingCost, 'shippingCostDisplay' => displayAmount($shippingCost), 'shippingZone' => $shippingZone, 'total' => $total, 'totalDisplay' => displayAmount($total) ); print_r($array); echo json_encode($array); ?> The correct values are being generated in the php Th fields and div containers I am trying to update are in the HTML below <span id="total">£30.00</span> <input name="hidDiscountType" type="hidden" id="hidDiscountType" value="" /> <input name="hidDiscountCode" type="hidden" id="hidDiscountCode" value="" /> <input name="hidDiscount" type="hidden" id="hidDiscount" value="0" /> <input name="hidTotalDiscount" type="hidden" id="hidTotalDiscount" value="0" /> <input name="hidTotal" type="hidden" id="hidTotal" value="30" /></td> any guidance would be appreciated
  12. bravo14

    timeago function giving wrong value

    This is one of the functions I have used with the same result http://phppot.com/php/php-time-ago-function/ I will look at DateTime
  13. Hi all Trying to use a timeago function, however for a date and time for today of 2016-07-02 16:41:48 it is showing at 46 years ago. below is the function function ago($timestamp) { $diff = time() - (int)$timestamp; //echo $diff; if ($diff == 0) return 'just now'; $intervals = array ( 1 => array('year', 31556926), $diff < 31556926 => array('month', 2628000), $diff < 2629744 => array('week', 604800), $diff < 604800 => array('day', 86400), $diff < 86400 => array('hour', 3600), $diff < 3600 => array('minute', 60), $diff < 60 => array('second', 1) ); $value = floor($diff/$intervals[1][1]); return $value.' '.$intervals[1][0].($value > 1 ? 's' : '').' ago'; } and this is how I am displaying it echo '<span class="timeAgo">'.ago($row['date_time']).'</span>';
  14. bravo14

    elrte and elfinder

    Hi all I have set of code for elrte and elfinder, the code works fine on one hosting package from one provider, however the same code is not working on another hosting package from another provider. The code is as follows <script type="text/javascript" charset="utf-8"> $().ready(function() { var opts = { cssClass : 'el-rte', lang : 'en', allowSource : 1, // allow user to view source height : 450, // height of text area toolbar : 'normal', // Your options here are 'tiny', 'compact', 'normal', 'complete', 'maxi', or 'custom' cssfiles : ['http://www.wightwarriors.co/css/style.css'], // elFinder fmAllow : 1, fmOpen : function(callback) { $('<div id="myelfinder" />').elfinder({ url : 'http://www.wightwarriors.co/tapesup/library/connector.php', // elFinder configuration file. lang : 'en', dialog : { width : 900, modal : true, title : 'Files' }, // Open in dialog window closeOnEditorCallback : true, // Close after file select editorCallback : callback // Pass callback to file manager }) } //end of elFinder } $('.editor').elrte(opts); // id of textarea you want rich edit on }) </script> The error generated in firebug is below Notice</b>: Undefined index: extract in <b>/home/linweb41/i/iowislanders.co/user/htdocs/tapesup/library/elFinder.class.php</b> on line <b>321</b><br /> I don't understand why the same code works on one package but not another
  15. bravo14

    glob returning empty array

    Hi all I am trying to display a list of images contained withina folder. I am using the following code <?php //Path to folder which contains images $dirname = $shopConfig['url'].'images/flags/'; //echo $dirname; //Use glob function to get the files //Note that we have used " * " inside this function. If you want to get only JPEG or PNG use //below line and commnent $images variable currently in use print_r(glob($dirname."*")); $images = glob($dirname."*.png"); //Display image using foreach loop foreach($images as $image){ //print the image to browser with anchor tag (Use if you want really ) echo '<a href="'.$image.'" target="_blank"><img src="'.$image.'" height="100" width="100" /></a>'; } ?> I know there are images within the folder, however when I print the array it is empty. Can anyone point out what is wrong with the code and where I have gone wrong? Thanks
×

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.