Jump to content

fastsol

Moderators
  • Posts

    827
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by fastsol

  1. Here is some info on how to force a file download properly. http://amecms.com/article/PHP-Force-File-Download-With-File-Whitelist
  2. Ok, you need to move the $brand var higher in the script so that it's defined before the move_uploaded_file, good place would likely be where you define $title. $brand = $_POST['brand']; // Put this up by where you define $title $up_file = $brand.'.'.$file_ext; if (move_uploaded_file($file_tmp, 'images/'.$up_file)) { echo 'File uploaded'; $image = 'www.mysite.com/images/'.$up_file; }
  3. This is what I do also and seems to work rather well.
  4. Can u translate the error to English please since most of us can't read it
  5. Well first, how are you wanting to distinguish one sale from another in the db? Usually you would have a transaction id that is unique to the sale, but you aren't actually making a sale? So how do you want to generate that id?
  6. Can we have a link to the page in question? Otherwise you'll need to provide the code so we can take a look. First guess is that you need to apply the background color to the <li> and not the <a>.
  7. I think it looks great, good job. Usually people post some horrible looking site that they think is great, not in your case. The colors are used perfectly together along with the subtle textures. Seeing that it's a wordpress site is fine cause most syntax and correct building practices are generally used, although usually overly bloated for my taste. Only syntax error I found was you have an extra </p> on this section <div class="mainLeft"> <h3 style="margin-bottom:0 !important;"><span class="red">FinTec:</span> A metal finishing partner to help you grow</h3> <p>We partner with companies who expect the highest quality equipment, spare parts and consumables from worldwide market leading manufacturers in the surface finishing industry today. FinTec offers training, machine rebuilds and consultation services for all projects relating to surface finishing. Our staff is experienced in implantation of Lean Manufacturing, giving us a unique background to help you solve the most complex of problems. Our aim is to help you reduce operating costs and increase efficiency and productivity.</p> </p></div>
  8. I am familiar with that shopping cart. What are you using to actually process the payment? PayPal? You wouldn't want to perform the actions you are asking about until the payment has been taken. If you are using the paypal IPN service then you would use a foreach loop to go through the posted vars and insert them into the db then. If you are using a different service then can you post the code that is returned from the service to determine the payment has been processed and any additional info the service provides like an array of the items bought. If you simply want to insert them into the db without taking into account these things then that is easy but not advised.
  9. if (move_uploaded_file($file_tmp, 'images/'.$file_name)) { echo 'File uploaded'; $image = 'www.mysite.com/images/'.$file_name; } See how easy that is when you actually describe the issue properly.
  10. Ok here is a basic setup based on the info you have provided in your posts. This assumes that the user_type in the db is a string value of admin, student, etc. You'll need to put the 2 functions in your functions file and include it before you use the function to validate the user_type on the specific admin, student page. Also include the functions file before your login processing script to use the checkUserType() for the redirection after login. Here are the 2 functions function checkUserType($type) { switch($type) { case 'admin': $page = 'admin.php'; break; case 'student': $page = 'student.php'; break; case 'lecturer': $page = 'lecturer.php'; break; case 'parents': $page = 'parents.php'; break; } header('Location: '.$page); //You may need to edit the path to suit your folder structure. } function checkUserStatus($actual_page) { //First check to make sure the $_SESSION['user_type'] is set, if it's not then they haven't logged in so redirect back to login screen if(!isset($_SESSION['user_type'])) { header('Location: login.php'); } else { if($actual_page == $_SESSION['user_type']){} else{ checkUserType($_SESSION['user_type']); } } } Here is a example of how to protect a page and only allow the correct user type to view the page. On each admin, student, etc page you would change the 'admin' string value in the function call to whatever user type is allowed to view that specific page. <?php session_start(); require_once('your_functions_page.php'); //Set this to what ever page you include that holds all your functions so that we can use the checkUserStatus() checkUserStatus('admin'); ?> <!DOCTYPE html> <html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <title>Untitled</title> </head> <body> </body> </html> In your login php processing, after you validate everything and need to redirect to the proper page, put this function in that place and it will handle the redirection. checkUserType();
  11. Get rid if the select box in the login form, it's not needed and confusing at best. At the top of your admin, student, etc pages you put a if() to check if the user_type is correct for that page and redirect if not. But upon login you do a check of the user type and redirect there accordingly based on that info in the db. The concept of this is very simple and straight forward, just slow down and think about how the logic should work for this.
  12. What does it echo when you submit to the page? Nothing or something, what?
  13. Not sure what you're trying to do on this line $_POST['contact']; $from = $_POST['email']; And you forgot to send the $headers in the mail()
  14. The mysql_error() will display the reason the query failed. To place the select box you need to add an empty td in the table <tr> <td></td> // This is the empty cell <td align='center'> <select name="type" id="type"> <option value="0 selected="selected">Select user type</option> <option value="admin">Admin</option> <option value="student">Student</option> </select></td> </tr>
  15. The comma in this snippet from the query needs to be replaced with AND username='$username', pass='$password' Add this line after the query run during production but remove it once the site is working echo mysql_error();
  16. Looks like most of the issue is with this block <tr> <td align='center'> <select name="type" id="type"> <option value="0 selected="selected">Select user type</option> <option value="admin">Admin</option> <option value="student">Student</option> </select> </tr> You're missing a clising </td> after the </select> and a closing " for the 1st option value.
  17. No, the auto-increment is part of the db, mysqli_insert_id() is a php function that provides the last id generated right after a query is run. Read up on it http://us3.php.net/manual/en/mysqli.insert-id.php
  18. if (move_uploaded_file($file_tmp, 'images/'.$file_name)) { echo 'File uploaded'; $image = $file_name; }
  19. To verify that the script is actually sending the email you can do this if(mail($to, $subject, $message, $headers) === TRUE) { echo "Your email was sent!"; } else { echo 'Email NOT Sent'; } That way you'll know if it was sent and then you can focus your energy on the headers and stuff it you don't receive the email. CHECK YOUR SPAM BOX
  20. Is the ID the unique ID for the row in the database for a auto-incremented field? If so you can use something like mysql_insert_id() or the equivalent of that if you are using PDO or mysqli. Beyond that you will need to provide more info as to how you are getting that ID or how it's being built.
  21. You have some syntax errors in the $message. You start by using . to concatenate then you change to , which is wrong. Here is a snippet of that code, notice the, after the last var $message = 'FROM: '.$name.' Email: '.$email.' Respuestas: '.$pregunta1,'<br />' Change all those , in that line to start with. Have you checked your spam folder to make sure it's not in there, that is very common when making very simple email scripts like this cause they don't have all the headers that most email clients require to validate an email against spam.
  22. You're not defining or reassigning the $image for a uploaded file.
  23. Not without your code and css
  24. CRON is for sure the way to go on this.
  25. You would need to use the while loop to gather all the results from the query, the way you have it it only gets the first row. $company_array = array(); while($row = mysql_fetch_assoc( $result )) { $company_array[] = $row; } I also prefer using mysql_fetch_assoc instead of mysql_fetch_array cause you don't get twice the array size and the array provided is keyed by the row name.
×
×
  • 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.