Jump to content

newbreed65

Members
  • Posts

    44
  • Joined

  • Last visited

    Never

Everything posted by newbreed65

  1. Hiya everyone I'm currently working on a project where I need to be able to log certain information by Ajax running a php page behind the scene that logs the information in a database. I can get this working fine when both verbiage's are located on one domain server but I'm having difficulty getting it to work when there on separate servers... I'm ab it of a noob when it comes to Ajax and got a feeling I'm trying to wrong thing when your need to interact with different servers, just a lil unsure were to go now Below is the code i have currently function getXMLHTTPRequest() { try { req = new XMLHttpRequest(); } catch(err1) { try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch (err2) { try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch (err3) { req = false; } } } return req; } var http = getXMLHTTPRequest(); function getServerText() { var myurl = 'http://www.ftp5.dns-systems.net/~guardhog/test.php'; myRand = parseInt(Math.random()*999999999999999); var client = "&client=123456" var modurl = myurl+"?rand="+myRand+client; http.open("GET", modurl, true); http.onreadystatechange = useHttpResponse; http.send(null); } function useHttpResponse() { if (http.readyState == 4) { if(http.status == 200) { var mytext = http.responseText; document.getElementById('myPageElement').innerHTML = mytext; } } else { document. getElementById('myPageElement').innerHTML = ""; } }
  2. Hi I am currently trying to transfer a file from my server to another one via SFTP and I’m not having any luck at all. it just keeps failing to connect although I know the ftp detail are correct since I can connect it via core ftp, can anyone help me with SFTP transfers? here is my current code $ftp_id = ftp_ssl_connect($ftp_server) or die ('Cant Connect'); $login_result = ftp_login($ftp_id, $ftp_user_name, $ftp_user_pass)or die ('Cant login'); $upload = ftp_put($ftp_id, $ftp_path . $file_name, $file_path, $mode)or die ('upload dint work'); ftp_close($ftp_id);
  3. Thanx for that just before i looked on your post i tried the same thing and it look like its worked havent double checked thou lol
  4. Hi Everyone In PhpMyAdmin I’m trying to get a list of clients from the clients table that don’t have any claims linked to them in the Claims table, I can get all the ones that have claims but don’t know how to get the ones that don’t have claims Any Help? Here are a few of my failed attempts SELECT`Clients`.*, `Claims`.`ClientID` FROM `Clients` WHERE`Clients`.`ID`!=`Claims`.`ClientID`) SELECT`Clients`.* FROM `Clients` JOIN `Claims` ON (`Clients`.`ID`!=`Claims`.`ClientID`)
  5. Hi everyone I’m currently working on a Image gallery that in the future I can add to sites that need one but I’m currently having problem find a simple way of splitting the images up into group. For example if there were 50 images in my gallery it would be split up into pages of 24 with the remainders on the last page. Can anyone help me? This site is a good example of what I’m trying to do http://www.comicartcommunity.com/gallery/search.php?show_result=1 and here the gallery at the moment and its relevant code http://www.andyhughes.co.uk/development/imagegallery/ <?php $images = "image_gallery/"; // Location of small versions $big = "big/"; # Location of big versions (assumed to be a subdir of above) $cols = 6; # Number of columns to display if ($handle = opendir($images)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && $file != rtrim($big,"/")) { $files[] = $file; } } closedir($handle); } $filecount = count(glob("" . $images . "*.jpg")); echo "<p>Images (" . $filecount . ")</p>"; if ($filecount == 0) { echo "<h1>No Images Currently in the Gallery</h1>"; } else { rsort($files); $colCtr = 0; echo '<table width="100%" cellspacing="3"><tr>'; foreach($files as $file) { if($colCtr %$cols == 0) echo '</tr><tr><td colspan="' . $cols . '"><hr /></td></tr><tr>'; echo '<td align="center"><a href="index.php?image=' . $file . '"><img src="' . $images . $file . '" /></a></td>'; $colCtr++; } echo '</table>' . "\r\n"; } ?>
  6. As you will see from the code below i have a MYSQL Query which adds a person data to my database, but when it come to the next part were i upload the persons image (if they have added one) I want to use the value from the primary key (person_id) ) that is Auto incremented as the images name, is there away to just get the ID instead if running another query like you would if you were displaying the data on a page $sql = "INSERT INTO team (person_firstname, person_surname, person_role, person_info, person_image) VALUES ('" . mysql_real_escape_string($firstname) . "', '" . mysql_real_escape_string($surname) . "', '" . mysql_real_escape_string($role) . "', '" . mysql_real_escape_string($info) . "', '" . mysql_real_escape_string($image) . "')" ; mysql_query($sql, $conn) or die('Could not submit person; ' . mysql_error()); //if image true then upload image if ($image == true) { require_once '../../includes/image_upload.php'; }
  7. Hi Everyone I'm currently trying to figure out how to deal with more than one array since this is the first time Ive tried doing something like this. below is some code that in the end with be changed into a Update MySQL query case "Save": $test = $_POST['character']; $test2 = $_POST['castid']; foreach ($test as $key=> $person){ echo $person . " "; foreach ($test2 as $key=> $id){ echo $id . " "; echo "<br>"; } } break; What i want the code to do is display the data from the arrays like this.. but currently in this version of the code it getting displayed like this .. Any ideas?? i got a feeling like i might be about this completely wrong
  8. Hey Everyone I'm having a problem with the movie part of the page the link will take you too. http://bulletsnoctane.co.uk/people/person.php?id=5 I'm trying to show all the movie that the person has been attached too but for some reason the first record in the query doesn't show it should be terminator salvation dark knight batman begins not just the last 2 movies, I've double checked the query in phpmyadmin and all 3 records show up <h3>Movies</h3> <?php $sql = "SELECT * FROM casts JOIN movie ON (casts.movie=movie.id) JOIN roles ON (casts.role=roles.id) WHERE person_id=" . $id . " ORDER BY released DESC"; $result = mysql_query($sql) or die(mysql_error()); $cast = mysql_fetch_array($result); if (mysql_num_rows($result) == 0) { echo " <em>currently not attached to any movies</em>"; $table = ""; } else { $table = "<table>"; while ($cast = mysql_fetch_array($result)) { $date1 = $cast['released']; $date2 = explode("-",date("Y-m-d",strtotime($date1)));//splits up the date $table .= "<tr><td>" . $date2[0] . "</td>" . '<td><a href="/movies/movie.php?id=' . $cast['movie'] . '">' . $cast['name'] . "</a></td><td>" . $cast['role_name'] . "</td><td>" . $cast['char_name'] . "</td>"; } } $table .= "</table>"; echo $table; ?> </div>
  9. This is the first time i have ever tried to do this and when i have been looking for help and tutorials well i havnt found anything helpful :-/ , havnt used CURDATE()
  10. ive just tried the below query in phpmyadmin and got the same result the data type im using for released is date SELECT movie.id, movie.name, movie.released FROM movie WHERE released >=2009 -01 -10 ORDER BY released DESC LIMIT 0 , 10
  11. Not look sorry the dates are stored as date("Y-m-d") in the database then when you scroll down and explode the and change it into how it is show on the page while ($row = mysql_fetch_array($result)) { $date1 = $row['released']; $date2 = explode("-",date("Y-m-d",strtotime($date1)));//splits up the date echo '<a href="/movies/movie.php?id=' . $row['id'] . '">' . htmlspecialchars($row['name']) . "</a> | "; echo $date2[2] . "/" . $date2[1] . "/" . $date2[0]; echo "<br />"; } }
  12. Hey I'm making a movie news site and on my home page I'm currently trying to show a short list of the next movies that are due to be released but i don't seem to be getting anywere. i either end up getting nothing back or just the list of all the movie even if they have already been release as show in this link http://bulletsnoctane.co.uk/index.php <h3>Coming Soon..</h3> <?php $sql = "SELECT movie.id, movie.name, movie.released FROM movie WHERE released >=" . date("Y-m-d") . " ORDER BY released DESC LIMIT 0, 10 "; $result = mysql_query($sql, $conn) or die('Could not get list of movies; ' . mysql_error()); if (mysql_num_rows($result) == 0) { echo " <em>No movies available</em>"; } else { while ($row = mysql_fetch_array($result)) { $date1 = $row['released']; $date2 = explode("-",date("Y-m-d",strtotime($date1)));//splits up the date echo '<a href="/movies/movie.php?id=' . $row['id'] . '">' . htmlspecialchars($row['name']) . "</a> | "; echo $date2[2] . "/" . $date2[1] . "/" . $date2[0]; echo "<br />"; } } ?>
  13. Thank you very much that works fine and sorry for the slow reply first time i got back to doing stuff because of new years
  14. Hey everyone when inserting text fields into my database like a Name or News entry, i want to be able have certain characters like single quotes (", ') in the fields without breaking the MySQL Query, how would I do that? Ive done abit of research and found things like mysql_real_escape_string, addslashes, stripcslashes and quotemeta but is there a simple function like htmlspecialchars which could do it on insert for me
  15. No sadly the folder has to be empty first...below is currently the code I have which deletes it all. I was just hoping that there might have been a function out there that would have done the same thing just would have mess around deleting all the files from the folder first $getpic = "SELECT * FROM movieimages WHERE movie_id = $mid"; $result = mysql_query($getpic) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { $DelImage ="images/" . $mid . "/" . $row ['image_id'] . ".jpg"; $DelThumb = "images/" . $mid . "/thumbs/" . $row ['image_id'] . ".jpg"; $dirImage = "images/" . $mid; $dirThumb = "images/" . $mid . "/thumbs"; unlink($DelImage); unlink($DelThumb); } rmdir($dirThumb); rmdir($dirImage);
  16. hmm I guess Ill have to just do it by deleting the files first :-/
  17. Hi Everyone Is there a function to delete a folder and its content by just saying you want to delete the folder? I currently I know how to do it by deleteing every file with unlink and then deleting the folder with rmdir. I was just wondering if there was well a less pain in the arse way. its for deleting a photo album folder
  18. i currently want to have a min-height for the demo site I'm making but i cant seen to get min-height to work on my content div, though i have checked it works fine in firefox and safari any ideas? here the site http://bulletsnoctane.co.uk/ and here all the css i have for the site currently body { font: 100% Verdana,; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:0.9em; background-image:url(/style/image/bg.jpg); margin: 0; /* zero the margin and padding of the body for differing browser defaults*/ padding: 0; color: #000000; text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */ } /********************* Container **********************/ #container { width: 990px; margin: /*0*/ auto; /*the auto margins (in conjunction with a width) center the page */ border: 1px solid #000000; text-align: justify; /* this overrides the text-align: center on the body element. */ background-color:#FFFFFF; } /********************* Header **********************/ #header { height: 120px; background:#FFFFFF; background-image:url(/style/image/header.png); background-repeat:no-repeat; background-position:center; } /********************* Nav bar **********************/ #nav { background:#000000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:1.2em; font-weight:bold; color:#FFFFFF; height:30px; text-align:center; margin:0px;*/ } #nav ul { width: 100%; font-family:Verdana, Arial, Helvetica, sans-serif; height: 20px; } #nav ul li { display: inline; } #nav ul li a { padding: 10px 15px 0px 15px; color: #fff; } #nav ul li a:hover { color:#0000FF; height: 20px; } /********************* Main Content **********************/ #content { padding: 0 15px; /* padding is the space inside the div, margin is space outside the div */ background: #FFFFFF; min-height:700px; margin:10px; border:1px; border-color:#000000; /*overflow:auto; scrollbar scrollbar-base-color: #FF0000; scrollbar-arrow-color: #FF0000; scrollbar-3dlight-color: #000000; scrollbar-darkshadow-color: #000000; scrollbar-face-color: #000000; scrollbar-highlight-color: #ffffff; scrollbar-shadow-color: #ffffff; scrollbar-track-color: #777777;*/ } /********************* Footer **********************/ #footer { padding: 0 10px; /* this padding matches the left alignment of the elements in the divs that appear above it. */ background:#000000; color:#FF0000; text-align:right; font-weight:bold; height:20px; clear:both; margin:auto; } footer p { color:#fff; text-align:right; margin: 0; padding: 10px 0; font-size:0.7em; } #h7 { color:blue; text-align:right; margin: 0; padding: 10px 0; font-size:0.7em; text-align:right; } /********************* Control Panel **********************/ #cp_reviews { width:400px; float:right; display:block; } #cp_news { width:400px; float:left; border:thick; display:block; } /********************* Validation and Errors **********************/ #error { margin:auto; background-color:#FF0000; color:#000000; font-weight:bold; padding-bottom:10px; } /********************* Images **********************/ #upload { background-color:#CCCCCC; padding:10px; width:240px; height:20px; margin-bottom:10px; } #canvas { clear:both; margin:auto;} #gallery { width:200px; margin:10px; float:right; border:3px; border-color:#FF0000; background:#CCCCCC; } .pic { text-align:center; border:#999999 5px; } /********************* Tables **********************/ td { color:#353535; font-family:Verdana; } th { color:#FFFFFF; font-family:Verdana, Arial, Helvetica, sans-serif; background-color:#336699; } a { text-decoration:none; color:#FF0000; } /********************* Text **********************/ p { font-family:Verdana, Arial, Helvetica, sans-serif; text-align:justify; color:#FF0000; } h1 { font-family:Verdana, Arial, Helvetica, sans-serif; text-align:center; font-size:1.8em; } h2 { font-family:Verdana, Arial, Helvetica, sans-serif; text-align:left; font-size:1em; } h4 { font-family:Verdana, Arial, Helvetica, sans-serif; text-align:center; font-size:1.5em; padding:0px; margin:0px; margin-right:10px; } h5 { font-family:Verdana, Arial, Helvetica, sans-serif; text-align:left; padding:0px; margin:0px; margin-right:10px; display:inline; font-size:1em;
  19. im not pulling any data from the database with that code premiso if i miss led you. code was just me trying to show people how i had the selection box and the date split up. Thank you Mchl for the exmple that is exactly what i was after
  20. its currently getting stored as a date data type Im making a movie site that as well as news and review im trying to include more detail info about the actual movies and actors like what you would find at imdb.com so im storing information about the movie(name, release date, summary, type etc) and then the users would enter/edit the data, so when it comes to the user editing the data i want the selection boxes to show the correct release date if one has already been entered
  21. hi everyone I'm trying to find out if/how I can separate a date that I would have already stored in a database into $month, $day and $year since I'll be using selection boxes for inputting the date and obviously when it comes to editing info on say a movie I would need the right release date showing I've tried looking round for how to do and tried a few things but no luck, can anyone help me or would it actually better if I just stored the date in the database a separate field (month, day, year). Just in case it's useful here is a link to what I made learning how to make the date selection boxes and the code below http://bulletsnoctane.co.uk/date_select.php <?php $d2 = $_POST['d2']; $m2 = $_POST['m2']; $y2 = $_POST['y2']; if($y2 == "") $y2 = date("Y"); ?> <form name=xc action="" method=POST> <?php /* ----------------------- Day Select Box ---------------------------- */ echo "<select name=d2>"; for($value=1; $value<32; $value++) { if($d2 == $value) echo "<option value=$value selected>$value</option>"; else echo "<option value=$value>$value</option>"; } echo "</select>"; /* ----------------------- Month Select Box ---------------------------- The Month Select Box So the Value is the numeric value but but what the user selects is the actual text value of a month like "May" */ /* create array so we can name months */ $monthName = array(1=> "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); echo "<select name=m2>"; for($value = 1; $value <= 12; $value++) { echo "<option value=\""; echo intval($value); echo "\""; if($m2 == $value) { echo " SELECTED"; } echo ">" . $monthName[$value] . "</option>"; } echo "</select>\n"; /* ----------------------- Year Select Box ---------------------------- */ echo "<select name=y2>"; $startYear = date( "Y"); for($value = $startYear - 75; $value <= $startYear+5;$value++) { echo "<option value=\"$value\""; if($y2==$value) { echo " SELECTED"; } echo ">" . $value . "</option>"; } echo "</select>\n"; ?> <input type=submit value="view stats"> </form> <?php $date1 = date("Y-m-d",mktime(0, 0, 0, $m2, $d2, $y2)); include "action.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.