-
Posts
1,437 -
Joined
-
Last visited
Never
Posts posted by papaface
-
-
I'm already using a different session save handler to a directory that I know all accounts can access. The issue is that php is creating the session with read/write only permissions for the user that made it.
connect to 1 database from all domains u have
for example
sample1.com connect to database 123.123.123.123
sample2.com connect to database 123.123.123.123
sample3.com connect to database 123.123.123.123
database 123.123.123.123 has the following table
user_session
phpSID
hyperlink
sample1.com?phpsid=31790AF
sample2.com?phpsid=31790AF
sample3.com?phpsid=31790AF
where 31790AF, you generate this number, better not use the one php generated
How can I get each site to use the same PHPSID? How does each site know what SID to use?
-
How can I do that as I need to be able to tell the sites what PHPSID to use?
-
Hey,
I am in the process of writing a script to share a php session across various domains I have.
The problem I have, is getting php to access the php session. It gives me a persmission error. It seems the session is being created with chmod 0600 which does not allow the other domains to access the session data.
When I manually chmod it to 0777 the session data can be retrieved across my domains.
Is there a way (maybe in php.ini) to change the permissions the sessions are given?
Thanks
-
Hey,
I am trying to create a loop based on a boolean output from a function.
This is essentially what I have:
function queue($skip) { if ($skip == false) { //some code which will check their queue status and return true if they're in the queue or false if they're not. } else return true; }
Then:
while (queue() == true) { //do something when they're in the queue }
Is my code correct here?
Will it not check the queue() function only once?
Any help would be appreciated.
-
No one can help me
-
Hey
I am trying to work out a way of selecting the top 50 high point scorers from my table. At the moment I have:
$gettop = $ftcdb->get_col("SELECT * FROM `xperience_stats` ORDER BY `points_xperience` DESC LIMIT 0, 50"); foreach ($gettop as $userid) { if ($userid == $this->getUserId()) $allowskip = true; }
It works absolutely fine. It selects the first 50 leaders and if their userid is one of the top 50 pulled from the table then $allowskip = true.
But what happens if the 50th and 51st user have the same score? User 50 would be $allowskip = true but 51 wouldn't.
Any idea how to get around that? With one query ideally.
Any help would be appreciated
-
-
Got it:
echo "<pre>"; ob_start(); var_dump($GLOBALS); $a=ob_get_contents(); ob_end_clean(); echo "</pre>";
Thanks
-
I am trying to email a list of $GLOBALS values to an error email address so that one of my complex scripts can be debugged properly.
When I try the following:
mail('*****','*****','here is a list of all the vars in this session: <pre>'.$GLOBALS.'</pre>
I simply get an email which has <pre>1</pre> obviously due to the fact it is an array. print_r($GLOBALS) does not work either.
So my question is, how can I send a list of the array values in the format produced by print_r i.e
[HTTP_KEEP_ALIVE] => 300 [HTTP_USER_AGENT] => Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 [PATH] => /bin:/usr/bin [QUERY_STRING] => [REDIRECT_STATUS] => 200 [REMOTE_ADDR] => 86.162.181.79 [REMOTE_PORT] => 2965
Any help would be appreciated
-
Needs to be done in real time.Cron job, maybe?
-
Hey,
I have a website which runs processes invoked by the user on the website.
We find that when a lot of people are on the website it causes the processes to get locked up and as such we want to only do a MAX of 20 instances of the process at any given time.
We are having an issue implementing this kind of system because sometimes checks are performed on the existing database to see how many processes are queued, but by the time the script gets that information it is out of date.
Our table structure is simple
Name | Active
Andrew | 1
Lisa | 0
0 in active denotes a process that has NOT been invoked as yet and 1 means that the process is running.
Does anyone have any ideas as to what would be the best way to do this? We're confused lol
-
I'm pretty sure
is ' and not ' unless they're equal.' -
or maybe just
echo $_GET['reply'];
If you're wanting the value of "reply" in the url of the page displayed.
-
$result = mysql_query("SELECT `team` FROM `".$_GET['game']."_teams"`) or die(mysql_error());
Not a very good way of doing the query though if you ask me.
-
Have you looked into http://uk.php.net/mk_dir ?
-
Put this at the top of your file and then tell us the output:
error_reporting(E_ALL); ini_set('display_errors', '1');
-
-
-
Hello,
I am trying to find the value of the text between square brackets in my string
$str = "hell my name is [andrew]"; $find = preg_split("\[(*])\]", $str, null, 1); $name = trim($find[1]);
However this is not working :'(
Anyone got any ideas?
-
Regex is your best option, although I'm not the best at regex so I'd probably do something like:
$file = file_get_contents("a.php"); $split = explode('<div id=mydiv>Positive Negative</div>',$file); if (count($split) > 1) { //div was found } else { //div was not found }
Admittedly, this is not the best way to do it, but it will work.
-
The issue is with you using mysql reserved terms in your table/db.
You can see them here:
http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html
The sticking point is your field name "read". This is a reserved name. I suggest you either do what Coreye suggested and use backticks (`) around the word read. Or change the field name from read to something that isnt a reserved term. The latter is better for compatibility as backticks are not technically valid SQL and therefore if you were to import the database into another database server you may experience issues.
-
I've found the issue. It is the permissions on the files. They need to be set to 755
Thanks for your help anyways Daniel
-
I didn't write the script, my friend did.Any reason why you don't just write it in bash?
What do you propose and I'll give it a try
-
Hello,
I have a script on my server which is supposed to go through certain directories and delete the files within them if they're more than 1 day old. However the script is not working (i.e nothing is being deleted) and I have no idea why.
Does anyone know why this may be happening:
<?php /* Cleanup Script */ //set_time_limit(900); error_reporting(1); ini_set('display_errors',1); function execInBackground($cmd) { if (substr(php_uname(), 0, 7) == "Windows"){ pclose(popen("start /B ". $cmd, "r")); } else { exec($cmd . " > /dev/null &"); } } function is_empty_dir($dir) { if ($dh = @opendir($dir)) { while ($file = readdir($dh)) { if ($file != '.' && $file != '..') { closedir($dh); return false; } } closedir($dh); return true; } else return false; // whatever the reason is : no such dir, not a dir, not readable } //Do processed execInBackground('find /home/***/conv/processed -mtime +1 -exec rm {} \;'); execInBackground('find /home/***/conv/uploaded -mtime +1 -exec rm {} \;'); execInBackground('find /home/***/conv/tmp -mtime +1 -exec rm {} \;'); //Do Cache&Stored execInBackground('find /home/***/public_html/tmpvidstore -mtime +1 -exec rm {} \;'); //Do Logs execInBackground('find /***/fetchmp3/public_html/convlog -mtime +1 -exec rm {} \;'); //Do Cachefind /home/***/public_html/vidcache/o -mtime +7 -exec rm {} \; $cachedirs = array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','q','y','z'); foreach($cachedirs as $value) { if(!is_empty_dir('/home/***/public_html/vidcache/'.$value)) execInBackground('find /home/***/public_html/vidcache/'.$value.' -mtime +7 -exec rm {} \;'); } ?>
Sharing PHP Sessions Across Domains
in PHP Coding Help
Posted
So,
?
That is an acceptable and proper way to do this?
Also (as mentioned earlier), how can I get each site to use the same PHPSID? How does each site know what SID to use?