Jump to content

QuizToon

Members
  • Posts

    21
  • Joined

  • Last visited

Everything posted by QuizToon

  1. Hi All, I want to include my terms and conditions in an ebay listing. The reason for this is to ease the process if and when i need to change the terms. I stopped using eBay about a year ago and back then is used this code to display my terms withing the eBay lisitng. <?php include ('http://www.example.com/terms.php'); ?> NOw when i put that code into the listing it doesnt display. I tested this out on my own server and it didnt display there either so I now it isnt eBay. I also tried emoving the brackets without success. The only way I can get it to display as include on my server is to use a relative path, which isnt the result I need Has something changed in the past year? Is there another way to display an external file using an absolute path to an external file? Many Thanks
  2. Hi all, I already have a database and tables set up and it has information in there already. I would like a way of adding new fields to the database using a php form. Example would be that I would like to add the field called 'field2' to the database, it can be added as the last field in the table. I would also like to be able to name the additional field before it is created. So basically process is: select the database select the table choose a new field name add the field I have tried searching for this but only seem to find adding a table. Have tried my self but quite frankly I am nowhere near the correct code. Decided its time to ask the experts. many Thanks
  3. Hi there, Not sure if this is in the right place, my apologies if not. I have googled various search terms for this but don't seem to get the answer. I am looking to see if there is a script that determines if you have flash installed, if it does it goes ahead and displays the flash file if it doesn't it displays a static graphic/image instead Many thanks
  4. Hi all I am having a bit of a problem understanding addslashes and n2lbr and where and when to use them. I have, after much toing and froing, managed to create a small news script which displays news in the form od a newsletter on the website. I have also done the admin system to allow me to upload news articles, edit current ones and delete old ones. What I have noticed is that there seems to twice as many line breaks as there needs to be. EG i input the text with 2 line breaks and the system uploads it and adds another one in, if I edit the article the same thing happens. I am guessing I have done something wrong with either of 2 functions mentioned. Please can someone just explain in real simple terms when and where I should use them, if indeed that is my problem. Many Thanks
  5. First off let me thank you for your patience and for sticking with me on this. I have a little knowledge of php and I do understand it a little, I tend to get confused with it though, you know how it is, just cant get it to sink in all the time. My problem is I find it difficult to learn from books etc, I need to be taught in a lesson like at school (long time ago that was). Need someone to tell me and show me as well as having the book to reference to. I don't think SQLyog is quite what I am looking for in this instance but looks like something I could use for other projects. Going to crack on and try the code you have written up there. Many thanks Look forward to part 2 of my lesson
  6. I don't currently have any code because I don't update using php at the moment, I have been using the csv file and manually amending it before importing to the database via myphp. I just know how to select a single record from a list of records retrieved from the database, and update a given field for that record. Basically I would have a script which would return the following from the database player 1 - Click to edit player 2 - Click to edit player 3 - Click to edit player 4 - Click to edit player 5 - Click to edit player 6 - Click to edit player 7 - Click to edit I would then select which I wanted to edit and would then be given that players record with all the fields available to update, it would update when the submit button was clicked eg something like Name R1 Score R2 Score R3 Score R4 Score R5 Score R6 Score R7 Score R8 Score John Doe 15 21 * I would then place the next score, in this case it would be round 3, and update. What I would like is to select all of the player records ....... eg Name R1 Score R2 Score R3 Score R4 Score R5 Score R6 Score R7 Score R8 Score John Doe0 15 21 * John Doe1 15 21 * John Doe2 15 21 * John Doe3 15 21 * John Doe4 15 21 * John Doe5 15 21 * John Doe6 15 21 * SUBMIT I would then input the score for each player, eg replace the asterisk with the score and then click the submit button and all the record would update with the relevant score. Obviously the asterisk wouldnt actually be there that is just to try show you what I mean. Hope this makes a little better sense. Thanks for trying and being patient with me, it is appreciated ps i should mention that there are probably 100 players in total
  7. HI again I am updating already existing records. Assume that it is week 3 and I need to insert/update week 3 scores into the week3 field in the database for each of the competitors. At the moment I have to call each competitor record update the field then get the next one and so on, which takes quite a long time as you have to load each competitor every time. What I want is to call all the competitors into a form and have them listed one under the other, update/insert the week 3 scores for each one right there on the page then click the submit button and each week3 field for each of the competitors is updated to reflect their score for that week. Hope that makes a bit more sense Thanks again
  8. Thanks for the quick reply, but I have already read that and it doesnt really answer my question. I am beginning to feel that what I want to do cant be done.
  9. HI all Title gives an idea of what I want to happen. I have a database which is basically a league table with the highest point scorer at the top and the lowest at the bottom. I have been receiving each rounds scores via a spreadsheet which I then had to mess about with so that I could eventually import it to the database. It takes about an hour and a half to do for each event There are several fields in the database table. e.g. id, first name, last name, event, round 1, round 2, round 3, up to round 8. I know how to call up and update one record at a time but was wondering if there was a way to call up all the records for a given event, input that weeks rounds scores for each and hit the update button so they are all updated in one go. If someone could tell me if it or isn't possible would be a great start and if they could point me in the direction of the right term to search on or show me a tutorial to achieve this I would be very grateful. Many thanks for reading
  10. Hey thanks for exactly what is required. I also read through the tutorial on your site and it makes the code easier to understand and to see what is happening. I am now going to create a login script for this to hide behind as you suggested. Once again I thank you.
  11. I dont suppose you could point me in the direction of a tutorial or thread which shws how to do this I am not sure where to start. Many thanks for the reply
  12. Hi all I got the following script off an old post I found. It works very well and creates the subfolder. Is it possible to make it so that I can type my required folder name into a form and have it create the folder with that name? For example I might want to create 2 folders, one called folder1 and the called folder2. Is this possible without having to change the code each time <?php /* wherever this particular script will be installed, I want to create a subfolder */ /* Step 1. I need to know the absolute path to where I am now, ie where this script is running from...*/ $thisdir = getcwd(); /* Step 2. From this folder, I want to create a subfolder called "myfiles". Also, I want to try and make this folder world-writable (CHMOD 0777). Tell me if success or failure... */ if(mkdir($thisdir ."/myfiles" , 0777)) { echo "Directory has been created successfully..."; } else { echo "Failed to create directory..."; } ?> Hope you follow me here Thanks in advance
  13. Hi all, I am having a exremely frustrating time. Usually I can ask a couple of questions of the expers in this forum and get the code sorted. I have been trying to do this one for myself and have come to the conclusion that I am thick. I just cannot get my head around this at all. I cannot fathom how it works. Basic background - I have a MySql database, in it I want to store id, title, bodytext, imagepath, imagename, uploaddate,image size, and image caption. I have a script already which is working without problems. Up until recently this was fine, however, I now need to resize the image to a size which is easily manageable on the web, whilst keeping the aspect ration. Image size of 800x600 would be fine. The images being uploaded are generally from a digital camera and the sizes are something like 3000x2000. Now I did manage to get a script to work and do all this, but with one problem. If the filename ends with uppercase .JPG then the scripts executes and does everything apart from upload the actual image. Dont know how to fix this and am now ready to throttle the kids, kill the budgie and kick the dog only joking but I think you get level of my frustration. The script for the upload and resize are 3rd party scripts, which I have tried to integrate with my upload script. I have attached the files if someone would like to see them. Many thanks for looking [attachment deleted by admin]
  14. I have looked through all of these but am not sure how to incorporate that script into my script
  15. Hi all, Looking for some help on a problem I have been working on for some time now Basically the form and process below work perfectly well. User uploads an image, the image is saved to a pictures folder and the path is saved in the database. No problems with that. The problem is the size of the images being uploaded. I want the image that is selected for upload to be resized by the script so that it is no larger than 800x600. I have tried to get to grips with the GD Library but alas I must be too thick to follow it and just cannot get it to work. Obviously if the image already 800x600 or smaller then it can be left as it is. Please could somebody put this thicko out of his mysery. <?php $uploadDir = 'pictures/'; $fileUploaded = 0; // set a flag for use later // connection parameters should be in a seperate file! //$dbhost = 'localhost'; //$dbuser = 'username'; //$dbpass = 'password'; //$dbname = 'dbname'; include('/home/sites/mysite.com/db_config/config.php'); $database = mysql_connect($hostname,$username,$password) or die("Could not connect to server"); mysql_select_db($table,$database) or die("Could not find table"); //$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); //mysql_select_db($dbname); //////////////////////////////////// if(isset($_POST['upload'])) { $id = $row['id']; $title = addslashes($_POST['title']); $detail = addslashes($_POST['detail']); $picinfo = addslashes($_POST['picinfo']); //$year = addslashes($_POST['year']); // check if a file has been uploaded if($_FILES['userfile']['error'] != 4) { // error code 4 meaning that no image is present $fileUploaded = 1; $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_name']; $fileSize = $_FILES['userfile']['size']; $fileType = $_FILES['userfile']['type']; // the files will be saved in filePath $filePath = $uploadDir . $fileName; // move the files to the specified directory // if the upload directory is not writable or // something else went wrong $result will be false $result = move_uploaded_file($tmpName, $filePath); if (!$result) { echo "Error uploading file"; exit; } } else { // if no file added, generate empty variables so as not to break the query $fileName = ''; $fileSize = ''; $fileType = ''; $filePath = ''; } if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); $filePath = addslashes($filePath); } $query = "INSERT INTO tablename(name, size, type, path, title, detail, picinfo) ". "VALUES ('$fileName', '$fileSize', '$fileType', '$filePath', '$title', '$detail', '$picinfo')"; mysql_query($query) or die('Error, query failed : ' . mysql_error()); mysql_close($database); // if a file was uploaded, the fileUploaded variable will be set to 1 if($fileUploaded == 1) { echo "<br>File uploaded<br>"; // show the image after upload - comment this out if not required - good for checking though echo '<img src="'. $uploadDir .'/'.$_FILES['userfile']['name'][$i] .'" >'; $movedtolocation="pictures/".$_FILES['upload']['name'];# basically, take the location of wher the image is stored.. } } ?> <link href="styleadmin.css" rel="stylesheet" type="text/css"> <form action="" method="post" enctype="multipart/form-data" name="uploadform"> <table width="609" align="center" cellpadding="1" cellspacing="1"> <tr> <td colspan="4" align="center"> </td> </tr> <tr> <td width="165"><p class="subtitle">Main Title :</p></td> <td width="437" colspan="3"><p> <input name="title" type="text" size="35"> </td> </tr> <tr> <td width="165" valign="top"> </td> <td colspan="3"> </td> </tr> <tr> <td width="165" valign="top"><p class="subtitle"> Blog :</p> <p align="center" class="small"> </p></td> <td colspan="3"><textarea name="detail" id="detail" cols="50" rows="20"></textarea></td> </tr> <tr> <td width="165"><p class="subtitle">Select Picture:</p></td> <td colspan="3"><p align="center"> <input type="hidden" name="MAX_FILE_SIZE" value="2000000"> <input name="userfile" type="file" class="box" id="userfile" size="35"> <span class="small"> <br> Leave blank if no picture to upload</span><br> <br> </p></td> <tr> <td width="165">Picture Info</td> <td colspan="3"><p align="left"><input name="picinfo" type="text" size="35"></p></td> </tr> <tr><td colspan="4" align="center"><input name="upload" type="submit" class="box" id="upload" value=" Upload "></td> </tr> </table> </form>
  16. Thanks for the replies, I will be off to give them a try and see if I cant get it to work. Thanks again
  17. Hi all, Is it possible to check an entry against a database before deciding how to process. EG I have a basic contact form, Name, email, message. What I would like to happen is when the user hits the submit button I want to check if the email address already exists in the database. If it doesnt I want to post the info to a new record, if it does i dont want to post anything to the database, in both instances I want to send the form to an email recipient. If it is possible to do this please can someone either tell me where I will find a good tutorial which covers it or what search terms should I be searching for. I have tried for ages and just dont get the right results when I try to google. Thanks in advance
  18. I tried that and it doesnt work, it comes up with a move error. I am guessing its something to do with the path it tries to insert into the database not matching the actual location, but I cant work it out.
  19. Hi All I want to upload some information and an image to a database, and then retrieve the information into a web page. Simple enough to do I know but I am struggling with some specifics. I am using the following to upload the information <?php $uploadDir = 'pictures/'; $fileUploaded = 0; // set a flag for use later // connection parameters should be in a seperate file! include('/path/to/site/folder/config.php'); $database = mysql_connect($hostname,$username,$password) or die("Could not connect to server"); mysql_select_db($table,$database) or die("Could not find table"); //$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); //mysql_select_db($dbname); //////////////////////////////////// if(isset($_POST['upload'])) { $id = $row['id']; $title = addslashes($_POST['title']); $detail = addslashes($_POST['detail']); // check if a file has been uploaded if($_FILES['userfile']['error'] != 4) { // error code 4 meaning that no image is present $fileUploaded = 1; $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_name']; $fileSize = $_FILES['userfile']['size']; $fileType = $_FILES['userfile']['type']; // the files will be saved in filePath $filePath = $uploadDir . $fileName; // move the files to the specified directory // if the upload directory is not writable or // something else went wrong $result will be false $result = move_uploaded_file($tmpName, $filePath); if (!$result) { echo "Error uploading file"; exit; } } else { // if no file added, generate empty variables so as not to break the query $fileName = ''; $fileSize = ''; $fileType = ''; $filePath = ''; } if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); $filePath = addslashes($filePath); } $query = "INSERT INTO lindablog (name, size, type, path, title, detail) ". "VALUES ('$fileName', '$fileSize', '$fileType', '$filePath', '$title', '$detail')"; mysql_query($query) or die('Error, query failed : ' . mysql_error()); mysql_close($database); // if a file was uploaded, the fileUploaded variable will be set to 1 if($fileUploaded == 1) { echo "<br>File uploaded<br>"; // show the image after upload - comment this out if not required - good for checking though echo '<img src="'. $uploadDir .'/'.$_FILES['userfile']['name'][$i] .'" >'; $movedtolocation="pictures/".$_FILES['upload']['name'];# basically, take the location of wher the image is stored.. } } ?> <link href="styleadmin.css" rel="stylesheet" type="text/css"> <form action="" method="post" enctype="multipart/form-data" name="uploadform"> <table width="609" align="center" cellpadding="1" cellspacing="1"> <tr> <td colspan="4" align="center"> </td> </tr> <tr> <td width="165"><p class="subtitle">Main Title :</p></td> <td width="437" colspan="3"><p> <input name="title" type="text" size="35"> </td> </tr> <tr> <td width="165" valign="top"> </td> <td colspan="3"> </td> </tr> <tr> <td width="165" valign="top"><p class="subtitle"> Blog :</p> <p align="center" class="small"> </p></td> <td colspan="3"><textarea name="detail" id="detail" cols="50" rows="20"></textarea></td> </tr> <tr> <td width="165"><p class="subtitle">Select Picture:</p></td> <td colspan="3"><p align="center"> <input type="hidden" name="MAX_FILE_SIZE" value="2000000"> <input name="userfile" type="file" class="box" id="userfile" size="35"> <span class="small"> <br> Leave blank if no picture to upload</span><br> <br> </p></td> <tr> <td width="165"> </td> <td colspan="3"> </td> </tr> <tr><td colspan="4" align="center"><input name="upload" type="submit" class="box" id="upload" value=" Upload "></td> </tr> </table> </form> All of this works fine. Now the admin file which does all this is in a directory i want to password protect, when I do this it also protects the dirtectory to which the image was uploaded. How do I either upload the image toa directory outside the admin directory, or how can i call the picture without having to input the password, as when the webpage loads and it tries to display the image it asks for a password. If we can upload the image outside of the protected directory how do I reference it in the webpage. Hope you understand all this Thanks in advance
  20. Thanks for youor reply that would be all well and good if i knew what you were talking about.  I need a tutorial which explains how to get the photos onto the page first. see not very good at this yet but am willing to learn, just cant find the tutorial.  Found one for uploading the stuff and it works but cant find one to display the photos on the page.
  21. What I am trying to create is a method for my family to upload pictures to the internet so that we can all see them. I have created the upload part (except I missed a field for comments for each picture), after much looking reading copying, typing etc and a lot of swearing but it eventually works.  Suffice to say I now know the theory involved with php if not the actual coding. What I want to do now is have a page that when it is viewed will have all the photographs displayed on the page with their comments (when I add the comments field). Later on I will need to have abit of code that splits the pages up so there is not too much on one page. My parents live abroad and we want to share photographs. Hope someone can help by pointing me in the direction of a tutorial which covers this. Oh,  the upload script doesnt store the photos in the mysql database, the database holds the url link to the picture, the picture is held in a directory on the server. Thanks for reading
×
×
  • 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.