
richo89
Members-
Posts
59 -
Joined
-
Last visited
Never
Contact Methods
-
Website URL
http://dawsonz.co.uk
Profile Information
-
Gender
Not Telling
richo89's Achievements

Member (2/5)
0
Reputation
-
No I dont have imagemagick unfortunately I can certainly look into it however. I was hoping with my image upload above I could simply use a PHP function to just resize the image but it's obviously not as simple as that.
-
Ok such as the imagecopyresized ? I'll give that a look, I just want a simple resize of the image the user has selected and then upload it. Thanks
-
Hey, I've got a script that uploads an image to a particular destination that the user has selected however I wondered if its simple enough to resize that image and upload it to a seperate destination? My code: //define a maxim size for the uploaded images in Kb define ("MAX_SIZE","500"); //This function reads the extension of the file. It is used to determine if the file is an image by checking the extension. function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } //This variable is used as a flag. The value is initialized with 0 (meaning no error found) //and it will be changed to 1 if an errro occures. //If the error occures the file will not be uploaded. $errors=0; //reads the name of the file the user submitted for uploading $image=$_FILES['image']['name']; //if it is not empty if ($image) { //get the original name of the file from the clients machine $filename = stripslashes($_FILES['image']['name']); //get the extension of the file in a lower case format $extension = getExtension($filename); $extension = strtolower($extension); //if it is not a known extension, we will suppose it is an error and will not upload the file, //otherwise we will do more tests if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif")) { //print error message echo '<h1>Unknown extension!</h1>'; $errors=1; } else { //get the size of the image in bytes //$_FILES['image']['tmp_name'] is the temporary filename of the file //in which the uploaded file was stored on the server $size=filesize($_FILES['image']['tmp_name']); //compare the size with the maxim size we defined and print error if bigger if ($size > MAX_SIZE*1024) { echo '<h1>You have exceeded the size limit!</h1>'; $errors=1; } //we will give an unique name, for example the time in unix time format $image_name=time().'.'.$extension; //the new name will be containing the full path where will be stored (images folder) $newname="images/".$image_name; //IMAGE RESIZER ********************* //we verify if the image has been uploaded, and print error instead $copied = copy($_FILES['image']['tmp_name'], $newname); if (!$copied) { echo '<h1>Copy unsuccessfull!</h1>'; $errors=1; }}} Now I was wondering if its possible to take the file its uploaded or even resize the image before its uploaded and place it in imagesResized folder? Thank you.
-
Thank you kindly it works perfectly, i'll try figure it out now and further it. Thanks again, PFMaBiSmAd.
-
Can anyone try and help me further i'd be very grateful..
-
Ok so when I click submit the IF needs to process the form which is checking if the answer equals user input. the ELSE produces the form, so by this do you mean the form name, method etc.
-
Thanks for the help just tried the above code but it still seems to refresh the variables each time so I keep getting incorrect answer.
-
Hi, I'm trying to use PHP math to create maths questions and test the user. I'm currently generating random numbers and asking the user to add the two numbers, I then want to check if the answer is correct. However, when I click submit the random numbers change as page refreshes and therefore my variable changes so it keeps saying incorrect answer. Code is below: <?php // Question 1. $number1 = rand(1,10); $number2 = rand(5,15); $answer1 = $number1 + $number2; echo "<p>"; echo "<b>Q1.</b> $number1 + $number2 = <form name='answer1form' method='post' action='index.php'> <input type='text' size='1' name='answer1'/>"; echo "</p>"; echo "<input type='submit' name='Submit' value='Submit'>"; if($_POST['Submit']){ echo "<p>"; echo $_POST['answer1']; echo "</p>"; echo "<p>"; echo $answer1; echo "</p>"; if ($_POST['answer1'] == $answer1) { echo "<p>Correct answer</p>"; } else { echo "<p>Incorrect answer</p>"; } } echo "</form>"; ?>
-
I did initially, but i'm currently using this setup and would be great if I could get it working.
-
Hi, The process I have at the moment is that a user makes a payment with paypal through my website, so there logged in via a session and I have the if (!isset($_SESSION['email'])) to check there logged in. They then click pay by paypal and it takes them to paypal website where they pay, once paid it redirects to a page www.test.com/success.php which requires the user to be logged in. Now, when I do this process with firefox it works perfectly, they come back to the success page correctly as their sesssion is still there. However, with internet explorer when there redirected there logged out and therefore it cant take them to the success page. Any ideas on how to workaround this? Thanks
-
Hi could I just get some further clarification on exactly whats required here. I have a page whereby the users select the service that they want ie. Sell a prefix number plate Sell a current number plate Now once the user has clicked the relevant hyperlink they have a form where they fill in a few select details. Looks like this: I then want the inforamtion that has been entered into the form to be posted to paypal - so that I can then take them to a confirmation page which says thank you for payment and at the same time enters the relevant information into my database? Do I need to setup a paypal button to take payment and then go to an external link? How does the process work posting data through the paypal payment?
-
I have the following: <form action="listPlate.php" method="POST"> <input type='hidden' name='customerid' value='".$_GET['Customer_ID']."'> However, when I echo whats been submitted I get the following: Z2 ZZZ submitted succesfully, \".$_GET[ is customer id
-
Hi, I have a page which sends the variable via the URL to the nextpage which in this case is listPlate.php The code to pass the variable is echo "<p><a href='listPlate.php?Customer_ID=$customerid'>Click here to start selling! </a></p>"; On listPlate.php I have the following code: <? //initilize PHP if($_POST['submit']) //If submit is hit { $plate = $_POST[plate]; $keywords = $_POST[keywords]; $category = $_POST[category]; $notes = $_POST[notes]; $cost = $_POST[cost]; $id = $_GET['Customer_ID']; $plate1st = $plate{0}; $plate2nd = $plate{1}; $plate3rd = $plate{3}; $plate4th = $plate{4}; $plate5th = $plate{5}; //Insert the values into the correct database with the right fields //mysql table = purchases $sql=("INSERT INTO prefix (Customer_ID, plate, keywords, category, notes, cost, plate1st, plate2nd, plate3rd, plate4th, plate5th)". "VALUES ('$id','$plate','$keywords','$category','$notes','$cost','$plate1st', '$plate2nd', '$plate3rd', '$plate4th', '$plate5th')"); $result = mysql_query($sql) or die (mysql_error()); echo "<font color='black'>$plate submitted succesfully, $id is customer id</font>"; } ?> However, once I click submit it enters the Customer_ID as blank into my database and for some reason is forgetting what the variable is. When i'm on listPlate.php the URL clearly shows the Customer_ID.. Example.. listPlate.php?Customer_ID=5 Any ideas?
-
Brilliant so this will mean the user enters the inforamtion, hits submit/paypal pay now, then the information will be recorded and sent back to my website - can I get this to automatically update mySQl database?
-
Hi just looking for some help here. I currently have a website whereby the user sells a number plate and they need to enter their information to sell the plate. However, I currently have paypal payments setup and need to know the best way of accepting payment. I currently have a button where they pay with paypal and then it takes them to a link where they can enter the information for their number plate and click submit. However, how do I make this page secure so that a user cant just type it into their URL and enter plates into the database. Or is their an alternative way to do it?