Jump to content

common

Members
  • Posts

    58
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

common's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi Thanks for your reply. I tried looking at the website, but had some difficulty to understanding/initialize the Slim app object. So I am not sure if I am doing it correctly now: Can you maybe just help me where I go wrong, or what developing pattern I should follow. Here is something I have already. <?php header("Content-Type: application/json"); require 'Slim/Slim.php'; \Slim\Slim::registerAutoloader(); $app = new \Slim\Slim(); $app->get('/users', 'findAll'); $app->get('/users/:id', 'findById'); $app->post('/user/new', 'create'); $app->put('/user/update', 'update'); $app->run(); function create() { $app = new \Slim\Slim(); $request = $app->request; //Slim::getInstance()->request(); $user->json_decode($request->getBody(),true); $id = .... echo $id; } function update() { $request = Slim::getInstance()->request(); $user = json_decode($request->getBody()); ... } function findAll() { $userarr =... echo json_encode($userarr); } function findById($id) { $user = ... echo json_encode($user); } ?> Thanks in advance.
  2. Hi Sorry, meant javascript - The Base64 is a java object that I found on the internet javascript The token is not a bad idea, but got it to work using var xhr = new XMLHttpRequest(); xhr.open(method, url, true); xhr.responseType = 'blob'; xhr.setRequestHeader('Authorization', 'Basic ' + auth); xhr.onload = function(e) { if (this.status === 200) { var blob = new Blob([this.response], {type: this.response.type}); var blobURL = URL.createObjectURL(blob); blobCallBack(blobURL); } }; xhr.send(); blobCallback is a function I provide where I do my inline content: src=blobURL . And that works perfectly. Thanks for your help!
  3. Hi everyone. I am looking at creating my application's back end with PHP, which returns all data with Jason or simplexml. I have tried Slim once, but think there should be something easier to use. Can anyone give me suggestions on what I can use which is easy to catch on, and maybe an example? Appreciate it. Kind regards
  4. Hi Everyone, I am struggling with a pdf. On our server I get the pdf as a byte array from the database, which I then build up in a StreamingOutput object and return as a pdf file. This is done using java using JAX-RS service. Now when I open the path/link in my browser(chrome/firefox) the pdf opens in the browser. So this means my backend is working. On my webapp I want to use $.ajax to download the pdf and view it in an Iframe or embed it in an <embed> or <object> tag. I need to do this as the service call is actually under username and password, and we do not create a session between the browser and the server - there is a long explanation for this. I saw the option to use http://[username]:[password]@www.myserver.com/... but this was dropped by most browsers. This is why I am trying ajax. Now in my ajax call I do receive the pdf in the success function as: %PDF-1.4.... This open the browser's pdfviewer correctly and every thing, but the pdf only returns blank pages. The Base64 is a java object that I found on the internet. But I have tried it without the base64 but still now luck. Here is my success function from my ajax call. success: function(data, status, xhr) { var pdfText = Base64.encode(xhr.responseText); var url = "data:application/pdf;base64," + escape(pdfText); var html = '<embed width=100% height=600' + ' type="application/pdf"' + ' src="' + url + '">' + '</embed>'; $("div.inner").html(""); $("div.inner").append(html); }, Can anyone help me? Kind regards
  5. common

    Print()

    Hi Guys, I am working on 2 pages. One page has a list of accounts with a form and this is submitted to second page. The second page displays html of documents(like invoices and so on.) that need to be printed. The system I work in is a couple of pages in framesets. Now I want to have the html in the second page printed without showing the second page. So in other words: When the submit button is clicked I need the print box popup and when print is clicked the second page needs to be printed. Now what I have done, is to add a another frame to the frameset with a with of 0, so it will not be visible in the browser. And after the second page loads, I use the window.print() function to bring up the print box. My problem is, that this only works when I open the second page in a new window. And nothing happens when I open the second page in the additional frame. Now I havn't tried thisyet, but belives if I use parent.[framename].print() it will work for the frame. I want it work in both when opening the page in a new window and when I open it in the Additional frames. Does anyone know how I can do this? Thanks in advance
  6. Hi ppl I have a weird error... (or at least i think its weird) I have a project with 3 forms, and at the end(the last file) will enter all data of this form in an email and sent it using PEAR smtp email. On my local server it works. Everything - from testing all the mandatory fields in each form till the sending of the email. I also receive the email using @localhost. When I upload these files to the server, every form with the testing of the mandatory fields and returning to that form, everything works, except the file where I test the last form and put all content in the email body. On the server, as soon as the last page starts to load, I get a Server Error HTTP Error 500. I really don't understand it, as everything works on my local xampp server. Please let me know of places I can search for errors... like log files on the server or something like that. Thanks PS: I also used NetBeans, with its debugger, so I am quite sure its not the code, maybe a php setting...
  7. Hey guys, I want to create my header using 4 span (inline-blocks). For the two spans at the left and right ends I have fixed values. The two in the middle needs to fill in the rest of the page. The whole header has 'n max-width of 1400px and a min-width of 900px (just for window resizing/ smaller resolutions). I want to keep all four blocks inline, and even when window is resized smaller it should stay inline, just the two middle blocks needs to be smaller. I have tried the theoretical way - giving the blocks in the middle max- and min-width values, but it does not seem to work. Please help Thanks in advance
  8. Hey ppl I have a login script that I found in a PHP MySQL book. And yesterday I realized that it is easy to hack this script as it use session variables and it can use cookies. DOes anyone have login script for me that is secure and easy to implement? It would really help! Thanks
  9. Hi guys what i am trying to do: I have a form, but on one of the fields (Interests), when a user focus (click in the text ) field another window(like popup window) must open with another form with a couple of dropdown boxes. Now when the second form (on the popup window) is submitted I want that $_POST data to be displayed in the in the text field of the original form. I am going to handle the $_POST data from the second form so that it is displayed as a single string Does anyone know how to do this?? PLease help... Thanks
  10. Hi I am trying to create a site that determines the device's screen size. Most mobile phone browsers does not have javascript, so to determine the width and height of the screen I cannot use Javascript. Does anyone know how i can test whether a mobile phone is used to visit the site and what that phone's screen resolution is, so that I can redirect it to the right folder. Thanks in advance
  11. HI all With an checkbox I run a script that enables a link. Now what I mean with that I created to div, the one I hide with css. When I check the checkbox it must hide the other div and show the first hidden div. This works in Chrome, FF, and IE, except in IE when I check the checkbox I must first click somewhere on the page for the results.. Can anyone help me so that IE automatically/immediately show results?? PLease Thankls
  12. common

    OOP PHP

    Hi I am still new to OOP PHP I have a question. Say I have: class class_name { function act_1() { } function act_2() { } } How can I call act_2() from the act_1() function? Because I want function act_1() to be private (meaning that it cannot be accessed by anything outside of this file) and that the code in act_1() can only be accessed when act_2() calls it. Or would it be better to use an extended class?? But how would that work? Thanks for any help!
  13. Hi First of all, thanks for the reply. By subdomain, do you mean something like http://www.mobile.example.com? How exactly does that work? Do I only create a folder in root folder of my server (parent folder of public_html)? Or do I actually buy another domain? Sorry i not exactly sure how hosting works. Thanks
  14. HI everyone I am still new with javascript. I am creating a newsletter function with php and so. Now I want like when the articles are already in the newsletter the ability for the user to drag and drop the articles in a other order. I have search the internet and found a couple scripts, but i cant implement it with what I want. Does anyone know/ has a script for me, (with some explanations,if possible). I will work in basically two culumns(main articles, and sidebar). I will really appreciate it. Thanks
  15. Hi everyone This is not really about php code...sorry. But i want some advice if you dont mind. I am working on a system, but i would like it to be available for PC use, aswell as for mobile use. What would be the best? To create two websites, one for mobile other for PC, and upload them to .mobi and .com domains, or should i create only one... I need this to be as user-friendly as possible...because the clients who are going to use this, is those ppl that is not comfortable with a PC, not to mention the web. Thanks
×
×
  • 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.