Jump to content

christa

Members
  • Posts

    74
  • Joined

  • Last visited

Everything posted by christa

  1. hi friends! this code foreach ( $users as $key => $value ) { $user_ids = implode(',', $value); echo "$key - $user_ids<br />"; } sends this output: user one - 376,373 user charlie - user beta - 372 I need the $user_ids are shown in a DropDownList, of course only if the $user_ids is not empty. How can I do? thanks!
  2. same error: No releases available for package "pear.php.net/PHP_Beautifier" install failed
  3. hi,i trying to installing http://pear.php.net/package/PHP_Beautifier/redirected on Ubuntu. First, i've installed pear, ok. After, i try: "sudo pear install PHP_Beautifier-0.1.15" but it returns: How can I do? many thanks!
  4. good. this is exactly what I wanted, many thanks!
  5. thanks, it seems to work fine. I explain: my goal is to obtain a result as in this forum: kickstart Posts: 3.122 per day Christa Posts: 0.049 per day and so on...
  6. this is the dump and some values: CREATE TABLE IF NOT EXISTS `products` ( `ID_product` int(1) NOT NULL AUTO_INCREMENT, `user_id` int(1) NOT NULL, `data_pub` int(10) NOT NULL, PRIMARY KEY (`ID_product`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=59 ; INSERT INTO `products` (`ID_product`, `user_id`, `data_pub`) VALUES (1, 1, 1034145512), (2, 1, 1047023998), (3, 1, 1048863029), (4, 1, 1082878114), (5, 1, 1057765362), (6, 1, 1069845339), (7, 1, 1072974569), (8, 1, 1073734879), (9, 1, 1078061830), (10, 1, 1081612558), (11, 1, 1088926719), (12, 1, 1097613613), (13, 1, 1294484457), (14, 1, 1108819740), (15, 1, 1110113708), (16, 1, 1113055990), (17, 1, 1116447075), (18, 1, 1121891159), (19, 1, 1125754462), (21, 1, 1129987058), (22, 1, 1137935681), (23, 1, 1147014380), (24, 1, 1152644776), (25, 1, 1153058150), (26, 1, 1166644581), (27, 1, 1171662130), (28, 1, 1174755781), (29, 1, 1190465853), (30, 1, 1198401192), (31, 1, 1212938489), (32, 1, 1233401000), (33, 1, 1241865261), (34, 1, 1271504408), (35, 1, 1296487128), (36, 1, 1296570001), (37, 1, 1296573545), (38, 1, 1296579164), (39, 1, 1296585392), (40, 1, 1296585421), (41, 1, 1296585455), (42, 1, 1296585648), (43, 1, 1296815811), (44, 1, 1297454728), (45, 1, 1297454975), (46, 1, 1298120648), (47, 1, 1298807272), (48, 1, 1299010216), (49, 1, 1299092477), (50, 1, 1299180670), (51, 1, 1299404673), (52, 2, 1301249170), (53, 2, 1301252055), (54, 2, 1301913083), (55, 2, 1302523995), (56, 2, 1302526008), (57, 2, 1302695466), (58, 2, 1302766366); also the your second query returns unexpected results
  7. your query returns: user_id AVG(ProductCount) 1 25.5000 2 6.0000 The result is unreal because the user_di 1 has inserted 51 products and user_id 2 has inserted 6 products, both in the past 2 years
  8. hi friends, my db table is this one: `ID_product` int(1) `user_id` int(1) `datapub` int(10) (as Timestamp, eg: 1302766366) PRIMARY KEY (`id`) I need to retrieve the daily average of ID_product inserted where user_id=someone I've seen the AVG() function but I have problem with date!
  9. i've tried your code but it just returns the path to image and not the width and height:
  10. i've edited as: function imgsize($myimg){ return getimagesize($myimg); } $search = array( '{\[quote\](\r\n|\r|\n)*(.+)\[/quote\]}siU', '{\[img\](\r\n|\r|\n)*((http)://([^;<>\*\(\)"\s]+)|[\w/\\\._\- ]+)\[/img\]}siU' ); $replace = array( '<b>\\2</b>', '' . imgsize(\\2) . '<img src="\\2" alt="img" />' ); $mytext = preg_replace_callback($search, $replace, $mytext); Now i obtain this result: Warning: getimagesize(\2): failed to open stream: No such file or directory... Warning: preg_replace_callback(): Requires argument 2, 'Array', to be a valid callback in...
  11. $search = array( '{\[quote\](\r\n|\r|\n)*(.+)\[/quote\]}siU', '{\[img\](\r\n|\r|\n)*((http)://([^;<>\*\(\)"\s]+)|[\w/\\\._\- ]+)\[/img\]}siU' ); $replace = array( '<b>\\2</b>', '<img src="\\2" alt="img" />' ); $mytext = preg_replace($search, $replace, $mytext); I need to obtain the size and dimensions of image found in replace array using getimagesize(): how can I do? The image in the code above is \\2 regards
  12. hi using this preg $text = preg_replace ('(([:/~a-zA-Z0-9_\-\.]+)\.([:/~a-zA-Z0-9/?_=]+))', '<a href="$1.$2$3">$1.$2$3</a>', $text); all URLs are correctly resolved except www.somedomain.tld How can I add the www.?? bye
  13. thanks your code seems work fine! Only one question: if i remove session_start(); // restart the current/new session the script continues to work without errors (notice nor warning): why in you opinion?
  14. ^^^ What makes you think that? If php can create the session data files in that folder, you can use php to remove the session data files in that folder (that are owned by the same user that your web server/php is running under.) And as someone already mentioned, why are you still using php4? It's dead and gone. well... my app runs on a hosting shared, the server isn't mine. I'm lost in this problem: can you post some code example please?
  15. how can I do this operation? the files are stored in /tmp and I do not have access to that directory.
  16. exactly. How can i "fix" this issue in php < 5.1 ???
  17. But if not erased the old session files are still there, available and working (until garbage collector). So the attacker can use one of those to forge their own identity.
  18. hi friends!! in php > 5 i use "session_regenerate_id(TRUE)" in order to generate a new session file and delete old one. In php 4.x the TRUE parameter doesn't exist: old files will be accumulated until the garbage collector will cleans all. How can I delete old session file in php 4.x having regenerated the new one?
  19. i tried your code but I need of an output as this one: text to be replace 1, 12654124 text to be replace 2, 120025 text to be replace 3, 3509955 text to be replace N, 12654124... I've used a code as this: $string = "every chars , 12654124"; $pieces = explode(",", $string); foreach($pieces as $key => $value) { for ($i = 0; $i <= 1; $i++) { $value = preg_replace("/[a-zA-Z]+[a-zA-Z ]+/", "text to be replace $i", $value); echo $value . "<br />"; } } but it returns: text to be replace 0 text to be replace 10 12654124 12654124
  20. hi all why this code doesn't work? $string = "some words here, 12654124"; $pieces = explode(",", $string); for ($i=0; $i<=1; $i++){ $pieces[0] = preg_replace("/[^A-Za-z ]$/", "text to be replace", $pieces[0]); echo $pieces[0] . "<br>"; } It returns: some words here some words here The right result would be: "text to be replace, 12654124"
  21. yes, the 2 values are comparated and matched when the user is logged and he is the author of the article
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.