1. Imagemagick

    Date: 08/14/07     Keywords: php

    Sorry for yet another question, but this one is just frustrating:

    Is there any decent documentation for the Imagemagick functionality in PHP, preferably in the way of code examples? The API on php.net, in a word, sucks. :)

    Source: http://community.livejournal.com/php/580041.html

  2. File uploads.

    Date: 08/13/07     Keywords: php, browser, security, web

    I'm creating a photo upload site, using a WAMP server for development and Dreamhost for production. I'm pretty new to file uploads, and really just don't know where to begin. I'd like each user to have their own folder (a home directory, if you will), and for every photo uploaded has three seperate images in a uniquely named folder (currently a hash of the filename and unix time at creation). For example, a username of "demo" uploading "testing.jpg" would have his files placed in the "/demo/HashOfTestingJPG" directory, with the files "thumb.jpg", "scaled.jpg", and "testing.jpg". When demo uploads another file, a different folder is created within the "demo" folder, so a file named foobar.jpg would be in the "/demo/HashOfFoobarJPG" folder with these three generated files.

    My WAMP server is creating folders and uploading these files in C:\wamp\tmp, but I'm finding that my browser cannot access this directly through a web browser (makes sense). My php.ini file allows me to specify a "temporary" file upload directory, but is there a "permanent" upload directory? To accomplish what I want to do, should I just change the uploads directory to something like http://localhost/pictures/uploads and appropriately chmod that directory? What security issues do I need to worry about? If you use Dreamhost, do they require me to do anything special to allow such a setup?

    Also, what might I do to prevent a user from viewing the original file directly? The original version needs to be viewable through the website, but NOT via /demo/HashOfTestingJPG/testing.jpg. Thank you all for your help.

    ~Elliot

    Source: http://community.livejournal.com/php/579815.html

  3. PDF woes

    Date: 08/08/07     Keywords: php, html, linux

    Ok there are way to many ways to do this and I am getting behind schedule so here we go:
    -There is a lovely form (as it stands now in HTML); I want people to enter in data and then when they press submit a PDF is generated on the box and saved for later review by the client.
    The end form is going to run on a Linux box with PHP that has limited access (think little to no console access).

    Fpdf looked like the best choice but I do not want to build the PDF file if need be ( I can make it now via Acrobat Pro). That and I have found 0 examples (I live by them) that incorporates (and works!) HTML form work, $POST and FPDF.

    In Acrobat Pro I can make a form, put a submit button and then give it an action; then it can magically export the data as FDF, HTML, XFDF or PDF. Horrible shame that there is no documentation to show how to catch it on the server side (email links assume the user has a email client on their machine).

    At this point I just want this over and done; any hints or help?

    Source: http://community.livejournal.com/php/579519.html

  4. "ecb"

    Date: 08/04/07     Keywords: php

    I've got some recursive code at work that runs through a hash tree. The tree has two levels. I have it setup so that if the script dies, I can start it off were it died by running through the entire tree again until it gets to the starting point, at which point it starts running my process.

    Well there's a problem with this, it runs just fine and dandy, but once it finishes processing the "eca" directory, the script dies. There are no error messages, nothing in /var/log/messages and it's not running out of memory (or swapping for that matter).

    I echo'd the elements of the first level hash to see if it was even getting to "ecb", and it stopped echoing items after "eca".

    Is there some sort of conflict with PHP and the "ecb" directory? I can access it just fine in the filesystem. It's permissions are correct, and all of its contents are valid.

    I spent all day on this at work, and myself and all my coworkers at stumped at it.

    Have I found a PHP bug? It's probably not worth reporting because PHP 4 got it's EOL.

    Source: http://community.livejournal.com/php/579250.html

  5. Intranet/Apache/IP issue

    Date: 08/01/07     Keywords: php, mysql, browser, sql, apache

    ok, this is getting posted a few places because I'm head/desk-ing all over the place on it.

    Have Intranet, Intranet is based around an OS X Mac running Apache/PHP/MySQL. Was working fine, OS X server (just regular OS X but the machine is designed to work as a server) was at someone's house. Worked fine with the IP it had there and everything pointing to it, which was actually the IP of the router it was connected to I believe. This was the ServerName address in httpd.conf . Server moved to small office, BOOM.

    Updated the ServerName value in httpd.conf to the proper IP for the machine, however if you try and go to that IP (how the intranet works there, via the browsers connecting to that ip then going where they need to from the index page there) it gives a "Forbidden" error (don't think it's even a 403) and says that you don't have permission to connect to the OLD IP address. I don't understand this, we even disconnected it from the internet to see if it was even actually trying to connect to that IP and no, same error. Anything else and it says it cannot be reached when the uplink is disconnected, so definitely a problem on the server somehow. On top of that, localhost and 127.0.0.1 will work, the machine will reach out to the internet and can be mounted in internet explorer with the \\servername\path\etc., however this won't let us access the PHP processor to display the pages, just the files themselves.

    Is there anywhere else that a problem like this could lurk? Just uninstall Apache and re-install? I've never removed Apache from a machine or done a make of apache or anything else on a mac so I'm not exactly sure how to if that would even help. Really don't understand what's going on and I need to get this up ASAP. :( Any help please? Will repay in kind somehow, not monetarily but somehow (work, knowledge, something).

    Thanks!

    Cross posted all over sort of.

    Source: http://community.livejournal.com/php/578944.html

  6. Google Search Customized

    Date: 08/01/07     Keywords: google

    Has anyone try this?
    Making Google a search engine with standards

    I tried to implement it this morning, with no success, the result keep coming out 'no result'.

    The Google API key was just generated, so it's impossible if one said it has consumed 1000 queries.

    If you have try it in the past, what could be the culprit?

    Source: http://community.livejournal.com/php/578796.html

  7. Upload to email attachment

    Date: 07/30/07     Keywords: php, html


    This has me scratching my head... I have no idea why the sending of the file is failing.

    I found a script here
    http://www.trap17.com/index.php/form-php-mail-attachment_t28987.html

    It seems to work except the file doesnt arrive in the email

    Here are the relevent headers from the email

    Content-Type: ;
    name=""
    Content-Disposition: attachment;
    filename=""
    
    Attachment converted: Kobol:Untitled (TEXT/ttxt) (0048378B) 
    
    
    Email message here

    there is an attachment "untitled" and its size is zero.

    If you go here
    http://tfcdesign.fatcow.com/demos/form_upload_to_attachment/index.php

    you can send me a graphic and see the headers as they are before the email is sent.

    Any helpful tips are appreciated!

    UPDATE: it seems to be working with a jpeg... but not a gif... OK it seems it was the particular gif file I was using. SHEESH.
    OK - one last issue - if the file size is over 1MB or so, the email fails to send. Any ideas?

    Source: http://community.livejournal.com/php/578438.html

  8. Last fatal error?

    Date: 07/26/07     Keywords: no keywords

    I'm looking for a way to email myself the fatal error that has caused a script to terminate upon exit using register_shutdown_function. I have that part working; it sends me an email.

    The problem I'm having is finding a way to detect what that fatal error was/is. A big list of the warnings would be nice as well... is there a way to do this?

    Source: http://community.livejournal.com/php/578276.html

  9. Accent squashing

    Date: 07/26/07     Keywords: no keywords

    Does anyone know of a command or library function that will take a string with accents in such as 'héllô' and squash it into a non-accented string ('hello')?

    Source: http://community.livejournal.com/php/577839.html

  10. External cron jobs ?

    Date: 07/25/07     Keywords: hosting, google

    Hello,

    I came upon this issue when I was trying to see if my hosting provider allowed for any scheduled tasks e.g. cron jobs (the answer apparently being no) so I wondered, is there possibly a service, that allows you to set up external scheduled tasks, i.e. a system that will automatically call a certain script on *your* site.

    I'm took it to google but so far didn't find anything. It just seemed something natural that the IT boom would create something like this. Any info?


    p.s. I know there are some classes imitating cron out there, and although I have still to look into how they work I'm pretty much sure they rely on consistent traffic to do the job (i.e. if you statistically have hits every minute or so, you can get the job done with a minute's error). But this is not the case I'm talking about.

    Source: http://community.livejournal.com/php/577749.html

  11. Sending a file with an uploaded attachment

    Date: 07/23/07     Keywords: no keywords

    A while ago I created a form for a client. Now they want the form user to be able to upload a file...

    However, instead of storing the file as an attachment, they want to send the file with an email as an attachment.

    Can anyone help me figure this out?

    The current form handler is rather complex and I can't just replace it with a free script out there. I have to append the new function to the current form handler.

    Thanks!

    Source: http://community.livejournal.com/php/577343.html

  12. PHP5 Web Frameworks

    Date: 07/20/07     Keywords: php, web

    Hello Friends

    Has anyone here had any working experience developing using a PHP5 Web Framework? (Cake, Zend, symfony, etc.)

    Do you have any advice based on practical experience regarding which frameworks I should consider evaluating and which ones I should avoid?

    I will be building a simple web application that requires session-based user authentication and a fairly small and simple schema.

    Thank You!

    Source: http://community.livejournal.com/php/577191.html

  13. max_user_connections

    Date: 07/18/07     Keywords: php, mysql, database, sql

    I have a chronic problem with a fanfiction archive script I made. Since I've put it online, I hit max_user_connections in MySql very often, and my host is losing patience. The script opens a mySql connection (originally a normal one, now a permanent one by my host's suggestion) on loading and should use it for all the mysql calls forward. The archive is famous in the fandom and gets a lot of hits, but this shouldn't happen. I've tried to reduce the mysql calls at minimum, but I only get a few days reprieve. This is the code I use:

    In db_layer.php:

    function db_connect ($db_host, $db_user, $db_password, $db_database, $use_persistent = 0) {
    if ($use_persistent == 1) {
    $db_link = mysql_pconnect($db_host, $db_user, $db_password);
    } else {
    $db_link = mysql_connect($db_host, $db_user, $db_password);
    }

    if (!$db_link) {
    db_print_error("Unable to connect to SQL server", '');
    }

    $db_selected = mysql_select_db($db_database, $db_link);
    if (!$db_selected) {
    db_print_error("Unable to select database", '');
    }

    return $db_link;

    }

    Which is called at pagestart.php:
    $db_link = db_connect ($db_host, $db_user, $db_password, $db_database, 1);

    And querys are done this way:
    function db_query($query, $error_msg=0) {
    global $db_link;

    $result = mysql_query($query, $db_link);

    if ($result == false) {
    $error_msg = ($error_msg) ? $error_msg : "Error executing query";
    db_print_error($error_msg, $query);
    }

    return $result;
    }

    I am doing anything wrong? Does anyone have any advice for this problem, please? It's driving me crazy!

    Source: http://community.livejournal.com/php/576875.html

  14. html forms formatting

    Date: 07/17/07     Keywords: php, mysql, sql, web

    hey everyone,
    i have a website: http://thebigone.homeip.net with a form for users to put either 'chat' or news for the site.
    my question is: when someone tries posting in either of the text boxes and hits enter to create a new line the php doesn't pick up on this when it posts to the mysql backend. how do i keep the formatting of the textbox for the actual site?

    Source: http://community.livejournal.com/php/576562.html

  15. Step in the right direction

    Date: 07/13/07     Keywords: php, database, web

    Hi everyone!

    At my place of employment, we have a web form that will send an e-mail to our IT helpdesk person so they know that a work order has been placed. Currently, there is no reliable automatic way to send a confirmation e-mail saying the work request has been received. Despite the fact that we specifically ask the person requesting the work to enter their e-mail address, they usually don't, or just put their computer username because they don't know the difference (Asking people to read instructions? Shocking!)

    I had this idea today that perhaps our Exchange server could be queried to pull the names/usernames of all the people in our company so they could choose their name from a list, rather than relying on them to actually read the instructions and enter their e-mail.

    Another option would be to just dump everyone's name and e-mail addresses into a small database and query that. Unfortunately, this adds extra steps for our helpdesk people to follow when creating new users, and requires them to have access to our web server, which we'd rather not give.

    This idea literally came to me like 5 minutes ago, so I'm coming to you, oh Great and Wonderful LJ Community, to ask if this sort of thing is doable, and if it is, what kinds of stuff would I need to use with PHP to get it to work?

    I should note that our Exchange server is hosted externally, as I'm sure that sort of information makes a difference.

    Source: http://community.livejournal.com/php/576359.html

  16. Dynamically Calling Methods - Inheritance/PHP5

    Date: 07/11/07     Keywords: no keywords

    Right, I've got an interestingstupid problem. I have a controller base class:



    abstract class BaseController {

      final public function execute($action) {
         $action = $action."Action";
         if (method_exists($this, $action)) {
             return $this->{$action};
        } else {
            return $this->defaultAction();
        }
     }

    public function defaultAction() {
    return 'This should be overridden';
    }
    }



    Which I then inherit for page controllers:


    class SomePageController extends BaseController {
    public function thingAction() {
    return "thinging";
    }
    }



    Of course, the problem is that the execute($action) function is only in the scope of the abstract base class, so the $this in question is actually an instance of a PageControllerBase not a SomePageController and thus $actionAction never exists. So it's always the defaultAction that is executed.

    Is there anyway I can code the execute() handler so it can route to the right action handler in an inherited sub-class without re-implementing the execute handler in every derived class?


    Actually, the problem turns out to be that I didn't have the line:


    if (method_exists($this, $action)) {


    I had

    if (method_exists($this, $action."Action")) {


    So I was looking for thingActionAction() which of course, doesn't exist.

    And also I was actually writing code in SomeOtherPageController, which extended SomePageController, but still instantiating SomePageController which didn't have listenAction() which was the action I was trying to execute.

    Let that be a lesson to me: Don't code and watch TV at the same time.

    Source: http://community.livejournal.com/php/576070.html

  17. Trouble

    Date: 07/08/07     Keywords: php, mysql, html, database, sql

    I'm sorry to disturb, I'm new in php and I have a trouble with this code:

     

    It has to extract a row from a mysql database and make a html select of the value id_persona displaying also the value of the other fields (Nome, Cognome, Organizzazione) but it don't works properly. Choices on select are displayed like in the attached photo instead with the correct data .

    Source: http://community.livejournal.com/php/575883.html

  18. Articles, notes, whatever on compiling php5

    Date: 07/08/07     Keywords: php, linux

    I have a production machine running 'Red Hat Enterprise Linux ES release 3 ', never mind that I am pretty certain Red hat has moved onto a generation release of 4-5, I need to install php5 onto this machine without threatening the php4 installation already in place. From past experience, I know php isn't that simple to compile (ex. ./configure && make && make install ) so I was wondering if anyone knows of a howto to walk me through the configure/compilation part and explicity make sure php5 doesn't touch the working php4.

    Source: http://community.livejournal.com/php/575552.html

  19. Oh, Objects...

    Date: 07/06/07     Keywords: php, database, java

    Hey all, I'd like to consider myself pretty decent at PHP, but I've only recently started to move my projects into the realm of the object-oriented. Until now I've only used OO with Java and a bit of C++. Essentially I'm trying to encapsulate a database using objects. The issues are primarily with managing the complexity of the data model.

    I have a database table for users, let's call it users, and this table has fields along the lines of userid and displayname.

    I've created a User class which instantiates to a User object. Each of the fields (a/k/a columns) from the database is a so-called Field object. (So now a User object is a collection of Field objects). Internally, there is just an array of Field objects. To be able to display these Fields in different ways in the output, I've abstracted the display of the Field object into a FieldPrototype Object, which also contains information about the Field's data type (e.g. integer).

    So User is a collection of Fields, which is a FieldPrototype and a value which is accessed and according to the FieldPrototype.

    I anticipate that there may be up to several hundred of these objects instantiated at a time (and efficiency is a concern), so I've made the FieldPrototypes static members of the User class.

    Thus, if there are 100 User objects instantiated, each of them only carries around a value and an address of a FieldPrototype that is used to display and describe the Field.

    My question, then is how logically this is laid out and if the added burdens of creating static objects as descriptors of instantiated objects is worth the performance increase (or really if there even is a performance increase).

    I've put some time into this code already, visible at this page (user: lj, pass: lj). If it helps... Most of what I'm talking about takes place in the User.php file.

    This promises to be a fairly large project, and I'd like some experienced input before I go off and implement a system on fundmantally-flawed ideas.

    Also, anyone have any good resources (or book suggestions) for this sort of stuff with PHP? That is, Object Oriented + Database on a relatively large scale?

    Thanks in advance! You all are great.

    Source: http://community.livejournal.com/php/575351.html

  20. Credit Card Processing suggestions

    Date: 07/06/07     Keywords: web, google

    Y'all were so helpful with my idiotic line-break problem last week, I thought I'd ask about a slightly more troubling issue...

    Only *after* I signed our company up for a PayPal Website Pro account did my boss tell me to scrap it, because he found out we'll be required to put their logo on our forms and accept PayPal Express. He's afraid this will somehow drive customers away.

    Anyone have suggestions for credit card processing that fit the following requirements?

    • Is super, crazy cheap (like PayPal: $20/month + 35¢ + 2.something% per transaction)
    • Requires no logos, Google accounts, or anything else that will make our registration form appear "unprofessional" =P
    • Has lots of support for integration, and can be set up quite quickly, as our current e-commerce solution (are you sitting down?) is a form that emails the credit card information to our accountant, who rings it up manually. I hope they didn't actually pay anybody to set that up.

    Alternatively, has anyone had good experience with PayPal, and can vouch for it not actually harming sales? I've looked at 2checkout, authorize.net, and worldpay, and PayPal still looks like the best option to me.

    Thanks!

    Source: http://community.livejournal.com/php/575102.html

Previous page  ||  Next page


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home