PHP: how to clear cookies

Consider this example index.php: <script> var first = new XMLHttpRequest(); var second = new XMLHttpRequest();'POST', 'foo.php');'POST', 'bar.php'); first.onreadystatechange = function() { console.log(document.cookie); }); f

Extract the html entry with php

I am new to php and want to make a dropdown menu where you can select a site that you want, then when you click a button you will be redirected to that site. The button will take you to for example "" if that is what you select, if you

.htaccess URL rewrite breaks relative paths

I was attempting to remove the .html extension from my website URLs using a simple rewrite in my .htaccess file: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.html-f RewriteRule ^(.*)$ $1.html This however succ

The location of the HTTP header does not work

This question already has an answer here: header location doesn't work and still in protect page 2 answers This code use protect function . to do permission access level header location doesn't work and I look at address bar found it still in protect

Filemaker at the Mongodb Collection to View Data Using Data

I have a a table on filemaker that has about 1 million + rows and growing. It has about 30 columns. I need to display this on to the datatables on my PHP page. My research online says FileMaker to PHP is super slow. So, i am trying to get the data to

Logout in codeigniter

I am trying to design a login/logout page in codeigniter framework.My problem is that when I logout of the web-page I am getting redirected to a login page. When I go back I am getting a page which says: Document Expired This document is no longer av

get data from the table where a field is maximal in a query

i want to get data from my database where one field is max, at this moment i do this in 2 queries. the thing is i dont want to overload the server so i am looking for a way to make it in 1 query. any suggestions? as you can see i am looking for entry

PHP quiz with results on the screen

I am trying to create a simple quiz based on a tutorial I found. Unfortunately, this is making me spin my wheels and the answer is probably pretty simple. I got this working perfectly. I would like to cha

Drupal 7 custom module gives 403

i am having some troubles with my custom drupal 7 module. Notice, this is not my first module. This is my hook_menu; function blog_contact_menu(){ $items = array(); $items["blog_contact/send_to_one"] = array( "page_callback"=>"

PHP code output

I was studying for my finals and I came across this question: write the output after running this code. <?php function swap($x, $y) { $x = $x + 1; $y = $y + 2; return $x * $y; } $a = 3; $b = swap($a, $a); print "$a, $b"; $b = swap(&$a, &a

Avoid using isset () on the form?

When you have many inputs (select/textarea/input), it will look real messy when you include isset() For example: <input id="firstname" type="text" name="firstname" value="<?php echo (isset($_POST['firstname']) ? $_

PHP form field (display: none) Spam prevention

I am working on the re-development of a clients website and am looking for an alternative to a captcha in order to make the user experience a little nicer. I am redeveloping the various forms throughout the site and am trying to find the best solutio

Browscap configuration for PHP

I have just tried enabling php_browscap.ini so that I can use the get_browser function. However, it seems to display an empty array? $user_agent = get_browser(null, true); print_r($user_agent); In my php.ini file, I have the following: [browscap] ; h

PHP script with regular expressions

I'm trying to get the text between the heading tag using the following php script: $search_string= < h1 >testing here< /h1 >; $text = preg_match('<%TAG%[^>]*>(.*?)</%TAG%>',$search_string, $matches); echo $matches[0]; When i try

mod rewrite, title slugs and htaccess

I have been taken in to provide some SEO guidance on a website which has been running since 2005. My problem is I want to use clean URLs. The code that handles the URL is hidden away in some class file. And with over a few thousand lines of code its

MySQL count included in the jSon object

I made a php/ajax/mysql/json script for my site, to show all the tags. If I GET the page id it will show me all the tags of that page. But! In my main page i'd like to show all tags, from all pages WITH a counter. For example if I tagged 4 pages with

Credit card payment gateway in PHP?

I need to process credit cards and integrate with backend payment services to credit them. The majority of solutions on the internet require an intermediary, eg. 2CO, GCO, Do you have any experience with implementing a credit-card payment g

PHP / Zend complains of indefinite variables

The situation: index.php: <?php include("foo.php"); include("baz.php"); foo("bar.php"); ?> baz.php: <?php $x = 42; ?> foo.php: <?php function foo($p) { include_once($p); // please dont mind the inclusion hole }