|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general-digest-help_at_lists.php.net
Date: Sun Dec 01 2002 - 07:25:08 CST
php-general Digest 1 Dec 2002 13:25:08 -0000 Issue 1737
Topics (messages 126581 through 126598):
Re: last updated ?
126581 by: Morgan Hughes
Re: Read Files
126582 by: Chris Wesley
login_script_help needed.
126583 by: Karl James
126585 by: Maxim Maletsky
126592 by: Andrew Brampton
Re: Page break
126584 by: Justin French
Re: Redirect opening in a new window
126586 by: Maxim Maletsky
Problem importing LARGE text file.....
126587 by: CDitty
Re: Test links?
126588 by: Hugh Danaher
126590 by: Jason Wong
Session Variables Not Being Passed
126589 by: Jami
Guestbook
126591 by: Vicky
126593 by: Thomas Seifert
126594 by: Jason Wong
126595 by: sfasf saff
Inheritance problem
126596 by: Bernard Chamberland
126597 by: Tom Rogers
anyone askin for Page Breaks .... !
126598 by: sfasf saff
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
> >Dumb question here but whats the general practice regarding putting a
> >"website last updated:" entry on a web page? Does the web master manually
> >enter in today's date in a database table entry and let PHP display. Is it
> >statically added to the HTML page? Etc...
> If you want "website last updated" then from a database sounds OK but
> where I'm working its commonly a "page last updated" wanted. In this
> case its just a manually entered date in html in the page.
Or use stat() to get the page's mtime, something like
<?
$stat = stat($HTTP_SERVER_VARS['SCRIPT_FILENAME']);
$date = strftime("%c", $stat[9]);
print "Last update: $date";
?>
Which will be automatically updated...
-- Morgan Hughes C programmer and highly caffeinated mammal. kyhmkyhm.com ICQ: 79293356
attached mail follows:
On Sat, 30 Nov 2002, Randum Ian wrote:
> Ministry is the name of the club. > Full is the type of the content. > 6122002 is the date - It is in the form ddmmyyyy so the example here is > 6th December 2002. > Is there a simple way I can just grab the date and sort it by order? > Should I change the format of the date to make it easier or something?
It'd be easier to sort if you changed your date format a bit ... what you have is rather difficult to work with, unless you take the string apart. (i.e. - How is '7102002' not greater than '6122002'?) For simplicity & ease, I work with date strings formatted as "YYYYMMDD". If your files were named "something-full-YYYYMMDD", you could get a sorted array of your files easily.
$interestingFiles = array(); $dir = opendir( "/path/to/directory" ) or die( "Could not open dir" ); while( $dirEntry = readdir( $dir ) ){ if( ereg( "full-([0-9]{8})", $dirEntry, $MATCH ) ){ $interestingFiles[$MATCH[1]] = $dirEntry; } } ksort( $interestingFiles );
g.luck, ~Chris
attached mail follows:
http://www.ultimatefootballleague.com/Create_Account.phps hey people I was wondering if anyone can tell me why I cant get this script to work. Or do you have an easier one I can use.. Thanks Karl
attached mail follows:
what is on your line 22?
-- Maxim Maletsky maximphp.net
On Sat, 30 Nov 2002 20:46:12 -0800 "Karl James" <karl.james
verizon.net> wrote:
> http://www.ultimatefootballleague.com/Create_Account.phps > > hey people > > I was wondering if anyone can tell me why I cant get this script to > work. > > Or do you have an easier one I can use.. > > Thanks > Karl
attached mail follows:
Well quickly looking at the code I can't see what line is causing the Warning: Cannot add header information but there have been many discussion explaining why this happens... as for your Unknown MySQL Server Host '$198.63.221.3' the error for that is on the line: if(!($link_id = mysql_connect($198.63.221.3, $Ultimatefootball, $kjames1973))) die(mysql_erorr()); I think the line would look better like: $link_id = mysql_connect('198.63.221.3', 'Ultimatefootball', 'kjames1973') or die(mysql_erorr());
(might be a good idea to change your password now btw (since you have shown everyone))
Hope that gets you started
Andrew
----- Original Message -----
From: "Karl James" <karl.james
verizon.net>
To: <php-general
lists.php.net>
Sent: Sunday, December 01, 2002 4:46 AM
Subject: [PHP] login_script_help needed.
> http://www.ultimatefootballleague.com/Create_Account.phps > > hey people > > I was wondering if anyone can tell me why I cant get this script to > work. > > Or do you have an easier one I can use.. > > Thanks > Karl >
attached mail follows:
This is totally not PHP related. There is a page-break: before; (or similar) in CSS, so I suggest you go look around some CSS sites... like the W3.org.
Justin
on 01/12/02 5:26 AM, Lars Espelid (lars_espelid
hotmail.com) wrote:
> Hello, > > Is there some way to insert page breaks in a php document so that it becomes > more printer friendly. > > thanks > lars > >
Justin French -------------------- http://Indent.com.au Web Development & Graphic Design --------------------
attached mail follows:
isn't there an only module you could modify? Do you really need to edit 2000 pages? I am not NUKE fan, but I am sure there is an easier way
-- Maxim Maletsky maximphp.net
On Sat, 30 Nov 2002 12:09:33 -0800 "Troy May" <tmay
pcsympathy.com> wrote:
> That easy solution is not so easy for me. This portal system is PHP-Nuke. > There's different themes, pages, etc. It would take me 3 weeks to find and > edit all the links in a 2000 file directory. > > I just need to be able to do this from the called module itself, and that > would take care of all the pages/themes in one shot. > > > > -----Original Message----- > From: Jeffrey B.Ferland [mailto:jferland
autocracy.homelinux.org] > Sent: Saturday, November 30, 2002 12:02 PM > To: Troy May > Subject: Re: [PHP] Redirect opening in a new window > > > On Saturday 30 November 2002 02:55 pm, you wrote: > > Hello, > > > > I'm playing with a portal system now and I need to edit a module to > > redirect to another site/page. I have done this with a header() > > redirection, but it takes the current window. > > > > How can I do this and have it open a new window for the redirect? > > <a href="/link.htm" target="_blank">Displayed Link</a> > > > -Jeff > SIG: HUP > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
attached mail follows:
Hello all,
I am trying to import a 400 meg pipe delimited text file, but I am having problems. For some reason, it will only read in 320 lines and then it will cause a core dump. I have used this same script to import a 350 meg file with no problems. I have talked with my support and they believe it could be some type of problem or limitation with php.
Can anyone offer any advice on how to track this down? When I look at the core file, this is what it says..."core: ELF 32-bit LSB core file of 'php' (signal 11), Intel 80386, version 1"
CDitty
attached mail follows:
Not sure how to supress the warning message that PHP automatically does when you haven't got a valid URL though.
should be able to surpress errors by adding an * before the result variable
*$fp = fopen($linkdata['linkurl'],"r");
Hope this helps--or even works for this particular problem. Hugh
----- Original Message -----
From: "Beth Gore" <bethgore
tesco.net>
To: <php-general
lists.php.net>
Sent: Saturday, November 30, 2002 11:02 AM
Subject: Re: [PHP] Test links?
> Rob Packer wrote: > > >Okay, I'm confused... file, fopen, and fsockopen seem to say not found on > >alot valid URLs... does this look to be correct usage? > >$url = $row[0]; // just get the url from the db > >$fp = implode ('', file ($url)); > > if (!$fp) {echo "<font color=red><b>Unable to access file</b></font>"; } > > else { fclose($fp); echo "The link is working!"; } > > > >It seems I always get this warning... > > > >Warning: Supplied argument is not a valid File-Handle resource in > >/web/home/nrc.net/www/robert/links4.php on line 11 > > > >If someone can tell me what I'm doing wrong, I'd appreciate it. > > > >Thanks, > > Robert > > > > > > > > > > > When fopen successfully opens a file it populates an array > $http_response_header, which you can examine to see if the link works or > not - I don't believe you can actually get the file itself, but since > that's not what we're after that's not a problem! > > Having said that, fopen produces a very annoying error if it doesn't > find the page, but I found the following works: > > <?php > > $SQL = "SELECT linkurl, linkID FROM links"; > $result = mysql_query($SQL); > > while($linkdata = mysql_fetch_array($result)){ > > $fp = fopen($linkdata['linkurl'],"r"); > if($fp) > { > echo "<p>".$linkdata['linkurl']." is still valid.</p>"; > > }else{ > > echo "<p>".$linkdata['linkurl']." is invalid. Updating > database... "; > > $SQL = "UPDATE links SET status = 0 WHERE linkID = > '".$linkdata['linkID']."'"; > $result2 = mysql_query($SQL); > if($result2) > { > echo "Database updated</p>"; > } > } > > } > ?> > > Rather than deleting the link, it's probably better to set a flag to > show it was invalid last time you checked, but check it again next time. > Or you could keep a count of the number of failed attempts, and delete > if it goes beyond 3 or so. > > Not sure how to supress the warning message that PHP automatically does > when you haven't got a valid URL though. > > Hope this works for you! > > Beth Gore > -- > http://bethanoia.dyndns.org > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
attached mail follows:
On Sunday 01 December 2002 15:33, Hugh Danaher wrote: > Not sure how to supress the warning message that PHP automatically does > when you haven't got a valid URL though.
Error reporting options can be set in php.ini or by using ini_set().
> should be able to surpress errors by adding an * before the result variable > > *$fp = fopen($linkdata['linkurl'],"r");
I think you mean '
':
$fp =
fopen($linkdata['linkurl'],"r");
-- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* Blessed is he who expects no gratitude, for he shall not be disappointed. -- W.C. Bennett */
attached mail follows:
The code that I have is as such:
//header.php if(isset($_POST['login'])){ $checkuser = mysql_query("SELECT * FROM mainacct WHERE username = '{$_POST['username']}' AND password = '{$_POST['password']}' ", $connection) or die ("Couldn't find user."); if (mysql_num_rows($checkuser) > 0){ while ($row = mysql_fetch_array($checkuser)){ $_SESSION['UN'] = $row['username']; $_SESSION['UserLoggedIn'] = True; } } else { header("Location:login.php"); exit; } }
This file is then used as an include in main.php. As long as the variables are used ONLY in the header.php file, it works. But when I try to call the session variables in main.php, it doesn't show the values of UN or UserLoggedIn. session_start() is called in main.php. Is this a quirk with sessions, or is there something more I am supposed to be doing? Running Apache 2 w/PHP 4.2.3 on WindowsXP.
Jami
attached mail follows:
Hiya ^_^
I have a guestbook I coded myself using PHP. In the corner it keeps record of the entry number, but when I delete and entry the entries posted after it don't go back to catch up. So the entry numbers skip from 22 to 24, for example.
Is there anyway to stop this happening, so if i delete an entry the next one will follow on instead of being the number it would have been if i hadn't deleted the entry?
Thanks ^_^
attached mail follows:
Hi,
you give less information. How do you compute the entry number and how do you save the entries and so on. Normally you will have to live with the gaps but sure, you can touch every entry and change its number ;-).
Thomas
On Sun, 1 Dec 2002 10:33:45 -0000 vprince
btinternet.com (Vicky) wrote:
> Hiya ^_^ > > I have a guestbook I coded myself using PHP. In the corner it keeps record > of the entry number, but when I delete and entry the entries posted after it > don't go back to catch up. So the entry numbers skip from 22 to 24, for > example. > > Is there anyway to stop this happening, so if i delete an entry the next one > will follow on instead of being the number it would have been if i hadn't > deleted the entry? > > Thanks ^_^ >
attached mail follows:
On Sunday 01 December 2002 18:33, Vicky wrote: > Hiya ^_^ > > I have a guestbook I coded myself using PHP. In the corner it keeps record > of the entry number, but when I delete and entry the entries posted after > it don't go back to catch up. So the entry numbers skip from 22 to 24, for > example.
You're probably using some kind of 'autoincrement' field for your entry number.
> Is there anyway to stop this happening, so if i delete an entry the next > one will follow on instead of being the number it would have been if i > hadn't deleted the entry?
The short answer is if you want that kind of behaviour then you shouldn't be using an autoincrement field.
The quick solution, if you intend to continue the autoincrement field, is to number the entries manually when you're displaying them: Something along the lines of:
$count = 0; while ($row(mysql_fetch_array($result_id))) { $count++; echo "Entry $count"; ... ... }
-- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* If bankers can count, how come they have eight windows and only four tellers? */
attached mail follows:
in mysql the autoincrement field will not go back to fill gaps...
and this is for a good reason ...
suppose you had an entry (bogus1) in your guest book with entry number 23 and you deleted it...
now a new entry comes and it is given the entry number 23 ... well this ambigus : did u delete the original one or modified it ? also people pointing to that particular entry in their sites will be confused by the change... where as in the real life we usuallay offer a "record does not exist" type of message ...
got it ?!
--- Thomas Seifert <thomas.seifert
myphorum.de> wrote:
> Hi,
>
> you give less information.
> How do you compute the entry number and how do you
> save the entries and so on.
> Normally you will have to live with the gaps but
> sure, you can touch every entry
> and change its number ;-).
>
>
> Thomas
>
> On Sun, 1 Dec 2002 10:33:45 -0000
> vprince
btinternet.com (Vicky) wrote:
>
> > Hiya ^_^
> >
> > I have a guestbook I coded myself using PHP. In
> the corner it keeps record
> > of the entry number, but when I delete and entry
> the entries posted after it
> > don't go back to catch up. So the entry numbers
> skip from 22 to 24, for
> > example.
> >
> > Is there anyway to stop this happening, so if i
> delete an entry the next one
> > will follow on instead of being the number it
> would have been if i hadn't
> > deleted the entry?
> >
> > Thanks ^_^
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
===== +------------------------------------------+ |Wana Know what ISLAM is all about ? | +------------------------------------------+
visit : http://www.sultan.org/#int
__________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com
attached mail follows:
Hi,
I would like to post the following question related to an inheritance problem with PHP OO programming :
With an object of a subclass, I call a method of the parentclass in order to modify an attribute of the parentclass. It does work correctly but later when I call the display method of the parentclass, I receive the previous value of the attribute !!!
The code below shows the problem : The parentclass is "Ressource" The subclass is "Water" The attribute of the parentclass is "$volume" The method to update $volume is "increase" The method to display the parentclass is "display"
An explanation and a trick to fix the problem would be greatly appreciated.
Thanks !
Bernard
<?php
define('_MAXX', 10); define('_MAXY', 10); define('_MAXENERGY', 20); define('_MAXRESERVEWATER', 20); define('_MAXVOLUMEWATER', 10); define('_MAXVOLUMEPLANT', 10);
class Jungle { var $jungleobjects; // composition relation = array of $Jungleobject
function Jungle() { // Create eaux for ($i=1; $i<=2; $i++) { //> $this->jungleobjects[] = new Water($posx = mt_rand(1, _MAXX), $posy = mt_rand(1, _MAXY), $volume = mt_rand(1, _MAXVOLUMEWATER)); } // Create plantes for ($i=1; $i<=1; $i++) { //> $this->jungleobjects[] = new Plant($posx = mt_rand(1, _MAXX), $posy = mt_rand(1, _MAXY), $volume = mt_rand(1, _MAXVOLUMEPLANT)); }
}
function display() { foreach ($this->jungleobjects as $jungleobject) { $jungleobject->display(); } }
function receiverain($density) { foreach ($this->jungleobjects as $jungleobject) { $jungleobject->receiverain($density); } }
} // Jungle
class Jungleobject { var $posx; var $posy;
function Jungleobject($posx, $posy) { $this->posx = $posx; $this->posy = $posy; }
function display() { echo "<br>"; echo "Class : ".get_class($this)."<br>"; echo "Posx : ".$this->posx."<br>"; echo "Posy : ".$this->posy."<br>"; }
function receiverain($density) // Abstract method : should be defined at sub-class level (not mandatory) { echo "Class : ".get_class($this)." Nothing to do with rain"."<br>"; }
function evoluer() {} // Abstract method : should be defined at sub-class level (not mandatory)
} // Jungleobject
class Ressource extends Jungleobject { var $volume;
function Ressource($posx, $posy, $size) { $this->Jungleobject($posx, $posy); $this->volume = $size; }
function increase($quantity) { echo "Class : ".get_class($this)." method : increase ($quantity)"."<br>"; echo "Actual volume : $this->volume"."<br>"; $this->volume += $quantity; echo "New volume : $this->volume"."<br>"; }
function display() { jungleobject::display(); echo "Volume (Ressource) : $this->volume"."<br>"; }
} // Ressource
class Plant extends Ressource { function Plant($posx, $posy, $volume) { //$this->Ressource($posx, $posy, $volume); Ressource::Ressource($posx, $posy, $volume); }
} // Plant
class Water extends Ressource { function Water($posx, $posy, $volume) { $this->Ressource($posx, $posy, $volume); }
function receiverain($density) { echo "<br>"; echo "Class : ".get_class($this)." Welcome the rain ($density) !"."<br>"; $this->increase($density); //Ressource::increase($density); }
} // Water
class Rain { var $jungle;
function Rain($jungle) { $this->jungle = $jungle; }
function fall($density) { $this->jungle->receiverain($density); }
} // Rain
// Main
$myjungle = new Jungle(); $myrain = new Rain($myjungle);
$myjungle->display(); $myrain->fall(10); $myjungle->display();
?>
attached mail follows:
Hi,
Sunday, December 1, 2002, 10:05:53 PM, you wrote: BC> Hi,
BC> I would like to post the following question related to an inheritance BC> problem with PHP OO programming :
BC> With an object of a subclass, I call a method of the parentclass in order BC> to modify an attribute of the parentclass. It does work correctly but later BC> when I call the display method of the parentclass, I receive the previous BC> value of the attribute !!!
Try this:
class Rain { var $jungle;
function Rain(&$jungle) //<<<<< { $this->jungle =& $jungle; //<<<<< }
function fall($density) { $this->jungle->receiverain($density); }
} // Rain
-- regards, Tom
attached mail follows:
there was a post here asking about creating page breaks...
well ..
this page might be of great help :
http://www.west-wind.com/wckb/creatingpagebreaksinhtmldocuments.htm
===== +------------------------------------------+ |Wana Know what ISLAM is all about ? | +------------------------------------------+
visit : http://www.sultan.org/#int
__________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]