-
Editing a live site
Date: 05/14/05
(WebDesign) Keywords: php, web
When some sites are undergoing maintainance a user may see an "under maintainance come back later" message when visiting the site. Most of the time they'll see this message no matter what part of the site they try to visit. I'm still very dinosaur when it comes to web design so I still write everything by hand and when I do have some php I need to work on I need to work on it live. Sometimes however I want to be able to work on the site or make updates without having people be able to interact with the site... I want to do this without renaming any files (esp. the index file), any directories, or moving anything around. How is it done?
Source: http://www.livejournal.com/community/webdesign/878333.html
-
Is it okay to do this?
Date: 05/14/05
(Javascript Community) Keywords: php, browser, html, java
I have been wondering... How do I pass on some data to a html file given that cookies are disabled on the client's computer, and the server does not support scripting - PHP, Perl, CGI, etc. ??? The problem has to be solved on the client's side.
Let's say we have two files: p1.htm and p2.htm. The JavaScript in p1.htm wants to load p2.htm into the browser. But p1.htm needs to pass certain values to p2.htm. How do you do it?
Here is what I found:
p1.htm will load p2.htm and insert the data into the address field like this:
location.href = 'p2.htm#mydata123';
The JavaScript function in p2.htm will read the "location.href" variable and remove everything that precedes the '#' sign. What's left is "mydata123"!!!
This way, I can pass parameters from one file to the next.
My question is, IS THIS 'LEGAL'?
What the script is doing here is basically tell the browser to load p2.htm and go to LABEL mydata123. Of course, there is no such label in p2.htm, so the browser will just go to the beginning of the page.
Source: http://www.livejournal.com/community/javascript/67112.html
-
ATTN: Firefox Experts
Date: 05/16/05
(PHP Development) Keywords: php
Okay, so this isn't PHP-specific, but I thought someone here might be likely to know...
Does anyone here know how to get the song name to show up when embedding an mp3/m3u in Firefox?
Examples _without_ filename/ID3 display:
http://www.popgoeslethal.com/wma_embed_firefox/wma_embed_main_frame.htm
I can embed and play fine... but Firefox users will have no idea WHAT is playing. Thanks!
Source: http://www.livejournal.com/community/php_dev/57808.html
-
Из файлов примеров модуля PHP mnogosearch // From the example files in mnogosearch PHP module
Date: 05/14/05
(Code WTF) Keywords: php
$str=ereg_replace('\$DT', $title, $str);
$str=ereg_replace('\$DR', "$rating", $str);
$str=ereg_replace('\$DX', $text, $str);
$str=ereg_replace('\$DE', ($desc != '')?$desc:$text, $str);
$str=ereg_replace('\$DC', $contype, $str);
$str=ereg_replace('\$DM', $lastmod, $str);
$str=ereg_replace('\$DS', "$docsize", $str);
$str=ereg_replace('\$DN', "$ndoc", $str);
Для незнающих PHP поясню: ereg_replace - функция для работы с POSIX regexp, поэтому $ в строке заэкранирован. Т.е., фактически, в данном случае нужна другая функция - str_replace, которая заменяет одну строку на другу. Впрочем, PHP позволяет задать массив замен и вопрользоваться функцией strtr
Source: http://www.livejournal.com/community/code_wtf/3889.html
-
mod_rewrite and php problems
Date: 05/16/05
(Web Development) Keywords: php, css, html
I have a simple php file that inserts 1 row into a db. It's in a
directory with a mod_rewrite in a .htaccess file. The mod_rewrite
appears to be causing the php script to be run twice for every page
request because it inserts two rows into the db for each page request.
If I remove the .htaccess then it works fine. Can someone tell me why
this is happening and how I can fix it? Here is my php file
test.php
---------------------------
$db = mysql_connect('localhost', 'xxxxx', 'xxxxx');
mysql_select_db('xxxxxx');
echo 'create cache' . "
\n";
$query1 = "insert into searches (keywordId, relatedId)
values('1','764419')";
mysql_query($query1);
?>
---------------------------
here is my .htaccess
---------------------------
Options FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} .*sitemap(.*).html.*
RewriteRule ^(.*)$ sitemap.php [L]
RewriteCond %{REQUEST_FILENAME} !.*main.css.*
RewriteCond %{REQUEST_FILENAME} !.*sm.css.*
RewriteCond %{REQUEST_FILENAME} !.*banner.gif.*
RewriteCond %{REQUEST_FILENAME} !.*disclaimer.html.*
RewriteCond %{REQUEST_FILENAME} !.*sitemap.php.*
RewriteCond %{REQUEST_FILENAME} !.*index.php.*
RewriteCond %{REQUEST_FILENAME} !.*test.php.*
RewriteCond %{REQUEST_FILENAME} !.*404.html.*
RewriteRule ^(.*)$ index.php
Source: http://www.livejournal.com/community/webdev/200040.html
-
WordPress Plugin: AdRotator - Ad Rotating Solution for your Ads (including AdSense)
Date: 05/16/05
(Java Web) Keywords: cms, php
Overview
Displays an advertisement (which is randomly selected from a group of advertisements specified in a text file) at your chosen location. Tested only on WordPress 1.5. Should work with earlier and later versions (future and past proofed). It can also be used with other CMS systems or anywhere where PHP is supported.
It does one [...]
Source: http://blog.taragana.com/index.php/archive/wordpress-plugin-adrotator-rotate-your-ads-including-adsense-dynamically/
-
weird question...
Date: 05/18/05
(WebDesign) Keywords: php, mysql, database, asp, sql
How difficult is it to learn PHP for use with a MySQL database? And how difficult is it to create the MySQL database? Like, would it take me months? I have no previous PHP experience...I've only ever done ASP.NET with VB.NET.
I'm going to be starting a new project at my summer internship, and I'm wondering if it's worth it to focus on this particular part of it (or if I need to just setup a prototype of how the data display will look, and tell them they need to find someone with PHP/MySQL experience to create the actual database and code).
Source: http://www.livejournal.com/community/webdesign/882497.html
-
javascript click tracker
Date: 05/18/05
(Web Development) Keywords: php, mysql, browser, html, sql, java, tracker
I'm trying to create a javascript click tracker, but I'm having a problem. The setup is very simple so I'll just give the code.
index.html
---------------
A Link
tracker.php simply inserts the url of the link into mysql.
The problem is very strange. Everything works fine if the files served
from my local machine. If I upload it to the server things get weird.
It doesn't work with firefox from my office (3 different machines and 3
different versions), but it works with firefox from every other place
(home, friends, etc). It works fine with IE and Konqueror. Note: I
did change localhost in the js function to the proper value for the
server. It works if I go directly to the URL that's in the javascript
so it seems that that line isn't exucted by my local firefox browsers.
Does anyone have an ideas on this? Is there a free click tracker script
that any of you know of? (free as in I can see the code)
Source: http://www.livejournal.com/community/webdev/200619.html
-
Access database and ASP
Date: 05/18/05
(Web Development) Keywords: php, database, asp, sql, web
I have an access database I'd like to put on the web, so:
1) Is the best way to do this using ASP? Currently the website is hosted on Dreamhost, which I don't think supports ASP. Is there maybe an easy way to export it to an SQL database and then use PHP?
2) If the best solution is ASP (which I've never touched), can you recommend any good hosts?
Thanks.
Source: http://www.livejournal.com/community/webdev/201019.html
-
CSS Cheat Sheet
Date: 05/19/05
(WebDesign) Keywords: php, css
Hello. Long time lurker, first time poster.
Quick question. Awhile back someone posted a link to a CSS and PHP cheat sheet. I can't remember if it was an actual post or in a comment, but I searched the community and can't find the information. Can someone point me in the right direction?
Thanks in advance!
Source: http://www.livejournal.com/community/webdesign/883985.html
-
Goofy permissions
Date: 05/19/05
(MySQL Communtiy) Keywords: php, mysql, sql
I have a PHP script that was failing until I fixed the permissions. It was falling down on DELETE. The script's account in the mysql.user table had Delete_priv set to N. When it was changed to Y, the script ran.
However, Select_priv, Insert_priv, and Update_priv are also set to N, and the script has not had any problems running SELECT, INSERT and UPDATE queries. Why would this be happening?
Source: http://www.livejournal.com/community/mysql/57244.html
-
Articles
Date: 05/19/05
(WebDesign) Keywords: php
In the process of redesigning and restructuring my site, as some may already know, and I'm looking for a script (preferably PHP) that will help with posting articles. I've found a few good free ones, but I'm looking for one that also has a rating system. As I'm already bogged down with scripting myself, any suggestions?
And hi to the rather attractive girl... :D
Source: http://www.livejournal.com/community/webdesign/884572.html
-
Crikey is LAMP ever fast...
Date: 05/19/05
(PHP Community) Keywords: cms, php, templates, mysql, sql, linux, apache
I don't know why I never thought to do it before, but I put some benchmarking code into my CMS project today (PluggedOut CMS) - and was somewhat astounded at how quickly it's throwing pages back at me.
For an "un-cached" page, it's throwing things back in around 0.004 seconds, which I thought was damn fast... but get this - if I cache the page (so it doesn't have to bother building it from templates etc...) - it took just under 0.0004 seconds on average.
I don't know of a better advert for Linux, Apache, MySQL, and PHP quite frankly.
For those interested, the testing is on a Athlon 64 3200 (2.8Ghz), with 1Gb RAM, and a 160Gb HDD. It has Mandrake X64 on it.
Source: http://www.livejournal.com/community/php/299782.html
-
[resolved]
Date: 05/19/05
(PHP Community) Keywords: php
RESOLVED
The following code is part of my vars.php file:
$path = basename($_SERVER['SCRIPT_FILENAME']);
$newpath = str_replace('.php','',$path);
When I echo $newpath
, it shows me the filename minus the .php at the end, which it's supposed to do. This suggests to me that $path
is working as it should, and has picked up the filename.php - right?
(EG. file might be index.php, so $path
is index.php and $newpath
is index)
So, why is it that when I echo $path
, it shows: URL
(source: URL
)
..which incidently is the last variable in my vars.php file. What I don't get is why $newpath
is worked out okay from what is obviously the right path, but $path
echos as something completely different? I can't for the life of me figure out why it's echoing the wrong thing. What am I missing?
EDIT: Even if I remove the $url
variable from the vars.php file altogether, echoing $page
still echos the crap that WAS in $url
. wtf?
vars.php
$ip = $_SERVER['REMOTE_ADDR'];
$browser = getenv('HTTP_USER_AGENT');
$ref = getenv("HTTP_REFERER");
$path = basename($_SERVER['SCRIPT_FILENAME']);
$newpath = str_replace('.php','',$path);
$xhtml = "XHTML";
$css = "CSS";
$html = "HTML";
$w3c = "W3C";
$php = "PHP";
$os = "OS";
$path = "URL";
$asap = "ASAP";
$msie = "MSIE";
$ict = "ICT";
$mysql = "MySQL";
$url = "URL";
?>
other file
include('header.php'); ?>
=$path;?>
include('footer.php'); ?>
..the vars.php is included (require_once('vars.php');
) in the header.php file
Source: http://www.livejournal.com/community/php/299614.html
-
WordPress + EzStatic + MicroWiki = frustration!
Date: 05/20/05
(Web Development) Keywords: php, software, html
Thanks for all your comments and suggestions when I asked for recommendations for blog software.
So I installed WordPress 1.5.1 yesterday and today I've been trying to install MicroWiki. I'm stumped by the EzStatic install/config and/or the MicroWiki install/config. I've followed the instructions but I just can't get in to MicroWiki.
Here are the links: [homepage for the WP blog] [where I'd expect to find the wiki]
I've installed EzStatic as per the instructions: ezstatic.php resides in ~blog/wp-content/plugins ("blog" isn't really it's a user - I'm just using that as shorthand for the top-level directory of the WP installation). I haven't messed around with the Advanced Configuration section as I don't really know PHP.
"If EzStatic is activated on your server, but your static content doesn't appear, it could be the result of several issues: First, be doubly sure that EzStatic is activated on your WordPress Plugins tab. It doesn't work if it's not turned on." I've been installing a few plugins today, but I've double checked that EzStatic is active.
"Second, view the source of a page that should contain EzStatic content. If EzStatic is truly active, then somewhere in the HTML source you should see a message. Search the source for "EzStatic"." This is where it gets confusing ... http://www.henman.name/blog/wp-content/wiki/index.php is empty, and yet I can see the source PHP file OK. I can also browse to the .GIF and .TXT files in that same directory.
So what's up with the Wiki's PHP file? Or is it EzSetup? Or something else??
p.s. The blog only contains a couple of dummy entries (copied from my LJ) so I can trash it if I absolutely have to ... although I hope/suspect that won't be necessary.
Source: http://www.livejournal.com/community/webdev/202350.html
-
Fedex shipping calculator in PHP?
Date: 05/21/05
(PHP Community) Keywords: php, java, google
Hi, I need to set up a Fedex shipping calculator in PHP for work. I was looking around the Fedex Ship Manager API, but it says it only supports Java, C/C++, VB and JScript. I've also searched Google to try to find a solution, but to no avail (all the "solutions" I found did not work). This seems like it should be a very simple problem. Does anyone know if there is already a simple solution available or if I could reverse-engineer a script in another language? Thanks in advance for your help!
Source: http://www.livejournal.com/community/php/300069.html
-
Stupid question
Date: 05/21/05
(Computer Geeks) Keywords: php, web
Where the hell has the free version of AVG gone? I've been poking around http://www.grisoft.com/ for a full 15 minutes now, and I keep going in circles.
Never bloody mind. I found it. http://free.grisoft.com/freeweb.php
Boy, do I feel like a dork now...
Source: http://www.livejournal.com/community/computergeeks/690357.html
-
Installation
Date: 05/22/05
(Apache) Keywords: php, apache
I am wanting to install Apache on my XP (w sp2), so that I can test my PHP scipts. However, I do not have a domain name in the instal wizard, what should I put if I don't have a domain name, server name as I just want it to run on my one computer ? Does it even matter ?
(I'm hoping this makes sense)
Source: http://www.livejournal.com/community/apache/20146.html
-
Selecting all records between dates
Date: 05/23/05
(MySQL Communtiy) Keywords: php, mysql, database, sql
Hello! This is probably a painfully stupid question, but I'm asking anyway. I'm trying to select all records in the database where the start date (start, which is of type date, obviously) is between the user-supplied dates.
Entering select email from nexus where start between '2000-01-01' and '2005-05-01'; from the mysql prompt returns the correct information, but when I put it in a php script, it returns nothing. I've got other queries in this same script ("select email from nexus where ".$field." like '%".$term."%'") which are working as expected, so I'm pretty sure it's just that particular query.
It's probably something really stupid that I just don't see because I'm looking too hard, but I'm all out of ideas. If any of you kind folks have any insight, I'd really appreciate it. Thanks!
Source: http://www.livejournal.com/community/mysql/57350.html
-
PHP + MySQL Paging
Date: 05/23/05
(WebDesign) Keywords: php, mysql, sql, google
Well, it turns out this whole PHP and MySQL project was a heck of a lot easier than I thought.
I have hit one hitch, though. I've looked all over Google for an easy script for using paging with my SQL queries. When all is said and done, this table I'm going to have will have somewhere around 5,000 entries, so I really need to enable paging.
Problem is, all the scripts I've found won't work.
I'm using a somewhat complex SQL statement (it's not just a SELECT * FROM TABLE kind of thing), and I've got all my query display and search functions working correctly. I just need this paging thing to work. I understand the general idea of how the whole function is supposed to work, but I keep getting errors.
If anyone can give me any help at all, I'd really appreciate it. I've totally resorted to cut-and-pasting code and just modifying the SQL statement to work with my existing tables, but it still won't work. I can post code portions if necessary..
Thanks in advance.
Source: http://www.livejournal.com/community/webdesign/887367.html