I need to direct multiple domains to a single set of (PHP) files. So I point a domain at my server, which then goes to a single index.php file. This index.php file then detects the domain accessing it and returns the appropriate content. I do not want to add domains or set-up sites manually though as this is for a content management serv...
I created 3 language packs for my site: English, Spanish and French. I am just having trouble implementing them based on user selection. I have the following drop down menu:
<select onchange='document.location.href=this.options[this.selectedIndex].value;'>
<option>Select</option>
<option value="?lang=eng">US English</option>
<opt...
Which of these would provide the most functionality?
Defining the templates within the variable:
elseif($global[action] == "edit_template") {
$template_content = template_get($_GET['template']);
$template_content = str_replace('\"', '"', $template_content);
$template_content = str_replace('</textarea>', '</textarea>',...
I've attempted to write a PHP class that gets the uptime of my Linux machine. It will get the uptime correctly, but I have an if statement that determines whether or not the load average is "high" or not and set a warning code, and it doesn't seem to be working (it stays at 0).
I've included all of the code here from the class (50 or so...
The code I'm using is:
while($template = array_loop($templates)) {
eval("\$template_list = \"$template_list\";");
echo $template_list;
}
It appears to detect how many templates there are successfully, but it just shows the same name for them all:
Name: LayoutName: LayoutName: LayoutName: LayoutName: LayoutName: LayoutName: La...
hello im using this code to do search
<form action="arama.php" method="get">
<input type="text" name="lol">
<select name='kategori'>
<option value="tum">Tum kategoriler</option>
<?
while ($kat = mysql_fetch_array($kategori_isim)) {
echo "
<option value=".$kat[kategori_isim].">".$kat[kategori_isim]."</option>";
}
?>
</select>
<inpu...
I know it can't be done, well I hope it can't or my Google skills have failed me.
But my annoyance is beyond that now, I have abandoned all hope of ever being able to overload my constructors in PHP, so what I'd really like to know is why. Is there even a reason for it? Does it create inherently bad code? Is it widely accepted language ...
I'm using Ajax via jQuery for the first time ever. I have an html input and when a user clicks it and types something and then the focus blurs, i'm using jquery to call a php script to validate the user's input.
I'm trying to figure out how to take the variable in PHP and compare it in jQuery. Please give me any advise
Right now when ...
i've got a regular array with keys and values.
is there a simple way to remove the array element based on its value or do i have to foreach-loop it through and check every value to remove it?
...
So I want to write a REST API in PHP for JSON for consumption on the iPhone, but also a lot of websites and devices. I have the below code, when accessed via a GET statement, returns a file like:
1mdi2o3.part
How do I return something like: users.json
$db->setQuery( "SELECT * FROM users");
$db->query() or die($queryError);
$numRows ...
So I have this registration script:
The HTML:
<form action="register.php" method="POST">
<label>Username:</label> <input type="text" name="username" /><br />
<label>Password:</label> <input type="text" name="password" /><br />
<label>Gender:</label>
<select name="gender">
<optgroup label="genderset">
<opt...
I've tried parsing a list of users currently connected via SSH to a server, but the results are very irregular, so I was forced to simply do:
$users = shell_exec('who');
echo "<pre>$users</pre>";
Is there a better way to parse the output of who in the command line before I let PHP mess around with it? I want it in an array which conta...
hey guys.
I have a form that generates new input fields via JavaScript on click.
the inputs are successfully added to the FORM with the desired naming convention.
<input type="text" name="util_name0" id="util_name0" value="" /><br/>
<input type="button" onClick="newUtil(this)" value="Add New" />
newUtil() adds:
<input type="text" nam...
What are the advantages and disadvantages of both active record and data mapper?
Please be PHP-specific, where the language matters.
Personal experiences are welcome! Ideally with both.
...
Say I had 2 paragraphs of text to compare..
1) "Text text text text text
text text text text text
text text text text text"
2) "Text text text text text
text text text NEW TEXT text text
text text text text text"
How would I go about finding out what the different parts are from the first paragraph to the next (like what you see in w...
Hi there, i run a system which needs to update various xml files from data stored in a db. The script runs via a server side php file which is monitored by a daemon so that it executes, finishes to free resources, then is restarted.
I have some benchmarking within the script, and when i have to update 100 xml files, its taking about 15...
I would like to learn to use Oracle some, just for the sake of learning it. Is there a way to do this without spending a lot of money? I looked on the oracle site and the cheapest thing I saw was this...
Oracle Database Personal Edition
Oracle Database Personal Edition is designed to provide software developers a cost effective, yet...
Are there any free OCR libraries that work with PHP? Perhaps there is a different way to do OCR on a website. If so please share.
EDIT: Python is also acceptable.
EDIT2: I'm working with a Linux server, ideally.
...
I'm trying to get data from a class in php5, where the data in the class is private and the calling function is requesting a piece of data from the class. I want to be able to gain that specific piece of data from the private variables without using a case statement.
I want to do something to the effect of:
public function get_data($f...
I have a string such as:
"0123456789"
and need to split EACH character into an array.
I for the hell of it tried:
explode('', '123545789');
But it gave me the obvious: Warning: No delimiter defined in explode) ..
How would I come across this? I can't see any method off hand, especially just a function
...