I am coding my first object factory, and I am wondering if there any any drawbacks to passing one object into another when creating the second object, and then saving the first object within the second for use later?
Example:
class main
{
public $connection = array();
// various other useful functions that should be loaded on ...
For some reason a call to header() causes an internal server error for me. I'm using PHP5 and use mod_rewrite extensively in this script (if that helps). Here is the code (sort of):
<?php
include 'core/initialize.php'; // Loads the core class (and session manager class)
if($_GET['reset'] == 'true')
{
$core->Session->...
I have a client that is using WP for a CMS. He wants un-registered users to be able to submit content. It's a form that has the following fields:
Your name
Your email
Friend's name
Friend's email
Message
Submit
Then the message would be posted on the site (as a comment) and that message/comment would then be emailed to the Friend's ema...
Just an idea:
example (in PHP):
to set name:
$object->name('name');
to get name:
$object->name();
If no argument: the method is used as getter, else as setter. For simple getters/setter. Stupid, whatever, maybe?
edit: to follow up on the answers: I don't really like get and set because I prefer to have the interface as explicit as pos...
I am working on my captcha image script, I know the fonts I use are stored on the server end but I am wondering for a high traffic site, does the font size (like kb and mb not dimensions) does it make a difference on the server? Some font's I was messing with are like 4-5mb and then some are under 1mb, is it better to use the smallest ...
for($x=0; $x<12; $x++)
{
$month = mktime(0, 0, 0, date("m")+$x, date("d"), date("Y"));
$key = date('m', $month);
$monthname = date('F', $month);
$months[$key] = $monthname;
}
I know for sure I'm doing the math incorrectly for the 4th parameter of mktime. I'm starting with the current month number ( 7 being July ) and a...
Anyone Please help me in implementing Paging in my project. I have nearly hundred pictures in images folder. When the user clicks the gallery link, the page will be directed to gallery.php, where the pictures should be shown 10 by 10. Please help me i need solution soon.
...
What should I look into to accomplish this.
When you select an input field some text to the right shows up.
For example: https://twitter.com/signup
Anyway i need something like that works with PHP. What should I look in to?
And also How can you query the database and not have to reload the page to see result? For example i have seen ...
I have been trying to make this search engine for a MySQL database. Taking in user input is no problem, database querying is also fine.
One thing I need to figure out is this:
I am a string in the database
How do I match the input "AM", but keep the same case? There are PHP functions like str_ireplace or preg_replace/eregi_replace...
I'm using Subversion for one of my PHP projects. I have two questions/issues:
How are file permissions handled with Subversion? If I have a file that I CHMOD to 755, and I check that file into the repository, will it have the same permissions when it's checked out into other working copies? If it does not copy, do I really need to chan...
I'm building a very basic CMS for a specific project that contains numerous functions such as get_menu(), get_title(), get_recent(), etc. However, I want to be able to store templates, which would be echoed during page load, that contain said functions in the MySQL database.
Doing a str_replace for each possible function would be a pit...
Where can i store picture while paging. Whether it should be stored in folder or db. What to store in the db. entire images or only path. if path only how to get the path for a picture in a directory. Please help me
Exact Duplicate: User Images: Database or filesystem storage?
Exact Duplicate: Storing images in database: Yea or nay?
...
I am currently using similar_text to compare a string against a list of ~50,000 which works although due to the number of comparisons it's very slow. It takes around 11 minutes to compare ~500 unique strings.
Before running this I do check the databases to see whether it has been processed in the past so everytime after the inital run i...
How to fetch the images from a folder and display it in the page, whether i can resize it in php itself or i have to resize it and upload it separtely to display it as thumbnails?
...
I am working on a captcha image type script and I am wanting to alternate each letters color on my image, so far I have it working pretty much except the color values are not what I expected
The colors in this $multi_text_color variable should be the colors that it randomly picks and shows, it does work in randomly picking the color arr...
Im working with a php url shortener and my problem is that it only creates the MAX number of shortening codes up to 2 characters (eg domain.com/XX). I want it to go up to 5 characters (eg domain.com/XXXXX)
I believe i found the relevant code, but im not sure how to change it to allow for this modification
function decode_url_id($code)
...
I'm trying to read a CSV file generated by M$ Excel on linux.
The file has quoted multi-line (x0A separated) columns and a 0x0d0a line termination.
PHP on Linux uses 0x0a as line terminator, so all the line-based tools (file, fgets, fgetcsv) thinks there are record breaks in the middle of the data cells.
Short of processing the file ...
I am using file_get_contents to grab a page, but i need to replace some data in the contents of the page before echoing it.
I have this so far (this script runs on domain2.com)
<?php
$page = file_get_contents('http://domain.com/page.html');
str_replace('href="/','href="http://domain.com','$page');
echo $page;
?>
The problem is, that...
Hey everyone,
I am writing a simple profanity filter in PHP. Can anyone tell my why, in the following code, the filter works (it will print [explicit]) for the $vowels array and not the $lines array which I constructing from a text file?
function clean($str){
$handle = fopen("badwords.txt", "r");
if ($handle) {
while (!feof($hand...
Hi
The following code will retrieve the body content of a url retrieved using CURL in php but not https. Can anyone tell me how I edit the code as I need to get the data returned not just the header.
From the test I did here is the result. You can see it has a content-length, I just don't know how to access it.
Thanks
Stephen
Error...