Jump to content

jonoc33

Members
  • Posts

    151
  • Joined

  • Last visited

    Never

Everything posted by jonoc33

  1. Hey guys! Haven't been here in a while but it's finally time I need help again. Heres the issue i'm having: I'm working for my Dad, making a new application called Traveller. They use web services to input data and get data. Web services so far have worked well for me. They output data perfectly and it's all worked fine. Now i'm up to the stage where I need to input data to a web service so that it can create a record. It uses ALOT of data. I'm talking: Notice how theres nested data or objects in there? Look at address_det, theres multiple address_details in that. At the moment it passes through all values fine, except for these nested objects. What i'm struggling with is being able to input multiple address detail objects inside address_det. Considering each object would have the same name its a bit hard to code that. Heres what i've got at the moment. $parameters = new Request(); $parameters->user_id = $_COOKIE['user_id']; $parameters->password = $_COOKIE['password']; $parameters->req_input = new ReqInput(); $parameters->req_input->request_id = 0; $parameters->req_input->request_description = $issue; $parameters->req_input->refer_no = $refno; $parameters->req_input->service_type = $service; $parameters->req_input->request_type = $request; $parameters->req_input->function_type = $function; $parameters->req_input->request_datetime = date("Y-m-d") . "T" . date("H:i:s"); $parameters->req_input->due_datetime = date("Y-m-d") . "T" . date("H:i:s"); $parameters->req_input->centre = 'WEB'; $parameters->req_input->how_received = 'WEB'; $parameters->req_input->input_by = $_COOKIE['responsible_code']; $customer_name_det = array( "name_id" => 0, "pref_title" => $cust_title, "given_names" => $cust_given, "surname" => $cust_surname, "mobile_no" => $cust_mobile, "telephone" => $cust_phone, "work_no" => $cust_work, "email_address" => $cust_email, "name_ctr" => 0, "company_name" => $cust_company ); $address_det = array( array( "address_id" => 0, "house_number" => $cust_address_number, "property_number" => $cust_address_fnumber, "street_name" => $cust_address_street, "street_type" => $cust_address_streettype, "locality" => $cust_address_suburb, "address_ctr" => 0, "address_desc" => $cust_address_desc ), array( "address_id" => 0, "house_number" => $loc_address_number, "property_number" => $loc_address_fnumber, "street_name" => $loc_address_street, "street_type" => $loc_address_streettype, "locality" => $loc_address_suburb, "address_ctr" => 0, "address_desc" => $loc_address_desc ) ); $parameters->req_input->customer_name_det->customer_name_details = $customer_name_det; $parameters->req_input->address_det->address_details = $address_det; $parameters->req_input->ws_status = 0; $parameters->req_input->ws_message = ''; $wsdl = WEB_SERVICES_PATH.MERIT_REQUEST_FILE."?wsdl"; try { $client = new SoapClient ($wsdl, array ("classmap" => array ("ws_create_request" => "Request"))); $result = $client->ws_create_request($parameters)->ws_create_requestResult; } catch (Exception $e) { echo $e -> getMessage (); } Notice where I have the $customer_name_det and $address_det variables. They're the ones that are nested as you'll see in the web service sample. I've tried putting each into an array and then just setting customer_name_det->customer_name_details to that array variable (and address_det->address_details as well ), but when passed through that fails to work as well. How should I input data into these nested objects in a web service?
  2. Check the MySQL connection settings, thats why it comes up with those errors.
  3. Hi guys, I have made an update platform which auto generates a ZIP file from a folder's contents, using Rochak Chauhan's ZIP file creation tool along with an extended class to auto-find all of the files and folders automatically to add to the zip. The ZIP makes itself ok. <? session_start(); require_once("zipfile.php"); $createZip = new createDirZip; $createZip->addDirectory(''); $createZip->get_files_from_folder('../development/', ''); // gets all files and folders from the development folder $fileName = 'zip/zipfile-'.mysql_real_escape_string(htmlentities($_POST['version'])).'.zip'; $fd = fopen ($fileName, 'wb'); $out = fwrite ($fd, $createZip->getZippedfile()); fclose ($fd); ?> Now, I have another application i've made which checks for updates, and uses the ZIP to unzip itself and overwrite everything to basically update the whole thing. <? include("inc/php/config.php"); // Functions to be used function unzip($src_file, $dest_dir, $create_zip_name_dir=false, $overwrite=true) { if (is_resource($zip = zip_open($src_file))) { $splitter = ($create_zip_name_dir === true) ? "." : "/"; if ($dest_dir === false) $dest_dir = substr($src_file, 0, strrpos($src_file, $splitter))."/"; // Create the directories to the destination dir if they don't already exist create_dirs($dest_dir); // For every file in the zip-packet while ($zip_entry = zip_read($zip){ { // Now we're going to create the directories in the destination directories // If the file is not in the root dir $pos_last_slash = strrpos(zip_entry_name($zip_entry), "/"); if ($pos_last_slash !== false) { // Create the directory where the zip-entry should be saved (with a "/" at the end) create_dirs($dest_dir.substr(zip_entry_name($zip_entry), 0, $pos_last_slash+1)); } // Open the entry if (zip_entry_open($zip,$zip_entry,"r")) { // The name of the file to save on the disk $file_name = $dest_dir.zip_entry_name($zip_entry); // Check if the files should be overwritten or not if ($overwrite === true || $overwrite === false && !is_file($file_name)) { // Get the content of the zip entry $fstream = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry)); if(!is_dir($file_name)) file_put_contents($file_name, $fstream ); } // Close the entry zip_entry_close($zip_entry); } } // Close the zip-file zip_close($zip); } else { echo "No Zip Archive Found."; return false; } return true; } else { if(version_compare(phpversion(), "5.2.0", "<")) $infoVersion="(use PHP 5.2.0 or later)"; echo "You need to install/enable the php_zip.dll extension $infoVersion"; } } function create_dirs($path) { if (!is_dir($path)) { $directory_path = ""; $directories = explode("/",$path); array_pop($directories); foreach($directories as $directory) { $directory_path .= $directory."/"; if (!is_dir($directory_path)) { mkdir($directory_path); } } } } $current = $_POST['version']; $con = mysql_connect("host", "user", "pass"); mysql_select_db("updateplatform_zipfile", $con); $dbQueryV = mysql_query("SELECT * FROM updateplatform_zipfile WHERE version > '".$current."' ORDER BY id ASC"); while($dbRowV = mysql_fetch_array($dbQueryV)){ $version = $dbRowV['version']; $file = file_get_contents("http://link.com/etc/zipfile/zipfile-".$version.".zip"); file_put_contents("zipfile-".$version.".zip", $file); $zip = "zipfile-".$version.".zip"; unzip($zip, "", false, true); unlink("zipfile-".$version.".zip"); } ?> Now the strange thing is, that when I make a ZIP MANUALLY by downloading all the "development" files and zipping them up through winrar then uploading them to the correct location all manually, that above script which unzips it and overwrites it all works. When it's ZIPped up all done automatically through the Update Platform I made it comes up with these errors. over and over again, hundreds of times, mostly due to it doing it for each file in the zip. I need help!!
  4. So there is no way of fixing the problem unless I have access to php.ini? I'm paying for a web hoster, so that won't be happening any time soon.
  5. I've made an upload form/script for one of my websites yet whenever I upload, $_FILES contains no data in it at all (i've done print_r($_FILES)). I've also done ini_set("upload_file_maxsize", "10M"); AND ini_set("post_file_maxsize", "10M"); to make sure that the max size of uploads doesn't mess it up. I know it's something to do with the size because if I upload a significantly smaller file it works. Any ideas?
  6. Hey guys, I'm making a Project Management System and want to know if it's possible to make a Dynamic PHP Gantt Chart. Basically you fill in all the information and it would automatically create an image on the following page that you can save to your PC. I know this is slightly possible due to the fact that you can use the ImageCreate or Image functions to do so in some cases. Anyone got any ideas? Jono
  7. Say if I had a variable: $rank = "Fighters"; How would I get retrieve the last letter?
  8. How exactly do I do that? Also, for some reason my site is running incredibly slow now that i've added this to the .htaccess. Any reason why?
  9. No advantages, just makes it cleaner. Although several problems emerge. Making the images direct links still doesn't work.
  10. Anyone else know how to set this up? I searched PHP virtual directory on google and that relates to what my question is. It has something to do with modifying your .htaccess file.
  11. I didn't really mean it like that. That's really basic stuff. Say I have this link: http://www.site.com/index.php?page=home I want to make it this: http://www.site.com/home/ But it's like a virtual folder, the folder isn't actually on the server.
  12. Hey guys, Title pretty much says it. How would I make a link of a server-side page a folder layout instead of the normal $_GET tags? What is it's specific name? I can't really find much on google on it.
  13. Hey, I have a PHPBB2 forum, and a main page. The forum is located the folder forums/ and the main page is in the root folder. What i'm trying to do is when you login on the forums and then go back to the main page, you can see on the sidebar that you have logged in (Say like "Welcome" or something like that, and if not, show the login box). I've tried echoing the PHPBB2 cookie on the main page but it does not show anything. Would the cookie only be set to show on the forums/ folder? Or am I doing something wrong?
  14. Hey guys I'm currently learning javascript, very good at PHP, and am learning how to make dynamic interactivity etc. etc. Say I have a form, with two fields. Name and email. Basically I need it to perform a javascript function onclick which utilizes a MySQL database query without having to go to another page and redirect etc. Any way of doing this? Thanks guys, Jono
  15. Hey guys, Heres the situation: Me and a friend are both working on a website together. My friend has done a bit of the css, so I open up the css file and take a look. I close it and open up index.php On index.php, a link links the stylesheet to the page. While i'm editing index.php, my friend makes a change to the css file. If i edit index.php and save it, it will overwrite the css that he edited with what I viewed earlier. It's getting really annoying because if I edit index.php it erases almost all css except for the bits that I saw when I first opened the css file earlier. In order to edit index.php I have to first open the css file to make sure it doesn't erase everything. Anyone have the same problem?
  16. I did. It only returns the coding of the colours, not what you've inputted though.
  17. Hey guys, I've made a site called Codebase and it's basically a personal site for my use where I can add and view code that i've used. I've already done pretty much everything for it, but when it displays the code is there any way of making it show up with colors like this: <?php echo "I need these colours etc."; ?> Is there some sort of mod you can get to make it display this? Jono
  18. Hey guys, This is my entire script for sending multiple attachments. <?php session_start(); $attachments = $_POST['theValue']; $client = $_POST['client']; $email_from = $_POST['name']; // Who the email is from $email = $_POST['email']; $email_subject = "Merit Requests - New Request"; // The Subject of the email $priority = $_POST['priority']; $phone = $_POST['phone']; $issue = $_POST['issue']; $email_message = "Hello,<br>".$email_from." of ".$client." (<a href='mailto:".$email."'>".$email."</a>) has a request.<br><br>".$issue."<br><br>Priority: ".$priority."<br>Phone Number: ".$phone."<br><br>Thankyou.<br>Merit Requests"; // Message that the email has in it $email_to = "jonoc33@optusnet.com.au"; // Who the email is too $headers = "From: ".$email; $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; $email_message .= "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type:text/html; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $email_message . "\n\n"; // Attachment if(strlen($_FILES['1']['name']) >> 0){ $fileatt = $_FILES['1']['tmp_name']; // Path to the file $fileatt_type = $_FILES['1']['type']; // File Type $fileatt_name = $_FILES['1']['name']; // Filename that will be used for the file as the attachment $file = fopen($fileatt,'rb'); $data = fread($file,filesize($fileatt)); fclose($file); $data = chunk_split(base64_encode($data)); $email_message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . //"Content-Disposition: attachment;\n" . //" filename=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$mime_boundary}\n"; unset($data); unset($file); unset($fileatt); unset($fileatt_type); unset($fileatt_name); } // End Attachment // Attachment if(strlen($_FILES['2']['name']) >> 0){ $fileatt = $_FILES['2']['tmp_name']; // Path to the file $fileatt_type = $_FILES['2']['type']; // File Type $fileatt_name = $_FILES['2']['name']; // Filename that will be used for the file as the attachment $file = fopen($fileatt,'rb'); $data = fread($file,filesize($fileatt)); fclose($file); $data = chunk_split(base64_encode($data)); $email_message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . //"Content-Disposition: attachment;\n" . //" filename=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$mime_boundary}\n"; unset($data); unset($file); unset($fileatt); unset($fileatt_type); unset($fileatt_name); } // End Attachment // Attachment if(strlen($_FILES['3']['name']) >> 0){ $fileatt = $_FILES['3']['tmp_name']; // Path to the file $fileatt_type = $_FILES['3']['type']; // File Type $fileatt_name = $_FILES['3']['name']; // Filename that will be used for the file as the attachment $file = fopen($fileatt,'rb'); $data = fread($file,filesize($fileatt)); fclose($file); $data = chunk_split(base64_encode($data)); $email_message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . //"Content-Disposition: attachment;\n" . //" filename=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$mime_boundary}\n"; unset($data); unset($file); unset($fileatt); unset($fileatt_type); unset($fileatt_name); } // End Attachment // Attachment if(strlen($_FILES['4']['name']) >> 0){ $fileatt = $_FILES['4']['tmp_name']; // Path to the file $fileatt_type = $_FILES['4']['type']; // File Type $fileatt_name = $_FILES['4']['name']; // Filename that will be used for the file as the attachment $file = fopen($fileatt,'rb'); $data = fread($file,filesize($fileatt)); fclose($file); $data = chunk_split(base64_encode($data)); $email_message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . //"Content-Disposition: attachment;\n" . //" filename=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$mime_boundary}\n"; unset($data); unset($file); unset($fileatt); unset($fileatt_type); unset($fileatt_name); } // End Attachment // Attachment if(strlen($_FILES['5']['name']) >> 0){ $fileatt = $_FILES['5']['tmp_name']; // Path to the file $fileatt_type = $_FILES['5']['type']; // File Type $fileatt_name = $_FILES['5']['name']; // Filename that will be used for the file as the attachment $file = fopen($fileatt,'rb'); $data = fread($file,filesize($fileatt)); fclose($file); $data = chunk_split(base64_encode($data)); $email_message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . //"Content-Disposition: attachment;\n" . //" filename=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$mime_boundary}\n"; unset($data); unset($file); unset($fileatt); unset($fileatt_type); unset($fileatt_name); } // End Attachment $ok = 1; if(strlen($email_from) == 0){ $ok = 0; $_SESSION['name'] = 1; } if(strlen($email) == 0){ $ok = 0; $_SESSION['email'] = 1; } if(strlen($issue) == 0){ $ok = 0; $_SESSION['issue'] = 1; } if(strlen($priority) == 0){ $ok = 0; $_SESSION['priority'] = 1; } if($ok == 1) { mail($email_to, $email_subject, $email_message, $headers); mail($email, "Merit - Thankyou for your Request", "Hi ".$email_from.",\nThankyou for your request. You will get an e-mail within the next 24 hours or the next working day.\n\nThanks,\nMerit Technology Pty. Ltd.\nhttp://www.merit.com.au", "From: support@merit.com.au"); $_SESSION['sent'] = 1; unset($_SESSION['rem_name']); unset($_SESSION['rem_email']); unset($_SESSION['rem_phone']); unset($_SESSION['rem_issue']); header("Location: index.php"); } else { $_SESSION['problem'] = 1; // Remember what has been inputted $_SESSION['rem_name'] = $email_from; $_SESSION['rem_email'] = $email; $_SESSION['rem_phone'] = $phone; $_SESSION['rem_issue'] = $issue; header("Location: index.php"); } ?> It sends the email ok, it sends the attachments, but only 1 of them is the file that was inputted. The rest are text files with a bunch of code and content-type stuff with random letters and numbers. How would I get this to work?
  19. Set some variables with the post data before you do the UPDATE. Not that it'll make it work but it will clean it up.
  20. $messager = "Someone has signed up on ations.com" Change that to this: $messager = "Someone has signed up on ations.com"; You forgot to add a colon . Another problem might be that you havent connected to SMTP.
  21. Hi guys, I'm doing work experience and i'm making a php website for a company. They use their own MSSQL database and when I connect to the database it comes up with an unknown function error. The php_mssql.dll has been uncommented and the extension directory points to exactly where the php_mssql.dll is. Weird?
×
×
  • 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.