Does anyone know if Node.js can access the session variables you set in PHP. I want to deliver diverent content to logged in users and non logged in users.
If not, does anyone know a way to achieve this.
In Javascript, after executing a function I can immediately get the an element of the array returned by the function, like so:
myFunc("birds")[0] //gets element zero returned from "myFunc()"
This is much easier and faster than doing this:
$myArray = myFunc("birds");
echo $myArray[0];
Does PHP have a similar shorthand to javascript? I'm just curious. Thanks in advance!
Say i have an xml file of this nature
some data
I wan to replace attributes of each later using one function in php:
example say:
replaceAttribute("collections","somecollection,"newcollection");
I'm having difficulties in the making the logout code for php to work.
When I click on the logout button, it will go back to the home page, but when I click on the back button in the browser. I can still access the previous page, wherein the user must be logged on to access it.
So I'm thinking of redirecting to the login page when the user clicks on the back button on the browser.
This is my code, in the home page(where in no user is logged in yet. This page is being called by a logout link on the user page.
<?
session_start();
session_destroy();
?>
<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form name="form1" method="post" action="checklogin.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="3"><strong>Member Login </strong></td>
</tr>
<tr>
<td width="78">Username</td>
<td width="6">:</td>
<td width="294"><input name="myusername" type="text" id="myusername"></td>
</tr>
<tr>
<td>Password</td>
<td>:</td>
<td><input name="mypassword" type="text" id="mypassword"></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="Submit" value="Login"></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
The FILTER_VALIDATE_URL filter seems to have some trouble validating non-ASCII URLs:
var_dump(filter_var('http://pt.wikipedia.org/wiki/', FILTER_VALIDATE_URL)); // http://pt.wikipedia.org/wiki/
var_dump(filter_var('http://pt.wikipedia.org/wiki/Guimarães', FILTER_VALIDATE_URL)); // false
Why isn't the last URL correctly validated? And what are the possible workarounds? Running PHP 5.3.0.
I'd also like to know where I can find the source code of the FILTER_VALIDATE_URL validation filter.
Hi guys,
Sorry to bother again, but I really need help transforming this Python2 code into PHP.
net, cid, lac = 25002, 9164, 4000
import urllib
a = '000E00000000000000000000000000001B0000000000000000000000030000'
b = hex(cid)[2:].zfill(8) + hex(lac)[2:].zfill(8)
c = hex(divmod(net,100)[1])[2:].zfill(8) + hex(divmod(net,100)[0])[2:].zfill(8)
string = (a + b + c + 'FFFFFFFF00000000').decode('hex')
data = urllib.urlopen('http://www.google.com/glm/mmap',string)
r = data.read().encode('hex')
print float(int(r[14:22],16))/1000000, float(int(r[22:30],16))/1000000
Would be great if someone could help, thanks in advance!
Hi guys,
I have this code in PHP. It connects to the DB fine, but pops an error, when tryinto to insert the info.
$dbc = mysqli_connect('localhost', 'root', 'marina', 'aliendatabase') or die('Error connecting to MySQL server.');
$query = "INSERT INTO aliens_abduction (name, email) VALUSE ('John', '[email protected]')";
$result = mysqli_query($dbc, $query) or die('Error querying database.');
mysqli_close($dbc);
Here's a screenshot: http://img532.imageshack.us/img532/2930/63306356.jpg
Thanks,
R
I googled for this problem but there is no answer for it.
I want my PHP script to generate HTTP response in chunked( http://en.wikipedia.org/wiki/Chunked_transfer_encoding). How to do it?
Good day!
I know that C# allows multiple iterators using yield, like described here:
http://stackoverflow.com/questions/1754041/is-multiple-iterators-is-possible-in-c
In PHP there is and Iterator interface. Is it possible to implement more than one iteration scenario for a class?
I'm an experienced PHP web developer and am wanting to learn ASP.NET so that I can consider going for ASP.NET jobs.
I've looked at a few introduction to ASP.NET books but I always find that they start far to simple and cover the basics of HTML and general web development. I'm looking for learning resources that will help me make that transition as an experienced web developer.
Can anyone recommend any?
I am looking for a copy php_apc.dll that was built with VC8. I found one built with VC9, but my PHP distro I got with the ZendServer CE says it needs to be built with VC8.
Any help would be greatly appreciated. Thanks,
Dave
I have a MD5 hash: 10f86782177490f2ac970b8dc4c51014
http://www.fileformat.info/tool/hash.htm?text=10f86782177490f2ac970b8dc4c51014
Result: c74e16d9
but PHP: crc32('10f86782177490f2ac970b8dc4c51014');
Result: -951183655
I don't understand!
I want users on my website to be able to pick a hex colour, and I just want to display white text for dark colours and black text for light colours. Can you work out the brightness from a hex code (preferably PHP)?
The website is running on a web hosting where we don't have access on htaccess file.The web server is Apache. I want to rewrite URL. For example: The original URL:
www.mydomainname.com/en/piecework/piecework.php?piecework_id=11
Expected URL:piecework.mydomainname.com/en/11
How to do it?
Possible duplicate:
http://stackoverflow.com/questions/433302/php-convert-a-string-to-variable
for example:
$test = array("this","is","a","test");
$what_array_to_read = "$test[0]";
function to read the array $test[0]
Hi all,
I have been doing PHP stuff for almost one year and I have never used the function eval() though I know the usage of it.
But I found many questions about it in SO.So can someone show me a simple example in which it's necessary to use eval()?And is it a good or bad practice?
I have a program that is interacting with hardware via parallel port programming. i had compiled it and using its object file to interact with the hardware (a simple led). when i execute it directly on the shell it serves the purpose of glowing the LED but when i execute it using shell_exec() in php the command is executed but unable to interact with the hardware. i am totally confused.. .
A URL redirects to another link. How do I know which link it gets redirected to with PHP and JS?
And is finding the filesize of the new link possible too, without complete transfer of the file?
Thanks in advance.
Hi all!
I want to make an import script which allows users to upload their excel file (extension not important) to my php application. The application should reconize a list of items (so far so good). The difficulty in this case is that the excel files contain images...I've read information about phpexcel library but it does not say anything about images.
Anybody ideas?
Regards,
Marcel
Array(0= blabla
1 = blabla
2 = blblll) etc..
Is there a way to change all the numeric keys to "Name" without looping through the array (so a php function)?
Is there anyone who has a good (basic) UML class diagram to get me started on an object oriented CMS?
I want to start using OOP in PHP but can't seem to find a good starting point.
When debugging in PHP I frequently find it useful to simply stick a var_dump($foo, $bar, ...) in my code to show me the the what a variable is, what is value is, and the same for anything that it contains.
What is a good python equivalent for this?
I have seen several things in my Google searching that are somewhat equivalent, but nothing that is the same or better.
Hello guys,
I am currently using the below IDE's. They serve their purposes but am wondering if there are better ones out there that i can switch to.
phpDesigner v6.2.5 (For PHP)
Navicat 8.0.29 (For MySql)
Dreamweaver CS3 (For HTML & CSS)
Spket IDE (For JavaScript)
Thats my collection of production tools. Wondering if there is anyone of them i can switch to a better one.
Thanks