Jump to content

jamesxg1

Members
  • Posts

    1,133
  • Joined

  • Last visited

Everything posted by jamesxg1

  1. As Pikachu2000 said, parenthesis missing... Use the code below. <?php $mysql = mysql_real_connect('localhost', 'root', '***********', '*******'); if (!$mysql) { die('Could not connect: ' . mysql_error()); } ?>
  2. Thanks for responding Christian - Regarding the date collector, I know how to pull the data down but I'm stumped as to how to make it "break" upon each new date because there could be 5 matches in one day and 10 in another so there is no default break :S and I'm very very new to DOM at the minute :S Thanks Christian James.
  3. Hi guys, Been a while! I was wondering if anyone out there could help with an issue I'm having. Basically I am trying to scrape a page for football fixtures, everything is going very well except the football "dates". If you visit http://www.bbc.co.uk...league/fixtures you will see a grey tr column containing the dates for when matches start. As you will see Westham V Arsenal is the last match on Saturday the 6th of Oct then Southampton V Fulham is the first match for the 27th. So to grab all this data I have written the following (please excuse some of the crap in it - debugging purposes). <?php $url = "http://www.bbc.co.uk/sport/football/premier-league/fixtures"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $html = curl_exec($ch); curl_close($ch); $dom = new DOMDocument; libxml_use_internal_errors(true); @$dom->loadHTML($html); libxml_use_internal_errors(false); $xpath = new DOMXPath($dom); $query = $xpath->query('.//div[@id="fixtures-data"]'); $matches = array(); foreach ($query as $node) { $DateData = $xpath->query('//h2[@class="table-header"]', $node); $MatchParent = $xpath->query('//tbody/tr[@class="preview"]/td[@class="match-details"]', $node); $Kick = $xpath->query('//tbody/tr[@class="preview"]/td[@class="kickoff"]', $node); $Date = trim($DateData->item(0)->nodeValue); echo '**' . $DateData->length. '**<br />'; echo '**' . $Kick->length. '**<br />'; echo '**' . $MatchParent->length. '**'; for ($i = 0; $i <= ($MatchParent->length - 1) AND $i <= ($Kick->length - 1); $i++) { $Teams = str_replace(array(' V ', '\n'), '-', trim($MatchParent->item($i)->nodeValue)); $TeamPeices = explode('-', $Teams); $matches[$Date][] = array('Home' => trim($TeamPeices[0]), 'Away' => trim($TeamPeices[1]), 'KickOff' => trim($Kick->item($i)->nodeValue)); } } echo '<pre>' . print_r($matches, true) . '</pre>'; ?> When I run the script I get the following results..... **52** **319** **320** Array ( [saturday 6th October 2012] => Array ( [0] => Array ( [Home] => Man City [Away] => Sunderland [KickOff] => 12:45 ) [1] => Array ( [Home] => Chelsea [Away] => Norwich [KickOff] => 15:00 ) [2] => Array ( [Home] => Swansea [Away] => Reading [KickOff] => 15:00 ) [3] => Array ( [Home] => West Brom [Away] => QPR [KickOff] => 15:00 ) [4] => Array ( [Home] => Wigan [Away] => Everton [KickOff] => 15:00 ) [5] => Array ( [Home] => West Ham [Away] => Arsenal [KickOff] => 17:30 ) [6] => Array ( [Home] => Southampton [Away] => Fulham [KickOff] => 13:30 ) [7] => Array ( [Home] => Liverpool [Away] => Stoke [KickOff] => 15:00 ) [8] => Array ( [Home] => Tottenham [Away] => Aston Villa [KickOff] => 15:00 ) [9] => Array ( [Home] => Newcastle [Away] => Man Utd [KickOff] => 16:00 ) [10] => Array ( [Home] => Tottenham [Away] => Chelsea [KickOff] => 12:45 ) ... [310] => Array ( [Home] => Chelsea [Away] => Everton [KickOff] => 15:00 ) [311] => Array ( [Home] => Liverpool [Away] => QPR [KickOff] => 15:00 ) [312] => Array ( [Home] => Man City [Away] => Norwich [KickOff] => 15:00 ) [313] => Array ( [Home] => Newcastle [Away] => Arsenal [KickOff] => 15:00 ) [314] => Array ( [Home] => Southampton [Away] => Stoke [KickOff] => 15:00 ) [315] => Array ( [Home] => Swansea [Away] => Fulham [KickOff] => 15:00 ) [316] => Array ( [Home] => Tottenham [Away] => Sunderland [KickOff] => 15:00 ) [317] => Array ( [Home] => West Brom [Away] => Man Utd [KickOff] => 15:00 ) [318] => Array ( [Home] => West Ham [Away] => Reading [KickOff] => 15:00 ) ) ) All very good, except it is putting them all under one date, when I need it to add the correct dates as the array "head" as it were then have the fixture data as another array inside. Does anyone know how I can do this? Any help appreciated as I've tried everything. Thanks, James.
  4. It would usually contain something like 16:32 pm or 4:32 am for instance
  5. Got the same again :S Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (1348068720) at position 7 (7): Unexpected character' in /home/sites/colewebdesigns.co.uk/public_html/wp-content/themes/footballclub-2.1/predictions.php:67 Stack trace: #0 /home/sites/colewebdesigns.co.uk/public_html/wp-content/themes/footballclub-2.1/predictions.php(67): DateTime->__construct('1348068720') #1 /home/sites/colewebdesigns.co.uk/public_html/wp-content/themes/footballclub-2.1/loop-match.php(12): include('/home/sites/col...') #2 /home/sites/colewebdesigns.co.uk/public_html/wp-includes/template.php(392): require('/home/sites/col...') #3 /home/sites/colewebdesigns.co.uk/public_html/wp-includes/template.php(366): load_template('/home/sites/col...', false) #4 /home/sites/colewebdesigns.co.uk/public_html/wp-includes/general-template.php(128): locate_template(Array, true, false) #5 /home/sites/colewebdesigns.co.uk/public_html/wp-content/themes/footballclub-2.1/single.php(23): get_template_part('loop', 'matc in /home/sites/colewebdesigns.co.uk/public_html/wp-content/themes/footballclub-2.1/predictions.php on line 67
  6. Returns the following: Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (1348070008) at position 8 (0): Unexpected character' in /home/sites/colewebdesigns.co.uk/public_html/wp-content/themes/footballclub-2.1/predictions.php:66 Stack trace: #0 /home/sites/colewebdesigns.co.uk/public_html/wp-content/themes/footballclub-2.1/predictions.php(66): DateTime->__construct('1348070008') #1 /home/sites/colewebdesigns.co.uk/public_html/wp-content/themes/footballclub-2.1/loop-match.php(12): include('/home/sites/col...') #2 /home/sites/colewebdesigns.co.uk/public_html/wp-includes/template.php(392): require('/home/sites/col...') #3 /home/sites/colewebdesigns.co.uk/public_html/wp-includes/template.php(366): load_template('/home/sites/col...', false) #4 /home/sites/colewebdesigns.co.uk/public_html/wp-includes/general-template.php(128): locate_template(Array, true, false) #5 /home/sites/colewebdesigns.co.uk/public_html/wp-content/themes/footballclub-2.1/single.php(23): get_template_part('loop', 'matc in /home/sites/colewebdesigns.co.uk/public_html/wp-content/themes/footballclub-2.1/predictions.php on line 66
  7. Ok no worries, I'll give that a shot in a moment Thanks premiso.
  8. $KickOffMatches[2] needed to be rendered into a usable format, so I've used date to format it using a "stamp" of the unusable date format then I've strtotime the correctly formatted date.
  9. I usually do for my sites, but this is a friends site and I'm helping them out.
  10. Well without that we are spinning our wheels trying to assist you. You do know that the errors are generally logged to files as well. Depending on the WebServer, it should be in something like /var/log/apache2/error.log or /var/log/nginx/error.log or some form of that. Well, the info I do have is this: Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string but that is only a portion of the error to be fair. Thanks, James.
  11. I would have but where it was causing a serious obstruction on the site, I've had to remove it and use a series of IF statements to do the validations for the meantime. Sorry Premiso :S James.
  12. Hello fellow PHPFreaks, It's been a while! I've come across an issue, I'm trying to calculate the amount of time difference between 2 times. I have done the date side of things and I only need to compare times if the date matches the same date in the database but I'm having some trouble with the time side. This is what I was using (it worked fine for a day and I've just checked it and its now not working). $KickOff = (string) do_shortcode('[tb_match id=' . $post->ID . ']'); $KickOffMatches = array(); preg_match('/\<div class="date"\>(.*?)<\/div\>\<time\>(.*?)\<\/time\>/', $KickOff, $KickOffMatches); $FormattedDate = date('Y-m-d', strtotime($KickOffMatches[1])); $FormattedTime = date('H:i A', strtotime($KickOffMatches[2])); $AMPM = date('A', strtotime($KickOffMatches[2])); $RawDate = strtotime($FormattedDate); $RawTime = strtotime(date('H:i', strtotime($KickOffMatches[2]))); $start_date = new DateTime(date('H:i A')); $TD = $start_date->diff(new DateTime($KickOffMatches[2])); The area that is causing the issue is $start_date = new DateTime(date('H:i A')); $TD = $start_date->diff(new DateTime($KickOffMatches[2])); I've tried everything but all I'm getting is a fatal error. I was wondering if anyone here knew of a way that I could do this without using DateTime? Any help with this would be greatly appreciated! Many thanks, James.
  13. Could you post your problem code here please? Remember to use the PHP or CODE tags. James.
  14. It would be a great deal easier to read if you use print_r() to print it and then post back and I will take a look. echo '<pre>' . print_r($winfo['regyinfo']) . '</pre>'; James.
  15. Hi! Would you please describe in a bit more detail what your issue here is? It's probably just me not understanding here LOL. Also, I think it would be a good idea to use mysql_num_rows at some point. James.
  16. Maybe something simple might do the trick. for($i = 0; $i < count($ARRAY_VAR_HERE); $i++) { echo $ARRAY_VAR_HERE[(count($ARRAY_VAR_HERE) - $i)]; } James.
  17. Take a look at this... http://www.w3schools.com/html/html_tables.asp James.
  18. <?php /** * @author James Pollard */ if(isset($_POST['pregled'])) { $id = $_GET['id']; $q = "SELECT * FROM `albums` WHERE `" . $id . "` = 'ideo'"; $results = mysql_query($q); $data = mysql_fetch_array($results); $diro = $data['dosjeid']; $id = $data['ideo']; class createTree { private $FilePath; private $TreeData; public function __construct($DirInput) { $this->FilePath = $DirInput; $this->GenerateTreeData(); return true; } public function deleteFile($FileID) { if(is_file($FileID)) { if(unlink($FileID)) { return 'File ' . $FileID . ' has been deleted.'; } else { return 'Failed to delete file ' . $FileID . '.'; } } else { return 'File ' . $FileID . ' does not exist.'; } } private function GenerateTreeData() { $ParentFolder = scandir($this->FilePath . '/'); $this->TreeData = array(); $Folders = array(); foreach($ParentFolder as $PFK => $PFV) { if($PFV !== '.' && $PFV !== '..') { if(is_file($this->FilePath . '/' . $PFV)) { $this->TreeData[$this->FilePath] = $PFV; } elseif(is_dir($this->FilePath . '/' . $PFV)) { $this->TreeData[$this->FilePath][$PFV] = array(); $Folders[] = $PFV; } } } $this->ScanFolders($Folders); return $this->TreeData; } private function ScanFolders($Folders) { foreach($Folders as $FK => $FV) { $FolderData = scandir($this->FilePath . '/' . $FV . '/'); foreach($FolderData as $FDK => $FDV) { if($FDV !== '.' && $FDV !== '..') { if(is_file($this->FilePath . '/' . $FV . '/' . $FDV)) { if(strpos($FV, '/') !== false) { $TP = explode('/', $FV); $this->TreeData[$this->FilePath][$TP[0]][$TP[1]][] = $FDV; } else { $this->TreeData[$this->FilePath][$FV][] = $FDV; } } elseif(is_dir($this->FilePath . '/' . $FV . '/' . $FDV)) { $this->TreeData[$this->FilePath][$FV][$FDV] = array(); $Folders[] = $FV . '/' . $FDV; } } } unset($Folders[$FK]); } if(count($Folders) === 0) { return true; } else { $this->ScanFolders($Folders); } } private function CreateTreeFolder($Folder, $ParentFolder) { if(is_string($Folder)) { return '<ul><li><img src="slike_izgled/directory.png" width="20" height="20"> <span class="toggle">' . $Folder . '</span>'; } elseif(is_array($Folder)) { $Return = ''; foreach($Folder as $TFK => $TFV) { if(is_array($TFV)) { $Return .= $this->CreateTreeFolder($TFK, $ParentFolder); $Return .= $this->CreateTreeFile($TFV, $ParentFolder . '/' . $TFK); $Return .= '</li></ul>'; } else { $Return .= $this->CreateTreeFile($TFV, $ParentFolder); } } return $Return; } else { return ''; } } private function CreateTreeFile($File, $Folder) { if(is_string($File)) { return '<li><input type="checkbox" name="delfile[]" value="' . $this->FilePath . '/' . $Folder . '/' . $File . '"/><a href="' . $this->FilePath . '/' . $Folder . '/' . $File . '"><img src="slike_izgled/file.png"> ' . $File . '</a></li>'; } elseif(is_array($File)) { $Return = ''; foreach($File as $TFK => $TFV) { $Return .= '<li><input type="checkbox" name="delfile[]" value="' . $this->FilePath . '/' . $Folder . '/' . $TFV . '"/><a href="' . $this->FilePath . '/' . $Folder . '/' . $TFV . '"><img src="slike_izgled/file.png"> ' . $TFV . '</a></li>'; } return $Return; } } public function CreateTree() { $Return = '<ul>'; $Return .= $this->CreateTreeFolder($this->FilePath, $this->FilePath); foreach($this->TreeData[$this->FilePath] as $TK => $TV) { if(is_array($TV)) { $Return .= '<ul><li><img src="slike_izgled/directory.png" width="20" height="20"> <span class="toggle">' . $TK . '</span>'; $Return .= $this->CreateTreeFolder($TV, $TK); $Return .= '</li></ul>'; } else { $Return .= $this->CreateTreeFile($TV, $TK); } } $Return .= '</ul>'; return $Return; } public function __destruct() { return true; } } $CT = new createTree($diro); if(isset($_POST['filedel'])) { $Response = ''; if(isset($_POST['delfile']) && !empty($_POST['delfile']) && is_array($_POST['delfile']) && count($_POST['delfile']) > 0) { foreach($_POST['delfile'] as $DFK => $DFV) { $Response .= $CT->deleteFile($DFV) . '<br />'; } } else { $Response = 'Please select a file to delete.'; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>jQuery Drop Down Menu</title> <link rel="stylesheet" href="stylee.css" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> <script type="text/javascript" src="jquery.color.js"></script> <script type="text/javascript" src="jMenu.js"></script> </head> <body> <div id="jQ-menu"> <b><?php echo $Response; ?></b> <!--- osnovni_dokumenti.php?id=</?php echo $data['ideo']; ?> ---> <form action="#" method="post"> <?php echo $CT->CreateTree(); ?> <p align='center'> <input type="submit" name="filedel" value="Delete" /> </p> </form> </div> </body> </html> <?php } ?> James.
  19. My pleasure, anytime :-)! Hope it helps Neven. Replace <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> With <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> Happy coding! James. P.S; Remember to make this topic as SOLVED :-).
  20. Neven, the code you have is very poorly composed. I have written this for you to get you back on track but you cannot expect people to write thee entire script for you because your code is messy. Anyway, I hope this helps. <?php /** * @author James Pollard */ class createTree { private $FilePath; private $TreeData; public function __construct() { $this->FilePath = 'YOUR DIRECTORY HERE! DO NOT PUT A SLASH AT THE END OF IT!'; $this->GenerateTreeData(); return true; } public function deleteFile($FileID) { if(is_file($FileID)) { if(unlink($FileID)) { return 'File ' . $FileID . ' has been deleted.'; } else { return 'Failed to delete file ' . $FileID . '.'; } } else { return 'File ' . $FileID . ' does not exist.'; } } private function GenerateTreeData() { $ParentFolder = scandir($this->FilePath . '/'); $this->TreeData = array(); $Folders = array(); foreach($ParentFolder as $PFK => $PFV) { if($PFV !== '.' && $PFV !== '..') { if(is_file($this->FilePath . '/' . $PFV)) { $this->TreeData[$this->FilePath] = $PFV; } elseif(is_dir($this->FilePath . '/' . $PFV)) { $this->TreeData[$this->FilePath][$PFV] = array(); $Folders[] = $PFV; } } } $this->ScanFolders($Folders); return $this->TreeData; } private function ScanFolders($Folders) { foreach($Folders as $FK => $FV) { $FolderData = scandir($this->FilePath . '/' . $FV . '/'); foreach($FolderData as $FDK => $FDV) { if($FDV !== '.' && $FDV !== '..') { if(is_file($this->FilePath . '/' . $FV . '/' . $FDV)) { if(strpos($FV, '/') !== false) { $TP = explode('/', $FV); $this->TreeData[$this->FilePath][$TP[0]][$TP[1]][] = $FDV; } else { $this->TreeData[$this->FilePath][$FV][] = $FDV; } } elseif(is_dir($this->FilePath . '/' . $FV . '/' . $FDV)) { $this->TreeData[$this->FilePath][$FV][$FDV] = array(); $Folders[] = $FV . '/' . $FDV; } } } unset($Folders[$FK]); } if(count($Folders) === 0) { return true; } else { $this->ScanFolders($Folders); } } private function CreateTreeFolder($Folder, $ParentFolder) { if(is_string($Folder)) { return '<ul><li><img src="slike_izgled/directory.png" width="20" height="20"> <span class="toggle">' . $Folder . '</span>'; } elseif(is_array($Folder)) { $Return = ''; foreach($Folder as $TFK => $TFV) { if(is_array($TFV)) { $Return .= $this->CreateTreeFolder($TFK, $ParentFolder); $Return .= $this->CreateTreeFile($TFV, $ParentFolder . '/' . $TFK); $Return .= '</li></ul>'; } else { $Return .= $this->CreateTreeFile($TFV, $ParentFolder); } } return $Return; } else { return ''; } } private function CreateTreeFile($File, $Folder) { if(is_string($File)) { return '<li><input type="checkbox" name="delfile[]" value="' . $this->FilePath . '/' . $Folder . '/' . $File . '"/><a href="' . $this->FilePath . '/' . $Folder . '/' . $File . '"><img src="slike_izgled/file.png"> ' . $File . '</a></li>'; } elseif(is_array($File)) { $Return = ''; foreach($File as $TFK => $TFV) { $Return .= '<li><input type="checkbox" name="delfile[]" value="' . $this->FilePath . '/' . $Folder . '/' . $TFV . '"/><a href="' . $this->FilePath . '/' . $Folder . '/' . $TFV . '"><img src="slike_izgled/file.png"> ' . $TFV . '</a></li>'; } return $Return; } } public function CreateTree() { $Return = '<ul>'; $Return .= $this->CreateTreeFolder($this->FilePath, $this->FilePath); foreach($this->TreeData[$this->FilePath] as $TK => $TV) { if(is_array($TV)) { $Return .= '<ul><li><img src="slike_izgled/directory.png" width="20" height="20"> <span class="toggle">' . $TK . '</span>'; $Return .= $this->CreateTreeFolder($TV, $TK); $Return .= '</li></ul>'; } else { $Return .= $this->CreateTreeFile($TV, $TK); } } $Return .= '</ul>'; return $Return; } public function __destruct() { return true; } } $CT = new createTree; if(isset($_POST['filedel'])) { $Response = ''; if(isset($_POST['delfile']) && !empty($_POST['delfile']) && is_array($_POST['delfile']) && count($_POST['delfile']) > 0) { foreach($_POST['delfile'] as $DFK => $DFV) { $Response .= $CT->deleteFile($DFV) . '<br />'; } } else { $Response = 'Please select a file to delete.'; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>jQuery Drop Down Menu</title> <link rel="stylesheet" href="stylee.css" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> <script type="text/javascript" src="jquery.color.js"></script> <script type="text/javascript" src="jMenu.js"></script> </head> <body> <div id="jQ-menu"> <b><?php echo $Response; ?></b> <!--- osnovni_dokumenti.php?id=</?php echo $data['ideo']; ?> ---> <form action="#" method="post"> <?php echo $CT->CreateTree(); ?> <p align='center'> <input type="submit" name="filedel" value="Delete" /> </p> </form> </div> </body> </html> James.
  21. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>jQuery Drop Down Menu</title> <!-- CSS For The Menu --> <link rel="stylesheet" href="stylee.css" /> <!-- Add jQuery From the Google AJAX Libraries --> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> <!-- jQuery Color Plugin --> <script type="text/javascript" src="jquery.color.js"></script> <!-- Import The jQuery Script --> <script type="text/javascript" src="jMenu.js"></script> </head> <body> <!-- Menu Start --> <div id="jQ-menu"> <?php error_reporting(0); $path = "store/" . $diro . "/"; function createDir($path = '.') { $handle = opendir($path); if($handle) { echo "<ul>"; while(false !== ($file = readdir($handle))) { if(is_dir($path . $file) && $file !== '.' && $file !== '..') { printSubDir($file, $path, $queue); } elseif($file !== '.' && $file !== '..') { $queue[] = $file; } } printQueue($queue, $path); echo "</ul>"; } } function printQueue($queue, $path) { foreach($queue as $file) { foreach($file as $FK => $FV) { printFile($FV, $path); } } } echo"<form action='osnovni_dokumenti.php?id=" . $data['ideo'] . "' method='POST'>"; function printFile($file, $path) { echo "<li><input type='checkbox' name='del[]' value='$file'/><a href=\"" . $path . $file . "\"><img src='slike_izgled/file.png'> $file</a></li>"; } function printSubDir($dir, $path) { echo "<li><img src='slike_izgled/directory.png' width='20' height='20'> <span class=\"toggle\">$dir</span>"; createDir($path . $dir . "/"); echo "</li>"; } createDir($path); echo"<p align='center'><input type='submit' name='filedel' value='Delete'></p> </form>"; ?> </div> <!-- End Menu --> </body> </html> <?php if(isset($_POST['filedel'])) { $id = $_POST['del']; $count = count($id); for($i = 0; $i < $count; $i++) { $files = $_POST['del']; echo"$files.$count"; echo '<pre>' . print_r($file, true) . '</pre>'; echo '<pre>' . print_r($files, true) . '</pre>'; echo $file[0] . ' - ' . $file[1] . '<br />'; echo $files[0] . ' - ' . $files[1] . '<br />'; if(unlink('store' . $file[$i])) { echo 'File ' . $file[$i] . ' deleted.'; } else { echo 'Failed to delete ' . $file[$i]; } } } ?> Try that. James.
  22. I'm not fully sure I understand what it is that's going wrong for you, but I've cleaned up your code and changed a few things, so give this a try. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>jQuery Drop Down Menu</title> <!-- CSS For The Menu --> <link rel="stylesheet" href="stylee.css" /> <!-- Add jQuery From the Google AJAX Libraries --> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> <!-- jQuery Color Plugin --> <script type="text/javascript" src="jquery.color.js"></script> <!-- Import The jQuery Script --> <script type="text/javascript" src="jMenu.js"></script> </head> <body> <!-- Menu Start --> <div id="jQ-menu"> <?php error_reporting(0); $path = "store/" . $diro . "/"; function createDir($path = '.') { $handle = opendir($path); if($handle) { echo "<ul>"; while(false !== ($file = readdir($handle))) { if(is_dir($path . $file) && $file !== '.' && $file !== '..') { printSubDir($file, $path, $queue); } elseif($file !== '.' && $file !== '..') { $queue[] = $file; } } printQueue($queue, $path); echo "</ul>"; } } function printQueue($queue, $path) { foreach($queue as $file) { foreach($file as $FK => $FV) { printFile($FV, $path); } } } echo"<form action='osnovni_dokumenti.php?id=" . $data['ideo'] . "' method='POST'>"; function printFile($file, $path) { echo "<li><input type='checkbox' name='del[]' value='$file'/><a href=\"" . $path . $file . "\"><img src='slike_izgled/file.png'> $file</a></li>"; } function printSubDir($dir, $path) { echo "<li><img src='slike_izgled/directory.png' width='20' height='20'> <span class=\"toggle\">$dir</span>"; createDir($path . $dir . "/"); echo "</li>"; } createDir($path); echo"<p align='center'><input type='submit' name='filedel' value='Delete'></p> </form>"; ?> </div> <!-- End Menu --> </body> </html> <?php if(isset($_POST['filedel'])) { $id = $_POST['del']; $count = count($id); for($i = 0; $i < $count; $i++) { $files = $_POST['del']; echo"$files.$count"; echo '<pre>' . print_r($file, true) . '</pre>'; echo '<pre>' . print_r($files, true) . '</pre>'; echo $file[0] . ' - ' . $file[1] . '<br />'; echo $files[0] . ' - ' . $files[1] . '<br />'; } } ?> James.
  23. monkeytooth is right! I assume that "Connections/isn_1.php" doesn't set any sessions either? James.
  24. <?php session_start(); if(isset($_SESSION['counter'])) { $_SESSION['counter']++; } else { $_SESSION['counter'] = 1; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Page A</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <h3>Add a Comment</h3> <form action="Processing.php" method="post"> <fieldset> <!-- Comment --> <label>Comment:</label><br /> <textarea cols="50" rows="15"><?php echo $_SESSION['counter']; ?></textarea> <br /> <!-- Submit Form --> <input type="submit" name="addComment" id="addComment" value="Add a Comment"/> </fieldset> </form> </body> </html> James.
×
×
  • 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.