-
PHP/MySQL question
Date: 12/18/06
Keywords: php, mysql, sql
I am applying for a job and have been working with PHP since PHP3, unfortunately not so lucky with MySQL and have only been working with that for about 2 years now and still feel awkward with it.
So the job interviewed me and wants me to come back to take a 1 hour test to make sure that my knowledge matches what they want, or what level my knowledge is at, not sure which. I was wondering if anyone would have any suggestions what areas I should sharpen up on/make sure I know all the options/tricks etc. on? And also does anyone know any self-scoring or automated PHP or PHP/MySQL tests out there on the net or care to make one? Would be much appreciated. I was using the Zend Certification book as a guideline but I'm too busy correcting typos and wondering what's write and wrong in the book :\
Thanks!
Source: http://community.livejournal.com/php/523205.html
-
Apache questions
Date: 12/17/06
Keywords: php, hosting, apache
I have just changed hosting providers and am having a minor problem with files matching before my mod_rewrite rules get to rewrite.
www.mydomain.com/foobar/stuff
is matching and executing foobar.php and I don't want it to.
I've tried changing DefaultType to text/plain so it wouldn't execute as php.
I've tried turning off ModSpeling in case that had an effect.
Other info: I'm using apache 2.x and php 5.2 as a fast cgi
* * * *
Another question I have is what type of encoding do I need to set to get degree (°) symbols and copyright (©) to display properly. At this new host they display as '?'.
Source: http://community.livejournal.com/php/522671.html
-
Email validation & quick Rails vs. PHP
Date: 12/16/06
Keywords: php, software, database, web, apache
Was playing with the idea of regEx'ing out the domain of an email address and then doing a gethostbyname() to verify that the email address is valid. I know in some cases this won't work, but was curious if anyone has ever tried something similar. Just trying to come up with more validation measures to protect my employeer and their customers from malicious users.
As for Rails VS. PHP
Rail cons
I am on the final stage of deploying a website built in rails and it's been a fun/frustrating learning experience because I've had to build it with a legacy schema that was mangled along the same lines as scope creep (non-standard keys, non-uniform structure (integer keys here, varchar keys there, variables inside join tables, and a lot of orphaned tables forcing the client software to do what the database should be doing [out of query joins or excessive join tables]). For the most part there is a lot of good things about Rails but it's not an end all, be all tool like some people make it out to be. Multi-page/multi-object (ex. user data mixed w/ purchase data) forms are difficult, breaking the rails way of data validation. Debugging has some nice benefits, but is poorly documented and so far I have not found a Rails equivalent to DBG symbolic debugging.... the best appears to be a rails inline assert/breakpoint object that halts the entire system to allow you a glimpse of the system state at that moment but not the ability to step in/out/over.
Lastly there is no mod_perl or mod_php like Apache component so getting Rails on a current server implementation is somewhere between entertaining to unbelievably frustrating. Further more, though rails has a couple different natively supporting webservers (light, webbrick, mongrel) they aren't as well tested or as versatile as Apache. And lastly there is little to no documentation or guidelines, so if you got to do something out of the ordinary, life gets interesting.
Rails pro's
On the plus side, Rails is rich in features, its easier to write C binary packages then PHP, the ActiveRecord & ActiveMailer packages are extremely versatile and thanks to standard Obj. Oriented mantra's, base/parent methods can be supplemented or completely overridden. Otherwise it's a great rapid development platform and practically promotes itself to being used in series with another scripting language if Apache 2.0's mod_proxy or similar httpd proxy service is used. `httdoc/{rails sub-dir/ &| php sub-dir/ & /static content dir}` Prototype and Scriptalicious (spelling) being embedded and wrapped by Rails helpers make Ajax/Web 2.0 stuff a breeze as well. So if you got a simple project on queue and the time to burn stumbling through Rails, I'd recommended checking it out to see if it can compliment and augment your portfolio. Just be prepared to earn your paycheck for the first couple projects. So for speed and minor enhancements to static content, PHP dominates while for complicated, Ajax heavy applications, Rails feels like a good choice.
Source: http://community.livejournal.com/php/522413.html
-
Word Verification
Date: 12/15/06
Keywords: php, web, spam
Does anyone know how to do a php code for an form that is e-mailed to you and has a word verification, so that you don't get that much spam from your form?
I have the basic form on my web site right now, www.cardeologist.com on my contact page. But, I have started to get some bots filling in the form and spamming it. Is there another way to stop this or a code to make you enter a word/phrase before it can be submitted?
Source: http://community.livejournal.com/php/522045.html
-
Disappearing PHP
Date: 12/15/06
Keywords: php, css
I've been working on this script that changes CSS styles by a user-selected drop-down menu. Everything was working fine, site was up and running, etc. A few days after initial upload, the drop-down menu no longer works, so I check the code and the PHP coding has been stripped from the page... When I uploaded the page initially the code was there and not to mention the page was working fine for days. I went and looked through the service package of the host and PHP support is indeed included. Just wondering if anyone knows how the code just... "disappeared?" If you know... how can I prevent this from happening again!?
Thanks all.
Source: http://community.livejournal.com/php/521891.html
-
PDF 2 JPG
Date: 12/14/06
Keywords: php
Is it possible to convert PDF files to small JPG thumbnails w/ PHP 4? Is it possible to do it without having a specially compiled version of PHP?
Source: http://community.livejournal.com/php/521582.html
-
PHP + IIS + exec() = CGI Error
Date: 12/14/06
Keywords: php
Here's a weird question: why would PHP running on a windows server with IIS fail every time I try to use the exec() or system() functions? Specifically, the error says that CGI didn't return a full set of http headers.
This is really weird because if I have an echo right after the exec(), it never echo's (unless the exec is commented out. duh.).
Thoughts?
Source: http://community.livejournal.com/php/521254.html
-
Dreamhost
Date: 12/14/06
Keywords: php, mysql, sql, hosting
DreamHost seem to get recommended every time anyone asks for a good host, but, has anyone had any problems?
My current host (square1hosting.com) are sucking harder than something that sucks very hard, and have been for some time.
I need a PHP5 host with MySQL and email for multiple domains at a reasonable price, dreamhost seems to be unbelievably good, which suggests to me they may be overloaded and therefore performance/availability might be dire.
Anyone have any problems?
Source: http://community.livejournal.com/php/521140.html
-
PHP quiz scripts
Date: 12/14/06
Keywords: php, mysql, sql
I used a quiz script from Dodo in the past, but in september I switched hosts for my domain, and after I had uploaded all the files I discovered that the script just wouldn't work. The script is just a bunch of php files and my new host supports PHP just like my old host.
Anyone used this script before?
Where would I start troubleshooting? What things are significant in this host-switching case?
I also tried to upload the uncustomized default files that came with the script, and still nothing. If the case is that it won't work whatever I do...
Do any of you have a link to another linkware PHP non-MySQL quiz script? I need this: 10 questions w/ radiobuttons. If you have 7 or more correct you get sent to pageA.php, if you have 6 or less you go to pageB.php
Thanks
Edit: I got help and it works now:)
Source: http://community.livejournal.com/php/520922.html
-
curl options
Date: 12/11/06
Keywords: html, asp
i use curl to talk to our local mls system (EXCITING!). this is the relevant part of the function i use to, in this case, perform a search:
when i run a script that uses this function, i get
# Netscape HTTP Cookie File
# http://www.netscape.com/newsref/std/cookie_spec.html
# This file was generated by libcurl! Edit at your own risk.
rets15.raprets.com FALSE / FALSE 0 RETS-Session-ID blah1019181817161514131211zzzzz
USEFUL OUTPUT
i know this is really nitpicky, but is there anyway to suppress the, "Netscape HTTP Cookie File," stuff (while still using the cookie i've generated)? i'm not echo'ing anything ever, it just spits that out to the console everytime the function fires... and uh, i don't like it.
Source: http://community.livejournal.com/php/520302.html
-
A matter of preference:
Date: 12/10/06
Keywords: no keywords
Here's a question that I'm assuming everyone has an answer to:
What is your preferred method of variable/function naming?
Do you prefer to use underscores when separating words or would you rather use capital letters?
Do you capitalize the first letter of them in addition?
Why?
I'm mainly asking this because I'm trying to find my niche and I'd like to hear everyone's input.
Originally, I used underscores to separate my words (i.e. - $my_variable_name), but as you can see, it adds length to the name. I'm trying my luck with capital letters (i.e. - $myVariableName), but I don't know how I feel about variables that end with "id" ($customerId)...I feel like that looks a bit strange.
So what do you think? I'm interested in hearing everything you have to say.
Source: http://community.livejournal.com/php/519267.html
-
making css into an array. in need of regex pointer
Date: 12/09/06
Keywords: css
if i have some css like that of below and i want to just grab the background image values "/3.5.x/forums/images/placebo_two/daylight/daylight_bg.gif" and store them in an array indexed by the class they're from. i.e.
array(
'body' => '/3.5.x/forums/images/placebo_two/daylight/daylight_bg.gif',
'tcat' => '/3.5.x/forums/images/placebo_two/daylight/daylight_gradient_tcat.gif',
thead => '/3.5.x/forums/images/placebo_two/daylight/daylight_gradient_thead.gif'
);
how would i go about doing that? i figure i can just grab the image locations by matching the brackets? but how i should be trying to match and how to index them on match? i've never wanted to index a regex specifically like this before.
body
{
background: #ECF2FA url(/3.5.x/forums/images/placebo_two/daylight/daylight_bg.gif) repeat-x top;
color: #000000;
font: 10pt verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif;
margin: 5px 10px 10px 10px;
padding: 0px;
}
.tborder
{
background: #4F6BA0;
color: #000000;
border: 0px solid #4F6BA0;
}
.tcat
{
background: #97B1DF url(/3.5.x/forums/images/placebo_two/daylight/daylight_gradient_tcat.gif) repeat-x top left;
color: #000000;
font: bold 10pt verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif;
font-variant : small-caps;
}
.thead
{
background: #97B1DF url(/3.5.x/forums/images/placebo_two/daylight/daylight_gradient_thead.gif) repeat-x top left;
color: #000000;
font: bold 11px tahoma, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif;
}
Source: http://community.livejournal.com/php/519089.html
-
Guilty by association to spam
Date: 12/08/06
Keywords: php, html, database, web, spam, google
I've got an interesting problem that's stumped both the senior programmer and me.
Situation:
A user is looking for a company to provide a service, they find our site at or near the #1 position on a google search result, they find a company where they need the service done, and they send a request for a quote via a php form. The form processes this request, logs it into the DB, and at a set time, that record is dropped into a MTA. This is the problem.
`From: $UserProvidedEmailAddress`
Problem:
In an ideal world, this would be fine, but thanks to spam... this sets of just about every single spam filter I know of and then a day/week later we are suddenly blacklisted by everyone including our own email service provider. In the last two months we've had to call up the spam database companies and get taken off the list (after a day or week of them doing necessary investigation to find we are in fact not spamming). The next logical step would be to replace the from field with a real email account like `info@ourserver.com` and then put the user provided email address in the `reply-to:` field of the email header instead. But my senior argues that we will still set off the spam filters and I agree and I can't see how to fix this.
So to review:
There are 3 parties involved in these script generated emails.
Customers who provide us their email addresses via the form. We protect the email addresses and flush them after 60 days (legal reasons)
Advertising clients who pay us to get these emails from our top listed site.
Ourselves, all transactions are bcc to us so we can track initial user to advertiser interactions and make sure we are providing the product our clients are paying us for( customers and web presence)
Why:
My employers want to keep it as simple as possible for our clients to respond to potential customers, hence the customer email address in the from field. But that doesn't work because of spam.
Thoughts:
Also, we can't put advertising client email addresses on the site or make them accessible to humans because spam-spiders will get them and proceed to spam the client's.
My senior has written a working prototype for an in-site messaging system using rails, but the fear is that some of our clients are to lazy/stupid to use it... I agree, some of these people are pretty dumb.
Another thought would be to put some sort of mailto: url in the emails, but not everyone uses html enabled email clients.
Source: http://community.livejournal.com/php/518711.html
-
Suite of PHP apps?
Date: 12/07/06
Keywords: no keywords
Hey everyone,
Starting on a new project that is going to involve profile pages, forums, etc. I considered Drupal, downloaded it, installed it. Really neat. But unfortunately, it appears to be a control freak of your site in order to work the way it demands. You can't customize anything without whatever code you create to be assimilated with it. So am very hesitant to go with Drupal because of future customizations that could have me re-inventing the wheel for nothing.
Does anyone know of someone who has come up with a "suite of modules"? Or even a suite of classes would be fine. Meaning, I can have a module for authentication, a forum, a blog, profile pages, but not subject my entire site to any particular one of them?
I know what is ideal and perfect. And I'll usually start creating it just to find out later that it existed elsewhere. Thought I might ask this time.
Source: http://community.livejournal.com/php/518627.html
-
Code Tidy
Date: 12/07/06
Keywords: php
Does anyone know a good tool that will tidy PHP code?
Source: http://community.livejournal.com/php/518161.html
-
Cutenews Question
Date: 12/07/06
Keywords: no keywords
Does anyone know how to get just the Comment link from "Cutenews"? I looked at http://www.swimchick.net's cutenews and she doesn't use Iframes. How do you subtract the Iframes? I'm confused, it might be a completely obvious answer, but my little tired brain isn't working right now.
I don't know where else to post this so that's why I am asking here.
Source: http://community.livejournal.com/php/517689.html
-
Require
Date: 12/06/06
Keywords: no keywords
Hi,
is anyone aware of a limit to stacking require()?
I have a file that includes 5 files each with a function. I then include that file. Then that include file is included once.
Source: http://community.livejournal.com/php/517350.html
-
credit card payment from website?
Date: 12/06/06
Keywords: php, software, security, web, shopping
I have this project, which started out as a relaunch of a relatively simple website for a photographer, and is getting more and more complicated. Which is fine, as long as I'm getting paid and I *know* what to do... ;-)
Part of the website is a simple php based ordering system without payment options (customer chooses photos, orders, gets a confirmation/invoice email; photographer also gets confirmation email, waits for customer to pay via check or bank transfer, then sends photos to the given address).
We had discussed including paypal payment, but now my client wants her customers to have the option to pay directly with their credit card when ordering. I've never done anything like this, and am not sure what is the best and most simple way to implement it.
I know some providers (no provider/host yet, so I'm open for any suggestions) offer e-commerce/shopping cart software, but I'm not sure if that's what I'm looking for, as I don't want to change anything with the ordering system itself if possible. What I do need is a way to initiate the transaction of a given sum of money from the customer's credit card to my clients bank account; including security issues and whatnot.
Is the best/easiest way to use e-commerce software? Is it possible (for someone who's not a total newbie but not a php guru either) to do that with a php script?
Any help, suggestion, information is welcome, thanks. :-)
Source: http://community.livejournal.com/php/516890.html
-
PHP password/security issue
Date: 12/06/06
Keywords: php, web
I cludged together some php to make a upload and download tool for a client and I have the username and password stored in the php file as such:
$username = "bob_the_unforgiving"; /* The username. Case sensitive. */
$password = "foobar12345";
I know this is bad but best practices get thrown out the window when you are given two days to make, test and roll out something. Does the community have any recomendations for better ways (or more secure ways) to handle the username and password since if something causes the server to make php stop working somehow possibly the php code would be visible to the interwebs.
Source: http://community.livejournal.com/php/516862.html
-
CSV to XML
Date: 12/04/06
Keywords: php, xml
Anyone familiar with converting CSV data to XML with php?
Source: http://community.livejournal.com/php/516462.html