[PHP] Force no Cache

2003-04-05 Thread Davíð Örn Jóhannsson
Is there any way in php to disable the users cache so that every time
you reload you fetch the newest version of the site?
 
 
Regards, David


[PHP] Search engine

2003-03-21 Thread Davíð Örn Jóhannsson
Dose any one have any tips on making a very simple search engine, that
only searches in two fields of a mysql table.
I just need some pointers to know where to begin.
 
Thanks, David


[PHP] Problem with a for loop...

2003-01-16 Thread Davíð Örn Jóhannsson
I have al for loop that looks something like this:
 
$checkCurrName  = SELECT imgName FROM $db_img ORDER BY imgName DESC;
$resultCurrName = mysql_query($checkCurrName, $db);
 
 
for ($i = 0; $i  $n; $i++){
list($currName) = mysql_fetch_row($resultCurrName);
$newName = $currName++;
print($newName);
 
//insert $newName into db
} 
 
The problem is that I get the first printout right (the current value in
the database + 1) but all after that equal the first one, it looks
like i’m not getting the newest value from the database after the first
loop.
 
Any Ideas about this
 
Thanks, David



FW: [PHP] Problem with a for loop...

2003-01-16 Thread Davíð Örn Jóhannsson


-Original Message-
From: Davíð Örn Jóhannsson [mailto:[EMAIL PROTECTED]] 
Sent: 16. janúar 2003 13:59
To: '1LT John W. Holmes'
Subject: RE: [PHP] Problem with a for loop...

I only want the last inserted row in the mysql database, and each time
the script goes trough the loop it adds a new row into the database, so
I want to get the newest row from the database when the script goes
throug the loop
The second time. But it dosent look like im geting the new row from the
database even though it is inserted. I'm wondering if mysql_querys don't
work in loops in order to get the newst row but if it works how would I
be able to accomplis that?

-Original Message-
From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]] 
Sent: 16. janúar 2003 13:51
To: Davíð Örn Jóhannsson; [EMAIL PROTECTED]
Subject: Re: [PHP] Problem with a for loop...

Are you sure $n is being set somewhere?

Why not do it like this:

while($row = mysql_fetch_row($resultCurrName))
{
  print $row[0]+1;

  //do rest of whatever...
}

---John Holmes...

