|
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 Oct 27 2002 - 23:50:44 CST
php-general Digest 28 Oct 2002 05:50:44 -0000 Issue 1670
Topics (messages 121603 through 121640):
Here's a weird one!
121603 by: Steve Jackson
121637 by: . Edwin
funny system()
121604 by: gamin
121605 by: gamin
oracle: updating clob causes error 600
121606 by: Nick Eby
Need a better way...
121607 by: Todd Cary
121608 by: Jonathan Sharp
121611 by: John W. Holmes
defining a variable
121609 by: Gary
121610 by: Matt
121612 by: Gary
PHP 4.3.0pre2
121613 by: Andrei Zmievski
Best way to store Votes for Survey app
121614 by: Monty
121617 by: John W. Holmes
121618 by: Andrew Brampton
121622 by: BAROILLER Pierre-Emmanuel
news related
121615 by: php.erars.demon.co.uk
121619 by: John W. Holmes
Re: Question!
121616 by: Trasca Ion-Catalin
Re: One mail function, multiple recipients
121620 by: dwalker
121621 by: Manuel Lemos
You to prevent site hacking by 'pirates' ?
121623 by: BAROILLER Pierre-Emmanuel
121625 by: John W. Holmes
121627 by: BAROILLER Pierre-Emmanuel
121629 by: Chris Shiflett
Getting server load?
121624 by: Leif K-Brooks
121628 by: Jonathan Sharp
A couple of questions..
121626 by: eriol
OCDB Connection from unix box
121630 by: Peter Houchin
121631 by: Andrew Hill
121632 by: Peter Houchin
What is this??
121633 by: Miguel Brás
121634 by: Jarrad Kabral
121635 by: Leif K-Brooks
121636 by: Miguel Brás
Library question
121638 by: Muhammad Khairuzzaman
121639 by: Tom Rogers
Sessions are acting strangely
121640 by: Paul Marais
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:
I've been trying for ages to add a form field qty to an array to pass it to
my shopping cart and have finally managed it but not quite.
Please check this cart:
http://www.violasystems.com/shop_testing/
When you add an item using the form text box it doesn't add more than 1 on
the first submit. However if you go back and then add further items it's
will add the multiple products to the cart? I have three functions which
control this and can't see where I'm going wrong:
Submitting the form:
echo "<table width ='760' background='images/shopbg.gif'><form
action='show_cart.php' method='post'><tr><td width='380'> </td>";
echo "<td width='200' align='right'>";
echo "<b>Quantity required: </b><input type='text' name='formqty'
value='1' size='3'></td>";
echo "<td width='180' align='left'>";
echo "<input type='hidden' name='new' value='$ItemCode'>";
echo "<input type='image' src='images/add-to-cart.gif' border ='0' alt
='Add to cart'>";
echo "</td></tr></form></table>";
echo "<table width='760' background='images/shopbg.gif'><tr><td
width='200'> </td><td><img src='images/lower.gif'></td></tr></table>";
Processing the form:
<?
include ('products_sc_fns.php');
// The shopping cart needs sessions, so start one
session_start();
if($new)
{
//new item selected
if(!session_is_registered("cart"))
{
$cart = array();
session_register("cart");
$items = 0;
session_register("items");
$total_price = "0.00";
session_register("total_price");
}
$qty = $formqty;
if($cart[$new])
//$cart[$new]++;
$cart[$new] = $cart[$new] + $qty;
else
$cart[$new] = 1;
$total_price = calculate_price($cart);
$items = calculate_items($cart);
}
if($save)
{
foreach ($cart as $ItemCode => $qty)
{
if($$ItemCode=="0")
unset($cart[$ItemCode]);
else
$cart[$ItemCode] = $$ItemCode;
}
$total_price = calculate_price($cart);
$items = calculate_items($cart);
}
do_html_header("Your shopping cart");
//array de-bug
//print_r($cart);
if($cart&&array_count_values($cart))
display_cart($cart);
else
{
echo "<table width='760' cellpadding='0'
background='images/shopbg.gif'><tr><td width='200'> </td><td>There are
no items in your cart";
echo "</td></tr></table>";
}
$target = "index.php";
// if we have just added an item to the cart, continue shopping in that
category
if($new)
{
$details = get_product_details($new);
if($details["catid"])
$target = "show_cat.php?catid=".$details["catid"];
}
$path = $PHP_SELF;
$path = str_replace("show_cart.php", "", $path);
echo "<table width='760' cellpadding='0'
background='images/shopbg.gif'><tr><td width='200'> </td><td
align='left'>";
display_button($target, "continue-shopping", "Continue Shopping");
display_button("http://".$SERVER_NAME.$path."checkout.php",
"go-to-checkout", "Go To Checkout");
echo "</td></tr></table>";
do_html_footer();
?>
And displaying the cart:
function display_cart($cart, $change = true, $images = 1)
{
// display items in shopping cart
// optionally allow changes (true or false)
// optionally include images (1 - yes, 0 - no)
global $items;
global $total_price;
echo "<table border = 0 width = 760 cellspacing = 0
background='images/shopbg.gif'>
<form action = show_cart.php method = post>
<tr><th width='200'> </th><th colspan = ". (1+$images) ."
bgcolor=\"#146190\"><font face='Verdana,Arial' size='-1'
color='White'>Item</font></th>
<th bgcolor=\"#146190\"><font face='Verdana,Arial' size='-1'
color='White'>Price</font></th><th bgcolor=\"#146190\"><font
face='Verdana,Arial' size='-1' color='White'>Quantity</font></th>
<th bgcolor=\"#146190\"><font face='Verdana,Arial' size='-1'
color='White'>Total</font></th></tr>";
//display each item as a table row
$qty = $formqty;
foreach ($cart as $ItemCode => $qty)
{
$product = get_product_details($ItemCode);
echo "<tr><td width='200'> </td>";
if($images ==true)
{
echo "<td align = left>";
if (file_exists("images/$ItemCode.jpg"))
{
$size = GetImageSize("images/".$ItemCode.".jpg");
if($size[0]>0 && $size[1]>0)
{
echo "<img src=\"images/".$ItemCode.".jpg\" border=0 ";
echo "width = ". $size[0]/3 ." height = " .$size[1]/3 . ">";
}
}
else
echo " ";
echo "</td>";
}
echo "<td align = left>";
echo "<a href =
\"show_products.php?ItemCode=".$ItemCode."\">".$product["ItemName"]."</a>
(Code) ".$product["ItemCode"];
echo "</td><td align = center> ".number_format($product["price"], 2);
echo "</td><td align = center>";
// if we allow changes, quantities are in text boxes
if ($change == true)
echo "<input type='text' name='$ItemCode' value='$qty' size='3'>";
else
echo $qty;
echo "</td><td align = center>
".number_format($product["price"]*$qty,2)."</td></tr>\n";
}
// display total row
echo "<tr><th width='200'> </th>
<th colspan = ". (2+$images) ." bgcolor=\"#146190\"> </th>
<th align = center bgcolor=\"#146190\"><font face='Verdana,Arial'
size='-1' color='White'>
$items
</font></th>
<th align = center bgcolor=\"#146190\"><font face='Verdana,Arial'
size='-1' color='White'>
".number_format($total_price, 2).
"</font></th>
</tr>";
// display save change button
if($change == true)
{
echo "<tr><td width='200'> </td>
<td colspan = ". (2+$images) ."> </td>
<td align = right>
<input type = hidden name = save value = true>
<input type = image src = \"images/save-changes.gif\"
border = 0 alt = \"Save Changes\">
</td>
<td> </td>
</tr>";
}
echo "</form></table>";
}
Any help much appreciated.
rgds
Steve.
attached mail follows:
Hello,
I think the problem lies here:
> $qty = $formqty;
> if($cart[$new])
> //$cart[$new]++;
> $cart[$new] = $cart[$new] + $qty;
> else
> $cart[$new] = 1;
> $total_price = calculate_price($cart);
> $items = calculate_items($cart);
> }
It seems like you should be adding the $qty on the "else" part and NOT here:
--> $cart[$new] = $cart[$new] + $qty;
However, I just checked the site and it seems like it's working fine.
I'm using Netscape 7, by the way...
- E
attached mail follows:
Hi,
RedHat 7.2 - PHP 4.0.6
i run this command on the console when im disconnected from the net and i
get an immediate response :
wget yahoo.com/ui.htm -O outfile -a logfile
the logfile has the error mentioning that HOST NOT FOUND
now if do something like this
---test.php---
#!/usr/bin/php -q
<?
system('wget yahoo.com/ui.htm -O outfile -a logfile');
?>
the script seems to hang. it does not seem to result in anything for at
least 4-5 minutes (i haven't tried more than that)
What am i doing wrong ?
gamin.
attached mail follows:
I found the error,
silly me i had $!/usr/bin/php -q instead of #!/usr/bin/php -q,
sorry
gamin.
"Gamin" <gamin
vsnl.net> wrote in message
news:20021027181157.79883.qmail
pb1.pair.com...
> Hi,
>
> RedHat 7.2 - PHP 4.0.6
>
> i run this command on the console when im disconnected from the net and
i
> get an immediate response :
>
> wget yahoo.com/ui.htm -O outfile -a logfile
>
> the logfile has the error mentioning that HOST NOT FOUND
>
> now if do something like this
>
> ---test.php---
> #!/usr/bin/php -q
> <?
> system('wget yahoo.com/ui.htm -O outfile -a logfile');
> ?>
>
> the script seems to hang. it does not seem to result in anything for at
> least 4-5 minutes (i haven't tried more than that)
>
> What am i doing wrong ?
>
> gamin.
>
>
attached mail follows:
I'm running oracle 8.1.7 w/ php 4.2. I use the oci8 functions to update
clob columns, and maybe 1 out of every 15 or 20 times, updating a clob
column causes the mysterious "ora-600, internal error code". Anybody out
there experienced this (and hopefully resolved it) who can shed some light?
thanks
/nick
attached mail follows:
My coding is not very concise and I would appreciate suggestions on how
to clean this up even though it works:
/* MySQL to date */
function mysql_to_date($mysql) {
$retval = "";
if ($mysql) {
$parts = explode("-", $mysql);
$mo = $parts[1];
$dy = $parts[2];
$yr = $parts[0];
$parts = explode(" ", $dy);
$dy = $parts[0];
$retval = $mo . "/" . $dy . "/" . $yr;
} else {
$retval = "";
}
return $retval;
}
-- Ariste Software, Petaluma, CA 94952
attached mail follows:
function mysql_to_date($mysql) { return ( $mysql ? date('m/d/Y', strtotime($mysql) ) : '' ); }
-js
Todd Cary wrote: > My coding is not very concise and I would appreciate suggestions on how > to clean this up even though it works: > > /* MySQL to date */ > function mysql_to_date($mysql) { > $retval = ""; > if ($mysql) { > $parts = explode("-", $mysql); > $mo = $parts[1]; > $dy = $parts[2]; > $yr = $parts[0]; > $parts = explode(" ", $dy); > $dy = $parts[0]; > $retval = $mo . "/" . $dy . "/" . $yr; > } else { > $retval = ""; > } > return $retval; > } >
attached mail follows:
Why not use DATE_FORMAT in your query, then you don't have to do any extra PHP at all?
---John Holmes...
> -----Original Message-----
> From: Jonathan Sharp [mailto:js-lists
sharpmedia.net]
> Sent: Sunday, October 27, 2002 1:45 PM
> To: Todd Cary
> Cc: php-general
lists.php.net
> Subject: Re: [PHP] Need a better way...
>
> function mysql_to_date($mysql)
> {
> return ( $mysql ? date('m/d/Y', strtotime($mysql) ) : '' );
> }
>
> -js
>
>
> Todd Cary wrote:
> > My coding is not very concise and I would appreciate suggestions on
how
> > to clean this up even though it works:
> >
> > /* MySQL to date */
> > function mysql_to_date($mysql) {
> > $retval = "";
> > if ($mysql) {
> > $parts = explode("-", $mysql);
> > $mo = $parts[1];
> > $dy = $parts[2];
> > $yr = $parts[0];
> > $parts = explode(" ", $dy);
> > $dy = $parts[0];
> > $retval = $mo . "/" . $dy . "/" . $yr;
> > } else {
> > $retval = "";
> > }
> > return $retval;
> > }
> >
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Hi All, I am have trouble getting $address to print the URL that is in the db. <td class=\"dtd\"><a href=\"$address\" target=\"_blank\">%s</a></td> is printing the url with the word address instead of the real address.
The code is below.
$sql ="SELECT * FROM links ORDER BY owner"; $sql_result = mysql_query($sql, $conn) or die ("couldn't Connect");
while ($myrow = mysql_fetch_array($sql_result)){ $address = 'address'; echo "<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\" class=\"dtd\">\n"; echo"<tr> <td class=\"tlt\">Name</td> <td class=\"tlt\">Creator</td> <td class=\"tlt\">Category</td> </tr>\n"; do { printf(" <tr> <td class=\"dtd\"><a href=\"$address\" target=\"_blank\">%s</a></td> <td class=\"dtd\">%s</td> <td class=\"dtd\">%s</td> </tr>\n", $myrow['tutorial'], $myrow['owner'], $myrow['category']); }while ($myrow = mysql_fetch_array($sql_result)); echo"</table>"; }
attached mail follows:
----- Original Message -----
From: "Gary" <garyb10
earthlink.net>
To: <php-general
lists.php.net>
Sent: Sunday, October 27, 2002 2:00 PM
Subject: [PHP] defining a variable
> Hi All, > I am have trouble getting $address to print the URL that is in the db. > <td class=\"dtd\"><a href=\"$address\" target=\"_blank\">%s</a></td> is > printing the url with the word address instead of the real address. > > The code is below. > > $sql ="SELECT * FROM links ORDER BY owner"; > $sql_result = mysql_query($sql, $conn) or die ("couldn't > Connect"); > > while ($myrow = mysql_fetch_array($sql_result)){ > $address = 'address'; ^^^^^ That's what you asking for here.
Perhaps you're meaning to do a: printf(" <tr> <td class=\"dtd\"><a href=\"%s\" target=\"_blank\">%s</a></td> <td class=\"dtd\">%s</td> <td class=\"dtd\">%s</td> </tr>\n", $myrow['address'], $myrow['tutorial'], $myrow['owner'], $myrow['category']); }while ($myrow = mysql_fetch_array($sql_result));
Don't just try to change 'address' to $row['address'] abve, because you haven't fetched the result yet, and it will be blank everytime. It needs to be in the fetch() loop.
attached mail follows:
Matt wrote:
> ----- Original Message -----
> From: "Gary" <garyb10
earthlink.net>
> To: <php-general
lists.php.net>
> Sent: Sunday, October 27, 2002 2:00 PM
> Subject: [PHP] defining a variable
>
>
> > Don't just try to change 'address' to $row['address'] abve, because you > haven't fetched the result yet, and it will be blank everytime. It needs to > be in the fetch() loop. > >
Thanks, I tried it in the loop earlier and I forgot %s. It is always the little things that jump up and bite ya.
Thanks Gary
attached mail follows:
Hello,
PHP 4.3.0pre2 is available for download from http://qa.php.net. This second pre-release incorporates a large number of bug fixes since the first one. Still, to help us catch as many bugs as possible, please download it and start testing.
-Andrei http://www.gravitonic.com/ * Gun manufacturers don't make bad products, bad parents do. *
attached mail follows:
I'm writing a survey app in PHP (4.2.2) that will allow people to view a set of photos and then rate each photo from 1-5 using a little dropdown under each photo. When they are done choosing their ratings, they click on SUBMIT to register all their votes at once.
I thought the best way to record votes was to create a record for each member and each photo they voted on in MySQL. So, for example, if someone rates 9 photos, there will be 9 records created in the voting DB structured something like this:
item_id // ID number of the photo being rated. member_id // ID of the member making the vote. date // Date vote made. rating // 1-5
While this system offers a lot of flexibility in calculating votes, I'm worried that the DB will become full fast with records because of the number of records created for each member when they vote. If there are 10 photos and 2,000 people rate those photos, that will create 20,000 new records in the DB for that one poll alone.
So, I'm wondering if anyone has any suggestions for better ways to store votes like this without created so many DB records. I want to be able to calculate total votes for each photo as well as prevent members that have already voted from voting again.
Any suggestions would be appreciated!
Monty
attached mail follows:
That's the method I would use. You could try having a separate table for each poll, though.
---John Holmes...
> -----Original Message-----
> From: Monty [mailto:monty3
hotmail.com]
> Sent: Sunday, October 27, 2002 3:21 PM
> To: php-general
lists.php.net
> Subject: [PHP] Best way to store Votes for Survey app
>
> I'm writing a survey app in PHP (4.2.2) that will allow people to view
a
> set
> of photos and then rate each photo from 1-5 using a little dropdown
under
> each photo. When they are done choosing their ratings, they click on
> SUBMIT
> to register all their votes at once.
>
> I thought the best way to record votes was to create a record for each
> member and each photo they voted on in MySQL. So, for example, if
someone
> rates 9 photos, there will be 9 records created in the voting DB
> structured
> something like this:
>
> item_id // ID number of the photo being rated.
> member_id // ID of the member making the vote.
> date // Date vote made.
> rating // 1-5
>
> While this system offers a lot of flexibility in calculating votes,
I'm
> worried that the DB will become full fast with records because of the
> number
> of records created for each member when they vote. If there are 10
photos
> and 2,000 people rate those photos, that will create 20,000 new
records in
> the DB for that one poll alone.
>
> So, I'm wondering if anyone has any suggestions for better ways to
store
> votes like this without created so many DB records. I want to be able
to
> calculate total votes for each photo as well as prevent members that
have
> already voted from voting again.
>
> Any suggestions would be appreciated!
>
> Monty
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Say item_id was a int(10) member_id was a int(10) date was a timestamp(14) rating was a int(1)
then each record would take up 35bytes + a little overhead Neglecting the overhead 20,000 records would take up only 700kb of space.
So size of the db shouldn't be a issue. But if it is then you could changed item_id and member_id to slightly smaller int types.
If you are worried about speed of searchs etc, I'm pretty sure MySQL can handle it, but if you want to place some less work on MySQL make a table which stores the current Averages/Totals/Etc and update that whenever a new vote is made/changed/deleted. That way MySQL isn't adding up 20,000 records each time you want to display the current results, and this also leaves you the flexibility to do other statitisics on your data later.
Hope this helps Andrew
----- Original Message -----
From: "Monty" <monty3
hotmail.com>
To: <php-general
lists.php.net>
Sent: Sunday, October 27, 2002 8:21 PM
Subject: [PHP] Best way to store Votes for Survey app
> I'm writing a survey app in PHP (4.2.2) that will allow people to view a set > of photos and then rate each photo from 1-5 using a little dropdown under > each photo. When they are done choosing their ratings, they click on SUBMIT > to register all their votes at once. > > I thought the best way to record votes was to create a record for each > member and each photo they voted on in MySQL. So, for example, if someone > rates 9 photos, there will be 9 records created in the voting DB structured > something like this: > > item_id // ID number of the photo being rated. > member_id // ID of the member making the vote. > date // Date vote made. > rating // 1-5 > > While this system offers a lot of flexibility in calculating votes, I'm > worried that the DB will become full fast with records because of the number > of records created for each member when they vote. If there are 10 photos > and 2,000 people rate those photos, that will create 20,000 new records in > the DB for that one poll alone. > > So, I'm wondering if anyone has any suggestions for better ways to store > votes like this without created so many DB records. I want to be able to > calculate total votes for each photo as well as prevent members that have > already voted from voting again. > > Any suggestions would be appreciated! > > Monty > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
attached mail follows:
Hi,
Your solution is a good way (I use the same system for user contributions vote).. The size of the DB is not a problem... You can add an history table if you work month by month. Like this, your 'voting' table will only have current month value, and the history table will get results for each month.. No?
Regards, P.E. Baroiller
"Monty" <monty3
hotmail.com> a écrit dans le message de news:
B9E1B4E8.14EB1%monty3
hotmail.com...
> I'm writing a survey app in PHP (4.2.2) that will allow people to view a
set
> of photos and then rate each photo from 1-5 using a little dropdown under
> each photo. When they are done choosing their ratings, they click on
SUBMIT
> to register all their votes at once.
>
> I thought the best way to record votes was to create a record for each
> member and each photo they voted on in MySQL. So, for example, if someone
> rates 9 photos, there will be 9 records created in the voting DB
structured
> something like this:
>
> item_id // ID number of the photo being rated.
> member_id // ID of the member making the vote.
> date // Date vote made.
> rating // 1-5
>
> While this system offers a lot of flexibility in calculating votes, I'm
> worried that the DB will become full fast with records because of the
number
> of records created for each member when they vote. If there are 10 photos
> and 2,000 people rate those photos, that will create 20,000 new records in
> the DB for that one poll alone.
>
> So, I'm wondering if anyone has any suggestions for better ways to store
> votes like this without created so many DB records. I want to be able to
> calculate total votes for each photo as well as prevent members that have
> already voted from voting again.
>
> Any suggestions would be appreciated!
>
> Monty
>
attached mail follows:
I have set up my own news submission system, basically you write an article and it is posted into a mysql database and then anyone can use a couple of lines of java script to access the various news articles.
I have noticed a bug though, in that when I put in particularly long articles and then click to view them only part of the article is shown. Now firstly I thought it might be the formatting of my show article page but its not and then I changed field in my database that stores the article from a text data type to a longtext which can handle a ridiculous amount of characters.
So I'm not sure why this is happening, when I perform a select query in mysql the article is displayed but I can't see at what point it finishes, plus after text flashes up it is followed by the character - mulitple times. I'm not sure if this is normal.
Not sure either if it has anything to do with my submission form. Think it must be something to do with storing it in the database because the show file would show all of what is in that field in the database.
Here are the two files.
add form: <html> <head> <title> Upload a News Article </title> </head> <body bgcolor="#FFFFFF"> <a href="http://www.testhouse.org.uk"> <img border="0" src="testhouse.gif"> </a>
<form action="submitnews.php" name="post"> <input type="hidden" name="articleId" value="NOT NULL">
<table border="0" cellpadding="0" cellspacing="0" bordercolor="#111111" width="100%">
<tr> <td width="100%" bgcolor="#999999" height="22" colspan="2"> <p style="margin-left: 10"><b><font face="Verdana" size="2" color="#FFFFFF"> Upload a News Article</font></b></td>
</tr>
<tr> <td width="100%" bgcolor="#FFE300" height="22" colspan="2"> <br> <p style="margin-left: 10"><b><font face="Verdana" size="2" color="#FFFFFF"> </font></b></td>
</tr>
<tr> <td width="15%" bgcolor="#FFE300"> <p style="margin-left: 10"><font face="Verdana" size="2"> Article Title:</font></td> <td width="85%" bgcolor="#FFE300"> <input type="text" name="title" size="20" maxlength="20"></td> </tr>
<tr> <td width="100%" bgcolor="#FFE300" height="22" colspan="2"> <br> <p style="margin-left: 10"><b><font face="Verdana" size="2" color="#FFFFFF"> </font></b></td>
</tr>
<tr> <td width="15%" bgcolor="#FFE300"> <p style="margin-left: 10"><font face="Verdana" size="2"> Article Body:</font></td> <td width="85%" bgcolor="#FFE300"> <textarea name ="content" rows=16 cols=60 input type="text" name="content"></textarea></td> </tr>
<tr> <td width="15%" bgcolor="#FFE300"> <p style="margin-left: 10"><font face="Verdana" size="2"> </font></td> <td width="85%" bgcolor="#FFE300"> <br> <input type="submit" name="submit" value="Publish"></td> </tr>
<tr> <td width="100%" bgcolor="#FFE300" height="22" colspan="2"> <br> <p style="margin-left: 10"><b><font face="Verdana" size="2" color="#FFFFFF"> </font></b></td> </tr>
<tr> <td width="100%" bgcolor="#999999" height="22" colspan="2"> <br> <p style="margin-left: 10"><b><font face="Verdana" size="2" color="#FFFFFF"> </font></b></td>
</tr>
</table> </form>
</body> </html>
This is the show part, very simple.
<?php
mysql_connect ("localhost");
mysql_select_db ("content");
$result = mysql_query ("select * FROM articles WHERE articleId='$articleId'");
while ($row = mysql_fetch_row($result))
{
printf ("<tr><td>%s</td></tr>",nl2br($row[2]));
}
?> <a href="getfile.php">back </a>
Probably something very simple but thanks in advance as usual.
attached mail follows:
So how do you store the text into the database? I didn't see that in here?
---John Holmes...
> -----Original Message-----
> From: php
erars.demon.co.uk [mailto:php
erars.demon.co.uk]
> Sent: Sunday, October 27, 2002 3:23 PM
> To: php-general
lists.php.net
> Subject: [PHP] news related
>
> I have set up my own news submission system, basically you write an
> article and it is posted into a mysql database and then anyone can use
a
> couple of lines of java script to access the various news articles.
>
> I have noticed a bug though, in that when I put in particularly long
> articles and then click to view them only part of the article is
shown.
> Now firstly I thought it might be the formatting of my show article
page
> but its not and then I changed field in my database that stores the
> article from a text data type to a longtext which can handle a
ridiculous
> amount of characters.
>
> So I'm not sure why this is happening, when I perform a select query
in
> mysql the article is displayed but I can't see at what point it
finishes,
> plus after text flashes up it is followed by the character - mulitple
> times. I'm not sure if this is normal.
>
> Not sure either if it has anything to do with my submission form.
Think it
> must be something to do with storing it in the database because the
show
> file would show all of what is in that field in the database.
>
> Here are the two files.
>
> add form:
> <html>
> <head>
> <title> Upload a News Article </title>
> </head>
> <body bgcolor="#FFFFFF">
> <a href="http://www.testhouse.org.uk">
> <img border="0" src="testhouse.gif">
> </a>
>
> <form action="submitnews.php" name="post">
> <input type="hidden" name="articleId" value="NOT NULL">
>
> <table border="0" cellpadding="0" cellspacing="0"
bordercolor="#111111"
> width="100%">
>
> <tr>
> <td width="100%" bgcolor="#999999" height="22" colspan="2">
> <p style="margin-left: 10"><b><font face="Verdana" size="2"
> color="#FFFFFF">
> Upload a News Article</font></b></td>
>
> </tr>
>
> <tr>
> <td width="100%" bgcolor="#FFE300" height="22" colspan="2">
> <br>
> <p style="margin-left: 10"><b><font face="Verdana" size="2"
> color="#FFFFFF">
> </font></b></td>
>
> </tr>
>
>
> <tr>
> <td width="15%" bgcolor="#FFE300">
> <p style="margin-left: 10"><font face="Verdana" size="2">
> Article Title:</font></td>
> <td width="85%" bgcolor="#FFE300">
> <input type="text" name="title" size="20" maxlength="20"></td>
> </tr>
>
> <tr>
> <td width="100%" bgcolor="#FFE300" height="22" colspan="2">
> <br>
> <p style="margin-left: 10"><b><font face="Verdana" size="2"
> color="#FFFFFF">
> </font></b></td>
>
> </tr>
>
>
> <tr>
> <td width="15%" bgcolor="#FFE300">
> <p style="margin-left: 10"><font face="Verdana" size="2">
> Article Body:</font></td>
> <td width="85%" bgcolor="#FFE300">
> <textarea name ="content" rows=16 cols=60 input type="text"
> name="content"></textarea></td>
> </tr>
>
>
> <tr>
> <td width="15%" bgcolor="#FFE300">
> <p style="margin-left: 10"><font face="Verdana" size="2">
> </font></td>
> <td width="85%" bgcolor="#FFE300">
> <br>
> <input type="submit" name="submit" value="Publish"></td>
> </tr>
>
> <tr>
> <td width="100%" bgcolor="#FFE300" height="22" colspan="2">
> <br>
> <p style="margin-left: 10"><b><font face="Verdana" size="2"
> color="#FFFFFF">
> </font></b></td>
> </tr>
>
>
> <tr>
> <td width="100%" bgcolor="#999999" height="22" colspan="2">
> <br>
> <p style="margin-left: 10"><b><font face="Verdana" size="2"
> color="#FFFFFF">
> </font></b></td>
>
> </tr>
>
> </table>
> </form>
>
>
> </body>
> </html>
>
> This is the show part, very simple.
>
> <?php
>
> mysql_connect ("localhost");
>
> mysql_select_db ("content");
>
>
>
> $result = mysql_query ("select * FROM articles WHERE
> articleId='$articleId'");
>
>
> while ($row = mysql_fetch_row($result))
>
> {
>
> printf ("<tr><td>%s</td></tr>",nl2br($row[2]));
>
>
>
> }
>
>
> ?>
> <a href="getfile.php">back </a>
>
> Probably something very simple but thanks in advance as usual.
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
this is the first file "continut.php" <html> <head> <title>Continut</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2"> <style> .spanstyle { position:absolute; visibility:visible; top:-50px; font-size:10pt; font-family:Verdana; font-weight:bold; color:yellow; } </style> <script>
var x,y var step=20 var flag=0
// Your snappy message. Important: the space at the end of the sentence!!! var message="TIC2000 Intrați pe FORUM " message=message.split("")
var xpos=new Array() for (i=0;i<=message.length-1;i++) { xpos[i]=-50 }
var ypos=new Array() for (i=0;i<=message.length-1;i++) { ypos[i]=-50 }
function handlerMM(e){ x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY flag=1 }
function makesnake() { if (flag==1 && document.all) { for (i=message.length-1; i>=1; i--) { xpos[i]=xpos[i-1]+step ypos[i]=ypos[i-1] } xpos[0]=x+step ypos[0]=y
for (i=0; i<message.length-1; i++) { var thisspan = eval("span"+(i)+".style") thisspan.posLeft=xpos[i] thisspan.posTop=ypos[i] } }
else if (flag==1 && document.layers) { for (i=message.length-1; i>=1; i--) { xpos[i]=xpos[i-1]+step ypos[i]=ypos[i-1] } xpos[0]=x+step ypos[0]=y
for (i=0; i<message.length-1; i++) { var thisspan = eval("document.span"+i) thisspan.left=xpos[i] thisspan.top=ypos[i] } } var timer=setTimeout("makesnake()",30) }
</script> <link href="/css/cata.css" rel="stylesheet" type="text/css"> </head>
<body background="imagini/bg1.gif" leftmargin="5" topmargin="5" marginwidth="0" marginheight="0" onLoad="makesnake()" style="width:100%;overflow-x:hidden;overflow-y:scroll">
<script> <!-- Beginning of JavaScript -
for (i=0;i<=message.length-1;i++) { document.write("<span id='span"+i+"' class='spanstyle'>") document.write(message[i]) document.write("</span>") }
if (document.layers){ document.captureEvents(Event.MOUSEMOVE); } document.onmousemove = handlerMM;
// - End of JavaScript - --> </script>
<?
$fisier=basename(__FILE__);
echo "<a href=\"amput_iso-8859-2.php?fisier=$fisier\"> Fara diacritice
</a>" ; ?>
<?
$ip = $REMOTE_ADDR; //IP-ul celui care viziteaza site-ul
if ( $ip == "192.168.0.3" ) {
$nume = "Cătălin";}
elseif ( $ip == "192.168.0.4") {
$nume = "Florin";}
elseif ( $ip == "192.168.0.2") {
$nume = "Ciprian";}
elseif ( $ip == "192.168.0.14") {
$nume = "Mihai";}
else { $nume = "Cineva";}
?>
<p align="justify"> <span class="catalin"><strong>Bine ai venit <? echo
"$nume"; ?>
pe situl rețelei locale "Rețea". Pentru început nu am inclus decât un
buton
în bara de navigare. Daca va fi nevoie voi include și alte butoane în
viitor,
dar nu cred.</strong></span></p>
<p align="justify" class="catalin"><strong> Folosiți forumul pentru a adresa
întrebări
și eventuale reclamații celor care ne ocupăm de ea (Ciprian, Cătălin,
adică
TIC2000 și Florin, adică Pappy).</strong></p>
<p align="justify" class="catalin"><strong>Menționez că acest sit nu va
funcționa
decât atunci când voi avea eu calculatorul deschis (adică TIC2000), asta
până
vom schimba serverul și-l voi pune acolo pentru a fi accesat tot
timpul.</strong></p>
<? if ( $nume == "Cineva" ) {?>
<p align=\"justify\" class=\"catalin\"><strong>Pentru a nu mai apărea data
viitoare ca "Cineva"
<a href="formular.php" target="_blank">trimite-mi</a> numele și ip-ul tău
(acesta fiind <? echo ($ip); ?>) pe adresa de e-mail tic2000
home.ro <? } ?>
</strong></p>
<p align="center" class="catalin"><strong>Vă mulțumesc pentru
vizită,</strong></p>
<p align="center" class="catalin"><strong>
TIC2000</strong></p></body></html>
this is the second one "amput_iso-8859-2.php"
<? $fp=fopen($fisier,"r"); if(!$fp){ echo "Fisierul este nu poate fi deschis";} else{ while(!feof($fp)){ $c=fgetc($fp); switch($c) { case "ș": echo "s"; break;//ALT+0186 case "ț": echo "t"; break;//ALT+0254 case "Ș": echo "S"; break;//ALT+0170 case "Ț": echo "T"; break;//ALT+0222 case "ă": echo "a"; break;//ALT+0227 case "î": echo "i"; break;//ALT+140 case "â": echo "a"; break;//ALT+131 case "Ă": echo "A"; break;//ALT+0195 case "Î": echo "I"; break;//ALT+0206 case "Â": echo "A"; break;//ALT+0194 default: echo $c; } }} fclose($fp); ?>
I send them in the attachment too, you won't have the background, but it doesn't matter.
I change letters like this ă in a, î in i, ș in s, etc. I use apache 2.40 and php 4.2.3
-- Trasca Ion-Catalin "Justin French" <justinindent.com.au> wrote in message news:B9E18359.154A1%justin
indent.com.au... > That's impossible to answer!! My guess is that the "few letters" you change > affect the way the script runs, so it's probably causing an error. > > Without seeing *WHAT* you change, I can only guess. > > > Justin > > > on 27/10/02 10:31 AM, Trasca Ion-Catalin (tic2000
home.ro) wrote: > > > If I have a php file who calls another php file which change some letters on > > the first file, why my php code on the first file won't work anymore? > > I hope I was explicit enough in my question. > > > > -- > > Trasca Ion-Catalin > > > > >
begin 666 amput_iso-8859-2.php M/#\-"B1F<#UF;W!E;B
D9FES:65R+")R(BD[#0II9B
A)&9P*7L-"F5C:&\
M(D9I<VEE<G5L(&5S=&4
;G4
<&]A=&4
9FD
9&5S8VAI<R([?0T*96QS97L- M"G=H:6QE*"%F96]F*"1F<"DI>PT*)&,]9F=E=&,H)&9P*3L-"G-W:71C:"
D M8RD
>PT*8V%S92 BNB(Z(&5C:&\
(G,B.R!B<F5A:SLO+T%,5"LP,3
V#0IC M87-E("+^(CH
96-H;R B="([(&)R96%K.R\O04Q4*S R-30-"F-A<V4
(JHB M.B!E8VAO(")3(CL
8G)E86L[+R]!3%0K,#$W, T*8V%S92 BWB(Z(&5C:&\
M(E0B.R!B<F5A:SLO+T%,5"LP,C(R#0IC87-E("+C(CH
96-H;R B82([(&)R M96%K.R\O04Q4*S R,C<-"F-A<V4
(NXB.B!E8VAO(")I(CL
8G)E86L[+R]! M3%0K,30P#0IC87-E("+B(CH
96-H;R B82([(&)R96%K.R\O04Q4*S$S,0T* M8V%S92 BPR(Z(&5C:&\
(D$B.R!B<F5A:SLO+T%,5"LP,3DU#0IC87-E("+. M(CH
96-H;R B22([(&)R96%K.R\O04Q4*S R,#8-"F-A<V4
(L(B.B!E8VAO M(")!(CL
8G)E86L[+R]!3%0K,#$Y- T*9&5F875L=#H
96-H;R D8SL-"GT- 5"GU]#0IF8VQO<V4H)&9P*3L-"C\^ ` end
begin 666 continut.php M/&AT;6P^#0H\:&5A9#X-"CQT:71L93Y#;VYT:6YU=#PO=&ET;&4^#0H\;65T M82!H='1P+65Q=6EV/2)#;VYT96YT+51Y<&4B(&-O;G1E;G0](G1E>'0O:'1M M;#L
8VAA<G-E=#UI<V\M.#
U.2TR(CX-"CQS='EL93X-"BYS<&%N<W1Y;&4
M>PT*"7!O<VET:6]N.F%B<V]L=71E.PT*"79I<VEB:6QI='DZ=FES:6)L93L- M"
ET;W Z+34P<'
[#0H)9F]N="US:7IE.C$P<'0[#0H)9F]N="UF86UI;'DZ M5F5R9&%N83L-"B
("
(&9O;G0M=V5I9VAT.F)O;&0[#0H)8V]L;W(Z>65L M;&]W.PT*?0T*/"]S='EL93X-"CQS8W)I<'0^#0H-"
T*=F%R('
L>0T*=F%R M('-T97 ],C -"G9A<B!F;&%G/3 -"
T*+R\
66]U<B!S;F%P<'D
;65S<V%G M92X
26UP;W)T86YT.B!T:&4
<W!A8V4
870
=&AE(&5N9"!O9B!T:&4
<V5N M=&5N8V4A(2$-"G9A<B!M97-S86=E/2)424,R,# P($EN=')A_FD
<&4
1D]2 M54T
(
T*;65S<V%G93UM97-S86=E+G-P;&ET*"(B*0T*#0IV87(
>'!O<SUN M97<
07)R87DH*0T*9F]R("AI/3 [:3P];65S<V%G92YL96YG=&
M,3MI*RLI M('L-"
EX<&]S6VE=/2TU, T*?0T*#0IV87(
>7!O<SUN97<
07)R87DH*0T* M9F]R("AI/3 [:3P];65S<V%G92YL96YG=&
M,3MI*RLI('L-"
EY<&]S6VE= M/2TU, T*?0T*#0IF=6YC=&EO;B!H86YD;&5R34TH92E[#0H)>" ]("AD;V-U M;65N="YL87EE<G,I(#\
92YP86=E6" Z(&1O8W5M96YT+F)O9'DN<V-R;VQL M3&5F="ME=F5N="YC;&EE;G18#0H)>2 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T
<V-H:6UB82!S97)V97)U;""Z:2UL('9O:2!P=6YE(&%C;VQO('!E M;G1R=2!A(&9I(&%C8V5S870
=&]T('1I;7!U;"X\+W-T<F]N9SX\+W ^#0H\ M/R!I9B H("1N=6UE(#T](")#:6YE=F$B("D
>S\^#0H\<"!A;&EG;CU<(FIU M<W1I9GE<(B!C;&%S<SU<(F-A=&%L:6Y<(CX\<W1R;VYG/E!E;G1R=2!A(&YU M(&UA:2!A<.-R96$
9&%T82!V:6ET;V%R92!C82 B0VEN979A(B -"B \82!H M<F5F/2)F;W)M=6QA<BYP:' B('1A<F=E=#TB7V)L86YK(CYT<FEM:71E+6UI M/"]A/B!N=6UE;&4
NFD
:7 M=6P
=.-U("AA8V5S=&$
9FEI;F0
/#\
96-H M;R H)&EP*3L
/SXI('!E(&%D<F5S82!D92!E+6UA:6P
=&EC,C P,$!H;VUE M+G)O(#P_('T
/SX-"CPO<W1R;VYG/CPO<#X-"CQP(&%L:6=N/2)C96YT97(B M(&-L87-S/2)C871A;&EN(CX\<W1R;VYG/E;C(&UU;/YU;65S8R!P96YT<G4
M=FEZ:73C+#PO<W1R;VYG/CPO<#X-"CQP(&%L:6=N/2)C96YT97(B(&-L87-S M/2)C871A;&EN(CX\<W1R;VYG/B!424,R,# P/"]S=')O;F<^/"]P/CPO8F]D )>3X\+VAT;6P^ ` end
attached mail follows:
You'll need to be careful with this method. In an effort to keep spam to a minimum, some ISP's may refuse messages with more than X number of email address attached. Then the question becomes: did everyone on the list actually receive the message?
-----Original Message-----
From: Justin French <justin
indent.com.au>
To: Stephen <webmaster
melchior.us>; PHP List <php-general
lists.php.net>
Date: Friday, October 25, 2002 7:53 PM
Subject: Re: [PHP] One mail function, multiple recipients
>instead of your while() loop calling mail() each time, use it to build a
>comma separated list of recipients, then pipe them into a Bcc (so as to not
>publicise everyone's email address), and send one email with all people in
>the Bcc list.
>
>UNTESTED code:
><?
>$bcc = '';
>
>$sql = "SELECT email FROM mailingListTable";
>$result = mysql_query($sql);
>
>while($myrow = mysql_fetch_array($result))
> {
> $bcc .= $myrow['email'].',';
> }
>
>// $bcc will now look like:
>// justin
indent.com.au,webmaster
melchior.us,bob
somewhere.com,
>
>// trim off the trailing comma
>$bcc = substr($bcc, 0, -1);
>
>// prepare to send
>$to = 'dummyAddress
somewhere.com';
>$subject = 'My Mailing List';
>$message = 'This is my email message';
>$headers = 'From: me
mine.com\r\n';
>$headers .= "Bcc: {$bcc}\r\n";
>
>// send
>mail($to, $subject, $message, $headers);
>?>
>
>
>Good luck -- like I said, untested code, so it may need some tweaking.
>
>
>Justin
>
>
>
>on 26/10/02 10:41 AM, Stephen (webmaster
melchior.us) wrote:
>
>> I'm pulling email addresses from a database, then emailing them a
newsletter
>> email. Right now, I'm calling the mail() function each time to send an
email
>> and that's slooow. How could I make it so all the emails are put into a
BCC
>> field then emailed all at once instead of multiple times?
>>
>> Thanks,
>> Stephen Craton
>> http://www.melchior.us
>> http://php.melchior.us
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
Hello,
On 10/27/2002 06:23 PM, Dwalker wrote: > You'll need to be careful with this method. In an effort to keep spam to a > minimum, some ISP's may refuse messages with more than X number of email > address attached. Then the question becomes: did everyone on the list > actually receive the message?
The ISP that refuse messages to many recipients in BCC, certainly will not allow you to send separate messages to the as many recipients because that overloads even more their servers. That has nothing to do with whether you are sending spam or solicited bulk mail like newsletters. Thas has to do with abusing the mail server resources compromising the quality of service to other customers .
Whether you send separate messages or a single message with all recipients in Bcc, you need to ask your ISP if you are not infringing the acceptable use policy. In shared servers you are most likely abusing.
Regards, Manuel Lemos
> -----Original Message-----
> From: Justin French <justin
indent.com.au>
> To: Stephen <webmaster
melchior.us>; PHP List <php-general
lists.php.net>
> Date: Friday, October 25, 2002 7:53 PM
> Subject: Re: [PHP] One mail function, multiple recipients
>
>
>
>>instead of your while() loop calling mail() each time, use it to build a
>>comma separated list of recipients, then pipe them into a Bcc (so as to not
>>publicise everyone's email address), and send one email with all people in
>>the Bcc list.
>>
>>UNTESTED code:
>><?
>>$bcc = '';
>>
>>$sql = "SELECT email FROM mailingListTable";
>>$result = mysql_query($sql);
>>
>>while($myrow = mysql_fetch_array($result))
>> {
>> $bcc .= $myrow['email'].',';
>> }
>>
>>// $bcc will now look like:
>>// justin
indent.com.au,webmaster
melchior.us,bob
somewhere.com,
>>
>>// trim off the trailing comma
>>$bcc = substr($bcc, 0, -1);
>>
>>// prepare to send
>>$to = 'dummyAddress
somewhere.com';
>>$subject = 'My Mailing List';
>>$message = 'This is my email message';
>>$headers = 'From: me
mine.com\r\n';
>>$headers .= "Bcc: {$bcc}\r\n";
>>
>>// send
>>mail($to, $subject, $message, $headers);
>>?>
>>
>>
>>Good luck -- like I said, untested code, so it may need some tweaking.
>>
>>
>>Justin
>>
>>
>>
>>on 26/10/02 10:41 AM, Stephen (webmaster
melchior.us) wrote:
>>
>>
>>>I'm pulling email addresses from a database, then emailing them a
>>
> newsletter
>
>>>email. Right now, I'm calling the mail() function each time to send an
>>
> email
>
>>>and that's slooow. How could I make it so all the emails are put into a
>>
> BCC
>
>>>field then emailed all at once instead of multiple times?
>>>
>>>Thanks,
>>>Stephen Craton
>>>http://www.melchior.us
>>>http://php.melchior.us
>>
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
--Regards, Manuel Lemos
attached mail follows:
Hi everyone..
I would know what did you think of my method to prevent 'piracy'..
I do like this :
- A Session is made for each user In the session, put 2 value : a flag "userlogged" and the userId - In a cookie, I put the session Id and an unique crypted value.
When user go on private parts of the site, I check the session, the cookie and database fields for the user.. The crypted data contains some user values (the encryption is done with mcrypt lib).
Is it a good way or is there a better way (without SSL)... ?
Regards, P.E. Baroiller
attached mail follows:
> I would know what did you think of my method to prevent 'piracy'.. > > I do like this : > > - A Session is made for each user > In the session, put 2 value : a flag "userlogged" and the userId > - In a cookie, I put the session Id and an unique crypted value.
If you're using sessions, there is already a cookie with the session id in it. Why are you storing crypted values in a cookie? Why not just add the values to the session and not worry about encrypting it?
---John Holmes....
> > When user go on private parts of the site, > I check the session, the cookie and database fields for the user.. > The crypted data contains some user values (the encryption is done with > mcrypt lib). > > Is it a good way or is there a better way (without SSL)... ? > > Regards, > P.E. Baroiller
attached mail follows:
I work with double cookie to add a "security"... If the user try to change de sessionId, I check with the current sessionId stored into my own cookie.. But.. It may not to be usefull... :) The cookie is basically a crypted copy of the session content (with a different encryption method). I'm looking for a good way to protect a private part of a site and... I was thinking this method would be more efficient than only the session cookie.. But ... perhaps I'm on the bad way...
"John W. Holmes" <holmes072000
charter.net> a écrit dans le message de news:
002501c27e08$40567040$7c02a8c0
coconut...
> > I would know what did you think of my method to prevent 'piracy'..
> >
> > I do like this :
> >
> > - A Session is made for each user
> > In the session, put 2 value : a flag "userlogged" and the userId
> > - In a cookie, I put the session Id and an unique crypted value.
>
> If you're using sessions, there is already a cookie with the session id
> in it. Why are you storing crypted values in a cookie? Why not just add
> the values to the session and not worry about encrypting it?
>
> ---John Holmes....
>
> >
> > When user go on private parts of the site,
> > I check the session, the cookie and database fields for the user..
> > The crypted data contains some user values (the encryption is done
> with
> > mcrypt lib).
> >
> > Is it a good way or is there a better way (without SSL)... ?
> >
> > Regards,
> > P.E. Baroiller
>
>
attached mail follows:
BAROILLER Pierre-Emmanuel wrote:
>I work with double cookie to add a "security"... >
This is a common technique and does strengthen security somewhat.
>If the user try to change de sessionId, I check with the current sessionId >stored into my own cookie.. >But.. It may not to be usefull... :) >The cookie is basically a crypted copy of the session content (with a >different encryption method). >
You might want to consider using only one piece of session data rather than the whole thing. For example, many people who use this type of approach will have an extra validation key stored in the session that is used to create the second cookie (or URL variable or whatever).
If you focus too much on strengthening security, or make your extra steps too complex, you risk making your session mechanism very inefficient, and this can open you up to the risk of denial of service attacks.
>I'm looking for a good way to protect a private part of a site and... >I was thinking this method would be more efficient than only the session >cookie.. >
Not more efficient, but definitely a bit more secure.
Here is a suggestion, however. Your method here is focused on preventing a "guess" attack, right? Well, the unique IDs generated by PHP are already extremely difficult to guess, and this is probably not the weakest point in your mechanism. What you might want to do is let your validation token be passed in the URL on each page. This way, for those with cookies enabled, the PHPSESSID will be in a cookie, and your validation token will be in the URL.
Why use two different methods? Well, there are more dangers than someone trying to guess a valid cookie. Browsers have been known to have vulnerabilities that allow people to read cookies from any domain (IE 4.0 - 6.0 has this problem). Thus, a bad guy could get a good guy's cookies and then visit your site. Passing a validation token on the URL certainly doesn't make everything safe, but it makes the bad guy have to work harder, and that's what we want to do. Also, with a combination of methods, you almost force the bad guy to have to intercept the HTTP request itself. If someone can intercept the HTTP transactions, then your only real protection is something like SSL, so if you're not using SSL, you can feel pretty good knowing that you've made things about as difficult for the bad guy as you can.
Happy hacking.
Chris
attached mail follows:
I know there's a way to check the current server load... does anyone know how? Thanks.
-- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
attached mail follows:
assuming linux and 'server load' to equal 'entire server[read computer] load' try 'uptime' and look at last three #'s try man uptime for more details
-js
Leif K-Brooks wrote: > I know there's a way to check the current server load... does anyone > know how? Thanks. >
attached mail follows:
I have two very newbie questions..
I want to be able to create a directory index view on my local Apache server other than the default Apache view (similar to Expow, but not as complex).. Can anyone recommend a simple script that you know of which can display Name, Type, Size and Modified Date columns as well as allow users to browse folders/directories and download the files within them? I was told browsing subdirectories on Win32 machines isn't possible with PHP, but I've seen it elsewhere (such as using Expow)..
I assume I could make a simple directory view script myself, but I'm not familiar enough with PHP to feel comfortable about possible security issues.. Register globals is off if that has any impact on possible help..
The second question relates to the first, although it's more of an Apache question.. I hope someone could help me as I assume it'd be an easy fix, but I don't know what to search for.. I'm running Apache 1.3.27 on WinXP Pro with PHP 4.2.3 locally.. Whether I type in the SERVER_ADDR IP address, the computer name, localhost or 127.0.0.1, I still get this following problem.. If I view this:
I get the default Apache directory index view.. However, if I view this:
http://localhost/mp3 (minus the trailing forward slash)
I can't get a directory listing.. I get the default MSIE error page similar to no DNS found.. I have most every ErrorDocument number set correctly and working, but I don't even get an error # or page..
Is there something in Apache's httpd.conf that corrects this? I wasn't sure if the following has anything to do with this.. With my last setup (Win98/Apache 1.3.26/PHP 4.1.1), I don't remember having the php.exe Action & ScriptAlias directive there.. As you probably have guessed, I'm no expert with Apache either.. When I started Apache in the past on my old setup, it'd start in console and tell me PHP was running as well..
<IfModule mod_dir.c> DirectoryIndex index.html index.o0o index.php AddType application/x-httpd-php .php .o0o AddType application/x-httpd-php-source .phps Action application/x-httpd-php /php/php.exe ScriptAlias /php/ "D:/Server/PHP/" </IfModule>
FYI: It's not a fulltime, always on server by any means, just something to let friends grab files from me and allows me to locally test php scripts when I run it.. Any help is appreciated.. TIA..
Take care.. peace.. eriol
attached mail follows:
can any one point me to a good tutorial or article that has web server on a unix box and a win2k server with access on it? is there anything other than the ocdb_connect... that i need to get/use to connect to it?
Cheers
Peter "the only dumb question is the one that wasn't asked"
attached mail follows:
Hi Peter,
Check out the PHP-ODBC HOWTO's on http://www.iodbc.org, this will help you get the *nix side set up. You will also need an appropriate driver to install on the *nix box - OpenLink has 30 day trials if you require one.
Best regards, Andrew Hill Director of Technology Evangelism - OpenLink Software Universal Data Access and the Virtuoso Universal Server http://www.openlinksw.com/virtuoso/whatis.htm
On Sunday, October 27, 2002, at 07:56 PM, Peter Houchin wrote:
> can any one point me to a good tutorial or article that has web server > on a > unix box and a win2k server with access on it? is there anything other > than > the ocdb_connect... that i need to get/use to connect to it? > > Cheers > > Peter > "the only dumb question is the one that wasn't asked" > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > >
attached mail follows:
Thanks Andrew :D
> -----Original Message-----
> From: Andrew Hill [mailto:ahill
openlinksw.com]
> Sent: Monday, 28 October 2002 12:10 PM
> To: Peter Houchin
> Cc: php_gen
> Subject: Re: [PHP] OCDB Connection from unix box
>
>
> Hi Peter,
>
> Check out the PHP-ODBC HOWTO's on http://www.iodbc.org, this will help
> you get the *nix side set up.
> You will also need an appropriate driver to install on the *nix box -
> OpenLink has 30 day trials if you require one.
>
> Best regards,
> Andrew Hill
> Director of Technology Evangelism - OpenLink Software
> Universal Data Access and the Virtuoso Universal Server
> http://www.openlinksw.com/virtuoso/whatis.htm
>
> On Sunday, October 27, 2002, at 07:56 PM, Peter Houchin wrote:
>
> > can any one point me to a good tutorial or article that has web server
> > on a
> > unix box and a win2k server with access on it? is there anything other
> > than
> > the ocdb_connect... that i need to get/use to connect to it?
> >
> > Cheers
> >
> > Peter
> > "the only dumb question is the one that wasn't asked"
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
>
>
attached mail follows:
Hi guys,
I was doing a script to insert data on a table, and the following message appeared me when testing the form for data insertion: Column count doesn't match value count at row 1
I lsaw the PHP manual and some other resources that I have, but couldn't find anything about it...
Any hint from someone??
Cheers Miguel
attached mail follows:
It means you are most likely performing an insert and have more fields specified than values given.
If you give us your SQL we can help you out.
Regards Jarrad Kabral
-----Original Message-----
From: Miguel Brás [mailto:molino26
netcabo.pt]
Sent: Monday, 28 October 2002 1:40 PM
To: php-general
lists.php.net
Subject: [PHP] What is this??
Hi guys,
I was doing a script to insert data on a table, and the following message appeared me when testing the form for data insertion: Column count doesn't match value count at row 1
I lsaw the PHP manual and some other resources that I have, but couldn't find anything about it...
Any hint from someone??
Cheers Miguel
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
My guess is that you're doing something like "insert into table(col1,col2,col3) values('val1','val2')". You need to have an equal ammount of columns and values.
Miguel Brás wrote:
>Hi guys, > >I was doing a script to insert data on a table, and the following message >appeared me when testing the form for data insertion: >Column count doesn't match value count at row 1 > >I lsaw the PHP manual and some other resources that I have, but couldn't >find anything about it... > >Any hint from someone?? > >Cheers >Miguel > > > > >
-- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
attached mail follows:
Ok I found the problem. I also had a column on my table and I was not using it, so I deleted her. I had also one more field on my form and forgot to add him to the query.
Thx for the hint
Best
Miguel
"Leif K-Brooks" <eurleif
buyer-brokerage.com> escreveu na mensagem
news:3DBCA42E.9070608
buyer-brokerage.com...
> My guess is that you're doing something like "insert into
> table(col1,col2,col3) values('val1','val2')". You need to have an equal
> ammount of columns and values.
>
> Miguel Brás wrote:
>
> >Hi guys,
> >
> >I was doing a script to insert data on a table, and the following message
> >appeared me when testing the form for data insertion:
> >Column count doesn't match value count at row 1
> >
> >I lsaw the PHP manual and some other resources that I have, but couldn't
> >find anything about it...
> >
> >Any hint from someone??
> >
> >Cheers
> >Miguel
> >
> >
> >
> >
> >
>
> --
> The above message is encrypted with double rot13 encoding. Any
unauthorized attempt to decrypt it will be prosecuted to the full extent of
the law.
>
>
>
attached mail follows:
Hi all.
I would like to know what does it mean by "I need to have a certain library to have access to a certain function such as encrypt and decrypt?"
And how do I install these library?
attached mail follows:
Hi,
Monday, October 28, 2002, 2:52:47 PM, you wrote: MK> Hi all.
MK> I would like to know what does it mean by "I need to have a certain library MK> to have access to a certain function such as encrypt and decrypt?"
MK> And how do I install these library?
Those are a collection of functions that PHP will call for encryption and such. In windows they will be something like mcrypt.dll or for unix libmcrypt.
-- regards, Tom
attached mail follows:
Hi there, Im looking for ANY help regarding his problem - I find this interesting to say the least.
I recently switched to a new hosting company - they are running php 4.1.2 - register globals is ON. the sessions automatically expire without closing the window. if you load index.php and wait past 30 seconds - the session variables are empty - Sometimes - although not reliably - if you wait another 30 seconds - the variables are back? - this is very strange? - here are the files I have setup to illustrate this problem. Im using the default php-ini file - so no weird session expires or garbage collections stuff.
Ive set up 3 basic files: ------------------------------------------------ index.php: <?php session_start(); session_register('var1','var2'); $var1 = "cat"; $var2 = "dog"; echo "Click <a href=\"sess2.php\">here</a> to view the session vars on page 2"; ?> --------------------------------------------------- sess2.php: <?php session_start(); echo "Var1 = $var1, var2 = $var2"; echo "Click <a href=\"sess3.php\">here</a> to view the session vars on page 3"; ?> ------------------------------------------------------ sess3.php: <?php session_start(); echo "Var1 = $var1, var2 = $var2"; echo "Click <a href=\"sess2.php\">here</a> to view the session vars on page 2"; echo "<br><br><br><br>Click <a href=\"index.php\">here</a> to go back to page 1 to reset the session vars"; ?> --------------------------------------------------------
Does anyone know if 4.1.2 had any session bugs?
Thanks for reading this ;-) Paul paul AT triplethree DOT com
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]