I am unable to use session variables on a page other than the one where they are set, IOW they act like non-session variables. I have found a similar question posted in half a dozen other similar fora, but the answer in those other cases always turns out not to apply.
Here are my files:
sess1.php
<?php
session_start();
session_regi...
I found a function in a PHP page that calculates the number of miles between 2 points, but it's faulty. It's supposed to work with google maps, but the difference in distances are ranging from 1.3 to 1.65 times further in google maps(which is more accurate).
Here's the function:
$M = 69.09 * rad2deg(acos(sin(deg2rad($lat1)) * sin(deg2...
Hello,
I need to write PHP page which would accept XML document sent over POST request. Request itself looks like this:
POST /mypage.php HTTP/1.1
Host: myhost.com
Content-Type: application/xml
Content-Length: ...
<?xml version="1.0" encoding="utf-8"?>
<data>
...
</data>
This is not data from some HTML form, just plain XML document....
I've got a small snippet of code below and I was curious what types of things you would change with regards to best practices/code maintainablity and so on.
function _setAccountStatus($Username, $AccountStatus)
{
if ($Username == '' || ($AccountStatus != 'Active' || $AccountStatus != 'Banned' || $AccountStatus != 'Suspended')) {
// ...
I want to parse some XML that looks like this:
<node>
This is
<child>
blah
</child>
some
<child>
foo
</child>
text
</node>
How do I get access to the text node children in Simple XML?
Can I access them in the correct order of text and element children?
Do I need some other package for this?
...
In PHP you can use square brackets on an element to access attributes:
$node = /* SimpleXMLElement */
$id = $node['id'];
What's weird is that $id isn't a string, It's another SimpleXMLElement. Why isn't it a string? I find myself using strval() all over the place on this.
How are the square brackets working? Can I do that with my own...
Hello all,
Here is proof that my site is not portable. I had some regex that worked perfectly on my old server. I have now transferred my site to a new server and it doesn't work.
$handle = popen('/usr/bin/python '.YOUTUBEDL.'youtube-dl.py -o '.VIDEOPATH.$fileName.'.flv '.$url.' 2>&1', 'rb');
while(!feof($handle))
{
$progress = fr...
I'm wonder how people are kicking people out or blocking access to a site when you want to do an upgrade and you have users that are logged in.
My one thought is to just put a bool setting in a global file (such as the settings file) for whether or not the site is unavailable. True is available, while false is unavailable. When false, t...
Hi:
I have a tar.gz with a full mysql database update that I can access via ftp.
This tar.gz updates daily and I would like to create a php and/or mysql connection to that ftp account that would allow me to run that large sql query on my local mysql server.
Any thoughts?
...
ok...in php how do i do this? given the following scenario:
// array of letters
var $letters = array('a', 'b', 'c');
// loop through array and create empty arrays with names like $a, $b, $c
foreach($letters as $letter) {
var $$letter = array();
}
...
I have a column in my table titled 'authorised'. It's default is 0. It needs to be changed to 1 when the user is authorised, but it must be able to be reset to 0. I know I could do this easily with 2 queries like so:
$authorised = Db::query('SELECT authorised FROM users WHERE id=2');
$newAuthValue = ($authorised['authorised']) ? 0 : 1;...
I am getting a bunch of undefinded index warnings when i print out my data from a SQL query, when i remove the INNER JOINS most of the warnings disappear. I am not sure what is causing that error.
My code is here:
<?php
$id = $_GET['id'];
$sql = "SELECT * FROM updates INNER JOIN clients ON updates.c_id = clients.c_id I...
Hello,
I am wondering if it is possible to request more information besides email from Google and get the name of the user also?
Am using JanRain OpenID PHP script.
Thank you
...
I have a small form where I want the values to be updated on change for my select boxes which can be done with:
$("form#updateclient select").change(function(){ // use one selector for all 3 selects
$.post("inc/process-update.php",{
// data to send
completed: $("select#completed").val(),
hours: $("select#hours").val(),
upda...
I am writing a sql query creator using some parameters. While doing that ,I came across this problem. In java , Its very easy to detect the last element of an array from inside the for loop by just checking the current array position with the array length.
for(int i=0; i< arr.length;i++){
boolean isLastElem = i== (arr.length -1) ?...
I'm working a site where users could technically stay logged in forever, as long as they never close their browser (and therefore never get a new session key). Here's what I could see happening: a user leaves a browser open on computer A. The then use computer B, login and change their name which is stored in the session. They logout of ...
This is the Main page where I am calling a light box link using ajax submit. But I am not getting the light box effect after ajax responce..
index.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Doubt</title>
<!-- CSS for Light Box -->
<link rel="stylesheet"...
I am trying to upload file using zend frame work but have not been successful. I have read Akras tutorial, which was helpful but when i used those techniques in my project I was not able to get it to work.
...
Any one a idea how to simply create a form with Zend_Form and jquery? I want to use Zend_Form to validate the form so I don't have to dual script the form in JavaScript and PHP.
Thank you,
Ivo Trompert
...
When I upload a file, where is the immediate place the file will go to on the webserver? Is there anyway to configure this place?
...