I have 4 IF sentences, after that i want to say else(not the condition of any of if) but i get an error.
I have:
if (condition 1) { }
if (condition 2) { }
if (condition 3) { }
if (condition 4) { }
else { }
What am i doing wrong ?
...
Can anyone say
How to integrate custom css file to fckeditor or
which are the files need to edit and how
...
I'm looking for a way to tell Apache that if there is a request for a file from a certain directory it should first run a php script to verify if the user is logged in.
I know I could put the directory outside of the docroot and let a php script handle the authentication and file downloads, but because these are flash files that try to o...
Hi,
I am using cakephp 1.2. I am using httpsocket get method. It works well. But the content is enclosed by quotes..
string(123) "..this is where the content is".
I think it is telling the type of response and the number of characters of the output. I have my application in production setup.
How can i remove it.
I appreciate any h...
my code-
$username = mysql_real_escape_string($_POST['username']);
$password = mysql_real_escape_string($_POST['password']);
but it throws warning-
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\xampp\htdocs\pics\confirm_login_credentials.ph...
Are PHP resource IDs unique per PHP instance? Does casting all kinds of resources to string returns "Resource id #X" (where X is some decimal number)? Is there a function that returns resource ID (I know about get_resource_type() to get resource typem, but didn't find anything like get_resouce_id()), or does it have to be done like this?...
I'm making a KSSN (Korean ID Number) checker in PHP using a MySQL database.
I check if it is working by using a file_get_contents call to an external site.
The problem is that the requests (with Hangul/Korean characters in them) are using the wrong charset.
When I echo the string, the Korean characters just get replaced by question mark...
Hello,
say I have XML:
<root>
<nodeA />
<nodeA />
<nodeA />
<nodeC />
<nodeC />
<nodeC />
</root>
How do I insert "nodeB" between As and Cs? In PHP, preferably via SimpleXML? Like:
<root>
<nodeA />
<nodeA />
<nodeA />
<nodeB />
<nodeC />
<nodeC />
<nodeC />
</root>
...
I have asked this question before and accepted the answer but now I found that the php version on our server is 5.2 and DateTime::diff() is not working on that.
I want to calculate person's age in months plus days using date of birth and a given date.
Date Format Input: Y-m-d (example: 1986-08-23)
Output:
5 months and 20 days old.
15...
I have the following code that adds a record to my MySQL database via PHP:
Contact is just a plain string.
$contact = mysql_real_escape_string(stripslashes($_POST["contact"]), $con);
$sql="INSERT INTO custom_downloads (contact) VALUES ('$contact')";
Is this good enough to prevent any sort of SQL injection attacks? What else can I do ...
I have a weird problem. Every time i execute this query in php i get the output "Challenge" even if the query is empty (should get "emptyq" if empty) when i test it in phpmyadmin everything is great and query is empty when it should be. I also tried to echo $detectChallengeRes[0][1] and got nothing. I cant find the problem, any help is v...
hoe we can stop to accept externally created session identifiers..
thanks
...
hi to all
i am using php and i am having problem to parse the href from anchor tag with text.
example: anchor tag having test http://www.test.com
like this <a href="http://www.test.com" title="test">http://www.test.com</a>
i want to match all text in anchor tag
thanks in advance.
...
HI,
I am using the following code
request.js
var request;
function runAjax(JSONstring)
{
// function returns "AJAX" object, depending on web browser
// this is not native JS function!
request = new XMLHttpRequest();
request.open("GET", "request.php?json="+JSONstring, true);
request.onreadystatechange = sendData;
...
my code-
<?php
$username = $_POST['username'];
$password = $_POST['password'];
require 'database.php';
$q = "SELECT id FROM users WHERE user_name = '$username' AND password = '$password'";
$result = $mysqli->query($q) or die(mysqli_error());
if (mysqli_num_rows($result) == 1) {
setcookie('authorized', 1, 0);
header("Location: index...
I want to integrate the services of escrow.com in my PHP site.
How would you get started with this goal, and what APIs provided would be the basic functionality? Do you have any PHP specific advice or gotchas? Would you recommend another service provider?
...
Hello, there is a way to make a fsockopen with unlimited timeout ? Like CURLOPT_TIMEOUT=0 ?
...
hi,
I need a help with regex which checks the string contains only letter and numbers but not only numbers
Valid
* letters
* 1wret
* 0123chars
* chars0123
* cha2rs
Invalid
* 1324
* xcvxxc%$#
* xcv123xxc%$#
* _012chars
* _test
...
I am currently trying to figure out what the best way is to create my objects on my current PHP 5.2 project. I basicly have a Registry which returns objects by keys. If the Registry does not have an object with the specified key it will try to create one by calling a factory method that is supplied to the registry by construction. Look a...
Hello all,
I'm trying to work with exceptions.
So I have something like:
If something bad occurs:
throw new CreateContactException($codigo, $result->msg);
Later on, I will, try and if not ok, catch:
try
{
createContact();
}
catch(CreateContactException $e)
{
$error .= 'An error occurred with the code:'.$e->getCode().' and ...