Got an error today that I thought was interesting. Must be a way to do this, perhaps I just have the wrong syntax.
class test{
private $test = '';
__construct(){
$this->test = "whatever";
}
function getTest($var = $this->test){
echo $var;
}
}
This throws an error basically saying that $this->test as a function ar...
I'm uploading files via JS and storing the temp path in the session.
Than i use the following code to move the files.
if(move_uploaded_file($_SESSION['temp_img'][$key]['path'], $dest.$bigimg)){
$dest and $bigimg are defined earlier in the script with the id from the database.
Any Ideas or alternatives ?
...
I am having problems figuring out how to retain users data when the validation fails. I am somewhat new to PHP so I might be making some huge mistakes in my logic.
Currently if the validation fails all the fields are wiped clean and $_Post data is also gone.
Here is some code assuming the user enters an invalid email I want the Name f...
Hi,
I am using a MySQL database with PHP. I store my date values in the database using the DATETIME field.
I'm using this PHP code to convert inputted dates to the appropriate format for MySQL.
date("Y-m-d H:i:s", strtotime($inputDate))
However, whenever a date is invalid, it is placed in the database as 1969-12-31 19:00:00
Is ther...
I'm working with a large legacy project created using CodeCharge Studio. We're looking to get away from CodeCharge, as we really don't like it (for a number of reasons).
We're not going to be able to rewrite the entire project at once, it's going to happen in increments. As a result, I need this question answered: which of the other po...
i want an .htaccess rewrite
so /en/home pulls /home
/es/stuff.php pulls /stuff.php
/fr/something/thisis.php pulls /something/thisis.php
without it being visible in the url.
...
I'm not trying to load javascript with jquery or anything of that sort.
Currently I'm modifying swfupload (if you'r familiar with it, great, otherwise it shouldn't matter) to work with a website I'm building. I need the ability to upload, store and delete files. I have the uploading and storing working great.
I have a file called hand...
Hi,
I am using mod_rewrite to create SEO URLs. Basically the thing works in the following way:
all requests are caught by .htaccess and redirected to a php script (let's say transform.php). transform.php parses SEO URL and transforms it into a normal URL, then includes index.php, then catches application's (index.php's) output and uses ...
I look at the manual but can't seem to find the answer.
What is the default visibility in PHP for functions without a visibility declaration. Does PHP have a package visibility like in Java? Example:
class test {
-- is go public or private?
function go() {
}
}
The reason I asked because I've seen many contructors code writte...
I don't want to specify the ".php" file extension in the link. But when I do that I can't successfully check to see if the file specified in the link exists or not. This is because PHP's built in "file_exists" function takes the .php extension in consideration. And even this doesn't work:
file_exists($file.".php");
Anyway, is there som...
I've done a bit of web programming (using PHP and MySQL), but nothing too large in scale. I've been thinking about how someone would create a social networking type of site and I've ran into some problems.
How would you safely and securely store passwords in MySQL? What kinds of encryption would you use?
If users were allowed to upload...
Hello,
I have a table that is passed via ajax and displayed. When the code is passed, it also passed all the javascript associated with the pass, as the code doesn't seem to work if I just put it in the page that it is being passed to.
When I click a in the table that has been passed, I would like to take the data convert it to a inp...
Here's what I'm trying to do:
I'm parsing incoming email, and using it to create posts in the system. This works almost completely, but there's a few bugs to work out. The one that's currently giving fits is coming up when an email contains certain characters (for example, ® – “ ”), the email body is being truncated at the special cha...
Kind of an unclear question but I'm trying to check if a username has been taken or not. The code I have now isn't erroring but it's also not working, when echoing the $username variable I get nothing.
$sql="SELECT people_username FROM people WHERE people_username='{$_POST['username']}'";
//Set the result of the query as $username...
What ways are there for detecting exploits in PHP/MySQL web applications (checking for certain characters or pieces of codes in the GET, POST, COOKIE arrays / using a library with a database that has all the patterns for common exploits, if any exist?) and how should I proceed when one is detected?
For example, if someone tried to find ...
Or in more specific words, is it "ok" to not be relying on setters and getters?
I'm dealing with a class that checks the availability of rooms and sets public properties of which there are more than a dozen. Things such as:
unitNumber
roomTypes ( array )
codeCorporate
codeGroup
numberKids
numberAdults
numberRooms
currency
minRate
maxR...
I have a problem when moving an uploaded file into a local directory.
When running the following code, the output is always "error uploading file". It seems to always not meet the condition for the 'move_uploaded_media' function and therefore $result is not being set?
Are there any glaring mistakes?
<?php
$page_title = 'Admin | Multi...
I want to echo a stylesheet inside the head section of a web page. Right now when I do this:
if($browser == "Opera")
{
echo "<link type='text/css' rel='stylesheet' src='/opera.css' media='screen' />";
}
it does echo the style sheet in the source code and not the page itself which is good but it doesn't echo it inside the <head></h...
It would be nice to be able to refer to a set "static" folder as a variable instead of having to keep track of a specific URL that might need to be changed if static media gets moved to a CDN later on.
For example, this:
<script src="{static_media}/js/jquery-1.4.min.js"></script>
Instead of this:
<script src="/static/js/jquery-1.4.m...
Hi,
I am trying to MD5 a string in ActionScript using the MD5 algorithm that was created by Adobe and is part of AS3corelib. (http://as3corelib.googlecode.com/svn/trunk/src/com/adobe/crypto/MD5.as).
I am comparing this to an MD5 created in php that I know is correct.
If I create MD5s using AS and PHP for say a string like "abcd1234" ...