php

How to escape/strip special characters in the LaTeX document?

We implemented the online service where it is possible to generate PDF with predefined structure. The user can choose a LaTeX template and then compile it with an appropriate inputs. The question we worry about is the security, that the malicious user was not able to gain shell access through the injection of special instruction into l...

MySQL & PHP - select/option lists and showing data to users that still allows me to generate queries...

Sorry for the unclear title, an example will clear things up: TABLE: Scenario_victories ID scenid timestamp userid side playdate 1 RtBr001 2010-03-15 17:13:36 7 1 2010-03-10 2 RtBr001 2010-03-15 17:13:36 7 1 2010-03-10 3 RtBr001 2010-03-15 17:13:51 7 2 2010-03-10 ID and timest...

php's strip_tags() won't work

Hello everyone I'm trying to tweak a tiny bit a wordpress, but i am level 0 in php, so i kinda suck :/ I want to add a custom 'tweet this' button (i know there already is a gazillion of them, i just wanted to do it on my own, for fun) So, i'm trying this : <a href="http://twitter.com/home?status=&lt;?php strip_tags(the_excerpt()) ?>...

PHP HttpRequest Cookie Issue

I have a chunk of code to login to test a web site login: $r = new HttpRequest($newlocation, HttpRequest::METH_GET); $r->addCookies($cookieArray); $r->send(); The content of $cookieArray is from a redirect, but I don't modify it in any way. The really baked part is that if the value of the cookie (an authentication token string) contain...

Integrate website backend with forum software?

I am designing a php/mysql website that will have a members are and a separate "forum" section. Should I just use the forum software as my "login/registration"? If this is the case should I go with VBulletin, Invision, phpBB3 or something different? Or should I roll my own single sign on hack? Or something completely different? ...

MySQL Collation or PHP side to display accented letters properly

What is the best Collation for the column that can allow to store accented letters and parse them out perfectly without any encoding error, because whenever I add an accented letter such as é, å, it shows out with an encoding problem on the PHP side, but in the MySQL side it's fine... How do I get the accented letters display properly? ...

AS3 equivalent of PHP's deg2rad

Hey all, what is the Actionscript 3 equivalent of PHP's deg2rad function? ...

I could really use a php based directory printer that lists all of the folders found in a windows directory.

Is this possible without uploading any of the clients files to my server? ...

Loading a class into a function ?

I`m currently working on a script, and I have the following situation. function somnicefunction() { require 'someexternalclass.php'; $somevar = new SomeExternalClass(); } For some reason, the above breaks the function. I'm not sure why, I haven't seen much documentation in php.net regarding this, plus google returned no real r...

Quick question on session security.

Hey guys, I was scanning my site for security and I noticed that it was possible for non users to send requests and post information, so I decided to put login checks on all information posts. I was wondering if it was a good way to keep a session id that is created by md5(uniqid()); in a session variable $_SESSION['id']=md5(uniqid()); f...

How to recursively display folders and sub folders with specific file types only using PHP5 RecursiveDirectoryIterator class

Hi I am trying to get RecursiveDirectoryIterator class using a extension on the FilterIterator to work but for some reason it is iterating on the root directory only. my code is this. class fileTypeFilter extends FilterIterator { public function __construct($path) { parent::__construct(new RecursiveDirectoryIterator...

Simple POST random number issue in PHP

Ok I am trying to make something to ask you random multiplication questions. Now it asks the questions fine. Generates the random questions fine. But when it reloads the page the random numbers are different... how can I fix this? <?php $rndnum1 = rand(1, 12); $rndnum2 = rand(1, 12); echo "<h3>". $rndnum1 . " x "; echo $rndnum2 . "...

Show one at a time?

I have a script on my website that shows messsages from a mysql database. Now I want to make it so it only pops up one message at a time. Anyone want to shed some light on this? Windows Vista PHP - Mysql - Ajax - JS I can't really provide a code sample but here is some pseudocode: if(ID == 1) { // SHOW ID++; } // Show #2 ...

PHP next MySQL row - how to move pointer until function checks true?

I have a PHP script which takes a value from a row in my MySQL database, runs it through a function, and if it determines it's true returns one value, and if it's false, it needs to go to the next value in the database and check that one until eventually one returns true. I think I need to use mysql_fetch_assoc, but I'm not really sure i...

is this valid json array using php

Hello, I need to convert some code done by someone else, to work in my mvc model It is using some functions like EOD that I don't understand. Does that still work in a class? Primarely, my question focusus on the json output. The old code does not use the php json_encode function, but outputs it directly like this ?> { "use...

What Gotchas When Learning C++, If I came from PHP/Java?

Hi, I need to learn C++ in order to learn building Nokia WRT and or maemo application. I need to know what gotchas and what aspect of C++ that I need/have to learn or focus more. One thing I got in my mind is that C++ doesn't have garbage collector. Therefor, I need to focus on variable type. But, is there any others that really importa...

How do I set ORDER BY params using prepared PDO statement?

I'm having problems using params in the ORDER BY section of my SQL. It doesn't issue any warnings, but prints out nothing. $order = 'columnName'; $direction = 'ASC'; $stmt = $db->prepare("SELECT field from table WHERE column = :my_param ORDER BY :order :direction"); $stmt->bindParam(':my_param', $is_live, PDO::PARAM_STR); $stmt->bind...

How do I continue a session from one page to another with PHP

Ok I set up a session... but now how do I make it work on my other pages? I tried doing @session_start(); if(isset($_SESSION['$userName'])) { echo "Your session is running " . $_SESSION['$userName']; } ...

Trouble pre-populating drop down and textarea from MySQL Database

I am able to successfully pre-populate my questions using the following code: First Name: <input type="text" name="first_name" size="30" maxlength="20" value="' . $row[2] . '" /><br /> However, when I try to do the same for a drop down box and a textarea box, nothing is pre-populated from the database, even though there is actual conte...

How to know that a php project is using Zend framework?

I am writing a piece of small software to go through the folders and files of all the php projects that are passed in and detect if any of them is actually also a Zend project. Is there any particular file that I can immediately read and tell that the current project is a Zend project? or is there any convenient way to tell? ...