I'm trying to generate php files that 'include' a template html file, as so:
$page = htmlspecialchars("Hello! <?php include("template.html"); ?>");
But, when I run it, I get:
Parse error: syntax error, unexpected T_STRING in /home/oliver/web/postmanapp.com/public/core.php on line 15
I'm pretty sure I need to escape the PHP code, jus...
I am a PHP web programmer who is trying to learn C#.
I would like to know why C# requires me to specify the data type when creating a variable.
Class classInstance = new Class();
Why do we need to know the data type before a class instance?
...
Hi:
I have a large table and would like to at least find the most repeated works so I can have a trends keyword list.
The database is mysql and I am running php5.
Is there any other way besides exploding the data and searching for repetitions on the php side?
What about having combinations of 2/3 words keyword trends?
Any thoughts?
...
I have 2 sites where mail is sent to two vanity gmail accounts. I'm using PHP to handle the mail, but the mail is not showing up at gmail (not in spam/junk, it just doesn't show up). If I switch the PHP to send to my personal hotmail account, the mail shows up. Same for a personal email account through my ISP.
The mail used to show u...
Hey!
I'm writing a script to extract files from a zip archive into the directory that the script is located.
Here's my code:
$zip = new ZipArchive;
if ($zip->open('latest.zip') === TRUE) {
$zip->extractTo('.');
$zip->close();
unlink('installer.php');
echo 'it works!';
} else {
echo 'failed';
}
This works fine, but there's one p...
Hi! I want to make a simple news system using PHP and MySQL, right now I got a working post and read system but there is only one problem, I want it to show the 10 latest news but instead it shows the 10 oldest news.
My question is: Is there a way to make MySQL return the results from the bottom of a table or do I have to first get the ...
http://localhost/allsides/.htaccess
RewriteRule (.*) index.php?$1 [L]
http://localhost/allsides/test
One or more chars after allsides/ are saved in $1
$_GET is $1.
test is not $_GET!
What is wrong?
...
I have been assigned to add a forum into an in-house CMS we have been using for some time. The system has its own login/user system and an established user database. Ideally I'd be looking for the easiest forum software to convert to use with our system, but if necassary can rewrite and migrate the user databases to use the forums syst...
In PHP+MySQL+PDO, would it be much slower to do
Get an item's ID by name
Get item data by ID
than to just
Get item data by name
The latter is only one query, so obviously faster. The former makes for cleaner code though (because the item's ID is often also just known beforehand), so it would be better if the performance differenc...
I am trying to create a timesheet and want to have the following SQL Query done:
I have the fields datebeginning and dateending and jobid and I want to only add a new one if no open one exists for a given job id and if not I want the query to update the fild dateending for the given id. Is there a way to do that without using PHP to fir...
(N is unknown)
$controller->$action($params);
must be
$controller->$action($param1, $param2, $param3... $paramN);
...
I am running this loop in php but using a jquery click function during the output. How can i record which instance of $i was clicked. When I use $(this) it returns the id.
The $('#pid-form').val('$frame_id[$i]') actually has the number i want as the value but I am not sure how to use it or convert it to a variable that I can use.
f...
preg_match('/(.*?)see below[^,\.<]*/s',$xml,$match);
echo $match[0];
the ouput is,which I think the non-greedy matching is not working:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<UserCredentials xmlns="http://jobg8.com/postadve...
Fatal error: Call to undefined function lcfirst() in C:\xampp\htdocs\allsides\others\basecontroller.php on line 9
How come it didn't find a Text Proccessing function mentioned in the official php manual (http://www.php.net/manual/en/function.lcfirst.php)?
...
I'm trying to send information from a form and a hidden email variable (from a db) to a PHP script using cURL. I have the post items moving correctly, but I am not sure if can also send a variable vai the url. (the $_Get)
...
With
include('basemodel.php');
I get
Fatal error: Class 'BaseModel' not found in C:\xampp\htdocs\allsides\account\model.php on line 2
Without
include('basemodel.php');
I get
Fatal error: Cannot redeclare class BaseModel in C:\xampp\htdocs\allsides\others\basemodel.php on line 2
...
I am using this JQuery Ajax Voting system guide as a rough reference but I am a little troubled at the security of this. Right now this guide basically stores the ID of something and the vote statistics for it.
I'd like to go off a similar idea but I need to include the userID as well so a user can only vote once. This is stored in a PH...
In PHP, I know that mysql_real_escape in much safer than using addslashes.
However, I could not find an example of a situation where addslashes would let an SQL Injection happen.
Can anyone give some examples?
Thanks!
...
I'm working on a new CMS to use on repeative projects. Basically this chunk of code connects to a server, grabs all the names of the tables and uses them to generate a simple navigation. It works pretty great for what I need however I'm just wondering if maybe I can optimize this code sniplet even more and make it even more simple. Ma...
i have an example here of two arrays from the form,
<input type="text" name="children[]" />
<input type="text" name="age[]" />
my problem is to insert the value above in the same table like
insert into childTable(children,age) values('children[]','age[]')
it's in the form of array coz i don't know how many children to input..
can u...