[PHP] [missing] images .htaccess
Hi there how I can ignore [missing] images and other files completely in .htaccess from being processed by the index.php file RewriteRule .* index.php [L] the CMS itself gives 404 error page for unknown request thanks in advance
Re: [PHP] count clicks to count most important news
All the answers are great but Stuart Dallas' answer is what I was asking about .. thank u all I really appreciate it a lot On Sun, Jan 1, 2012 at 11:10 PM, Stuart Dallas wrote: > On 1 Jan 2012, at 16:26, muad shibani wrote: > > > I have a website that posts the most important news according to the > number > > of clicks to that news > > the question is : what is the best way to prevent multiple clicks from > the > > same visitor? > > I'm assuming this is not a voting system, and the news items you're > counting are sourced from your own site and, with all due respect to Ash, > unlikely to be a target for false clicks. All you're really wanting to do > is prevent the site from registering multiple hits from the same user in a > short period of time. > > I would probably use memcached on the server-side to store short-term > information about clicks. When a news item is loaded... > > 1) Construct the memcache key: "newsclick__". > 2) Fetch the key from memcache. > 3a) If it does not exist, log the hit. > 3b) If it does exist, compare time() with the value and only log the hit > if time() is greater. > 4) Store the key with a value of time() + 300 and an expiry of the same > value. > > This will prevent hits being logged for the same news item from the same > IP address within 5 minutes of other hits. > > Other alternatives would be to use cookies (could get messy, and not very > reliable since it requires the response from click 1 to be processed before > click 2 gets started), Javascript (as suggested by tedd but without the > token - it would work pretty well and would be a lot easier to implement > than the above, but you sacrifice having full control over it). > > If I'm interpreting the requirement correctly my solution is almost > certainly overkill, and a simple Javascript solution would be more than > sufficient. > > -Stuart > > -- > Stuart Dallas > 3ft9 Ltd > http://3ft9.com/ -- *___* * * السجل .. كل الأخبار من كل مكان www.alsjl.com صفحة السجل على فيسبوك http://www.facebook.com/alsjl *Muad Shibani* * * Aden Yemen Mobile: 00967 733045678 www.muadshibani.com
[PHP] count clicks to count most important news
I have a website that posts the most important news according to the number of clicks to that news the question is : what is the best way to prevent multiple clicks from the same visitor?
Re: [PHP] news and article posts in one table
Thanks for all .. I really appreciate your effort .. now I have a solid idea of how I should do Thanks a lot On Sun, Nov 27, 2011 at 10:28 PM, Larry Garfield wrote: > On 11/26/2011 09:45 PM, Paul M Foster wrote: > >> On Sat, Nov 26, 2011 at 01:26:49PM -0600, Tamara Temple wrote: >> >> muad shibani wrote: >>> >>> i wanna to create one table that contains both news and articles posts, >>>> they have similar columns like id, title, content, and date but they are >>>> differ in one column = the source of news or article post >>>> article has writers that have permanent names and pictures obtained >>>> from >>>> another table called writers that supposed to be left joined with the >>>> news >>>> table, while news posts simply have a source as text like AFP >>>> or Reuters and so one. >>>> >>>> How I can solve this ? >>>> >>> >>> How you store things in tables can sometimes get a little tricky. One >>> way to approach this is with normalized tables and using joins in your >>> query like you are doing. To make this work, in your main entries table, >>> have a field that indicates what the entry type is. If you are doing one >>> select that gets both articles and news stories, having that extra field >>> can help you distinguish what type it is, and which fields contain data >>> in each record. >>> >>> (cf: Wordpress wp_posts table for an example of how this is done. They >>> store posts, pages, and attachments in a single table this way. I can't >>> say if this is a better arrangement than keeping them in separate >>> tables.) >>> >> >> I've had to hack this table. It's a prime example of bad design. Take a >> long look at the records of this table in an active blog, with a survey >> of each of the fields and their values. You'll see what I mean. >> >> Paul >> > > The Drupal approach to this problem is to have a common table for all > "nodes" (our generic content object thingie), and then dependent tables for > type-specific stuff. So (over-simplifying): > > node: id, title, type, created time, updated time, published (1 or 0) > field_body: node_id, delta, value > field_picture: node_id, delta, url > field_source: node_id, delta, url to reuters or whatever > field_writers: node_id, delta, writer name, url to writer picture > // etc. > > That way, you can have the basic information all in one table and then > specific fields can be shared by some, all, or just one node type, and all > can be multi-value. It does mean loading up a full object is multiple > queries, but really, MySQL is fast. You don't need to over-optimize your > query count, and this gets you a well-normalized database. > > If you know in advance exactly what your types are going to be (in Drupal > they're user-configurable), you could simplify it to something like: > > node: id, title, type, body. created time, updated time, published (1 or 0) > node_article: node_id, writer name, writer picture url > node_news: node_id, url to reuters or whatever > > And you can still select on whatever you need. With a LEFT JOIN, you can > even get back all data on all articles of both types, and just have lost of > nulls in the result set for the off-record fields. > > --Larry Garfield > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- *___* * * السجل .. كل الأخبار من كل مكان www.alsjl.com صفحة السجل على فيسبوك http://www.facebook.com/alsjl *Muad Shibani* * * Aden Yemen Mobile: 00967 733045678 www.muadshibani.com
Re: [PHP] Is there a decent design app ?
you can use find and replace feature in some IDEs to accomplish your task .. Dreamweaver do the job but with links inside HTML code On Sat, Nov 26, 2011 at 2:17 AM, Andreas wrote: > Hi > > Is there a decent design app that can automatically update links within > the pages of a php site whenever a referred file gets moved or renamed? > > Like you have /foo.css and for some reason or another you move it to > /lib/css and rename it to bar.css. > Now it'd be nice if an IDE was aware of all the references within a site > and update the affected urls. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- *___* * * السجل .. كل الأخبار من كل مكان www.alsjl.com صفحة السجل على فيسبوك http://www.facebook.com/alsjl *Muad Shibani* * * Aden Yemen Mobile: 00967 733045678 www.muadshibani.com
[PHP] news and article posts in one table
i wanna to create one table that contains both news and articles posts, they have similar columns like id, title, content, and date but they are differ in one column = the source of news or article post article has writers that have permanent names and pictures obtained from another table called writers that supposed to be left joined with the news table, while news posts simply have a source as text like AFP or Reuters and so one. How I can solve this ?
Re: [PHP] Frivolous Friday Fun!
I love it On Fri, Nov 11, 2011 at 9:22 PM, Marc Guay wrote: > >"Our" does not automatically become all-inclusive, but rather > > suggests that the individual is part of a larger group. Please watch > > your presumptions of being force-included into said group, as the > > statement is valid regardless of anyone's personal opinion. ;-P > > Crap, you're right. > > My apologies to myself for including myself in a group I didn't want > to be a part of. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- *___* * * السجل .. كل الأخبار من كل مكان www.alsjl.com صفحة السجل على فيسبوك http://www.facebook.com/alsjl *Muad Shibani* * * Aden Yemen Mobile: 00967 733045678 www.muadshibani.com
[PHP] Curl cost
what are the costs of using PHP Curl to show another websites on my site as stumbleon do .. traffic, memory or what?
Re: [PHP] PHP redirect
it works very well .. thanks a lot for you dajkta you saved my day .. thanks a lot On Sat, Sep 24, 2011 at 3:45 AM, Dajka Tamas wrote: > Try header(”Location: ”.html_entity_decode($data[’feed_link’])); > > ** ** > > *From:* muad shibani [mailto:muad.shib...@gmail.com] > *Sent:* Saturday, September 24, 2011 12:41 PM > *To:* Dajka Tamas > *Cc:* php-general@lists.php.net > *Subject:* Re: [PHP] PHP redirect > > ** ** > > it redirecting me to unavailable/wrong page, the data came from database > but each time it gives me & instead of & > > On Sat, Sep 24, 2011 at 3:39 AM, Dajka Tamas wrote:*** > * > > If $data['feed_link'] is extracted from $_POST, then it's already > urldecoded. > > BTW, what's the problem? It's not redirecting you, or just redirecting you > to az unavailable/wrong page? ( most browsers change the & in titlebar > to '&', so you don't have to worry about that ) > > > -Original Message- > From: muad shibani [mailto:muad.shib...@gmail.com] > Sent: Saturday, September 24, 2011 12:36 PM > To: php-general@lists.php.net > Subject: [PHP] PHP redirect > > when I try to go to a URL by using PHP header function so if the URL > contains & it converts it to & so the needed page will not > display correctly I tried to use: > > $url = urldecode($data['feed_link']); > > header ( "Location: $url" ); > > but I can't get it > > ** ** >
Re: [PHP] PHP redirect
it redirecting me to unavailable/wrong page, the data came from database but each time it gives me & instead of & On Sat, Sep 24, 2011 at 3:39 AM, Dajka Tamas wrote: > If $data['feed_link'] is extracted from $_POST, then it's already > urldecoded. > > BTW, what's the problem? It's not redirecting you, or just redirecting you > to az unavailable/wrong page? ( most browsers change the & in titlebar > to '&', so you don't have to worry about that ) > > -Original Message- > From: muad shibani [mailto:muad.shib...@gmail.com] > Sent: Saturday, September 24, 2011 12:36 PM > To: php-general@lists.php.net > Subject: [PHP] PHP redirect > > when I try to go to a URL by using PHP header function so if the URL > contains & it converts it to & so the needed page will not > display correctly I tried to use: > > $url = urldecode($data['feed_link']); > > header ( "Location: $url" ); > > but I can't get it > >
[PHP] PHP redirect
when I try to go to a URL by using PHP header function so if the URL contains & it converts it to & so the needed page will not display correctly I tried to use: $url = urldecode($data['feed_link']); header ( "Location: $url" ); but I can't get it
Re: [PHP] Querying a database for 50 users' information: 50 queries or a WHERE array?
Yes there is but all the IDs in one string like this $ids = $id1.', '.$id2.', ' ; note : remove the last comma from the string the make the query like this: mysql_query("SELECT * FROM table WHERE userID= in($ids ) } On Tue, Sep 13, 2011 at 7:24 AM, Dotan Cohen wrote: > I have a MySQL database table with about 10,000 rows. If I want to > query for 50 specific users (so no LIMIT ORDER BY) then I seem to have > these choices: > > 1) SELECT * FROM table > This will pull in all 10,000 rows, not nice! > > 2) foreach ($user as $u) { mysql_query("SELECT * FROM table WHERE > userID=".$u); } > This will lead to 50 queries, again not nice! (maybe worse) > > 3) foreach ($user as $u) { $whereClause+=" OR userID=".$u; } > This makes a huge SQL query. However, this is the method that I'm using > now. > > Is there some sort of array that can be passed in the WHERE clause, > containing all the userID's that I am interested in? > > Thanks! > > -- > Dotan Cohen > > http://gibberish.co.il > http://what-is-what.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
Re: [PHP] PHP cron job optimization
thanks a lot after I test it I will share the code .. Thanks again On Sat, Sep 10, 2011 at 11:20 AM, Gary Golden wrote: > > I want to design an application that reads news from RSS sources. > >> I have about 1000 RSS feed to collect from. > >> > >> I also will use Cron jobs every 15 minutes to collect the data. > >> the question is: Is there a clever way to collect all those feed items > >> without exhausting the server > >> any Ideas > >> Thank you in advance > Just watch your memory and you'll be fine. > As was stated fetching an rss feed is fast and cheap, so I would > contrariwise think about paralleling if I would you. > > -- * ___ Muad Shibani* * * Aden Yemen Mobile: 00967 733045678 Mobile: 00967 711811232 www.muadshibani.com
[PHP] PHP cron job optimization
I want to design an application that reads news from RSS sources. I have about 1000 RSS feed to collect from. I also will use Cron jobs every 15 minutes to collect the data. the question is: Is there a clever way to collect all those feed items without exhausting the server any Ideas Thank you in advance