Jump to content

Cyberdave

Members
  • Posts

    26
  • Joined

  • Last visited

    Never

Everything posted by Cyberdave

  1. A friend has asked me to switch his website from his web hosting company server on to my server. I have never switched a CMS based site before, so I'm not really sure what I'm doing. I know I need to setup a Database for it on my server, but not sure what files I need to edit to make sure the Username and Password match. I currently get the following error: Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'name_dealer'@'localhost' (using password: YES) in /home/name/public_html/folder/inc/classes/hubDB.class.php on line 16 Access denied for user 'name_dealer'@'localhost' (using password: YES) Any help would be appreciated.
  2. There is pagination on a Wordpress plugin I'm using and I not getting any response from the writer. Basically I just want to find out how to display the pagination like this: << 1 2 3 4 ... 20 >> It would be great if anyone could help. Thanks in advance. Here is the code: $pr = get_option('frp_rpp'); // rows per page $page = isset($_GET['page']) ? (int) $_GET['page'] : 1; // BEGIN PAGINATION HEAD if($competition != '') $pages = implode(mysql_fetch_assoc(mysql_query("SELECT COUNT(*) FROM `$tbl_match` WHERE DATE_ADD(matchdate, INTERVAL matchtime HOUR_SECOND) <= NOW() AND competitionyear = '$year' AND competition = '$competition' ORDER BY matchdate DESC"))); if($competition == '') $pages = implode(mysql_fetch_assoc(mysql_query("SELECT COUNT(*) FROM `$tbl_match` WHERE DATE_ADD(matchdate, INTERVAL matchtime HOUR_SECOND) <= NOW() AND competitionyear = '$year' ORDER BY matchdate DESC"))); $pages = ceil($pages/$pr); $querystring = ''; foreach($_GET as $key => $value) { if($key != "page") $querystring .= "$key=$value&"; } // END PAGINATION HEAD // BEGIN PAGINATION DISPLAY // TODO: CHECK FOR MORE THAN 1 PAGE if($pages > 1) { $display .= '<p class="pagination"><strong>Results:</strong> '; for($i = 1; $i <= $pages; $i++) { $display .= '<a '.($i == $page ? 'class="selected" ' : ''); $display .= "href=\"?{$querystring}page=$i"; $display .= '">'.$i.'</a> '; } $display .= '</p>'; } // END PAGINATION DISPLAY
  3. How can I limit the number of rows displayed by the code below? $display = ' <table class="fixt-res"> <thead> <tr> <th>Date</th> <th>Team</th> <th>Versus</th> <th>Time</th> <th>Venue</th> </tr> </thead> '; while($mrow = mysql_fetch_array($mresult)) { $display .= '<tr>'; $display .= '<td class="fixt-res">'.date('d/m/Y', strtotime($mrow['matchdate'])).'</td>'; $display .= '<td class="fixt-res">'; $sqlcode = "SELECT * FROM $tbl_grade WHERE `gradeID` = '".$mrow['grade']."' LIMIT 1"; $resultcode = mysql_query($sqlcode); $rowcode = mysql_fetch_array($resultcode); $display .= $rowcode['gradename']; $display .= '</td>'; $display .= '<td class="fixt-res">'; $sqlcode = "SELECT * FROM $tbl_team WHERE `teamID` = '".$mrow['team2']."' LIMIT 1"; $resultcode = mysql_query($sqlcode); $rowcode = mysql_fetch_array($resultcode); $display .= $rowcode['teamname']; $display .= '</td>'; if(date('H:i', strtotime($mrow['matchtime'])) == '00:00') $display .= '<td class="fixt-res"><acronym title="To Be Decided">TBD</acronym></td>'; if(date('H:i', strtotime($mrow['matchtime'])) != '00:00') $display .= '<td class="fixt-res">'.date('H:i', strtotime($mrow['matchtime'])).'</td>'; $display .= '<td class="fixt-res">'; $sqlcode = "SELECT * FROM $tbl_venue WHERE `venueID` = '".$mrow['matchvenue']."' LIMIT 1"; $resultcode = mysql_query($sqlcode); $rowcode = mysql_fetch_array($resultcode); $display .= $rowcode['venuename']; $display .= '</td>'; $display .= '</tr>'; } $display .= '</table>'; return $display; ?> </table>
  4. This has solved my problem. <div class="description"> <?php preg_match_all('/<img[^>]+>/i',$content,$images); ?> <?php foreach($images[0] as $img){ echo $img;}?></div>
  5. My code is like this now, but now the images do not appear: <div class="description"> <?php preg_match_all('/<img[^>]+>/i',$content,$images); foreach ($images as $image) { echo $image; } ?></div>
  6. So is this the correct code? <div class="description"> <?php {preg_match_all('/<img[^>]+>/i',$content,$images);} print_r($images); foreach ($images as $image) { echo $image; } ?></div>
  7. OK, I have got the images to appear using the following code: <div class="description"> <?php {preg_match_all('/<img[^>]+>/i',$content,$images);} print_r($images); ?></div> However, the Array info is appearing between the images, like this: Array ( [0] => Array ( [0] => 07-Green.gif [1] => 05-Red.gif [2] => 21-Yellow.gif [3] => 20-Blue.gif ) ) How can I edit the code so that only the images appear, without the array details? Thanks
  8. I am using Concrete5 on a site I'm working on. Below is the News List display view.php file needed in the block to display the content from news pages. The code allows images entered in the WSYIWYG to appear in the RSS list. I want to know how I can edit the code below, so it shows only the these images from the $content not the text. Can anybody help me on this? Thanks <?php defined('C5_EXECUTE') or die("Access Denied."); $html = Loader::helper('html'); $uh = Loader::helper('concrete/urls'); $bt = BlockType::getByHandle('news_list'); global $c; $rss_address = $controller->getRssUrl().'?ctID='.$ctID.'&bID='.$bID ; if (isset($_GET['pageno'])) { $pageno = $_GET['pageno']; } else { $pageno = 1; } // if ?> <div class="newsflash"> <div class="headtitle"> <h1><?php echo $rssTitle ?></h1> </div> <?php if (!function_exists('newslistParse')) { function newslistParse($url,$thumbnail,$thumbwidth,$time,$content,$title,$date){ //###################################################################################// //here we lay out they way the page looks, html with all our vars fed to it // //this is the content that displays. it is recommended not to edit anything beyond // //the content parse. Feel free to structure and re-arrange any element and adjust // //CSS as desired. // // available vars: $url,$thumbnail,$thumbwidth,$time,$content,$title,$date // //###################################################################################// ?> <div class="newsflashcontain"> <div class="title"> <?php echo $title ; ?> </div> <div class="time"> <?php echo $date ; ?><?php echo $time ; ?> </div> <div class="description"> <?php echo $content; ?> </div> </div> <?php //#####################################################################################// //this is the end of the recommended content area. please do not edit below this line // //#####################################################################################// } } $db = Loader::db(); //go grab the posts, check if they are current, return only current posts Loader::model('newzy','simplenews'); $news = NewsCheck::getCurrentBlocks($ctID,$ordering); //count the number of current posts returned $pcount = count($news); //if no events are returned, then we display a user defined message if($pcount==0){ echo $nonelistmsg; } //now calc the last page $lastpage = ceil($pcount/$num); //set the current page min max keys -1 as array key's start @ 0 $sKey = $num * ($pageno-1) ; $eKey = ($num * ($pageno-1)) + ($num-1) ; //take each current post and treat it like a query, for each one do X foreach($news as $key => $row){ //check for external URL, if none, rout to parent page if(!empty($row['urlLink'])){ $url = $row['urlLink']; }else{ $url = $controller->grabURL($row['cParentID']); } //check if thumbnail is there, if so get it, if not, null if($row['graphic']>0){ $thumbnail = $controller->getThumbnail($row['graphic']); }else{ $thumbnail = NULL; } //set vars $time = $controller->replaceTimeString($row['nbID']); $date = $row['sdt']; $title = $row['title']; //$content = strip_tags($controller->translateFrom($row['content'])); $content = $controller->translateFrom($row['content']); //if truncation is enabled if($truncateSummaries == 1){ if (strlen($content) >= $truncateChars){ //truncate to suplied truncation value //$content = substr($content,0,$truncateChars).'.....'; $content = wordwrap($content, $truncateChars); $content = substr($content, 0, strpos($content, "\n")).'.....'; } } //check if paging is enabled if($isPaged){ //check to make sure the array key is within the range if($key >= $sKey && $key <= $eKey){ newslistParse($url,$thumbnail,$thumbwidth,$time,$content,$title,$date); } //if paging is not selected, use number of items designated in the list block }else{ $i += 1; newslistParse($url,$thumbnail,$thumbwidth,$time,$content,$title,$date); //once we reach the set number stop the script if($i >= $num){ break; } } } ?> </div> <?php //is iCal feed option is sellected, show it if($showfeed==1){ ?> <div class="rssfeed"> <img src="<?php echo $uh->getBlockTypeAssetsURL($bt, 'rss.png');?>" width="14" height="14" alt="rss feed" /> <a href="<?php echo $rss_address ; ?>" id="getFeed">Get this Feed</a> <link href="<?php echo $controller->getRssUrl();?>" rel="alternate" type="application/rss+xml" title="<?php echo t('RSS');?>" /> </div> <?php } //$c = Page::getCurrentPage(); $link = Loader::helper('navigation')->getLinkToCollection($c); $link = $controller->URLfix($link); //if pagination is set, if it is needed, show it if($isPaged==1){ if ($pcount > $num) { echo '<div id="pagination">'; if ($pageno == 1) { echo " FIRST PREV "; } else { echo '<a href="'.$link.'pageno=1">FIRST </a>'; $prevpage = $pageno-1; echo '<a href="'.$link.'pageno='.$prevpage.'"> PREV</a>'; } // if echo ' ( Page '.$pageno.' of '.$lastpage.' ) '; if ($pageno == $lastpage) { echo " NEXT LAST "; } else { $nextpage = $pageno+1; echo '<a href="'.$link.'pageno='.$nextpage.'">NEXT </a>'; echo '<a href="'.$link.' pageno='.$lastpage.'"> LAST</a>'; } // if echo '</div>'; } } if (isset($bID)) { echo '<input type="hidden" name="bID" value="'.$bID.'" />';} ?>
  9. No, I have added the images manually in my WYSIWYG editor.
  10. Yes, I guess it is. It's a block for Concrete5.
  11. How can I edit this code to have images appear in it? <div id="rssSummaryList<?php echo intval($bID)?>" class="rssSummaryList"> <?php if( strlen($title)>0 ){ ?> <div class="rssSummaryListTitle"><?php echo $title?></div> <?php } ?> <?php $rssObj=$controller; $textHelper = Loader::helper("text"); if (!$dateFormat) { $dateFormat = t('jS F, Y'); } if( strlen($errorMsg)>0 ){ echo $errorMsg; }else{ foreach($posts as $itemNumber=>$item) { if( intval($itemNumber) >= intval($rssObj->itemsToDisplay) ) break; ?> <div class="rssItem"> <div class="rssItemTitle"> <a href="<?php echo $item->get_permalink(); ?>" <?php if($rssObj->launchInNewWindow) echo 'target="_blank"' ?> > <?php echo substr ($item->get_title(), 0, 100); ?> </a> </div> <div class="rssItemDate"><?php echo $item->get_date($dateFormat); ?></div> <div class="rssItemSummary"> <?php if( $rssObj->showSummary ){ echo $item->get_description(); } ?> <a href="<?php echo $item->get_permalink(); ?>" <?php if($rssObj->launchInNewWindow) echo 'target="_blank"' ?> >Read more</a> </div> </div> <?php } } ?> </div>
  12. I am trying to implement the method described in this post: http://www.addthis.com/forum/viewtopic.php?f=4&t=24637 to get my Addthis button to act the way I need it to. I have posted on the site, but have gotten no response. I cannot get it to work. Can anybody have a look at the code below and see if they can help? Thanks The PHP I need to modify is: <?php defined('C5_EXECUTE') or die(_("Access Denied.")); $html = Loader::helper('html'); $uh = Loader::helper('concrete/urls'); $bt = BlockType::getByHandle('news_list'); global $c; $rss_address = $controller->getRssUrl().'?ctID='.$ctID.'&bID='.$bID ; if (isset($_GET['pageno'])) { $pageno = $_GET['pageno']; } else { $pageno = 1; } // if ?> <div class="newsflash1"> <div class="headtitle1"> <?php echo $rssTitle ?> </div> <?php if (!function_exists('newslistParse')) { function newslistParse($url,$thumbnail,$thumbwidth,$time,$content,$title,$date){ //###################################################################################// //here we lay out they way the page looks, html with all our vars fed to it // //this is the content that displays. it is recommended not to edit anything beyond // //the content parse. Feel free to structure and re-arrange any element and adjust // //CSS as desired. // // available vars: $url,$thumbnail,$thumbwidth,$time,$content,$title,$date // //###################################################################################// ?> <div class="newsflashcontain1"> <div class="title1"><h3><?php echo $title; ?></h3> </div> <div class="time1"> <?php echo $date; ?></div> <div class="description1"><?php echo $content;?></div> <div class="addthis_toolbox addthis_default_style"> <a class="addthis_button" addthis:title="Title goes here" addthis:description="Check their site!" addthis:url="http://www.davidcunniffe.com/test3/index.php?cID=69" href="http://www.addthis.com/bookmark.php?v=250&username=dcunniffe"/> <a class="addthis_button_facebook"></a> <a class="addthis_button_twitter"></a> <a class="addthis_button_favorites"></a> <a class="addthis_button_email"></a> <a class="addthis_button_print"></a> <a class="addthis_button_facebook_like"></a> <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=dcunniffe"></script> </div> </div> <?php //#####################################################################################// //this is the end of the recommended content area. please do not edit below this line // //#####################################################################################// } } $db = Loader::db(); //go grab the posts, check if they are current, return only current posts Loader::model('newzy','simplenews'); $news = NewsCheck::getCurrentBlocks($ctID,$ordering); //count the number of current posts returned $pcount = count($news); //if no events are returned, then we display a user defined message if($pcount==0){ echo $nonelistmsg; } //now calc the last page $lastpage = ceil($pcount/$num); //set the current page min max keys -1 as array key's start @ 0 $sKey = $num * ($pageno-1) ; $eKey = ($num * ($pageno-1)) + ($num-1) ; //take each current post and treat it like a query, for each one do X foreach($news as $key => $row){ //check for external URL, if none, rout to parent page if(!empty($row['urlLink'])){ $url = $row['urlLink']; }else{ $url = $controller->grabURL($row['cParentID']); } //check if thumbnail is there, if so get it, if not, null if($row['graphic']>0){ $thumbnail = $controller->getThumbnail($row['graphic']); }else{ $thumbnail = NULL; } //set vars $time = $controller->replaceTimeString($row['nbID']); $date = date('l, jS F, Y'); $title = $row['title']; $content = $controller->translateFrom($row['content']); //$content = $controller->translateFrom($row['content']); //if truncation is enabled if($truncateSummaries == 1){ if (strlen($content) >= $truncateChars){ //truncate to suplied truncation value //$content = substr($content,0,$truncateChars).'.....'; $content = wordwrap($content, $truncateChars); $content = substr($content, 0, strpos($content, "\n")).'.....'; } } //check if paging is enabled if($isPaged){ //check to make sure the array key is within the range if($key >= $sKey && $key <= $eKey){ newslistParse($url,$thumbnail,$thumbwidth,$time,$content,$title,$date); } //if paging is not selected, use number of items designated in the list block }else{ $i += 1; newslistParse($url,$thumbnail,$thumbwidth,$time,$content,$title,$date); //once we reach the set number stop the script if($i >= $num){ break; } } } ?> </div> <?php //is iCal feed option is sellected, show it if($showfeed==1){ ?> <div class="rssfeed1"> <img src="<?php echo $uh->getBlockTypeAssetsURL($bt, 'rss.png');?>" width="14" height="14" alt="rss feed" /> <a href="<?php echo $rss_address ; ?>" id="getFeed">Get Feed</a> <link href="<?php echo $controller->getRssUrl();?>" rel="alternate" type="application/rss+xml" title="<?php echo t('RSS');?>" /> </div> <?php } //$c = Page::getCurrentPage(); $link = Loader::helper('navigation')->getLinkToCollection($c); $link = $controller->URLfix($link); //if pagination is set, if it is needed, show it if($isPaged==1){ if ($pcount > $num) { echo '<div id="pagination">'; if ($pageno == 1) { echo " FIRST PREV "; } else { echo '<a href="'.$link.'pageno=1">FIRST </a>'; $prevpage = $pageno-1; echo '<a href="'.$link.'pageno='.$prevpage.'"> PREV</a>'; } // if echo ' ( Page '.$pageno.' of '.$lastpage.' ) '; if ($pageno == $lastpage) { echo " NEXT LAST "; } else { $nextpage = $pageno+1; echo '<a href="'.$link.'pageno='.$nextpage.'">NEXT </a>'; echo '<a href="'.$link.' pageno='.$lastpage.'"> LAST</a>'; } // if echo '</div>'; } } if (isset($bID)) { echo '<input type="hidden" name="bID" value="'.$bID.'" />';} ?>
  13. Not sure if anyone on here has Concrete5 knowledge? I really am stumped on a site I am adding Concrete5 to. I've posted my problem on the C5 Forums, contacted the Creator of the Addon and other developers on C5 but haven't heard anything back. I have been trying to solve this problem every evening for the last two weeks. I was wondering if anyone could help? Here is the problem. I am adding images via the WYSIWYG Editor in the Simple News Addon. When I click on the add image button the code generated is the following: <img src="/test3/index.php/download_file/view_inline/13/" alt="24-Yellow.png" width="37" height="34" /> With this code the images do not show up in the News List generated. Just the Alt name of the image. However, when I manually remove the "/test3/" from the front of the URL in HTML view of WYSIWYG, the image shows up as it should in the News List. How can I edit the PHP (which file?) so that the "/test/" bit of the URL is left out automatically when the image is added via the button? The site is in a sub-folder of my site. I would appreciate any help. Thanks
  14. Oh... I see. I think I may be out of my depth. I'm gonna give it a go anyway and report back if I get stuck along the way. Thanks so much for your help.
  15. Well, initially I will be testing this on my own website, so yes.
  16. I am working on a website for a club and I'm using rssinclude.com to add the clubs Facebook RSS feed to the news page. I am wondering if there is a way of archiving each feed to a 'news archive' page once it drops outside the 5 latest status updates? Thanks
  17. Yes, I have tried a few of these, but I cannot get it to work. I am a newbie to PHP. I'm really sure what I am doing TBH.
  18. So, this is how the code should look? How do I go about validating my form to prevent email header injection with php. Here is my code: <?php $error = array(); if(isset($_POST['submit'])) { if (empty($_POST['name']) || empty($_POST['phone']) || empty($_POST['email']) || empty($_POST['message']) ){ $error[] = "Please fill in the all of the form fields"; } } $to = "client@clientswebaddress.com"; $subject = "Email from Website"; $name_field = $_POST['name']; $phone_field = $_POST['phone']; $email_field = $_POST['email']; $message = $_POST['message']; //haven't got a clue why this loop is here so is commented out /*foreach($_POST['check'] as $value) { $check_msg .= "\n$value\n"; }*/ $body = "Name: $name_field\n\n E-Mail: $email_field\n\n Phone: $phone_field\n\n Message:\n\n $message\n\n"; $headers = "From: noreply@yourdomain.com\r\n"; $headers .= "Reply-To: {$email_field}\r\n"; // the address inserted into To: field on reply $headers .= "Return-Path: {$email_field}\r\n"; // same as above supported by different clients if(empty($error)){ mail($to, $subject, $body,$header); header("Location: thanks.php"); exit(); } else { echo "The email has not been sent:<br />"; foreach($error as $x=>$y){ echo $y."<br />"; } //and here you can show the form to be re-submited after fixing the issues. } ?>
  19. How do I go about validating my form to prevent email header injection with php. Here is my code: <?php $error = array(); if(isset($_POST['submit'])) { if (empty($_POST['name']) || empty($_POST['phone']) || empty($_POST['email']) || empty($_POST['message']) ){ $error[] = "Please fill in the all of the form fields"; } } $to = "client@clientswebaddress.com"; $subject = "Email from Website"; $name_field = $_POST['name']; $phone_field = $_POST['phone']; $email_field = $_POST['email']; $message = $_POST['message']; //haven't got a clue why this loop is here so is commented out /*foreach($_POST['check'] as $value) { $check_msg .= "\n$value\n"; }*/ $body = "Name: $name_field\n\n E-Mail: $email_field\n\n Phone: $phone_field\n\n Message:\n\n $message\n\n"; $header="From: $email_field\r\n"; if(empty($error)){ mail($to, $subject, $body,$header); header("Location: thanks.php"); exit(); } else { echo "The email has not been sent:<br />"; foreach($error as $x=>$y){ echo $y."<br />"; } //and here you can show the form to be re-submited after fixing the issues. } ?>
  20. I have set up the following form to send mail from a website I am working on. I have set it to redirect to a thank you page if it sends and also an error page (which I have designed) if it fails. However, it isn't working with the code below. If I remove the if (empty... part it will send fine, but then I don't have error message if all the fields haven't been filled in. Here is the code: <?php if(isset($_POST['submit'])) { if (empty($_POST['name']) || empty($_POST['phone']) || empty($_POST['email']) || empty($_POST['message']) ){ header( "Location: form-error.php"); } } $to = "me@website.ie"; $subject = "Email from Website"; $name_field = $_POST['name']; $phone_field = $_POST['phone']; $email_field = $_POST['email']; $message = $_POST['message']; foreach($_POST['check'] as $value) { $check_msg .= "\n$value\n"; } $body = "Name: $name_field\n\n E-Mail: $email_field\n\n Phone: $phone_field\n\n Message:\n\n $message\n\n"; $header="From: $email_field\r\n"; mail($to, $subject, $body,$header); header("Location: thanks.php"); } else { echo "!"; }
×
×
  • Create New...

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.