php

PHP: Notice: Undefined index where the session variable is defined.

I am making a registration system with an e-mail verifier. Your typical "use this code to verify" type of thing. I want a session variable to be stored, so that when people complete their account registration on the registration page and somehow navigate back to the page on accident, it reminds them that they need to activate their acco...

How to send link id's to a sql query using jQuery?

Hello, I am trying to send link id's to a sql query in order to filter data. When I click a link like the ones below, I want to send the id of the link to the sql query as shown below: Example: Links (clicked): <p>Fitler Results</p> <a href="#" class="category" id="marketing">Marketing</a> <a href="#" class="category" id="automotive"...

Why are there pluses ( + ) in my oAuth tweets?

Ive cracked oAuth and have my class file for it. I'm at the last stage of posting a tweet and all works except all the words are joined with a plus sign in the tweet. Changing anything results in the signature been incorrect and twitter returns 401 error. So how does one remove the pluses? Post function below: function post($token, $t...

Is there a way to set the default database handle with mysql_query?

Is there a way to set the default database handle with mysql_query? So I know that mysql_query can be called without a sql handle but then it will basically use whatever handle you got from the last mysql_connect. What if I wanted to set that default handle myself, how do I do it? I just want to make it clear that we have all our code...

echo the contents of a File to the user but make it act as a download

I have a script where I get the contents of a file and then echo it to the screen, the problem is that it actually echos the binary file to the page, what I want if for it to act like a download where the download dialog will display. how can I achieve this? ...

PHP How to use multiple class functions of a class in a single script?

Here's the code I have. Everything works fine except when trying to use the same declared class variable in script more than once with a function. include("include/database.class.php"); $db = new Database(); $db->connect(); function fill_roles() { global $db; $r = $db->get_roles_all_order_by_name(); $drop_down = "<select id...

PHP: Problem with varible printing inside javascript

Hi, I have problem with varible printing inside javascript. varible htmlString printing not working: document.write(htmlString) <?php $htmlString= htmlspecialchars(file_get_contents('http://google.com'));?&gt; <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <bod...

php: efficiently running functions with one-time loaded classes multiple times in optional files

Hello again, after reading the responses I have rewritten my question. Let's say I have a theoretical php application that uses objects that do different things. For every page that gets loaded by the application, different scripts will be run. now I made a simple php script that creates a simple object. (this is all made up, I'm just ...

PHP session garbage collection becoming an annoyance, i need some help to modify this behavior.

I have been having this problem for some time now, I dont exactly know that if this is the issue but I am pretty confident that it is, I have my remember me session set too expire after 1 week, but when I go to my site after a few hours of inactivity my remember me session is gone, i check my servers tmp dir and the session flat file is ...

php and smarty var. value

smarty file {php} some php code... $php_var = "{/php}{$smarty_var}{php}"; echo $php_var; some php code ... {/php} smarty file Why '$php_var' value is: ?> How get $smarty_var value? Thanks ...

mysqli_fetch_array returning less results than expected.

I'm using the code below to return and echo an array. If I define ' mysqli_fetch_array($results, MYSQLI_BOTH) ' then my array is truncated by one result. The 1st result in the array drops off the list. If I remove the MYSQLI_BOTH then I get the results that I expect, but my hosting company (Dreamhost) throws this error: Warning: mysqli_...

From month to month and year

For example, I have the month 13 and I want to convert it to 1 year and 1 month with php. 26 - 2 years and 2 months. How to "convert" it? ...

Free database with places, parent places, latitude, longitude, etc.

Where to find free database of wolrd places with following fields: id place name in English place name in original language place type - city, region, state, country, continent, etc. latitude longitude parent id - id of place which current place belongs to, for example, San Francisco belongs to California, but California belongs to US...

Salesforce/PHP - Make field read-only after user has entered value

In Salesforce I have an account. On that account I have a couple of fields that are populated from the PHP SDK after some processes run in the background. The PHP SDK updates a field on certain conditions, when that happens I also would like to lock down that field to read-only. Can I do this from the PHP SDK? ...

Explode datalist into array

Hi, I've got a list of data with in the following format: data\n data\n data\n data\n data\n Now I try to explode it into an array with $array = explode("\n", $dataList); What happens next is that there is a key with no data, I think it is because of the \n on the end. Is there a way to explode it so that the last key isn't set? ...

Using JS setTimeout to post AJAX requests in a loop, but setTimeout gets called far too often

This question has been answered. The problem was that myEventMoveTrainManaul() was being called from other locations within the code. Thanks to everyone who offered their help. Please forgive me for re-posting this, but it was getting almost no attention and it's very important that I find someone to help me with this. Thank you for you...

using PHP to display output from a perl script

I'm new to PHP and I have a working perl script that basically logs into remote servers, cats a log file and displays certain log file information to STDOUT. I want to make this now viewable as a web page, hence looking at PHP to display this output. I just want to view the same output as I see on the terminal for now. The goal would b...

stream_publish using old FB api

Hi all, I can't seem to get the stream_publish to work from the old API. I am using the old API because there is no option to upgrade with the current client. $facebook->api_client->stream_publish("Test",null,null,$uid,$appid); I get error 500 returned. Any ideas? ...

PHP sum values of a whilefunction

Hello guys, we've codeded this PHP-Script: function price($id) { $ergebnis = mysql_query("SELECT * FROM preiszuordnungen where id=$id"); while($row = mysql_fetch_object($ergebnis)) { //Wenn grundpreis dann färben if($row->typ=="grundpreis") { ...

Random ID/Number Generator in PHP

I am building a list of "agent id's" in my database with the following requirements: The ID must be 9 digits long (numeric only) The ID may not contain more than 3 of the same number. The ID may not contain more than 2 of the same number consecutively (i.e. 887766551; cannot have 888..) So far I have part 1 down solid but am struggli...