Jump to content

angelali

Members
  • Posts

    128
  • Joined

  • Last visited

    Never

Everything posted by angelali

  1. I made an upload image system, the images are stored in a folder, while the image name is stored in database. When I try to execute the image name, it works successfully, but when I try to disply the image from the folder by using the image name in the database, I fail each time. The folder where the images are being stored is named: saveimage Here is the query: <?php mysql_connect('localhost', 'root', '') or die ('Connection Failed'); mysql_select_db('imagedatabase'); $images = mysql_query("SELECT * FROM img WHERE email='$lemail'"); while($row = mysql_fetch_array($images)) { echo "<img src='saveimage/'".$row['img_description']; } ?>
  2. Oh no, now you are making me afraid when you mentioned Megaupload's owner.. :'( Well, if like this, we will decide if we are going to cancel the project of image hosting and gallery...or simply, we can make a simple website where user will just upload an image, store it in the folder like a boss and give the user his links, embed codes etc... But wait, what to create in the place of the image website if it is going to cancel? Ok, we will think of a website directory...
  3. In fact myself I would not be able to determine if an image is copyrighted or not, so my conditions will be clear on the site, I am not responsible if the person has uploaded a copyrighted image...but for adult content, I should moderate...
  4. Well, well, well, I have to choose a real solution, me too I didnt want to store database in DB....but I think I have to, as people can search these images, there will be also categories of images like Technology, Abstract etc...
  5. Move the images to a folder, but, if an image has the same name, how will I know? as if i store the images in folder, only the image will be stored... And secondly, how to add images manually in database if you know please...on PHPMyAdmin.. thank
  6. Hello, my friends and I are planning to make a photo gallery, where people can upload their images and everyone can view them. These images will be saved in database. The problem is, we have to moderate these images when uploaded, to prevent adult content or copyrighted images from being displayed. We were thinking to make people send us these images by email, I mean through an email attachment, then we will review them, and if these images are OK, we will insert them manually into the database. We want as far as possible to not consume unnecessary spaces in the database, else the hosting will cancel our account even it offers unlimited space and bandwidth. We could make these images store in a folder, but the persons will have to give their names, that's why we think it would be better to make them fill some fields, attach the image and send us by email. 1/ Do you think this method is good? If you have another method, please give me... 2/ And also how do you insert images manually to database? I'm using PHPMyAdmin. I mean, to upload an image which is on my computer itself. I know there are some MySQL IDEs which do this, but do not know on PHPMyAdmin Thank you
  7. I am having a big problem creating foreign key on PHPMyAdmin. I saw many people having this problem... Never I did this before, so I tried but could not figure out... In Microsoft Access, you do it directly, but on PHPMyAdmin, its a bit complicated.. I have two tables, as follows: User -user_id (Primary key) -name -age -country Job -job_id (Primary key) -job_name -job_place What I want is to make user_id as foreign key in Job table. Can you explain me how to do it with the GUI PHPMyAdmin instead of query?
  8. Oh now i understand, yes, you are right.... thank you...
  9. My head is heavy right now, to close this problem here...just tell me what to change thats all... If I have understand well, we dont use 'isset' for fields which are not required to fill?
  10. I removed all the 'isset', and the form is being validated.. but tell me one thing, in all tutorials, and myself I have used isset($_post['xxx']) in forms to check, and they worked perfectly... Now Im getting Undefined Index in 'ragree' when I did declare the variables and also did write it ell...
  11. Wait, now I'm not understand you... You told me to remove isset post right? I did make a form like this before, same procedure, and never I met a problem...
  12. I did remove it as I told you, and did not work... here is the print result: Array ( [remail] => [rpass] => [rsecurity] => [rsanswer] => [rfirst] => [rlast] => [rcountry] => [rwebsite] => [rabout] => [rsector] => [rsub] => [rexperience] => [rwork] => [rcapt] => )
  13. I removed the image code itself to test, still not work...very weird problem for me seriously..never i encountered this...
  14. Can you explain me what you mean? Yes, its not a required field, I mean can choose to not upload his pic, but I put isset as I dont uset isset($_post['submit']);
  15. *I mean I remove the $_POST(['rimage']) and put isset($_files(['rimage'])?
  16. 'rimage' is for a input type file to upload image... So, I removed it?
  17. I have created many forms and validated in my life in PHP, but today, I just made a form, and the validations are not working at all... In other words, the error messages are not being displayed either... The form is very long, here both the PHP and HTML codes below: The PHP: <?php //Form validations and data save to database if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (isset($_POST['remail']) && isset($_POST['rpass']) && isset($_POST['rsecurity']) && isset($_POST['rsanswer']) && isset($_POST['rfirst']) && isset($_POST['rlast']) && isset($_POST['rimage']) && isset($_POST['rcountry']) && isset($_POST['rwebsite']) && isset($_POST['rabout']) && isset($_POST['rsector']) && isset($_POST['rsub']) && isset($_POST['rexperience'])&& isset($_POST['rwork']) && isset($_POST['ragree']) && isset($_POST['rcapt'])) { //Assigning variables, inserting security against SQL injection and XSS attacks and trim certain text fields $remail = mysql_real_escape_string(strip_tags(trim($_POST['remail']))); $rpass = mysql_real_escape_string(strip_tags(trim($_POST['rpass']))); $rsecurity = mysql_real_escape_string(strip_tags($_POST['rsecurity'])); $rsanswer = mysql_real_escape_string(strip_tags($_POST['rsanswer'])); $rfirst = mysql_real_escape_string(strip_tags($_POST['rfirst'])); $rlast = mysql_real_escape_string(strip_tags($_POST['rlast'])); $rcountry = mysql_real_escape_string(strip_tags($_POST['rcountry'])); $rwebsite = mysql_real_escape_string(strip_tags($_POST['rwebsite'])); $rabout = mysql_real_escape_string(strip_tags($_POST['rabout'])); $rsector = mysql_real_escape_string(strip_tags($_POST['rsector'])); $rsub = mysql_real_escape_string(strip_tags($_POST['rsub'])); $rexperience = mysql_real_escape_string(strip_tags($_POST['rexperience'])); $rwork = mysql_real_escape_string(strip_tags($_POST['rwork'])); $ragree = strip_tags($_POST['ragree']); $rcapt = strip_tags($_POST['rcapt']); //Profile image $rimage = mysql_real_escape_string(strip_tags($_FILES['rimage']['name'])); $size = $_FILES['rimage']['size']; $max = 1048576; $extension = strtolower(substr($rimage, strpos ($rimage, '.') +1)); //Validation if (empty($remail) || empty($rpass) || empty($rsecurity) || empty($rsanswer) || empty($rfirst) || empty($rlast) || empty($rcountry) || empty($rabout) || empty($rsector) || empty($rsub) || empty($rexperience) || empty($rwork) || empty($ragree) || empty($rcapt)) { echo '<p class="error">Fields marked with an asterisk are required!</p>'; } else if (!filter_var($remail, FILTER_VALIDATE_EMAIL)) { echo '<p class="error">Email address seems not valid!</p>'; } elseif ($size > $max) { echo '<p class="error">Your image must not exceed 1MB</p>'; } else if ($extension !== 'jpg' && $extension !== 'jpeg' && $extension !=='gif' && $extension !=='png') { echo '<p class="error">Only images in JPG, JPEG, GIF and PNG are acceptable!</p>'; } else if (!filter_var($rwebsite, FILTER_VALIDATE_URL)) { echo '<p class="error">Website URL seems not valid, do include HTTP or HTTPS in your link!</p>'; } else if (str_word_count($rabout) > 250) { echo '<p class="error">The number of words in all textareas is 250!</p>'; } else if (str_word_count($rwork) > 250) { echo '<p class="error">The number of words in all textareas is 250!</p>'; } else if (!($rcapt === '30')) { echo "<p class='error'>Wrong captcha answer! Try again!</p>"; } } } ?> The HTML: <form action="register.php" method="post" enctype="multipart/form-data" novalidate> <table width="1100"> <tr> <td><label>Your email address: <span class="ads">(Will also be displayed on profile page)</span> <span class="required">*</span></label></td> <td><input type="email" name="remail" required size="39"/></td> </tr> <tr> <td><label>Your password: <span class="required">*</span></label></td> <td><input type="password" name="rpass" required size="39"/></td> </tr> <tr> <td><label>Security question: <span class="ads">(In case you forget your password)</span> <span class="required">*</span></label></td> <td> <select required name="rsecurity"> <option value="">Please select a question</option> <option value="Mobile number">What is your first mobile humber?</option> <option value="School name">What is your school name?</option> <option value="School year">Which year you completed college?</option> <option value="Hobby">What is your best hobby?</option> <option value="Computer">What is your best quote?</option> </select> </td> </tr> <tr> <td><label>Answer: <span class="required">*</span></label></td> <td><input type="text" name="rsanswer" required size="39"/></td> </tr> <tr> <td><label>Your first name: <span class="required">*</span></label></td> <td><input type="text" name="rfirst" required size="39"/></td> </tr> <tr> <td><label>Your last name: <span class="required">*</span></label></td> <td><input type="text" name="rlast" required size="39"/></td> </tr> <tr> <td><label>Your profile picture: <span class="ads">(An avatar will appear in case you do not upload any profile pic)</span></label></td> <td><input type="file" name="rimage" size="38"/><br/> <span class="adss">Only .jpg, .jpeg, .gif, .png formats and not more than 1MB in size!</span> </td> </tr> <tr> <td><label>Your country: <span class="required">*</span></label></td> <td> <select required name="rcountry"> <option value="">Please select a country</option> <option value="Afghanistan">Afghanistan</option> <option value="Åland Islands">Åland Islands</option> <option value="Albania">Albania</option> <option value="Algeria">Algeria</option> <option value="American Samoa">American Samoa</option> <option value="Andorra">Andorra</option> <option value="Angola">Angola</option> <option value="Zimbabwe">Zimbabwe</option> </select> </td> </tr> <tr> <td><label>Your website: <span class="ads">(Include HTTP or HTTPS)</span></label></td> <td><input type="url" name="rwebsite" size="39"/></td> </tr> <tr> <td><label>Tell us about you: <span class="ads">(In 250 words, you can describe what kind of person you are)</span> <span class="required">*</span></label></td> <td><textarea required cols="50" rows="8" name="rabout" id="worda"></textarea></td> </tr> <tr> <td><label>Select category of sector: <span class="required">*</span></label></td> <td> <select required name="rsector"> <option value="">Please select a computer sector</option> <option value="Technical">Technical</option> <option value="Systems Administration">Systems Administration</option> <option value="Network Administration">Network Administration</option> <option value="Database Development">Database Development</option> <option value="Web Development">Web Development</option> <option value="Multimedia">Multimedia</option> <option value="Security">Security</option> <option value="Software Engineering">Software Engineering</option> <option value="Mobile Devices">Mobile Devices</option> <option value="Robotics">Robotics</option> <option value="Telecommunication">Telecommunication</option> <option value="Information Systems">Information Systems</option> <option value="Marketing">Marketing</option> <option value="Office">Office</option> <option value="Others">Others</option> </select> </td> </tr> <tr> <td><label>Specify a sub-category: <span class="ads">(Example: System administrator...)</span> <span class="required">*</span></label></td> <td><input type="text" name="rsub" required size="39"/></td> </tr> <tr> <td><label>Years of experiences in this sector: <span class="ads">(Also for personal experiences if you do not have working experiences)</span> <span class="required">*</span></label></td> <td> <select required name="rexperience"> <option value="">Please select years of experiences</option> <option value="0 to 1 year">0 to 1 year</option> <option value="1 to 2 years">1 to 2 years</option> <option value="2 to 3 years">2 to 3 years</option> <option value="3 to 4 years">3 to 4 years</option> <option value="4 to 5 years">4 to 5 years</option> <option value="5 years and above">5 years and above</option> </select> </td> </tr> <tr> <td><label>Working/Personal experiences details: <span class="ads">(In 250 words, write about your experiences)</span> <span class="required">*</span></label></td> <td><textarea required cols="50" rows="8" name="rwork" id="worde"></textarea></td> </tr> <tr> <td><label>Accept the terms and agreements: <span class="required">*</span></label></td> <td><input type="checkbox" value="Accept" name="ragree" required/> <span class="terms">Read the terms and agreements</span></td> </tr> <tr> <td><label>Are you human? Solve this: 25 - 10 * 2: <span class="required">*</span></label></td> <td><input type="text" required size="5" name="rcapt"/></td> </tr> <tr> <td></td> <td><input type="submit" value="Create profile account"/></td> </tr> </table> </form> NOTE: I used HTML5 and I set it to 'novalidate' in the form so that I can test the PHP. Only the PHP is not working... As you see in the codes, I performed validations only to test if everything is ok but it seems it is not working as I am not receiving any error message. For example, some fields are required and if a user does not fill them, a message will be displayed, but when I test them by not filling anything, no error message is shown. So, its not working it seems. I tested the codes, and Im not finding any mistake...
  18. Hello, I want to know, how can I integrate DISQUS based on user account? I am doing a website where users will have to register and they will have their own profile account. They will get the opportunity to integrate DISQUS in their profile account, for this, they will have to register on DISQUS and simple copy their Shortname of DISQUS in a text box, to get the comment system. I want to know that how I must get a DISQUS codes to ingrate in the page of the user account? Of course, I will get it on DISQUS, but I get it with my DISQUS shortname, what I want is a DISQUS code without shortname, to be present on the page, then the user will just have to insert their DISQUS shortname in a text box in their account, the value of the shortname will be stored in a a variable, which will be placed in the DISQUS codes where the shortname is. As a result, for each account, it will automatically populate the comment system based on the user shortname. Ok, if you have not understood what I mean, simply take the example of Tumblr, if you are on it, there are some themes where a text box is placed to insert your DISQUS shortname for a comment system... I want my system to be like this, thats why for that, I must get a DISQUS codes without shortname first, then when the user will place their shortname in the text box, it will appear... Thank
  19. Huh...is there a method to do it in procedural instead of object oriented?
  20. I am coding a login form. If the user forgets his password, he will click on a link where he will have to insert his email address, then, he will get a confirmation link in his inbox. After that, he willl click on the link, to redirect him to a page to create a new password. The page link to create a new password (the confirmation link) is actually like this: http://xxxxx.forgetpassword.php I want that when it will appear in the user's inbox, it should be like this: http://xxxxx.f135kkgg3f6f2f2.php Well, you know what I mean, perhaps most of us have got this kind of URL when we forget a password. It is like encrypted or hashed something like that. So, how can I do it like this?
  21. Hello, I have some questions here on PHP Object-Oriented. I started learning PHP Procedural since some months, and I am doing quite well. I want to start with PHP Object-Oriented now, but the problems, I have not found a good easy readable tutorial on it. I have watched some videos on YouTube, but the way they explained it made me confused. I want to know something from you, if you are an experienced PHP programmer. I want to work on CMS like Drupal, WordPress, Magento and Prestashop because I have noticed a rise in job availability in these fields in my country. 1/ Is it necessary to know PHP Object-Oriented to work as Drupal, Magento or Prestashop developers? (Note: I have a blog on WordPress, and I have huge experienced on the Dashboard, configurations and so on...) 2/ Can I start learning frameworks like CodeIgniter without learning PHP Object-Oriented? Thank you.. Perhaps the questions may have not sense for you, but I just want to know your opinions. Please, if you are an experienced programmer, you reply me.
  22. Hello, I made a site where to upload images. The images are saved to a directory (folder). After someoe uploads an image, he gets the link. For example, if someone has an image called "xxx.jpg", he gets the url like this: www.example.com/upload/xxx.jpg. What I want is, when someone uploads an images, the name of the image change to random numbers. I know the PHP function rand() and rename () function, but the only problem is, it is renaming the file without considering the file extension. Here is a sample of my codes: $image = htmlentities($_FILES['file']['name']); $number = rand(1,1000); $newname = rename ($image, $number); echo $newname So, can someone tell me, how to rename images but taking into consideration of the file extension? If the image is xxx.jpg, I want it like 123.jpg not 123.
  23. I have already solved the Magic_quotes one, I make an IF statement, so if it is on, then the striplashes take place. The validation also has been adjusted.
  24. The portfolio is online on a free hosting and sub domain name: mini-image-hosting.99k.org
  25. So, what you suggest me to correct? Its good you are telling me my mistakes...as I want to correct myself... The FILTER_VALIDATE_INT is doing its job well, I tested it... Huhh, for the striplashes, I have heard that turning Magic_gp ON is not recommended. For the '@', I see that doing that would not display the line if an error occurs. Well, I have learnt all of these in PHPAcademy, you know that guy who always do tutorials on YouTube... Please, suggest me one by one about which to correct... and what I should do.... Thank you for telling my erros..its important to me to learn
×
×
  • 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.