php

Ajax/PHP .post, and .load dont return any data

I am working on an AJAX login/logout form. The login works fine, but when someone clicks on "logout" I am having a few problems. Javascript: $("#logout").live("click", function(){ $.post("/hd/ajax.php",{ logout: "1" }, function(data) { alert(data); }); }); Ajax.php: if(isset($HTTP_POST_VARS['logout']) && $HTTP_POST_VARS['...

order of ajax post requests getting mixed up

I have a page where the user sends data (via ajax) to a php page, which inputs it to a database. However, occasionally, the requests are getting out of order when I check the database. Basically, the user inputs events as they occur and hit submit to send it off to the database. Occasionally, the user will record 2 events before sending...

Fetching data from another website

Hi all, I am making a new website using PHP and I want to fetch the data from another website in which I have my profile, which contains wallpapers, logos etc. I want to fetch the data from that website and display it on my new website in the content section. Please give me some ideas on how to do this task in PHP. Thanks in advance....

Random chat according to the map?

How would you develop of random chat feature, but you'll have to allow the user to select the country he wants the "random chatter" to be from. without collecting any data from the users. ...

how to pass these strings from php to javascript

hello i have 4 strings in my application like this that i want to pass to my js file $a1='[10,20,13,14]'; $a2='[17,15,14,16]'; $a3='[18,24,16,17]'; $a4='[15,54,18,27]'; echo $a1.",".$a2.",".$a3.",".$a4; and my javascriptcode is $.ajax({ type: "POST", dataType: "json", url: "loaddata.php", ...

Should passing parameter in method be avoided and used as much as possible in OOP?

Here is a scenario class page { public $name; public $title; public function showhead() { return "<head><title>".$this->title."</title></head>"; } } $mypage = new page; $mypage->title = "My Page title"; $mypage->showhead(); and another scenario class page { public $name; public function show...

Getting a cookies parameters in PHP?

How do you get a cookies params? The "expire, secure, httponly" etc. Is it possible? ...

PHP strange behavior in function nl2br.

I was dealing with refactoring of my small web app. all night. Today when I started testing, first bug what I found was problem with system PHP function nl2br(). On my localhost I have PHP version 5.2.9 and as I see on PHP site from version 4.0.5 nl2br() is XHTML compliant. Then I absolutely don't understand why does my nl2br() return ...

php code not embedded properly

Hello, I am using CodeIgniter for PHP. Can anybody tell me why is this code not working properly? <form action="/TestCodeIgniter/index.php/blog/comment_insert/<?php $this->uri->segment(3);?>" method="post"> However, this code works fine :- <?php echo form_open('blog/comment_insert/' . $this->uri->segment(3) ); ?> I am very much ...

Is there any unnecessary code in these PHP files for localization?

I got this code from a tutorial that I can't find now for some reason to localize my web page. It is the best example I've still at the moment. I modified it a little bit thanks to the collaboration of users from Stack Overflow. The localization files should basically do the following things: They don't have to detect the preferred la...

Creating a cron job for job pool for my membership website - whats a good table design?

Hi guys I want to set up a job pool for my membership based website. Users on my website can choose to execute certain tasks that take a while to be done like sending invite emails etc. Instead of having it be run on a form submit, I was thinking of creating a table where an entry would be made for the job requested. Eg a user wishes to ...

Enable whitespace in php regular expresssion

I want to have A-Z, 0-9 and whitespace ignored in regular expression, currently I have this, it works but whitespaces are ignored too but I need them. preg_match_all("/[^\w]/",$string,$matches); ...

Different way to d XMLWriter::writeRaw()

I use a PHP class called healthvaultphp which uses XMLWriter::writeRaw(). While my development server had PHP 5.2, when trying to "go live", I found out the production server has PHP 5.1.6, and won't be upgrdaded in the enar future. True, this is my fault not to verify the exact version, but the question is what can be the solution in t...

How to create rss feeds (.xml) for our own dynamic site while using php and mysql?

I've tried every method that I knows but didn't got the solution on "How to create an rss feeds and sitemap for a dynamic site that get updated automatically". ...

How to create a Zen Cart payment module

I'm interested in writing a Zen Cart payment module for a certain payment-gateway for people to download and install in their ecommerce website. My experience with Zen Cart is minimal so I don't know where to start. I checked the FAQ section on Zen Cart's website and I only found completed modules, no code examples of how to write one fr...

Curl Record Download Information

Hello i am trying to record how much the user has downloaded when the user aborts the script i want the script to be able to save a text file with information how much they have downloaded with this i will have an idea how to create a quota program, i have tried fopen, fread works grate only one problem it i ant seek for the file, curl d...

PHP REGEX: Ignore + and #

So here is what I'm doing exactly: I have a form with a caption on the right of it, I want to write in the form only A-Z,0-9 and whitespaces, and for the caption I want to do the opposite, so if the user write's something wrong I can show what's the problem for example: "Invalid Charachter" But I'm stuck with + and # I want to ignore ...

Two simple PHP files for localization that do basically the same, but one doesn't work?

The multilingual content echoed with PHP (e.g. line 17) are not displayed at all. localizatoin.php: This one works: <?php session_start(); header('Cache-control: private'); // IE 6 FIX if(isSet($_GET['lang'])) { $lang = $_GET['lang']; // register the session and set the cookie $_SESSION['lang'] = $lang; setcookie("la...

Warning: Cannot modify header information (something wrong with a localization PHP file)

My web server shows me the following warning, and I think know where is the problem: WARNING: CANNOT MODIFY HEADER INFORMATION - HEADERS ALREADY SENT BY (OUTPUT STARTED AT /WWW/ZXQ.NET/A/L/E/ALEXCHEN/HTDOCS/TEST/INDEX.PHP:10) IN /WWW/ZXQ.NET/A/L/E/ALEXCHEN/HTDOCS/TEST/LOCALIZATION.PHP ON LINE 14 But I don't know exactl...

Creating an installer script

Hi all, I'm trying to create an installer, using a combination of fwrite and forms. Here's my code: <?php $myFile = "db_config.php"; $fh = fopen($myFile, 'w') or die("can't open file"); fwrite($fh, "$host = " . $_POST['host'] . ";\n $username = " . $_POST['username'] . ";\n $password = " . $_POST['password'] . ";\n $name = " . $_POS...