- Original Message -
From: Davíð Örn Jóhannsson [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, January 16, 2003 8:39 AM
Subject: [PHP] Problem with a for loop...


I have al for loop that looks something like this:

$checkCurrName  = SELECT imgName FROM $db_img ORDER BY imgName DESC;
$resultCurrName = mysql_query($checkCurrName, $db);


for ($i = 0; $i  $n; $i++){
list($currName) = mysql_fetch_row($resultCurrName);
$newName = $currName++;
print($newName);

//insert $newName into db
}

The problem is that I get the first printout right (the current value in
the database + 1) but all after that equal the first one, it looks
like i'm not getting the newest value from the database after the first
loop.

Any Ideas about this

Thanks, David


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Going from 1040601600 to Human time

2003-01-14 Thread Davíð Örn Jóhannsson
I used mktime to make 1040601600 this stirng but I want to go back to
human readable time how should I do that?
 
Thanks, David



[PHP] How to attach a file to mail()

2003-01-03 Thread Davíð Örn Jóhannsson
mail($to, $subject, $body, From: $email);
 
how do I insert an attachment into this mail function, It would be
submitted with file field and would be called attachment.
 
Regards, David



[PHP] Showing 10 record items per page...?

2002-12-17 Thread Davíð Örn Jóhannsson
I need to be able to show maybe 10 items that I query from a mysql
database on each page and I’m not really sure how I can do this.
 
If I have lets say 30 items that match the query, I would like the page
to display this at the bottom 
 
Previous 10  page 1 2 3  Next 10 of 30
 
 
Can any one direct me in the right direction to make this possable?
 
Regards, David



[PHP] Don't get variable to be passed to the page on submit

2002-12-13 Thread Davíð Örn Jóhannsson
I have this code whitch I have been staring at for hours and I just
can’t figure out what is going on...
 
it is about as simple as it gets I just need to pass a variable from
this page to it self, and that would be tha variable $nafn
 
I have this included code included into another page that is why I use
the aAction and sAction variables in the from action
so the script knows where to go after submiting. I have done similar
things on this site I’m working on an that works but this
i just can’t get to work.
 
It is prob. just somthing silly and wery eazy but I could use some
assistance to finde out what.
 
Regards, David
 
?php
 
if(!isset($submit)){
session_register(nafn);
?
form action=?php echo
$PHP_SELF?aAction=$aActionsAction=$sActionsubmit=1test=test; ?
method=post enctype=text/plain name=form
 
  table width=450 border=0 cellspacing=0 cellpadding=0
tr 
  tdNafn yfirflokks:/td
  tdinput  type=text name=nafn id=nafn/td
/tr
  /table
 
  p
input type=submit name=Submit value=Vista flokk
  /p
/form
?php
}
else{
print($test);
print($nafn);
$newQuery = INSERT INTO $db_imgCat (catName, subCat) VALUES
('$nafn', 0);
if(mysql_query($newQuery, $db) or die(mysql_error())){
print(Flokkur vistaður);
}
else{
print(fail);
}

}
?
 
 



[PHP] Session

2002-12-12 Thread Davíð Örn Jóhannsson
Hi I think it is possible to use sessions without having to insert
sid=$sid into every link i print out but I don’t get it to work any
Ideas about what I could be doing wrong?
 I have a login form on a page called login.php, and if login is ok,
then it sets $sid = session_id(); and prints out headers:
heder(Location: index.php?sid=$sid); and it passes the sid variable to
the index page and it works ok but when I click on any links on the
index page I get thrown back to the login, because I made the script do
that if the $sid != session_id().
 
session.use_trans_sid = 1 in the php config
 
this would work if I would print out sid=$sid in every link I have on
the page but I rather not. I would be greatful for any ideas about what
I could be doing wrong.
 
Regards, David
 



[PHP] Uploading a directory via browser w/ php

2002-12-11 Thread Davíð Örn Jóhannsson
Hi I’m wondering if any body has done somthing like uploading a whole
directory trough webbrowser using php, 
or has any Ideas how such a thing can be done, any Ideas appriciated.
 
Regards, David



[PHP] Creating dynamic names for images

2002-12-04 Thread Davíð Örn Jóhannsson
I have a situation where I allow users to upload images, and I store the
names of the images in a database and the images  I store in a some
folder on the server, but what I would like to do is to dynamically
create names for the images and dont ever have to worry about if this
name exists and with out having to got to the trouble of asking the user
to change tha name of the file.
 
So dose some one have a nice litle solution for this problem.
 
Thanks, David
 



[PHP] Changeing user

2002-12-04 Thread Davíð Örn Jóhannsson
I need to be able to create dirs, chmod and other stuff on the server,
but I get : Warning: MkDir failed (Permission denied), so 
Is there any way for me to do something so I can change the user I
attept to execute those functions.
 
Something like exec(change user, pass).
 
Thanks David



[PHP] I'm having a problem with running scripts on IIS server

2002-11-21 Thread Davíð Örn Jóhannsson
This is the script I’m running
 
?php
include(db_connect.php);
$query = select top 5 * from news order by news_id desc;
$result = mssql_query($query, $db);
 
$i = 0;
while($row = mssql_fetch_row($result)){
$i++;
$title = rawurlencode($row[1]);
$date = rawurlencode($row[2]);
$headline = rawurlencode($row[3]);
$full = rawurlencode($row[4]);

$title = str_replace(%DE, %80, $title);
$date = str_replace(%DE, %80, $date);
$headline = str_replace(%DE, %80, $headline);
$full = str_replace(%DE, %80, $full);

$title = str_replace(%FE, %81, $title);
$date = str_replace(%FE, %81, $date);
$headline = str_replace(%FE, %81, $headline);
$full = str_replace(%FE, %81, $full);

$title = str_replace(%FD, %87, $title);
$date = str_replace(%FD, %87, $date);
$headline = str_replace(%FD, %87, $headline);
$full = str_replace(%FD, %87, $full);

$title = str_replace(%DD, %87, $title);
$date = str_replace(%DD, %87, $date);
$headline = str_replace(%DD, %87, $headline);
$full = str_replace(%DD, %87, $full);

$title = str_replace(%F0, %9B, $title);
$date = str_replace(%F0, %9B, $date);
$headline = str_replace(%F0, %9B, $headline);
$full = str_replace(%F0, %9B, $full);

$title = str_replace(%D0, %8B, $title);
$date = str_replace(%D0, %8B, $date);
$headline = str_replace(%D0, %8B, $headline);
$full = str_replace(%D0, %8B, $full);

printf(title$i=%sdate$i=%sheadline$i=%sfull$i=%s,
$title, $date, $headline, $full);}
 
php?
 
And it results this: 
 
?title1=ewrsdfdate1=21.11.2002headline1=sfasd%20fsd%20sdfdfffull1=s
df%20sdf%20sdf%20asdfdline$i=%sfull$i=%s, $title, $date, $headline,
$full);} php? , $full); } php?
 
Prints out all kinds of shit, php tags, variable names and stuff, I’ve
used this script on a LAMP server and no problems.
 
The server is runing PHP V. 4.1.2 on win 2000 CGI version, Any Ideas???
 



FW: [PHP] I'm having a problem with running scripts on IIS server

2002-11-21 Thread Davíð Örn Jóhannsson
?php
include(db_connect.php);
$query = select top 5 * from news order by news_id desc;
$result = mssql_query($query, $db);
 
