Jump to content

runnerjp

Members
  • Posts

    2,214
  • Joined

  • Last visited

Everything posted by runnerjp

  1. Ok over that yet still no upload..here out ouput POST:Array ( [form] => Array ( [name] => test ) ) FILES:Array ( [file] => Array ( [name] => ntu app.doc [type] => application/msword [tmp_name] => /tmp/phpvuQQNO [error] => 0 => 339968 ) ) Invalid fileArrayArray ( [name] => test ) and here is code <?php ini_set("display_errors", "1"); error_reporting(E_ALL); echo "<pre>"; echo "POST:"; print_r($_POST); echo "FILES:"; print_r($_FILES); echo "</pre>"; if ((($_FILES["file"]["type"] == "application/msword ")) && ($_FILES["file"]["size"] < 500000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("include/entry/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); echo "Stored in: " . "include/entry/" . $_FILES["file"]["type"]; } } } else { echo "Invalid file".$_FILES["file"]; } print_r($_REQUEST['form']);
  2. Undefined index on line 10 and 38 which are if ((($_FILES["file"]["type"] == "text/doc")) and echo "Invalid file".$_FILES["file"]; but i dont understand why :S
  3. Ok i added it ... <form action="/include/addfixture.php" method="post" onsubmit="return AIM.submit(this, {'onStart' : startCallback, 'onComplete' : completeCallback})"enctype="multipart/form-data"> <div><label>Name:</label> <input type="text" name="form[name]" /></div> <div><label>File:</label> <input type="file" name="form" /></div> <div><input type="submit" value="SUBMIT" /></div> </form> but im still getting invalid file
  4. Ok i have even made it simple <?php $target_path = "/include/entrys/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!";} //print_r($_REQUEST['form']); ?> and i still get There was an error uploading the file, please try again!
  5. here is html... <!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" xml:lang="en-US" lang="en-US"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Iframe Ajax</title> <script type="text/javascript" src="webtoolkit.aim.js"></script> <script type="text/javascript"> function startCallback() { // make something useful before submit (onStart) return true; } function completeCallback(response) { // make something useful after (onComplete) document.getElementById('nr').innerHTML = parseInt(document.getElementById('nr').innerHTML) + 1; document.getElementById('r').innerHTML = response; } </script> </head> <body> <form action="/include/addfixture.php" method="post" onsubmit="return AIM.submit(this, {'onStart' : startCallback, 'onComplete' : completeCallback})"> <div><label>Name:</label> <input type="text" name="form[name]" /></div> <div><label>File:</label> <input type="file" name="form[file]" /></div> <div><input type="submit" value="SUBMIT" /></div> </form> <hr/> <div># of submited forms: <span id="nr">0</span></div> <div>last submit response (generated by form action - index.php file): <pre id="r"></pre></div> </body> </html> also here is the javascript just incase.. /** * * AJAX IFRAME METHOD (AIM) * http://www.webtoolkit.info/ * **/ AIM = { frame : function(c) { var n = 'f' + Math.floor(Math.random() * 99999); var d = document.createElement('DIV'); d.innerHTML = '<iframe style="display:none" src="about:blank" id="'+n+'" name="'+n+'" onload="AIM.loaded(\''+n+'\')"></iframe>'; document.body.appendChild(d); var i = document.getElementById(n); if (c && typeof(c.onComplete) == 'function') { i.onComplete = c.onComplete; } return n; }, form : function(f, name) { f.setAttribute('target', name); }, submit : function(f, c) { AIM.form(f, AIM.frame(c)); if (c && typeof(c.onStart) == 'function') { return c.onStart(); } else { return true; } }, loaded : function(id) { var i = document.getElementById(id); if (i.contentDocument) { var d = i.contentDocument; } else if (i.contentWindow) { var d = i.contentWindow.document; } else { var d = window.frames[id].document; } if (d.location.href == "about:blank") { return; } if (typeof(i.onComplete) == 'function') { i.onComplete(d.body.innerHTML); } } }
  6. I chnaged it and still get invalied file
  7. Ok followed it all and for some reason it wont let me upload a .doc saying invalid file here is my script <?php if ((($_FILES["file"]["type"] == "text/doc")) && ($_FILES["file"]["size"] < 20000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("include/entry" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); echo "Stored in: " . "include/entry" . $_FILES["file"]["type"]; } } } else { echo "Invalid file".$_FILES["file"]; } print_r($_REQUEST['form']); ?> and my output is Invalid fileArray ( [name] => test [file] => cover.doc )
  8. Ok i have a form.. <form name="form1" method="post" action=""> <p>Name: <input name="Name" type="text" maxlength="20"> <br /> <br /> Email: <input name="Name" type="text" maxlength="20"> <br /> <br /> Event: <input name="Name" type="text" maxlength="20"> <br /> <br /> Venue: <input name="Name" type="text" maxlength="20"> </p> <p> </p> <p> <label> <input type="submit" name="submit" id="submit" value="Submit"> </label> <br /> <br /> </p> I want to have the option for users to upload a file (its an entry form to a compertition) but i wanted to know if i could add it to the current form so the same submit button is used. But i also want the form to be optional so if the dont have a file to upload they can still enter the data. Is this possible and if so how?
  9. all i get is 12 not [1] 2 here is full code //Pagination variables if (!isset($_GET['pagenum'])) $_GET['pagenum'] = 0; $entriesPerPage = 1; $start = $_GET['pagenum']*$entriesPerPage; //Querying $query = "SELECT *, (SELECT COUNT(*) FROM photos WHERE thumb_id = 3) as total FROM photos WHERE thumb_id = 3 LIMIT $start, $entriesPerPage"; $result = mysql_query($query) or die(mysql_error()); $total = mysql_result($result, 0, 'total'); $sql="SELECT * FROM `photos` WHERE `thumb_id` = '3'"; $res = mysql_query($sql) or die(mysql_error()); //$pages = (floor($total/$entriesPerPage)); //for($i=0;$i<$pages;$i++) //echo "<P align=\"right\"> <a href=\"?page=$i\">[$i]</a></p> ";<?php $totalPages = (ceil($total/$entriesPerPage)); $pageList = ''; for($page=1; $page<=$totalPages; $page++) { if ($currentPage==$page) { $pageList .= " <b>[{$page}]</b> "; } else { $pageList .= " <a href=\"?page={$page}\">{$page}</a> "; } } echo $pageList; include 'albumphotos.php'; if ($_GET['pagenum'] != '') { $string .= "<div><table width=100%><tr><td>"; if ($_GET['page']) $string .= "<center><a href=\"?pagenum=0\"><<</a> <a href=\"?pagenum=".($_GET['pagenum']-1)."\">< Previous Page</a></center>"; $string .= "<td align=\"right\">"; if ($_GET['pagenum']*$entriesPerPage+$entriesPerPage < $total) $string .= "<center><a href=\"?pagenum=".($_GET['pagenum']+1)."\">Next Page ></a> <a href=\"?pagenum=".(floor(($total-1)/$entriesPerPage))."\">>></a></center>"; $string .= "</table></div>"; echo $string; } ?>
  10. How would i use the current code to output how i wish it to?? $pages = (floor($total/$entriesPerPage)); for($i=0;$i<$pages;$i++) echo "<P align=\"right\"> <a href=\"?page=$i\">[$i]</a></p> "; I would like it to display at the right hand side of the page looking like this [1]23456... with the page the are on on [] and bold
  11. Ok i have it sorted but there is something i dont know how to do.... how can i display numbers like 12345... at the bottom dependant on how many pages there are? <?php require_once '../settings.php'; checkLogin('1 2'); include "../info.php"; // sets username/id ect include "../getuser.php"; // records user view on page //Pagination variables if (!isset($_GET['pagenum'])) $_GET['pagenum'] = 0; $entriesPerPage = 9; $start = $_GET['pagenum']*$entriesPerPage; //Querying $query = "SELECT *, (SELECT COUNT(*) FROM photos WHERE thumb_id = 3) as total FROM photos WHERE thumb_id = 3 LIMIT $start, $entriesPerPage"; $result = mysql_query($query) or die(mysql_error()); $total = mysql_result($result, 0, 'total'); $sql="SELECT * FROM `photos` WHERE `thumb_id` = '3'"; $res = mysql_query($sql) or die(mysql_error()); echo "<table>"; $i = 0; while($row = mysql_fetch_assoc($res)){ $i++; if ($i % 3 == 0) echo '<tr>'; echo "<td> <img src=\"http://www.runningprofiles.com/members/include/myimages/thumbs/" . $row['picurl'] . "\" /></a><br /> </td>"; if ($i % 3 == 0) echo '</tr>'; if( $i == 9 ) break; }echo "</table>"; if ($_GET['pagenum'] != '') { $string .= "<div><table width=100%><tr><td>"; if ($_GET['page']) $string .= "<a href=\"?pagenum=0\"><<</a> <a href=\"?pagenum=".($_GET['pagenum']-1)."\">< Previous Page</a>"; $string .= "<td align=\"right\">"; if ($_GET['pagenum']*$entriesPerPage+$entriesPerPage < $total) $string .= "<a href=\"?pagenum=".($_GET['pagenum']+1)."\">Next Page ></a> <a href=\"?pagenum=".(floor(($total-1)/$entriesPerPage))."\">>></a>"; $string .= "</table></div>"; echo $string; } ?>
  12. Ok so if im displaying it 3 row with 3 images in each and only 9 images...how would i stop it having previous ect if this isnt filled? <link rel="stylesheet" type="text/css" href="http://www.runningprofiles.com/css/login.css"> <?php require_once '../settings.php'; checkLogin('1 2'); include "../info.php"; // sets username/id ect include "../getuser.php"; // records user view on page //Pagination variables if (!isset($_GET['pagenum'])) $_GET['pagenum'] = 0; $entriesPerPage = 9; $start = $_GET['pagenum']*$entriesPerPage; //Querying $query = "SELECT *, (SELECT COUNT(*) FROM photos WHERE thumb_id = 3) as total FROM photos WHERE thumb_id = 3 LIMIT $start, $entriesPerPage"; $result = mysql_query($query) or die(mysql_error()); $total = mysql_result($result, 0, 'total'); $sql="SELECT * FROM `photos` WHERE `thumb_id` = '3'"; $res = mysql_query($sql) or die(mysql_error()); echo "<table>"; $i = 0; while($row = mysql_fetch_assoc($res)){ $i++; if ($i % 3 == 0) echo '<tr>'; echo "<td> <img src=\"http://www.runningprofiles.com/members/include/myimages/thumbs/" . $row['picurl'] . "\" /></a><br /> </td>"; if ($i % 3 == 0) echo '</tr>'; if( $i == 9 ) break; } echo "</table>"; $string .= "<div><table width=100%><tr><td>"; if ($_GET['page']) $string .= "<a href=\"?pagenum=0\"><<</a> <a href=\"?pagenum=".($_GET['pagenum']-1)."\">< Previous Page</a>"; $string .= "<td align=\"right\">"; if ($_GET['pagenum']*$entriesPerPage+$entriesPerPage < $total) $string .= "<a href=\"?pagenum=".($_GET['pagenum']+1)."\">Next Page ></a> <a href=\"?pagenum=".(floor(($total-1)/$entriesPerPage))."\">>></a>"; $string .= "</table></div>"; echo $string; ?>
  13. <?php //This code will obtain the required page number from the $_GET array. Note that if it is not present it will default to 1. if (isset($_GET['pageno'])) { $pageno = $_GET['pageno']; } else { $pageno = 1; } // if //This code will count how many rows will satisfy the current query. $query ="SELECT * FROM `photos` WHERE `thumb_id` = '3'"; $result = mysql_query($query) or trigger_error("SQL", E_USER_ERROR); $query_data = mysql_fetch_row($result); $numrows = $query_data[0]; //This code uses the values in $rows_per_page and $numrows in order to identify the number of the last page. $rows_per_page = 3; $lastpage = ceil($numrows/$rows_per_page); //This code checks that the value of $pageno is an integer between 1 and $lastpage. $pageno = (int)$pageno; if ($pageno > $lastpage) { $pageno = $lastpage; } // if if ($pageno < 1) { $pageno = 1; } // if //This code will construct the LIMIT clause for the sql SELECT statement. $limit = 'LIMIT ' .($pageno - 1) * $rows_per_page .',' .$rows_per_page; //Now we can issue the database qery and process the result. $sql="SELECT * FROM `photos` WHERE `thumb_id` = '3'"; $res = mysql_query($sql) or die(mysql_error()); echo "<table>"; $i = 0; while($row = mysql_fetch_assoc($res)){ $i++; if ($i % 3 == 0) echo '<tr>'; echo "<td> <img src=\"http://www.runningprofiles.com/members/include/myimages/thumbs/" . $row['picurl'] . "\" /></a><br /> </td>"; if ($i % 3 == 0) echo '</tr>'; if( $i == 9 ) break; } echo "</table>"; //... process contents of $result ... //Finally we must construct the hyperlinks which will allow the user to select other pages. We will start with the links for any previous pages. if ($pageno == 1) { echo " FIRST PREV "; } else { echo " <a href='http://www.runningprofiles.com/members/index.php?page=album&pageno=1'>FIRST</a> "; $prevpage = $pageno-1; echo " <a href='http://www.runningprofiles.com/members/index.php?page=album&pageno=$prevpage'>PREV</a> "; } // if //Next we inform the user of his current position in the sequence of available pages. echo " ( Page $pageno of $lastpage ) "; //This code will provide the links for any following pages. if ($pageno == $lastpage) { echo " NEXT LAST "; } else { $nextpage = $pageno+1; echo " <a href='http://www.runningprofiles.com/members/index.php?page=album&pageno=$nextpage'>NEXT</a> "; echo " <a href='http://www.runningprofiles.com/members/index.php?page=album&pageno=$lastpage'>LAST</a> "; } // if ?> Im alittle confused by my pageinated results... i only have 2 images... and for some reason its repeated these images over 11 pages... how comes?
  14. <?php //error_reporting(E_ALL); //session_start(); require_once '../settings.php'; include "../info.php"; // sets username/id ect ?><link rel="stylesheet" type="text/css" href="http://www.runningprofiles.com/css/login.css"> <fieldset> <form action="<?php echo $_server['php-self']; ?>" method="post" enctype="multipart/form-data" id="something" class="uniForm"> <p align="center"> <input name="new_image" id="new_image" size="30" type="file" class="fileUpload" /> </p> <p align="center"><legend><strong>Description</strong></legend> <input type='text' name='udesc'><br /> <div align="center"> <div align="center"> <?php $album=$_GET['al']; If ($album == ''){ ?> <select style='width:150px;' name='album'> <?php $fetch = mysql_query("SELECT * FROM `photomain` where uid = '1'"); while ($album = mysql_fetch_array($fetch)) { echo "<option value='$album[id]'>$album[name]</option>"; } } ?> </select> <br /> </div> <button name="submit" type="submit" class="submitButton">Upload/Resize Image</button> </div> </form> <?php if(isset($_POST['submit'])){ if (isset ($_FILES['new_image'])){ $file_name = $_FILES['new_image']['name']; $getExt = explode ('.', $file_name); $file_ext = $getExt[count($getExt)-1]; // Adding extension verification $allowed_ext = "|jpg|png|gif|jpeg|svg|bmp|"; if (strpos($allowed_ext, "|".strtolower($file_ext)."|")===false) die("Extension: $file_ext is not allowed!"); // End extension verification $imagename = "$id.$file_ext"; $source = $_FILES['new_image']['tmp_name']; $chars = "abcdefghijklmnopqrstuvwxyz1234567890"; //available chars $uniqueurl = substr(str_shuffle($chars), 0, 5); // shuffles the string $chars and picks the first 5 $target = "http://www.runningprofiles.com/members/include/myimages/$uniqueurl.$file_ext"; move_uploaded_file($source, $target); $imagepath = $imagename; $save = "http://www.runningprofiles.com/members/include/myimages/thumbs/" . $imagepath; //This is the new file you saving $file = "http://www.runningprofiles.com/members/include/myimages/" . $imagepath; //This is the original file list($width, $height) = getimagesize($file) ; // Adding proportionate image resizing, with max values /* $modwidth = 200; $diff = $width / $modwidth; $modheight = $height / $diff; */ $max_w = 130; $max_h = 86; if($width <= $max_w && $height <= $max_h){ // if it fits $modheight = $height; $modwidth = $width; }else{ // Then resize $diff = ($width > $height) ? ($width/$max_w) : ($height/$max_h); // Check which is bigger, and fit it to that max value. This will prevent stretching (80x800) $modheight = $height / $diff; $modwidth = $width / $diff; } // End $tn = imagecreatetruecolor($modwidth, $modheight) ; $image = imagecreatefromjpeg($file) ; imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ; imagejpeg($tn, $save, 100) ; $today = date("F j, Y, g:i a"); $picurl = "myimages/$uniqueurl" . $_FILES["file"]["name"]; $add_pic = mysql_query("INSERT INTO `photos` (`desc`,`thumb_id`,`date`,`picurl`, `datetaken`,`uid`) VALUES ( '$udesc','$album', '$date','$picurl','$today','$id');") or die(mysql_error()); echo "done"; } } ?></fieldset> i seem to be getting a list of errors from my script above and i dont undertstand why as iv used the code elsewhere and it works fine... can any 1 suggest any thing to solve the errors? Warning: move_uploaded_file() [function.move-uploaded-file]: URL file-access is disabled in the server configuration in /home/runningp/public_html/members/include/albumpicupload.php on line 52 Warning: move_uploaded_file(http://www.runningprofiles.com/members/include/myimages/yhi2d.jpg) [function.move-uploaded-file]: failed to open stream: no suitable wrapper could be found in /home/runningp/public_html/members/include/albumpicupload.php on line 52 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/php9DXghY' to 'http://www.runningprofiles.com/members/include/myimages/yhi2d.jpg' in /home/runningp/public_html/members/include/albumpicupload.php on line 52 Warning: getimagesize() [function.getimagesize]: URL file-access is disabled in the server configuration in /home/runningp/public_html/members/include/albumpicupload.php on line 58 Warning: getimagesize(http://www.runningprofiles.com/members/include/myimages/1.jpg) [function.getimagesize]: failed to open stream: no suitable wrapper could be found in /home/runningp/public_html/members/include/albumpicupload.php on line 58 Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in /home/runningp/public_html/members/include/albumpicupload.php on line 84 Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: URL file-access is disabled in the server configuration in /home/runningp/public_html/members/include/albumpicupload.php on line 85 Warning: imagecreatefromjpeg(http://www.runningprofiles.com/members/include/myimages/1.jpg) [function.imagecreatefromjpeg]: failed to open stream: no suitable wrapper could be found in /home/runningp/public_html/members/include/albumpicupload.php on line 85 Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/runningp/public_html/members/include/albumpicupload.php on line 86 Warning: imagejpeg(): supplied argument is not a valid Image resource in /home/runningp/public_html/members/include/albumpicupload.php on line 87 done
  15. Whats the best way to set up a gallery like most social networking sites so they can upload their own photos and the gallerys can be accessed under their profiles?
  16. ok i have this in my code... <?php SELECT friends.friendname, users.image FROM friends INNER JOIN users ON (users.Username=friends.friendname) WHERE friends.username='$profilename' GROUP BY friends.friendname ORDER BY RAND() limit 9?> I just want to know how it works?? so what does the . do and is the left one the table and right the colum?
  17. Humm it seems the code event runs before the loop and doubles itself <?php $query = "SELECT * from $db_table WHERE (ev_dat>='$min_dat') AND (ev_dat<='$max_dat') ORDER by ev_dat"; $result = @mysql_db_query($db_name, $query); echo "<table width='480' cellpadding='3' cellspacing='3' align='center' style='border: thin dotted #999999;' bgcolor='#f7f7f7'><tr><td>"; ?> even the above taken form the top code so it dont see where im psting it twice nor looping it twice
  18. I just cant find where its going wrong... its also doing it for this code which poicks dates rather then month <html> <head> <title>Event Information</title> <!-- change styles if you want --> <style type="text/css"> p {font-family: georgia, verdana, sans-serif; font-size: 13px; color: #333333; } h1 {font-family: georgia, verdana, sans-serif; font-size: 16px; color: #26618e; } body {background-color: #fcfcfc;} </style> </head> <body> <br /> <?php // no need to edit below here $id = $_GET['event']; // from clicked day $sho = $_GET['sho']; // display method // mo/yr needed as well for whole month view include("cal_parms.php"); include($dat_names); // retrieved from cal_parms.php as a 'language' file include("cal_db_conn.php"); mysql_connect($db_host, $db_login, $db_pass) or die ("Can't connect!"); mysql_select_db($db_name) or die ("Can't open database!"); // retrieve record for 'clicked' days $query = "SELECT * FROM $db_table WHERE id = '$id' "; // retrieves ONE record $result = mysql_db_query($db_name, $query); $myrow = mysql_fetch_array($result); $ev_1 = $myrow['ev_dat']; // is date for that record (allows multiple events selection) $found = $myrow['ev_dat']; $pieces = explode("-", $ev_1); $monum = intval($pieces[1]); $query = "SELECT * from $db_table WHERE ev_dat = '$ev_1' "; // retrieves ALL date matches $result = mysql_db_query($db_name, $query); echo"<table width='480' cellpadding='3' cellspacing='3' align='center' style='border: thin dotted #cccccc;' bgcolor='#f7f7f7'><tr><td>"; echo "<h1>". $mo[$monum]. " ". intval($pieces[2]). ", ". intval($pieces[0]). "</h1>"; while ($myrow = mysql_fetch_array($result)) // loop through all results { echo "<p><strong> Title: ". $myrow['ev_title']. "</strong></p>"; // echo "<p>". $LocationText. ": ". $myrow['ev_locn']. "</p>"; echo "<p>". nl2br($myrow['ev_desc']). "</p><br/>"; } ?> </td></tr></table> </html> </body>
  19. Hey guys.. for come reason my data is outputted twise shown in the image below and i cant figure out why. <html> <head> <title>Month Summary</title> <!-- change styles if you want --> <style type="text/css"> p {font-family: georgia, verdana, sans-serif; font-size: 13px; color: #333333; } h1 {font-family: georgia, verdana, sans-serif; font-size: 16px; color: #26618e; } body {background-color: #fcfcfc;} </style> </head> <body> <br/> <?php // THERE IS NO NEED TO EDIT BELOW HERE $mon = $_GET['mon']; // month from clicked month name $month = intval($mon); // var to use with month name array if (strlen($mon)==1) { $mon = "0". $mon; } $yr = $_GET['yr']; // year from clicked month name include("cal_parms.php"); include("./lang/dat_nam_en.php"); // load default language file so as not to mess anything upp with new text. include($dat_names); // retrieved from cal_parms.php as a 'language' file include("cal_db_conn.php"); mysql_connect($db_host, $db_login, $db_pass) or die ("Can't connect!"); mysql_select_db($db_name) or die ("Can't open database!"); $min_dat = $yr. "-". $mon. "-01"; $max_dat = $yr. "-". $mon. "-31"; //sloppy but effective // retrieve all events for the month $query = "SELECT * from $db_table WHERE (ev_dat>='$min_dat') AND (ev_dat<='$max_dat') ORDER by ev_dat"; $result = @mysql_db_query($db_name, $query); echo "<table width='480' cellpadding='3' cellspacing='3' align='center' style='border: thin dotted #999999;' bgcolor='#f7f7f7'><tr><td>"; while ($myrow = mysql_fetch_array($result)) // loop through all results { $found = $myrow['ev_dat']; $pieces = explode("-", $found); $monum = intval($pieces[1]); $danum = intval($pieces[2]); echo "<h1>". $danum. " ". $mo[$month]. ", ". $yr. "</h1>"; echo "<p><strong>". $EventText. ": ". $myrow['ev_title']. "</strong><br/>"; echo $LocationText. ": ". $myrow['ev_locn']. "<br/>"; echo $DetailsText. "<br/>". nl2br($myrow['ev_desc']). "</p>"; $i++; } if ($i==0) { echo "<h1>".$noEventsText." ". $mo[$month]. "</h1>"; } if ($sho == "1") { echo "<p align='right'><a href='javascript:self.close()'>".$closewindowText ."</a>"; } else { echo "<p align='right'>« <a href='javascript:history.go(-1)'>".$backToCalendar."</a></p>"; } ?> </td></tr></table> </html> </body> hopefully someone can see the reason why Thanks
  20. Ok thanks... would you say it would be easy to convert over to ajax?
  21. Here is my calander script <script src="http://www.runningprofiles.com/jquery.js" type="text/javascript"></script> <link href="http://www.runningprofiles.com/members/diary/facebox/facebox.css" media="screen" rel="stylesheet" type="text/css"> <script src="http://www.runningprofiles.com/members/diary/facebox/facebox.js" type="text/javascript"></script> <script> jQuery(document).ready(function($) { $('a[rel*=facebox]').facebox() }) </script> <?php // there is NO NEED to edit ANY of this code $ev_dat = array(); for ($i=0;$i<32;$i++) { $ev_dat[$i]=0; } $now = date("Y-m-d", time()); list($ty, $tm, $td) = explode('-',$now); // ty=thisyear, etc. used for highlighting 'today' include("cal_parms.php"); // assorted configuration variables include($dat_names); // retrieved from cal_parms.php as a 'language' file if (!isset($_GET['m'])) { $m = date("m",mktime()); } else { $m = $_GET['m']; } if (!isset($_GET['y'])) { $y = date("Y",mktime()); } else { $y = $_GET['y']; } /*== get what weekday the first is on ==*/ $tmpd = getdate(mktime(0,0,0,$m,1,$y)); $month = $tmpd["month"]; $firstwday= $tmpd["wday"]; if ($firstDayIsMonday == 1) { if ($firstwday == 0) { $firstwday = 6; } else { $firstwday--; } } $lastday = mk_getLastDayofMonth($m,$y); /*== get the last day of the month ==*/ function mk_getLastDayofMonth($mon,$year) { for ($tday=28; $tday <= 31; $tday++) { $tdate = getdate(mktime(0,0,0,$mon,$tday,$year)); if ($tdate["mon"] != $mon) { break; } } $tday--; return $tday; } // compute range of dates for this month to match dates in database in the format yyyy-mm-dd if (strlen($m)<2) { $q="0"; $q.=$m; } else { $q = $m; } $dats_beg = $y. "-". $q. "-01"; $dats_en = $y. "-". $q. "-". $lastday; // open db conn and select all records where date is between $dats_beg and $dats_en include("cal_db_conn.php"); mysql_connect($db_host, $db_login, $db_pass) or die ("Can't connect!"); mysql_select_db($db_name) or die ("Can't open database!"); $query = "SELECT * FROM $db_table WHERE (ev_dat>='$dats_beg') AND (ev_dat<='$dats_en') "; $result = mysql_db_query($db_name, $query); // any matches? if ($result) { // handle the matches and pass relevant info to arrays while ($myrow = mysql_fetch_array($result)) { $found = $myrow['ev_dat']; $pieces = explode("-", $found); $dd = intval($pieces[2]); $ev_dat[$dd] = $myrow['id']; } } ?> <table cellpadding="1" cellspacing="1" border="0" bgcolor="#<? echo $bg_edge; ?>"> <tr><td colspan="7" bgcolor="#<? echo $bg_top; ?>"> <table cellpadding="1" cellspacing="1" border="0" width="100%"> <tr bgcolor="#<? echo $bg_top; ?>"><th width="20" style="<?php echo $hcell; ?>"><a href="<? echo $username; ?>&m=<?=(($m-1)<1) ? 12 : $m-1 ?>&y=<?=(($m-1)<1) ? $y-1 : $y ?>"><img src='http://www.runningprofiles.com/calendar/images/prev.gif' height='18' width='18' alt='' border='0' /></a></th> <th style="<?php echo $hcell; ?>"> <?php echo "<a href='../members/diary/show-month.php?mon=". $m. "&yr=". $y. "'rel=\"facebox\">"; echo "<span style='text-decoration:none'>". $mo[intval($m)]. " ". $y. "</span></a>"; ?> </th> <th width="20" style="<? echo $hcell; ?>"><a href="<? echo $username; ?>&m=<?=(($m+1)>12) ? 1 : $m+1 ?>&y=<?=(($m+1)>12) ? $y+1 : $y ?>"><img src='http://www.runningprofiles.com/calendar/images/next.gif' height='18' width='18' border='0' alt='' /></a></th> </tr> </table> </td></tr> <tr bgcolor="#<? echo $bg_top; ?>"> <th width="20" style="<?php echo $hcell; ?>"><? echo $da[1]; ?></th> <th width="20" style="<?php echo $hcell; ?>"><? echo $da[2]; ?></th> <th width="20" style="<?php echo $hcell; ?>"><? echo $da[3]; ?></th> <th width="20" style="<?php echo $hcell; ?>"><? echo $da[4]; ?></th> <th width="20" style="<?php echo $hcell; ?>"><? echo $da[5]; ?></th> <th width="20" style="<?php echo $hcell; ?>"><? echo $da[6]; ?></th> <th width="20" style="<?php echo $hcell; ?>"><? echo $da[7]; ?></th> </tr> <? $d = 1; $wday = $firstwday; $firstweek = true; /*== loop through all the days of the month ==*/ while ( $d <= $lastday) { /*== set up blank days for first week ==*/ if ($firstweek) { if ($wday!=0) { echo "<tr bgcolor='#". $bg_tabl. "'>\n"; for ($i=1; $i<=$firstwday; $i++) { echo "<td style='". $tcell. "' bgcolor='#". $bg_fill. "'> </td>\n"; } } /*== Sunday start week with <tr> ==*/ else { echo "<tr bgcolor='#". $bg_tabl. "'>\n"; } $firstweek = false; } /*== check for event ==*/ echo "<td style='". $tcell. "' "; // is this day 'today' AND there's no event today if (($ty==$y) && ($tm==$m) && ($td == $d) && (!$ev_dat[$d])) { echo "bgcolor='#". $bg_now. "'>". $d; } elseif ($ev_dat[$d]) { // get what's happening that day and use as 'mouseOver' for the link $query = "SELECT * FROM $db_table WHERE id=$ev_dat[$d] "; $result = mysql_query($query); $ev = mysql_fetch_array($result); $titl = $ev['ev_title']; echo "bgcolor='#". $bg_act. "'>"; $url = "../members/diary/show.php?event=". $ev_dat[$d]. "&sho=". $win_sho; echo "<a href=' $url' rel=\"facebox\" title=\"". $titl. "\">". $d. "</a>"; } else { echo "bgcolor='#". $bg_days. "'>". $d; } echo "</td>\n"; /*== Saturday end week with </tr> ==*/ if ($wday==6) { echo "</tr>\n"; } $wday++; $wday = $wday % 7; if (($wday==0) AND ($d!=$lastday)){ echo "<tr bgcolor='#". $bg_tabl. "'>\n"; } $d++; } // and close off the table if (($wday!=7) AND ($wday!=0)) { for ($i=$wday; $i<=6; $i++) { echo "<td style='". $tcell. "' bgcolor='#". $bg_fill. "'> </td>\n"; } echo "</tr>"; } echo "\n</table>"; include("win_open.php"); ?> what would be the best way to make it so that if you wish to chnage the month it changed the month on page rather than refresh the whole page its on?
  22. oh yes i can see the calander as you can see it in the image above so the include points to cat_show.php
×
×
  • 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.