I can't for the life of me figure out why this function is causing multiple entries into my database table...
When I run the function I end up with two records stacked on top of each one second apart
here is the function:
function generate_signup_token(){
$connection = new DB_Connect(); // <--- my database connection class
$...
If someone knew the link of one of my page or simply they made an assumption like http://ww.yourweb.com/index.php, this is a general assumption and if you put this link on DAP or other donwload manager, it will download file, with source code inside.
I want to stop other from stealing my code on this manner, is there a way for this?
...
Hello,
I am wanting to create a web-based cronjob system for my userbase, and would need to know the best way to open a php script on a remote server, and ensure the script runs (could take 3 minutes), and use the least ammount of resources on my own side.
There is the possibility of having hundreds of connections open at one time.
...
I have an MPEG file (.mpg) hosted in Amazon S3, that I want to link to a page I have, so the user will be able to download it from the page.
I have in my page a link:
bla bla"
The link to the file works when I right-click it and choose "Save Target As" , but I would like it to work also when I left click it, and that it will open a fil...
Hello,
In MySQL, I am using the following three tables (their fields are listed after their titles):
comment:
commentid loginid submissionid comment datecommented
login:
loginid username password email actcode disabled activated created points
submission:
submissionid loginid title url displayurl datesubmitted
I would like to ...
I've been looking at this code and it's supposed to match my $input string and in $matches[0] store 'testing'
$input = ':testing';
$r = preg_match('/^(?<=\:).+/',$input,$matches);
What's wrong with it?
...
I have a PHP form that needs some very simple validation on submit. I'd rather do the validation client-side, as there's quite a bit of server-side validation that happens to deal with writing form values to a database. So I just want to call a javascript function onsubmit to compare values in two password fields. This is what I've got:
...
$ser = 'a:2:{i:0;s:5:"héllö";i:1;s:5:"wörld";}'; // fails
$ser2 = 'a:2:{i:0;s:5:"hello";i:1;s:5:"world";}'; // works
$out = unserialize($ser);
$out2 = unserialize($ser2);
print_r($out);
print_r($out2);
echo "<hr>";
But why?
Should I encode before serialzing than? How?
I am using Javascript to write the serialized string to a hidden fi...
UPDATE (Added the code for the class that does the read/write)
<?php
error_reporting(E_ALL);
class dbSession
{
function dbSession($gc_maxlifetime = "", $gc_probability = "", $gc_divisor = "")
{
if ($gc_maxlifetime != "" && is_integer($gc_maxlifetime)) {
@ini_set('session.gc_maxlifetime', $gc_maxlifetime);
...
Good afternoon,
I will first start with the goal I am trying to accomplish and then give a very basic sample of what I need to do.
Goal
Instead of collecting several variables and naming them with keys individually, I have decided to give in and use an array structure to handle all inputs of the same type and rules. Once I have the va...
I am converting from JSON to object and from object to array. It does not what I expected, can you explain to me?
$json = '{"0" : "a"}';
$obj = json_decode($json);
$a = (array) $obj;
print_r($a);
echo("a0:".$a["0"]."<br>");
$b = array("0" => "b");
print_r($b);
echo("b0:".$b["0"]."<br>");
The output here is:
Array ( [0] => a ) a0:
Ar...
Hi
I have a string that must fit into a box, and must be at most 3 lines long. To shorten it, I plan to truncate it and end it with '...'. I could shorten it to a certain # of characters but if i make it look good with "wwwwwwwww [...] wwww" it won't look right with "iiiiiiiiiii [...] iiii".
Is there some way I can shorten it by how mu...
I'm having a miserable time debugging one small function on my new project.
Essentially I'm having a user log out via an AJAX call to my log out script on my server called "userfFunctions.php" I'm using AJAX so that I don't have the headache of writing more regex to match my mod_rewrites. Anyway, every so often, it seems as though my...
I have a record of data with unix time date in it
i want to select the row based on the date/month/year only (not with time)
currently Im using something like this
select *
from tablename
where date > '$today'
and date < '$tomorow'
LIMIT 1;
how ever this is not that accurate if the $today and $tomorrow have different tim...
I have a form which loops if the value indicated is less than or equal the number of 'enrollee's needed. The while loop works perfectly with one exception, I use DOB fields which ALSO use FOR loops to display their values. If I remove the DOB fields, the form loop works fine, when left in, it errors out. Any ideas?
<form id="Enroll_Form...
UNIX timestamp always in GMT?
I tried to run php function time()
and when I tried to convert the unix timestamp from the time() function, the output is not similar to the computer time.
Thank You
...
I have a few images that i need to upload using an online form.
So far here's my code
$info = array('test title','1234','virginia','@'.realpath('e:\wamp\www\1.jpg'),'@'.realpath('e:\wamp\www\2.jpg'),'@'.realpath('e:\wamp\www\3.jpg'),'@'.realpath('e:\wamp\www\4.jpg'),'test description');
$post->postAd($url, $info);
The $info array is ...
Is there a php function that returns the sum of a row of an associative array?
If not should I just use a counter and a foreach loop?
Appreciate it!
...
I am trying to upload two files at once (two file fields) with codeigniters upload class. Despite having provided the field name codeigniter produces errors on the second field.
I this a limitation of codeigniter, php or html or am I simply using the class incorectly?
$this->upload->do_upload('video_file')
$this->upload->do_upload('im...
How would I strip out all characters from a string that does NOT contain: [a-zA-Z0-9\-\/_] ?
In other words, I'd like to specify what I DO want rather than what I don't. Thanks.
...