PHP - Url Change
<?php require_once('config/config.php'); include ("files/viator/api.php"); $page = new PhpCode(); $current_page = $page->curPageURL(); $_SESSION['last_page'] = $current_page ; function seoUrl($string) { //Lower case everything $string = strtolower($string); //Make alphanumeric (removes all other characters) $string = preg_replace("/[^a-z0-9_\s-]/", "", $string); //Clean up multiple dashes or whitespaces $string = preg_replace("/[\s-]+/", " ", $string); //Convert whitespaces and underscore to dash $string = preg_replace("/[\s_]/", "-", $string); return $string; } if(isset($_GET['submit']) && !empty($_GET['submit'])) { $lookupId = $_GET['lookupId']; $dest_code = $_GET['dest_code']; $currency_code = $_GET['currency_code']; $sortOrder = $_GET['sortOrder']; $catId = $_GET['catId']; $subcategoryId = $_GET['subcategoryId']; $country_name = $_GET['country_name']; $state_name = $_GET['state_name']; $country_dest_id= $_GET['country_dest_id']; $check_in = $_GET['check_in']; $check_out = $_GET['check_out']; if($dest_code =='' && $country_dest_id != '') { $dest_code = $country_dest_id; } } else if(isset($_GET['search_submit']) && !empty($_GET['search_submit'])){ $dest_code = $_GET['dest_code']; $currency_code = $_GET['currency_code']; $sortOrder = $_GET['sortOrder']; $catId = $_GET['catId']; $subcategoryId = $_GET['subcategoryId']; $country_name = $_GET['country_name']; $state_name = $_GET['state_name']; $country_dest_id= $_GET['country_dest_id']; $check_in = $_GET['check_in']; $check_out = $_GET['check_out']; $lookupId = $_GET['lookupId']; if($dest_code =='' && $country_dest_id != '') { $dest_code = $country_dest_id; } } else { $lookupId = $_GET['lookupId']; $dest_code = $_GET['dest_code']; $currency_code = $_GET['currency_code']; $sortOrder = $_GET['sortOrder']; $catId = $_GET['catId']; $subcategoryId = $_GET['subcategoryId']; $country_name = $_GET['country_name']; $state_name = $_GET['state_name']; $country_dest_id= $_GET['country_dest_id']; $check_in = $_GET['check_in']; $check_out = $_GET['check_out']; if($dest_code =='' && $country_dest_id != '') { $dest_code = $country_dest_id; } } $getdataarr = getAdventureSearch($dest_code,$currency_code,$sortOrder,$check_in,$check_out); $adventure_data_arr = $getdataarr['data']; $image = '' ; $part = new Body(); $title = "Things to do in "; if($state_name !="") { $title .= $state_name.' ' ;} if ($country_name=="United States of America") { $title .= 'USA ' ; $breadcrumb = 'USA';} elseif ($country_name=="United Arab Emirates") { $title .= 'UAE ' ; $breadcrumb = 'UAE'; } elseif ($country_name!="") { $title .= $country_name; } $title .= " | Compare & Choose"; $meta = '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="description" content="' .$state_name. ' Attractions & Things to do in ' .$country_name. '. Find your adventure in ' .$country_name. ' Today." /><link rel="canonical" href="//www.compareandchoose.com.au/adventure_list"/> <!-- MICROFORMATS FOR GPLUS --> <link href="https://plus.google.com/+CompareandchooseAuTravel/posts" rel="publisher" /> <meta itemprop="name" content="' .$title. '"> <meta itemprop="description" content="' .$state_name. ' Attractions & Things to do in ' .$country_name. '. Find your adventure in ' .$country_name. ' Today."> <meta property="og:locale" content="en_US" /> <meta property="og:type" content="website" /> <meta property="og:title" content="' .$title. '" /> <meta property="og:description" content="' .$state_name. ' Attractions & Things to do in ' .$country_name. '. Find your adventure in ' .$country_name. ' Today." /> <meta property="og:url" content="http://www.compareandchoose.com.au/" /> <meta property="og:site_name" content="Compare and Choose" /> <meta property="article:publisher" content="https://www.facebook.com/compareandchoose" /> <meta property="fb:app_id" content="1386609318277530" /> <meta property="og:image" content="http://www.compareandchoose.com.au/images/Compare-and-Choose-logo.png" /> <meta property="og:image:width" content="313" /> <meta property="og:image:height" content="75" />'; $head = $part->getHead($title,$meta); $header = $part->getHeader('Adventure'); $footer = $part->getFooter(); echo $head; echo $header; ?> <script> function sort() { $('.overlay_wrap').fadeIn(); $('.loader_hotel_page').fadeIn(); } </script> <div class="overlay_wrap" style="display: none;"></div> <div class="loader_hotel_page" style="display: none;"><img src="<?php echo SITE_URL; ?>images/search-loader.gif" alt="searching-records"/></div> <!-----Adventure Listing-----> <div class="container"> <div class="listing"> <div class="row"> <div class="col-xs-12 col-md-3 col-lg-3"> <div class="refine-search travel"> <?php require_once('files/keyword_search.php'); ?> <div class="block"> <div class="block-content"> <div class="block-title">Top Selling Tours & Activities</div> <div class="block-inner"> <div class="top-rated-pic"> <!--<img src="images/small-pic1.png" alt="" />--> </div> <div class="top-topics-sec"> <?php $getcatdataarr = getCategoryDestination($dest_code); $category_arr = $getcatdataarr['data']; $i=1; if($category_arr !="") { foreach ($category_arr as $categoryList) { if($catId == $categoryList['id']) { $image = $categoryList['thumbnailURL']; $groupName = $categoryList['groupName']; ?> <p onclick="sort()"> <strong><?php echo $i;?>.</strong><a href="adventure_list.php?currency_code=<?php echo $currency_code; ?>&dest_code=<?php echo $dest_code;?>&sortOrder=<?php echo $sortOrder;?>&catId=<?php echo $categoryList['id'];?>&country_name=<?php echo $country_name;?>&state_name=<?php echo $state_name;?>&country_dest_id=<?php echo $country_dest_id; ?>&lookupId=<?php echo $lookupId;?>&check_in=<?php echo $check_in;?>&check_out=<?php echo $check_out;?>"><?php echo stripslashes($categoryList['groupName']);?></a> <?php $subcategories_arr = $categoryList['subcategories']; foreach($subcategories_arr as $subcatList) { echo '<br>'; ?> <a href="adventure_list.php?currency_code=<?php echo $currency_code; ?>&dest_code=<?php echo $dest_code;?>&sortOrder=<?php echo $sortOrder;?>&catId=<?php echo $categoryList['id'];?>&subcategoryId=<?php echo $subcatList['subcategoryId'];?>&country_name=<?php echo $country_name;?>&state_name=<?php echo $state_name;?>&country_dest_id=<?php echo $country_dest_id; ?>&lookupId=<?php echo $lookupId;?>&check_in=<?php echo $check_in;?>&check_out=<?php echo $check_out;?>"><?php echo stripslashes($subcatList['subcategoryName']); ?></a> <?php } ?> </p> <?php } else{ ?> <p onclick="sort()"><strong><?php echo $i;?>.</strong><a href="adventure_list.php?currency_code=<?php echo $currency_code; ?>&dest_code=<?php echo $dest_code;?>&sortOrder=<?php echo $sortOrder;?>&catId=<?php echo $categoryList['id'];?>&country_name=<?php echo $country_name;?>&state_name=<?php echo $state_name;?>&country_dest_id=<?php echo $country_dest_id; ?>&lookupId=<?php echo $lookupId;?>&check_in=<?php echo $check_in;?>&check_out=<?php echo $check_out;?>"><?php echo stripslashes($categoryList['groupName']);?></a></p> <?php }$i++;} } ?> </div></div></div></div></div></div> <div class="col-xs-12 col-md-9 col-lg-9"> <div class="travel-main"> <div class="row"> <?php if($image !='') { //$image = 'images/travel-pic.png'; ?> <div class="col-xs-12 col-md-4 col-lg-4"> <!--<img src="<?php echo $image;?>" alt="" />--> </div> <?php } ?> <div class="col-xs-12"> <h1>Things to do in <?php echo stripslashes($country_name);?></h1> <?php if($state_name == '') { $search_name = $country_name; } else{ $search_name = $state_name; } ?> <p>Compare and choose things to do in <?php echo stripslashes($search_name);?></p> <a href="#"><?php echo strtoupper(stripslashes($search_name));?> >></a> <?php if($groupName != '') { echo '<p>'.$groupName.'</p>'; } ?> <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="GET"> <div class="filtering"> <select onchange="this.form.submit();" name="sortOrder"> <option value="TOP_SELLERS" <?php if($sortOrder == 'TOP_SELLERS'){echo 'selected';}?>>Most Popular</option> <option value="REVIEW_AVG_RATING_D" <?php if($sortOrder == 'REVIEW_AVG_RATING_D'){echo 'selected';}?>>Top Rated</option> <option value="PRICE_FROM_A" <?php if($sortOrder == 'PRICE_FROM_A'){echo 'selected';}?>>Price(Low - High)</option> <option value="PRICE_FROM_D" <?php if($sortOrder == 'PRICE_FROM_D'){echo 'selected';}?>>Price(High - Low)</option> </select> <input type="hidden" name="currency_code" value="<?php echo $currency_code;?>" id="currency_code"> <input type="hidden" name="lookupId" value="<?php echo $lookupId;?>" id="lookupId"> <input type="hidden" name="dest_code" value="<?php echo $dest_code;?>" id="dest_code"> <input type="hidden" name="catId" value="<?php echo $catId;?>" id="catId"> <input type="hidden" name="subcategoryId" value="<?php echo $subcategoryId;?>" id="subcategoryId"> <input type="hidden" name="country_name" value="<?php echo $country_name; ?>" id="country_name" > <input type="hidden" name="state_name" value="<?php echo $state_name;?>" id="state_name"> <input type="hidden" name="country_dest_id" value="<?php echo $country_dest_id;?>" id="country_dest_id"> </div> </form> </div><div class="c1"></div></div></div> <?php if($adventure_data_arr != ""){ foreach($adventure_data_arr as $adventureList) { $url = seoUrl($adventureList['title']); if($catId == '') { ?> <div class="travel-list-sec"> <div class="row"> <div class="col-xs-12 col-md-3 col-lg-3 spacal-img"> <?php if($adventureList['specialOfferAvailable'] == 1) {?> <div class="spacal-tag"> <img src="images/specila-tag.png" alt="" /> </div> <?php } ?> <img src="<?php echo $adventureList['thumbnailHiResURL'];?>" alt="" width="166" height="160" /> </div> <div class="col-xs-12 col-md-9 col-lg-9"> <div class="travel-det"> <h2 style="text-transform: uppercase; font: 400 15px 'Open Sans', sans-serif; text-decoration: none;"><a style="color: rgb(103, 191, 54);" href="adventure_details.php?name=<?php echo $url;?>&code=<?php echo $adventureList['code'];?>¤cyCode=<?php echo $adventureList['currencyCode'];?>&lookupId=<?php echo $lookupId;?>&dest_code=<?php echo $dest_code; ?>"><?php echo stripslashes($adventureList['title']);?></a></h2> <p><?php echo stripslashes($adventureList['shortDescription']);?></p> <div class="rating-box"> <div class="ratings"> <?php $rate = $adventureList['rating']; $f= floor($rate); $c = ceil($rate); $cnt = 0; if($rate!="" && $rate!=0) { for($in = 1; $in<=$rate ;$in++) { $cnt++; ?> <img src="images/rating_full.png"> <?php } if($f != $c) { $cnt++; ?> <img src="images/rating_half.png"> <?php } } if($cnt<5) { while($cnt<5) { $cnt++; ?> <img src="images/rating_blank.png"> <?php } } ?> <!--<span class="stars"><?php echo $adventureList['rating']; ?></span>--> </div> <div class="rating-txt"> based on <?php echo $adventureList['reviewCount']; ?> reviews </div> <div class="c1"></div> </div> <div class="price-box"><a href="adventure_details.php?name=<?php echo $url;?>&code=<?php echo $adventureList['code'];?>¤cyCode=<?php echo $adventureList['currencyCode'];?>&lookupId=<?php echo $lookupId;?>&dest_code=<?php echo $dest_code; ?>"> <span style="float: right; margin-right: 1%; padding: 6px 20px; color: white; background-color: rgb(108, 191, 61); text-align: center; font-size:16px; font-weight:400; ">See Details →</span></a> <span class="new_price">Duration :<?php echo stripslashes($adventureList['duration']);?></span><br /> <span class="new_price">From <?php echo stripslashes($adventureList['currencyCode']);?> <?php echo stripslashes($adventureList['priceFormatted']);?></span> <?php if($adventureList['specialOfferAvailable'] == 1) { ?> <div class="original"> <p>Original Price : <?php echo stripslashes($adventureList['rrpformatted']);?></p> </div> <div class="save-price"> <p>Saving Amount : <?php echo stripslashes($adventureList['savingAmountFormated']);?></p> </div> <?php } ?> </div></div></div><div class="c1"></div></div></div> <?php } else { if($subcategoryId == '') { $catgory_arr = $adventureList['catIds']; if(in_array($catId, $catgory_arr)) { ?> <div class="travel-list-sec"> <div class="row"> <div class="col-xs-12 col-md-3 col-lg-3"> <img src="<?php echo $adventureList['thumbnailHiResURL'];?>" alt="" width="166" height="160" /> </div> <div class="col-xs-12 col-md-9 col-lg-9"> <div class="travel-det"> <h1><a href="adventure_details.php?name=<?php echo $url;?>&code=<?php echo $adventureList['code'];?>¤cyCode=<?php echo $adventureList['currencyCode'];?>"><?php echo stripslashes($adventureList['title']);?></a></h1> <p><?php echo stripslashes($adventureList['shortDescription']);?></p> <div class="rating-box"> <span class="stars"><?php echo $adventureList['rating']; ?></span> <div class="rating-txt"> based on <?php echo $adventureList['reviewCount']; ?> reviews </div> <div class="c1"></div> </div> <div class="price-box"> <div class="price">Duration :<?php echo stripslashes($adventureList['duration']);?></div> <div class="price">From <?php echo stripslashes($adventureList['currencyCode']);?> <?php echo stripslashes($adventureList['priceFormatted']);?></div> <?php if($adventureList['specialOfferAvailable'] == 1) { ?> <h3>Special Offer </h3> <p>Original Price : <?php echo stripslashes($adventureList['rrpformatted']);?></p> <p>Saving Amount : <?php echo stripslashes($adventureList['savingAmountFormated']);?></p> <?php } ?> </div></div></div><div class="c1"></div></div></div> <?php } } else{ $sub_catgory_arr = $adventureList['subCatIds']; if(in_array($subcategoryId, $sub_catgory_arr)) { ?> <div class="travel-list-sec"> <div class="row"> <div class="col-xs-12 col-md-3 col-lg-3"> <img src="<?php echo $adventureList['thumbnailHiResURL'];?>" alt="" width="166" height="160" /> </div> <div class="col-xs-12 col-md-9 col-lg-9"> <div class="travel-det"> <h1><a href="adventure_details.php?name=<?php echo $url;?>&code=<?php echo $adventureList['code'];?>¤cyCode=<?php echo $adventureList['currencyCode'];?>"><?php echo stripslashes($adventureList['title']);?></a></h1> <p><?php echo stripslashes($adventureList['shortDescription']);?></p> <div class="rating-box"> <span class="stars"><?php echo $adventureList['rating']; ?></span> <div class="rating-txt"> based on <?php echo $adventureList['reviewCount']; ?> reviews </div> <div class="c1"></div> </div> <div class="price-box"> <div class="price">Duration :<?php echo stripslashes($adventureList['duration']);?></div> <div class="price">From <?php echo stripslashes($adventureList['currencyCode']);?> <?php echo stripslashes($adventureList['priceFormatted']);?></div> <?php if($adventureList['specialOfferAvailable'] == 1) { ?> <h3>Special Offer </h3> <p>Original Price : <?php echo stripslashes($adventureList['rrpformatted']);?></p> <p>Saving Amount : <?php echo stripslashes($adventureList['savingAmountFormated']);?></p> <?php } ?> </div></div></div><div class="c1"></div></div></div> <?php } } } } } ?> </div><div class="breadcrumb-new"> <ul> <li><div itemscope itemtype="http://data-vocabulary.org/Breadcrumb"> <a href="<?php echo SITE_URL;?>" itemprop="url"><span itemprop="title">Home</span></a><span>></span> </div></li> <li><strong>Adventures & Activities in <?php echo $state_name. ',' .$country_name; ?></strong></li> </ul> </div><div class="c1"></div></div></div></div> <?php echo $footer ;?> </body> </html>Hi All I am trying to change my website from http to https and I have ran into a problem with one of the scripts producing a none secure http problem Basically when I check this it shows a none secure error ERROR insecure url = http://cache.graphic...m/etcetcetc.jpg which needs to be https://cache.graphi...m/etcetcetc.jpg I thinks it is something to do with the array $adventureList array on line 285(not exactly sure, as I didn't write the code and I am not an expert) So my question is how do I change this to https url please find attached my page code thanks in advance all Alan Similar TutorialsNeed to change the value in an XML string tried the following but no luck, any suggestions?
$_xml_string = '<Order> <EmbeddedDoc DocumentName="TestDoc" DocumentFormat="PDF">jdsahfdhflhfsdlfhdslhsdflsdfhflkdslkfsdhkfhskldhkl</EmbeddedDoc> <EmbeddedDoc DocumentName="TestDoc1" DocumentFormat="PDF">jdsahfdhflhfsdlfhdslhsdflsdfhflkdslkfsdhkfhskldhkl</EmbeddedDoc> </Order>'; foreach($_xml_string->Order->EmbeddedDoc as $document) { $document ='##FILE_CONTENT##'; } Hi all I'm new to PHP so i might ask easy stuff Here is my Scenario I click a button .. this work fine But in the php code that runs after the button is clicked i need to change the Website uri (link) to something like this after button postback index?name=value How am i gonna do this . I tried header function but it did not work well Any suggestion please Sir, i know that we can change the user agent via cURL. i want to know is possible to change ip ? I have function for add or change parametre in utl(GET), but when i use seo url and mu url goes like this: www.example.com/article/2 and when i click on pagination button where is that function for add or change, i get this url: www.example.com/article.php?id=2&page=2 but i need to url be like this: www.example.com/article/2?page=2 What should i change in this function: Code: [Select] function add_or_change_parameter($parameter, $value) { $params = array(); $output = "?"; $firproun = true; foreach ($_GET as $key=>$val) { if ($key != $parameter) { if (!$firproun) { $output .= "&"; } else { $firproun = false; } $output .= $key."=".urlencode($val); } } if (!$firproun) { $output .= "&"; } $output .= $parameter."=".urlencode($value); return htmlentities($output); } ? Thanks.. Can someone tell me why this code will not work? It's supposed to update the quantity in a shopping cart by taking the user input and changing the value of the array. I can add items by clicking the 'add to cart' button, but as you know that only works one at a time. Once you make a selection you have the opportunity to go to the cart and modify the quantity by entering in a numeric value; so instead of clicking 10 times you can just type 1, 0 to get to 10. Is there any other info I can provide to convey what I'm trying to do? I'm new to php so I don't know why it's not working, this looks right according to php.net but something is wrong. if(isset($_POST['submit'])) { foreach($_POST['quantity'] as $key => $value) { if($value==0) { unset($_SESSION['cart'][$key]); }else{ $_SESSION['cart']['$key']['quantity']=$value; } } } errors below: Invalid argument supplied for foreach() illegal string offset 'cart' Edited by somerandom, 22 October 2014 - 06:04 PM. Hi guys, I'm trying to create a script which changes on curtain times, heres a example: 3pm - Dance Session 4pm - Indie Session 5pm - RnB Session What i want the desired outcome to be is Display current time with whats playing (say its 3pm) 3pm - Dance Session Then at 4 i want it to remove the 3pm and display the 4pm - Indie Session Is it possible? If so how? Many thanks for you time guys! J Hellow every one; i need little help to change code in my script version as i have older version codes and em using new version script so i need to change codes on my version script. iam using latest script which codes are these Quote if ($CURUSER['control_panel'] == 'yes' && $privacylevel == 'strong') print('<td class="f-border comment-details" align="left" width="15%"><center><strong>'.$postername.'</strong><br /><i>'.$title.'</i><br /><img width="80" height="80" src="'.$avatar.'"><br /><br />Uploaded: ---<br />Downloaded: ---<br />Ratio: ---<br /><br /><a href="account-details.php?id='.$row["user"].'"><img src="themes/'.$THEME.'/forums/icon_profile.gif"></a> <a href="mailbox.php?compose&id='.$row["user"].'"><img src="themes/'.$THEME.'/forums/icon_pm.gif" ></a></center></td>'); and Quote else print('<td class="f-border comment-details" align="left" width="15%"><center><strong>'.$postername.'</strong><br /><i>'.$title.'</i><br /><img width="80" height="80" src="'.$avatar.'"><br /><br />Uploaded: '.$useruploaded.'<br />Downloaded: '.$userdownloaded.'<br />Ratio: '.$userratio.'<br /><br /><a href="account-details.php?id='.$row["user"].'"><img src="themes/'.$THEME.'/forums/icon_profile.gif"></a> <a href="mailbox.php?compose&id='.$row["user"].'"><img src="themes/'.$THEME.'/forums/icon_pm.gif" ></a></center></td>'); and i want to change them under Quote if ($row["class"] == 3 || $row["donated"] > 0) { if ($site_config["donatedstar"] || $site_config["vipstar"]) { $star = "<img src=images/star.gif border=0>"; } else { $star = ""; } } if ($privacylevel != "strong" || ($CURUSER["control_panel"] == "yes")) { print("<tr><td valign=top width=150 align=left class=table_col2><center><b>$postername $star</b><br><i>$title</i></center><br>Uploaded: $useruploaded<br>Downloaded: $userdownloaded<br>Ratio: $userratio<br><br><center><img width=80 height=80 src=$avatar></center><br></td>"); and Quote }else{ print("<tr><td valign=top width=150 align=left class=table_col2><center><b>$postername $star</b><br><i>$title</i></center><br>Uploaded: ---<br>Downloaded: ---<br>Ratio: ---<br><br><center><img width=80 height=80 src=$avatar></center><br></td>"); } and one more thing i have two different images for both classes as in older codes version only one image specify for both class but em using two images for "Donated" = start.gif and for "VIP" = vip.gif so i want both images for both class so pls help me how to do them. Thanks, Regards. i have a basic html form with a drop down selection box with 2 options ('old' and 'new'). when you click one it swaps them round to you can click the other because it is an onchange event. <form action="<?php $_SERVER['self']; ?>" method="get"> <select name="Time" onchange="this.form.submit();"> <option value="New">New</option> <option value="Old">Old</option> </select></form> How would I change the current timezone used within a php script? The method I usually use, date_default_timezone_set() is undefined on my webhost, so I am trying to find another way. I have a navigation bar that allows the user to change the color scheme of the site (logo and background)
The javascript I am using works, it changes it from one color to another, however, if the user selects the color that is already selected the logo disappears:
function colorRed() { document.body.style.backgroundColor = "#b20a22"; $("#logo").fadeOut(function() { $(this).load(function() { $(this).fadeIn(); }); $(this).attr("src", "./redlogo.png"); });Thanks Hello PHPFreaks, Im looking to make a script that can find sertend text or numbers in mysql database and can change it. The only problem is that the database also contains same text and numbers that dont need to be changed. So only for example within [39,10] the , has to be changed into a . and only between the [ ] Anyone got script for this or can help me make one cause im new to php. I have a website on wordpress, at first it was on a friends server, but he switched it so its on bluehost. The website URL is an IP address with a slash and a name. However, I registered a domain name at godaddy. I was able to change the nameservers so that the URL of the index page of my website was changed to the domain name, however, when I click onto any other page from that page, it goes back to the IP address URL. What can I do? Thanks. I recently put together a form for a client - I am not a programmer (designer) but it worked really until we tried to put the name of a city. It wouldn't take abbreviations that the post office uses
I need to do one of two things - allow it to take abbreviations or take off the requirement that the field has to be filled out.
HELP
Here is the code.
<li class='field_block' id='field_3_div'><div class='col_label'> Hi all, I am dealing with an html page in which a dynamically created PNG image is shown with: <img src="createchart.php"> The problem arises when users try to download the image since the default name that appears is just "createchart.php". Is there any way to make the browser suggest something like "chart.png"? Than you guys for your help, Mam I have quite a long .php page but I've attached the end of it. I was wondering if I can change the order it is displayed. Basically $j is a year. And currently it goes from 1894 until 2019. I don't think anything is currently telling it to sort either way, it just by default shows that way. But I want it to show 2019 first and go down to 1894. I had this written for me by someone who I can no longer get hold of. $total_record=count($session_player); $i=0; $palyerslink=""; foreach($session_player as $var=>$val) { $i++; if($i==$total_record) $palyerslink.="<a href='/history/?pid=$var' title='view this in more detail'>$val</a>"; else $palyerslink.="<a href='/history/?pid=$var' title='view this in more detail'>$val</a>, "; } if(!empty($session_player)) { $tr++; $records.="<tr class=row> <td class=border-right><a href='/history/browse?season=$j'>$j-$value</a></td> <td class=border-right>$max_goal_season</td> <td>$palyerslink</td> </tr>"; } } $records.="</table></div>"; echo $records; ?>
This is the end of the page where the records are then displayed using the echo. I'm not sure if more code is needed though, I could post it in full if needed Edited May 29, 2020 by alxneUsing php I have a dynamically filled select box with the names of images. How can I get an image box on my page and change upon selection? Hi,
I'm having the following problem. I want to change the row color depending on the value of a record.
i made three different td class in the style.
Then i check the value of the record "TOEGEZEGD" and connect this to $NewClass,
The i try to change the color of the background.
$NewClass takes the value i want (check by display echo $NewClass)
But the background of the row doesn't change, i tried different methodes:
<td class = "$NewClass">'.$row['TOEGEZEGD'].'</td> <td class = \"$New$Class\">'.$row['VORM'].'</td> <td><DIV CLASS="$NewClass">'.$row['PAKKET'].'</DIV></td> But non of them work please help, it's driving my crazy <?php // checking for started session function is_session_started() { if ( php_sapi_name() !== 'cli' ) { if ( version_compare(phpversion(), '5.4.0', '>=') ) { return session_status() === PHP_SESSION_ACTIVE ? TRUE : FALSE; } else { return session_id() === '' ? FALSE : TRUE; } } return FALSE; } if ( is_session_started() === FALSE ) session_start(); if(isset($_SESSION ['ingelogd']) AND $_SESSION['ingelogd'] == 1) {} else { header("location:index.php"); exit; } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>**********</title> <meta name="" content=""> </head> <body> <style> textarea, input, button, a, td, span{ font-family: "Trebuchet MS", Helvetica, sans-serif; } td{ color: blue; width: 100px; background-color: #ceffce; height: 50px; text-align: center; } td.JA{ color: red; width: 100px; background-color: #00ee00; height: 50px; text-align: left; } .JA{ color: red; width: 100px; background-color: #00ee00; height: 50px; text-align: left; } td.NEE{ color: green; width: 100px; background-color: #ff0000; height: 50px; text-align: left; } td.MISSCHIEN{ color: orange; width: 100px; background-color: #f07700; height: 50px; text-align: left; } td.op{ color: black; width: 450px; background-color: #ceDDce!important; height: 50px; text-align: left; } th{ color: black; width: 40px; background-color: #cecece; height: 50px; text-align: center; } th.op{ color: black; width: 450px; background-color: #cecece; height: 50px; text-align: center; } .a{ height: 25%; cursor: pointer; } button{ width: 100%; height: 100%; margin: -5 auto -5 auto; } textarea { height: 100%; width: 100%; } .verwijder{ width: 10px; height: auto; background-color: #ffa8a8; } .space{ width: 20px; height: auto; } .invoegen{ background-color: #6dbbdc; width: 1434px; padding: 5px; margin: 5px; } .content{ background-color: #FFDD67; width: 1500px; ; padding: 0 5 0 5; margin: 0 5 0 5; } .content table{ margin-bottom: 100px; } span{ text-decoration: underline; } select{ height: 90%; } </style> <div class="content"> <?php mysql_connect("localhost", "************", "*********") or die(mysql_error()); mysql_select_db("*********"); $sql = "SELECT ID, NAAM, CONTACT, TOEGEZEGD, bestuur1, bestuur2, bestuur3, bestuur4, bestuur5, VORM, PAKKET, KANGEFACTUREERD, GEFACTUREERD, AANTAL, POST, OPMERKING FROM `sponsoren` ORDER BY $field $sort"; $result = mysql_query($sql) or die(mysql_error()); echo'<table>'; while($row = mysql_fetch_array($result)) { $BESTUUR1 = $row['bestuur1']; $BESTUUR2 = $row['bestuur2']; $BESTUUR3 = $row['bestuur3']; $BESTUUR4 = $row['bestuur4']; $BESTUUR5 = $row['bestuur5']; if ($row['TOEGEZEGD'] == 'ja') { $NewClass = "JA" ; } elseif ($row['TOEGEZEGD'] == 'nee') { $NewClass = "NEE"; } elseif ($row['TOEGEZEGD'] == 'misschien') { $NewClass = "MISSCHIEN"; } echo $NewClass; echo'<tr> <td><a href="full_table_row_results.php?ID='.$row['ID'].'">'.$row['ID'].'</a></td> <td>'.$row['NAAM'].'</td> <td>'.$row['CONTACT'].'</td> <td >'; if($BESTUUR1 == 1){ echo "<div class='item'><label>Kk</label></div>"; }; if($BESTUUR2 == 1){ echo "<div class='item'><label>Rutger</label></div>"; }; if($BESTUUR3 == 1){ echo "<div class='item'><label>Toby</label></div>"; }; if($BESTUUR4 == 1){ echo "<div class='item'><label>Meijke</label></div>"; }; if($BESTUUR5 == 1){ echo "<div class='item'><label>Boele</label></div>"; }"</td>"; echo'<td class = "$NewClass">'.$row['TOEGEZEGD'].'</td> <td class = \"$New$Class\">'.$row['VORM'].'</td> <td><DIV CLASS="$NewClass">'.$row['PAKKET'].'</DIV></td> <td>'.$row['KANGEFACTUREERD'].'</td> <td>'.$row['GEFACTUREERD'].'</td> <td>'.$row['AANTAL'].'</td> <td>'.$row['POST'].'</td> <td class = "op">'.$row['OPMERKING'].'</td>'; echo'</tr>'; } echo'</table>'; ?> </div> </body> </html> I need to change the date format to DD-MM-YYYY. Please help. $SomeVar = $_POST['finco']; $query = "SELECT * FROM news_home WHERE code = '".$SomeVar."' ORDER BY timestamp DESC"; $results = mysql_query($query); $returnS=""; while($line = mysql_fetch_array($results)) { $returnS.= $line["subject"].",,".$line["timestamp"].",,".$line["News"].",,".$line["links"].",,,"; } echo $returnS; mysql_close($link); ?> Hi I need to change the name of a file being uploaded by a user. The reason i need this is because there is a strong possibility that duplicate filenames would be logged. This is the code i have currently: Code: [Select] $upload_path = 'cv/'; // The place the files will be uploaded to (currently a 'files' directory). $filename = $_FILES['userfile']['name']; // Get the name of the file (including file extension). $ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); // Get the extension from the filename. // Check if we can upload to the specified path, if not DIE and inform the user. if(!is_writable($upload_path)) die('You cannot upload to the specified directory, please CHMOD it to 777.'); // Upload the file to your specified path. if(move_uploaded_file($_FILES['userfile']['tmp_name'],$upload_path . $filename)); This code works fine to upload the file in the current name. I assume i need to seperate the filename from the file extension, and i can then assign a new variable to the filename. Easier said than done though as Ive tried many combinations of things. Is there a simple way using this script? or will i need to start from scratch? Cheers |