In a previous post, I was trying to update the encoding for a download file from php. One of the suggestions was to run the unix2dos command before sending the file to the user. This works great when I run the command on the linux box, but when I try and run the command from php I get nothing. Here is what I tried:
$cmd = "unix2dos -...
I'm looking for the simplest way to recursively get all the parent elements from a database using the adjacency list / single table inheritance model (id, parent_id).
My select currently looks like this:
$sql = "SELECT
e.id,
TIME_FORMAT(e.start_time, '%H:%i') AS start_time,
$title AS title,
...
I created a simple PHP site for a friend last year. I went to check out the site yesterday and when the main page loads up, my AV software (Avira Antivir) raises an alarm about a JS/Redirector.A malware infection. The message seems to indicate that one of the CSS files is infected.
I'm obviously going to go through all the code on the s...
I am trying to do a little bit of math using dates in PHP. I am modifying a shoutbox, and I want to implement the following functionality.
If post date = today, return time of post
else if date = yesterday, return "yesterday"
else date = X days ago
How would I use php's date functions to calculate how many days ago a timestamp is...
Is it possible for a PHP script to be inside a GIF file? I found one when I opened a .gif file in notepad++.
...
Hello,
I have a javascript code helping me to dynamically create row after row in a table and to delete a row from that table.
each row has four cells. cell 1 for instance contains a text zone.
to differentiate cell1 from row 1 with cell1 from row 2, I rename my cell 1 like that cell1.name= cell1.name + '_' + row.rowIndex.
I create a s...
I'm developing a site that's pretty lightweight on the interface and mostly database driven (equal amounts read and write). It's written in PHP and I've found the easiest way to make each page is:
Page:
<?php include("header-nav.php"); ?>
<table>
<tr>
<th>Column 1</th>
<th>Column 2</th>
</tr>
<tr>
<td>Da...
Hey!
I have this mail script I have to run a few times.
To start the script I will use cron, but the script has to run 2 or 3 more times (with an hour apart).
What's the best way to do this?
To use the sleep command for an hour, or at the end of the script, place some code, so that the script will create a new cron job to run it self...
I have some pages that I don't want users to be able to access directly.
I have this function I came up with which works:
function prevent_direct_access()
{
if($_SERVER['REQUEST_URI'] == $_SERVER['PHP_SELF'])
{
//include_once('404.php');
header("Location: 404.php");
}
}
This does exactly what I want, the URL doe...
Hello!
I've been asked to come up with a plan (and implement) a way to customize ad campaigns on an individual post basis. Some background info: Our site in question runs off of Wordpress MU 2.7, and in our theme files we include calls to our ad server to display ads etc. This is managed with our own custom ad plugin, so we can easily ...
Hello,
I have a rather simple question. How would I write this statement in php?
$q="SELECT t1.gebruikersnaam FROM tbel_leden as t1,instellingen as t2 WHERE
t2.ledenid=t1.ledenid AND t2.livetracking=1";
I know it's just supposed to be a string but the error says unexpected t_variable and php admin is not helping either.
Thanks
...
Hi,
My structure: in each category there are texts. These texts are entries of its own. So, table 'category' and table 'texts'. There are about 90 texts in every category, each text is about 300 characters.
What i want to do is to make meta tags (keywords) for the categories. How to> get all relevant 'texts' and rank all words and take...
Hello, I'm testing codeigniter, trying to create a simple blog.
The video tutorial on codeigniter' site is nice, but very incomplete.
I'm not too familiar with the MVC structure, and am wondering exactly what goes in a "model".
For instance, I'm currently doing the "admin" part of the site : add a new entry, delete, modify, and so on....
As outlined by this guys post, blocking IP's via PHP is pretty easy.
However, how can I do this, site wide, using IIS?
Here are my (big) caveats:
I do not have access to change the php.ini. So I can't use auto_prepend feature.
I am on Windows with IIS so I can't use .htaccess.
I don't have any PHP "footer" which gets called on all o...
Hello,
my question is how I can echo this the right way
because the variable in the onclick function gives out a undefined error
$openchat="<a href='javascript:void(0)' onClick='return chatWith(" . $livenaam .")'>" . $livenaam . "</a><br>";
echo $openchat;
I want to use it in a loop to get a list off users online for the chat
Thank...
Hi,
I have a series of check boxes that are coming out of one MySQL table:
<?php
$result = mysql_query("SELECT * FROM strategies");
if (!$result) {
die("Database query failed: " . mysql_error());
}
while($row = mysql_fetch_array($result)) {
$strategylist = $row['name'];
$strategyname = htmlspecialchars($row['na...
I am going to post some data from one website to another website. I need a way for the receiving website to be sure that the data was sent from the sending website and not sent by some other malicious user. I am using PHP4.
How can I do this?
Thanks!
...
hi my friends , i just want to know about the language transation for the Japanese,
1) Which is the best encoding for the database mysql
2) Which/how can i print that in HTML page. ?
thanks in advance.
...
I have a page template where I want to list entries for each child page ( but not their child pages), and display some things based on the pages name, and custom fields. How would I do this?
Using wordpress 2.8
...
I want to take an array and use that array's values to populate an object's properties using the array's keynames. Like so:
$a=array('property1' => 1, 'property2' => 2);
$o=new Obj();
$o->populate($a);
class Obj
{
function Populate($array)
{
//??
}
}
After this, I now have:
$o->property1==1
$o->property2==2
How...