In PHP, what is a list of potentially harmful characters that can be used to break a PHP page? And, using regular expressions, how can I filter out the bad sequence of characters from all of my user input?
For example.. to check if a email is valid I would use the below line:
preg_match("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-...
The main problem of this thread is moved to here about boolean datatype in PHP / Postgres.
The problem is the conversion of t and f to true and false, since Postgres stores true and false as such.
How can you use the variable a_moderator in SESSION?
I fetch the value of the variable a_moderator by
#1 code of how I get the variable...
How do you sanitize data in $_GET -variables by PHP?
I sanitize only one variable in GET by strip_tags.
I am not sure whether I should sanitize everything or not, because last time in putting data to Postgres, the problem was most easily solved by the use of pg_prepare.
...
Started using PDO prepared statements not too long ago, and, as i understand, it does all the escaping/security for you.
for example, assuming $_POST['title'] is a form field.
$title = $_POST['title'];
$query = "insert into blog(userID, title) values (?, ?)"
$st = $sql->prepare($query);
$st->bindParam(1, $_SESSION['user']['userID'], PD...
ive heard a few timse that sessions need to be cleaned with mysql_real_escape_string or htmlspecial chars because they can be modified. what im wondering is how are they modified because when i look at a websites session named PHPSESSID the value it contains is always encrypted.
first of all what encryption method is it using and how is...
I have some php code that I'm trying to use to connect to gmail using imap. Here's the code:
$hostname = '{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX';
$tmp_username = 'username';
$tmp_password = 'password';
$inbox = imap_open($hostname, $username, $password) or die(imap_last_error());
And I get this error output everytime i tr...
Hi guys,
I have a stdClass object created from json_decode that won't return the right number when I run the count($obj) function. The object has 30 properties, but the return on the count() function is say 1.
Any ideas?
Below is an example of one of the objects. (I'm requesting the daily trend information from Twitter). If this ob...
How can you preserve "enters" given by the user in the database and show them then to other users?
I store the question of the user and use the following functions to sanitize the user data, prepare it, and execute the SQL command, respectively.
pg_escape_string
pg_prepare
pg_execute
I use htmlentities with ENT_QUOTES to convert t...
The agavi framework uses the PUT request for create and POST for updating information. Usually in REST this is used the other way around (often referring to POST adding information while PUT replacing the whole data record).
If I understand it correctly, the important issue is that PUT must be idempotent, while POST does not have this r...
I can't believe that the following statement seems to be still true
So, I switched to integers and 0 or 1 works fine, but it is
stupid, that the database system has boolean variables of a smaller
size, but I should use integers for boolean values!
How do you use boolean datatype with Postgres / PHP?
In other words,
Is the only way t...
I have a CORE class that pertains only to my specific site, ie, it performs site specific functions. I have a database class (for mysql), and other classes like access, validator, upload, template etc etc... I know that php classes can only extend one class each, so almost all of my classes extend the database class. I was looking over ...
I am creating a calendar application. In the Events table, there are two columns, a start and end timestamp.
EVENTS - { start_timestamp, end_timestamp }
I have two variables in my PHP application. One is the timestamp of the beginning of a month, another is the timestamp of the end of a month.
I want to select from the events table ...
I know that being open source does not necessarily makes a program more/less secure than closed source (let's assume this neutrality, to keep flames out of this post). Fact is: since the source code is open, everybody knows your defaults urls, default administrator logins, etc.
I'm using Wordpress and Joomla in some projects of my clien...
How do you compile integer data in Postgres by PHP?
My integers are string as the following show by var_dump ( $_SESSION )
'logged_in' => int 1
'user_id' => string '9' (length=1) // should be int
'a_moderator' => string '0' (length=1) // should be int
I compile the values by the following code which ...
On the file_put_contents() documentation, it says the following:
FILE_APPEND:
Mutually exclusive with LOCK_EX since
appends are atomic and thus there is
no reason to lock.
LOCK_EX:
Mutually exclusive with FILE_APPEND.
Yet, a couple of lines bellow I see the following code:
<?php
$file = 'people.txt';
// The new person t...
I have this html form which calls a php file .
The index.html ->
<form action="html_form_submit.php" method="post">
<textarea name="name" rows="2" cols="20"> </textarea >
<input type="submit" value="Submit" />
</form>
from html_form_submit.php ->
<?php
$name = @$_POST['name'];
?>
<html>
<body>
<p>
Id: <?php echo $id; ?><br>
Name: <?...
What does the following line mean?
jQuery.post('/codes/handlers/delete_a_question.php',
{ question_id: jQuery(this).attr('question_id') }
Context in HEAD
jQuery('a.delete_question').live('click', function(){
jQuery.post('/codes/handlers/delete_a_question.php',
{ question_id: jQuery(this).attr('question_id') },
...
I have an already setted up cron job. Now i have a file whose cron i have to setup such that my file should run at 9:00 am,11:00am,1:00pm,5:00pm and 7:00pm
Idont have much idea about cron So can anyone please help me in setting up this cron for my file at the aboove given timings !!
...
How can you search only unique words with PHP such that I can learn the basics in making the search?
I have had a few problems in making a multidimensional array for questions.
My first unsuccessful attempt is the following.
#1
$result = pg_query_params ( $dbconn,
"SELECT question_id, body
FROM questions",
array ()
);
...
I try to get round corners for textbox. But how can i get it. Here is the class
.tbox
{
float:left;
width:200px;
margin-top:10px;
margin-left:10px;
}
when i call using jquery using
$('.tbox').corners("4px");
it is not working. I already included Jquery.js and jquery.corners.js. But its not working. Any help would be appreciate...