Jump to content

JonnoTheDev

Staff Alumni
  • Posts

    3,584
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by JonnoTheDev

  1. Select the existing number of records from the user. If this number is equal to the limit then dont allow any more entries.
  2. When using FPDF and inserting an image of png format into the document, the image looks pixelated. By not setting the height and width the image size should automatically be calculated. I get the same results if I set the image size. $pdf->Image('logo.png',0,0,0,0); Has anyone had this issue?
  3. You maybe right. Unsure about at what point the data gets encrypted as POST & GET requests are sent in clear text packets.
  4. All pages must use https:// protocol
  5. Lookup exec() or system()
  6. Agreed, active directory is a thing of beauty. Active Directory was ripped off from Novell's NDS at the time. Think it was Netware 5 when MS released 2000 server. I preferred the Novell system!
  7. Seems like a strange design this. Wouldnt you be better splitting the staff and students into polymorphic classes defined by abstraction or an interface?
  8. Your case switch($intDiff) must be using the default condition: default: echo $time; The variable $time isn't defined anywhere in your function
  9. Have you successfully connected to the socket prior with socket_connect() Do you have an error routine if the connection fails i.e. if(!socket_connect(connection params)) { print "could not connect to socket"; exit(); } // continue processing - write to socket
  10. This sounds simple enough. Where are you getting stuck?
  11. You need to flag which members are customers and which are not in your mailing list table. Use the flag to determine what link you place in the newsletter email. Write a login script for each type of user (this will be the link in the email). This script will retrieve the customer details, set login sessions etc or set a guest session if not a customer. As others have stated this is a poor idea as you are stripping the authentication process out and leaving a massive security hole in your application. All it will take is for one of the email links to get posted on the web somewhere and your site will get abused.
  12. There is no big issue as you say with uploading multiple files. The max upload file size is usually set to 2 or 4mb by default. If error reporting is enabled then you would see an message warning that the file is too large. Add an .htaccess file to your webroot to increase this using: php_value upload_max_filesize 200M php_value post_max_size 200M To be honest you are using the mail() funtion to send attachments which isnt the best. Use PEAR:Mail_Mime package or install the SwiftMailer libraries to easily add attachments to your email. In terms of file uploading check the basics. Do your form fields have the correct names for both images: fileatt1 & fileatt2 This code will upload your files to the directory specified, saving the files as image1.x and image2.x You can then easily check for the existance of the files and attach them to email (not using mail()) // make sure that this directory has write permissions $uploadPath = '/path/to/uploads/'; for($x = 1 $x <= 2; $x++) { // check that an image has been selected if(strlen($_FILES['fileatt'.$x]['name'])) { $fileType = strtolower(strrchr($_FILES['fileatt'.$x]['name'], ".")); $newFileName = "image".$x.".".$fileType; $uploadTo = $uploadPath.$newFileName; move_uploaded_file($_FILES['fileatt'.$x]['tmp_name'], $uploadTo); } }
  13. Supply a proper path to your cookie file where there are sufficient permission to create it. i.e. /tmp/cookie.txt (linux)
  14. Break your project into smaller sections and tackle each section. Ask for help if you get stuck on a particular issue. There are plenty of tutorials on file uploading with php if you do a bit of Googling.
  15. Do you have the following in your form: enctype="multipart/form-data" i.e. <form action="upload.php" method="post" enctype="multipart/form-data">
  16. Using image magic. http://studio.imagemagick.org/script/index.php
  17. Build your SQL query up on only fields that contain data: i.e. $sql = array(); if(strlen(trim($_POST['name))) { $sql[] = "name='".$_POST['name']."'"; } if(strlen(trim($_POST['address))) { $sql[] = "address='".$_POST['address']."'"; } if(count($sql)) { $setPart = implode($sql, ","); mysql_query("UPDATE tableName SET ".$setPart." WHERE id='".$_POST['id']."'"); }
  18. That code will produce errors. If there are no post values and only url params you will get a foreach error on the foreach($_POST) as not array will exist. Same other way around. As Thorpe said if your form uses a POST method the values will be contained in the $_POST array and in the $_GET array if using the GET method. To display the array after form submission use print_r(); // display submitted input // using POST method print_r($_POST); You can then access the data as you would a normal array.
  19. Because your code is only processing the first image $fileatt. You are referencing the 2nd image in $fileatt2 = $_FILES['fileatt2']['tmp_name2']; This should be $fileatt2 = $_FILES['fileatt2']['tmp_name']; as there is no such thing as tmp_name2 You then need to add the code to include this image in your email
  20. increment a counter $i++
  21. Could do. Dont really have to store records in a variable. You can display the data for edit through the retrieval loop.
  22. Turn magic quotes off. Pain in the arse.
  23. Is this data coming from a mysql query as you could obtain the desired result using COUNT and GROUP BY clauses in the query.
  24. A connection will be made only when the connection function is called. mysql_connect() The connection will close when the script has finished processing unless the mysql_close() function is used prior. Looping through rows does not open and close connections. The same handle is used: $handle = mysql_connect(); $results = mysql_query("SQL", $handle); // loop rows while($row = mysql_fetch_array($results)) { }
  25. Yes, you are correct this is a poor method! You could create an array of all your site files and the status value within a file included on every page. Test the value against the server gloabal PHP_SELF $pageStats['/index.php'] = 0; $pageStats['/page1.php'] = 1; $pageStats['/page2.php'] = 0; $status = $pageStats[$_SERVER['PHP_SELF']]; if($status == 1) { // redirect to under construction page header("Location:construction-page.php"); exit(); }
×
×
  • 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.