$i = 0;
while($row = mssql_fetch_row($result)){
$i++;
$title = rawurlencode($row[1]);
$date = rawurlencode($row[2]);
$headline = rawurlencode($row[3]);
$full = rawurlencode($row[4]);

$title = str_replace(%DE, %80, $title);
$date = str_replace(%DE, %80, $date);
$headline = str_replace(%DE, %80, $headline);
$full = str_replace(%DE, %80, $full);

$title = str_replace(%FE, %81, $title);
$date = str_replace(%FE, %81, $date);
$headline = str_replace(%FE, %81, $headline);
$full = str_replace(%FE, %81, $full);

$title = str_replace(%FD, %87, $title);
$date = str_replace(%FD, %87, $date);
$headline = str_replace(%FD, %87, $headline);
$full = str_replace(%FD, %87, $full);

$title = str_replace(%DD, %87, $title);
$date = str_replace(%DD, %87, $date);
$headline = str_replace(%DD, %87, $headline);
$full = str_replace(%DD, %87, $full);

$title = str_replace(%F0, %9B, $title);
$date = str_replace(%F0, %9B, $date);
$headline = str_replace(%F0, %9B, $headline);
$full = str_replace(%F0, %9B, $full);

$title = str_replace(%D0, %8B, $title);
$date = str_replace(%D0, %8B, $date);
$headline = str_replace(%D0, %8B, $headline);
$full = str_replace(%D0, %8B, $full);

printf(title$i=%sdate$i=%sheadline$i=%sfull$i=%s,
$title, $date, $headline, $full);}
 
php?
 
And it results this: 
 
?title1=ewrsdfdate1=21.11.2002headline1=sfasd%20fsd%20sdfdfffull1=s
df%20sdf%20sdf%20asdfdline$i=%sfull$i=%s, $title, $date, $headline,
$full);} php? , $full); } php?
 
Prints out all kinds of stuff, php tags, variable names and stuff, I’ve
used this script on a LAMP server and no problems.
 
The server is runing PHP V. 4.1.2 on win 2000 CGI version, Any Ideas???
 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Running functions as other than nobody

2002-11-06 Thread Davíð Örn Jóhannsson
I need to chmod files which are owned by a nother user than nobody with
a php script runing from a browser.
 
lets say i have a file called image.gif and I want to
chmod(“imgage.gif”, 0777); and I want to run it as user: myuser with
passwd: passwd.
 
Can I do this?
 
Regards, David



[PHP] Array solution...

2002-11-01 Thread Davíð Örn Jóhannsson
I have two arrays and I have complete list of numbers in one of them,
lets call it $complete[] 
and another that has some values of the complete one, lets call that one
$part[], now if I want to
return an array with all the values that are in $complete[] but not in
$part[], how would I do that?
 
Regards, David
 



[PHP] Serverside script

2002-11-01 Thread Davíð Örn Jóhannsson
I need to write a stand alone script runing on a server that checks and
updates a database every week, is this posable and if so
could some one direct me to a tutorial or to any info on doing this.
 
Regards, David



[PHP] searching an array

2002-10-29 Thread Davíð Örn Jóhannsson
I have a array called  $arr[], it holds integer values, I don’t know how
many indexes it holds and I need to be able to find out what the hash
($arr[index])
holds the largest value, is this possable, and if so how?
 
Regards, David
 



[PHP] Week numbers

2002-10-28 Thread Davíð Örn Jóhannsson
Lets say I have a date: 29.10.2002 and I want to be able to find out
what week number it is, I know
how to find out what the current week number is: date(“W”) to day it
would result 44, but i need to be 
able to  do this dynamically ofcourse, any Ideas?
 
thanks, David
 



[PHP] Error disabling

2002-10-04 Thread Davíð Örn Jóhannsson

I need to be able to disable error reporting on one page with php, I
just don’t remember how to do this, if I remember correctly I could call
some function in the begining of a php doc and tell it not to disply any
errors that occur while parsing the doc.
 



[PHP] xml encodeing with new_xmldoc(1.0);

2002-09-30 Thread Davíð Örn Jóhannsson

I need to apply iso-8859-1 encodeing to the ?xml version=”1.0”? that
this function creates: 
new_xmldoc(“1.0”). 
I tried to replace the line but ofcourse the new_xmldoc function creates
object-tree of the document and I don’t know I can reffrer to
the first line, or ?xml version=”1.0”? or just create the document
with the encodeing
 
Thanks, David
 



[PHP] FW: problem with new_xmldoc()

2002-09-27 Thread Davíð Örn Jóhannsson

 
I ran into a problem using new_xmldoc() function I just set up PHP v
4.2.3 because  the 4.0.1. version resulted:
Fatal error: Call to undefined function: new_xmldoc()
 
and so dose the new version v.4.2.3
 
Any Ideas??