PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
GK
Forum Commoner
Posts: 51 Joined: Sat Jun 07, 2003 2:58 pm
Contact:
Post
by GK » Sat Jul 26, 2003 9:08 am
When i click the link edit, delete or note i get the same page with the edit/note below it
How do i get it in a seperate 400x400 window?
////// alle code
Code: Select all
<?
include "xxxxxxxx";
include "xxxxxxxx";
?>
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<div align="center"><span class="t">De edit venster verschijnt na het klikken
onder de table met de sql informatie!</span><br>
<table align=center border=2 cellpadding=1 cellspacing=0 width="90%" bordercolor="#000000">
<tr bgcolor="#333333">
<td align=center width="11%">
<div align="left"><B><font face="verdana" size="2" color="white">Sid:</font></B></div>
</td>
<td align=center width="36%">
<div align="left"><B><font face="verdana" size="2" color="white">Scan
domein:</font></B></div>
</td>
<td align=center width="24%">
<div align="center"><B><font face="verdana" size="2" color="white">Opties:</font></B></div>
</td>
</tr>
<?
$query = mysql_query ("select sid, scandomein, file, domein from checker",$db) or die("Sites Database SELECT Error");
while ($rows = mysql_fetch_array($query)) {
echo "<tr><td bgcolor="#ffffff"><font face=verdana size=2>" . $rows[sid] . "</font></td>";
echo "<td bgcolor="#ffffff"><font face=verdana size=2>" . $rows[scandomein] . "</font></td>";
echo "<td align="center" bgcolor="#ffffff"><font face=verdana size=2><a href="edit.php?sid=" . $rows[sid] . "&a=edit" target="_blank">Edit</a>";
echo " | <a href="edit.php?sid=" . $rows[sid] . "&a=delete" target="_blank">Delete</a>";
echo " | <a href="edit.php?sid=". $rows[sid] . "&a=note" target="_blank">Note</a></font></td></tr>";
}
?>
</table>
<br>
<?
if ($sid AND $a) {
if ($a == "edit") {
$query = mysql_db_query ($dbname,"select sid, scandomein, file, domein from checker where sid=$sid",$db) or die (mysql_error());
$rows = mysql_fetch_array($query);
?>
</div>
<Table Align="center" Border="1" Width="90%" CellPadding="3" CellSpacing="0" bordercolor="#000000">
<tr>
<td bgcolor="#FFFFFF">
<form action="edit.php" method="post">
<p>Sid=
<? echo $rows[sid]?>
<br>
<BR>
Scan domein:<br>
<input type="text" name="scandomein" size="90%" value="<? echo $rows[scandomein]?>">
<br>
Scan url:<BR>
<input type="text" name="file" size="90%" value="<? echo $rows[file]?>">
<BR>
Scan query:<br>
<input type="text" name="domein" size="90%" value="<? echo $rows[domein]?>">
<br>
<BR></font>
<BR>
</p>
<center>
<BR>
<input type="submit" name="submit" value="Submit deze info">
<input type=hidden name=sid value="<? echo $rows[sid]?>">
<input type=hidden name=a value="update">
</center>
</form>
</td>
</tr>
</Table>
<?
}
}
if ($a == "update") {
$query = mysql_db_query ($dbname,"Update checker set scandomein='$scandomein',file='$file',domein='$domein' Where sid=$sid",$db) or die(mysql_error());
echo "Update klaar!.<BR>";
}
if ($a == "delete") {
mysql_db_query ($dbname,"delete from checker where sid=$sid",$db) or die (mysql_error());
echo "Gedelete! Refresh de pagina Hit F5.<BR>";
}
?>
<div align="center">
<?
if ($sid AND $a) {
if ($a == "note") {
$query = mysql_db_query ($dbname,"select note, scandomein, sid from checker where sid=$sid",$db) or die (mysql_error());
$rows = mysql_fetch_array($query);
?>
</div>
<table align="center" border="1" width="90%" cellpadding="3" cellspacing="0" bordercolor="#000000">
<tr>
<td bgcolor="#FFFFFF">
<form action="edit.php" method="post">
<p>Sid =
<? echo $rows[sid]?>
<br>
Scandomein =
<? echo $rows[scandomein]?>
<br>
<br>
Notitie:<br>
<textarea name="note" cols="50" rows="10"><? echo $rows[note]?></textarea>
<br>
<br>
<br>
<input type="submit" name="submit" value="Bewaar notitie">
<input type="reset" name="Reset" value="Undo">
<a href="edit.php?sid=<? echo $rows[sid]?>&a=deln"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Delete
note</font></a>
<input type=hidden name=sid value="<? echo $rows[sid]?>">
<input type=hidden name=a value="voegtoe">
</p>
</form>
</td>
</tr>
</table>
<?
}
if ($a == "voegtoe") {
$query = mysql_db_query ($dbname,"Update checker set note='$note' Where sid=$sid",$db) or die(mysql_error());
echo "Note toegevoegt!.<BR>";
}
if ($a == "deln") {
mysql_db_query ($dbname,"Update checker set note='$note' Where sid=$sid",$db) or die (mysql_error());
echo "Note Gedelete! Refresh de pagina Hit F5.<BR>";
}
}
?>
?>
redhair
Forum Contributor
Posts: 300 Joined: Fri May 30, 2003 4:36 pm
Location: 53.23N-6.57E
Contact:
Post
by redhair » Sat Jul 26, 2003 9:32 am
1.By using/ implementing sessions you can store the vallues.
2.Echo these values in your pop-up window, wich usualy are opened with javascript.
GK
Forum Commoner
Posts: 51 Joined: Sat Jun 07, 2003 2:58 pm
Contact:
Post
by GK » Sat Jul 26, 2003 9:45 am
example?
redhair
Forum Contributor
Posts: 300 Joined: Fri May 30, 2003 4:36 pm
Location: 53.23N-6.57E
Contact:
Post
by redhair » Sat Jul 26, 2003 9:59 am
session()
Popup Windows
I know this is a bit daft...but i'm to lazy to write the code for you today.
Read and learn.
GK
Forum Commoner
Posts: 51 Joined: Sat Jun 07, 2003 2:58 pm
Contact:
Post
by GK » Sat Jul 26, 2003 11:09 am
Code: Select all
<?
include "xxxxxx";
include "xxxxxxx";
?>
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<div align="center"><span class="t">De edit venster verschijnt na het klikken
onder de table met de sql informatie!</span><br>
<table align=center border=2 cellpadding=1 cellspacing=0 width="90%" bordercolor="#000000">
<tr bgcolor="#333333">
<td align=center width="11%">
<div align="left"><B><font face="verdana" size="2" color="white">Sid:</font></B></div>
</td>
<td align=center width="36%">
<div align="left"><B><font face="verdana" size="2" color="white">Scan
domein:</font></B></div>
</td>
<td align=center width="24%">
<div align="center"><B><font face="verdana" size="2" color="white">Opties:</font></B></div>
</td>
</tr>
<?
$query = mysql_query ("select sid, scandomein, file, domein from checker",$db) or die("Sites Database SELECT Error");
while ($rows = mysql_fetch_array($query)) {
echo "<tr><td bgcolor="#ffffff"><font face=verdana size=2>" . $rows[sid] . "</font></td>";
echo "<td bgcolor="#ffffff"><font face=verdana size=2>" . $rows[scandomein] . "</font></td>";
echo "<td align="center" bgcolor="#ffffff"><font face=verdana size=2><a href="edit.php?sid=" . $rows[sid] . "&a=edit" target="_blank">Edit</a>";
echo " | <a href="edit.php?sid=" . $rows[sid] . "&a=delete" target="_blank">Delete</a>";
echo " | <a href="edit.php?sid=". $rows[sid] . "&a=note" target="_blank">Note</a></font></td></tr>";
}
?>
</table>
<br>
<?
if ($sid AND $a) {
if ($a == "edit") {
$query = mysql_db_query ($dbname,"select sid, scandomein, file, domein from checker where sid=$sid",$db) or die (mysql_error());
$rows = mysql_fetch_array($query);
?>
</div>
<Table Align="center" Border="1" Width="90%" CellPadding="3" CellSpacing="0" bordercolor="#000000">
<tr>
<td bgcolor="#FFFFFF">
<form action="edit.php" method="post">
<p>Sid=
<? echo $rows[sid]?>
<br>
<BR>
Scan domein:<br>
<input type="text" name="scandomein" size="90%" value="<? echo $rows[scandomein]?>">
<br>
Scan url:<BR>
<input type="text" name="file" size="90%" value="<? echo $rows[file]?>">
<BR>
Scan query:<br>
<input type="text" name="domein" size="90%" value="<? echo $rows[domein]?>">
<br>
<BR></font>
<BR>
</p>
<center>
<BR>
<input type="submit" name="submit" value="Submit deze info">
<input type=hidden name=sid value="<? echo $rows[sid]?>">
<input type=hidden name=a value="update">
</center>
</form>
</td>
</tr>
</Table>
<?
}
}
if ($a == "update") {
$query = mysql_db_query ($dbname,"Update checker set scandomein='$scandomein',file='$file',domein='$domein' Where sid=$sid",$db) or die(mysql_error());
echo "Update klaar!.<BR>";
}
if ($a == "delete") {
mysql_db_query ($dbname,"delete from checker where sid=$sid",$db) or die (mysql_error());
echo "Gedelete! Refresh de pagina Hit F5.<BR>";
}
?>
<div align="center">
<?
if ($sid AND $a) {
if ($a == "note") {
$query = mysql_db_query ($dbname,"select note, scandomein, sid from checker where sid=$sid",$db) or die (mysql_error());
$rows = mysql_fetch_array($query);
?>
</div>
<table align="center" border="1" width="90%" cellpadding="3" cellspacing="0" bordercolor="#000000">
<tr>
<td bgcolor="#FFFFFF">
<form action="edit.php" method="post">
<p>Sid =
<? echo $rows[sid]?>
<br>
Scandomein =
<? echo $rows[scandomein]?>
<br>
<br>
Notitie:<br>
<textarea name="note" cols="50" rows="10"><? echo $rows[note]?></textarea>
<br>
<br>
<br>
<input type="submit" name="submit" value="Bewaar notitie">
<input type="reset" name="Reset" value="Undo">
<a href="edit.php?sid=<? echo $rows[sid]?>&a=deln"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Delete
note</font></a>
<input type=hidden name=sid value="<? echo $rows[sid]?>">
<input type=hidden name=a value="voegtoe">
</p>
</form>
</td>
</tr>
</table>
<?
}
if ($a == "voegtoe") {
$query = mysql_db_query ($dbname,"Update checker set note='$note' Where sid=$sid",$db) or die(mysql_error());
echo "Note toegevoegt!.<BR>";
}
if ($a == "deln") {
mysql_db_query ($dbname,"Update checker set note='$note' Where sid=$sid",$db) or die (mysql_error());
echo "Note Gedelete! Refresh de pagina Hit F5.<BR>";
}
}
?>
</body>
</html>
?>
GK
Forum Commoner
Posts: 51 Joined: Sat Jun 07, 2003 2:58 pm
Contact:
Post
by GK » Sat Jul 26, 2003 3:04 pm
I really learned something today LOL
Fully working now
Code: Select all
<?
include "xxxxx";
include "xxxxx";
if ($action=="voegtoe")
{
$query = mysql_db_query ($dbname,"Update checker set note='$note' Where sid=$sid",$db) or die(mysql_error());
echo "Note toegevoegt!.<BR>";
}
if ($action=="deln")
{
mysql_db_query ($dbname,"Update checker set note='$note' Where sid=$sid",$db) or die (mysql_error());
echo "Note Gedelete! Refresh de pagina Hit F5.<BR>";
}
if ($action=="note")
{
$query = mysql_db_query ($dbname,"select note, scandomein, sid from checker where sid=$sid",$db) or die (mysql_error());
$rows = mysql_fetch_array($query);
?>
<table align="center" border="1" width="90%" cellpadding="3" cellspacing="0" bordercolor="#000000">
<tr>
<td bgcolor="#FFFFFF">
<form action="edit.php?action=note" method="post">
<p>Sid =
<? echo $rows[sid]?>
<br>
Scandomein =
<? echo $rows[scandomein]?>
<br>
<br>
Notitie:<br>
<textarea name="note" cols="50" rows="10"><? echo $rows[note]?></textarea>
<br>
<br>
<br>
<input type="submit" name="submit" value="Bewaar notitie">
<input type="reset" name="Reset" value="Undo">
<a href="edit.php?sid=<? echo $rows[sid]?>&action=deln"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Delete
note</font></a>
<input type=hidden name=sid value="<? echo $rows[sid]?>">
<input type=hidden name=action value="voegtoe">
</p>
</form>
</td>
</tr>
</table>
<?
}
if ($action=="edit")
{
include "../config.inc";
include "../connect.php";
$query = mysql_db_query ($dbname,"select sid, scandomein, file, domein from checker where sid=$sid",$db) or die (mysql_error());
$rows = mysql_fetch_array($query);
?>
<Table Align="center" Border="1" Width="90%" CellPadding="3" CellSpacing="0" bordercolor="#000000">
<tr>
<td bgcolor="#FFFFFF">
<form action="edit.php" method="post">
<p>Sid=
<? echo $rows[sid]?>
<br>
<BR>
Scan domein:<br>
<input type="text" name="scandomein" size="90%" value="<? echo $rows[scandomein]?>">
<br>
Scan url:<BR>
<input type="text" name="file" size="90%" value="<? echo $rows[file]?>">
<BR>
Scan query:<br>
<input type="text" name="domein" size="90%" value="<? echo $rows[domein]?>">
<br>
<BR></font>
<BR>
</p>
<center>
<BR>
<input type="submit" name="submit" value="Submit deze info">
<input type=hidden name=sid value="<? echo $rows[sid]?>">
<input type=hidden name=a value="update">
</center>
</form>
</td>
</tr>
</Table>
<?
}
if ($action=="update")
{
$query = mysql_db_query ($dbname,"Update checker set scandomein='$scandomein',file='$file',domein='$domein' Where sid=$sid",$db) or die(mysql_error());
echo "Update klaar!.<BR>";
}
if ($action=="delete")
{
$query = mysql_db_query ($dbname,"delete from checker where sid=$sid",$db) or die (mysql_error());
echo "Gedelete! Refresh de pagina Hit F5.<BR>";
}
if (!$action)
{
$query = mysql_query ("select sid, scandomein, file, domein from checker",$db) or die("Sites Database SELECT Error");
while ($rows = mysql_fetch_array($query)) {
echo "<table>";
echo "<tr><td bgcolor="#ffffff"><font face=verdana size=2>" . $rows[sid] . "</font></td>";
echo "<td bgcolor="#ffffff"><font face=verdana size=2>" . $rows[scandomein] . "</font></td>";
echo "<td align="center" bgcolor="#ffffff"><font face=verdana size=2><a href="edit.php?sid=". $rows[sid] . "&action=edit">Edit</a>";
echo " | <a href="edit.php?sid=". $rows[sid] . "&action=delete">Delete</a>";
echo " | <a href="edit.php?sid=". $rows[sid] . "&action=note">Note</a></font></td></tr><br>";
echo "<table>";
}
}
?>
<? print $show; ?>
m3mn0n
PHP Evangelist
Posts: 3548 Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada
Post
by m3mn0n » Sun Jul 27, 2003 2:16 am
never make config files .inc!
they show up as plain text in browsers if someone guessed its location.
i suggest naming them inc.php so variables can't be shown in the browser.
tylerdurden
Forum Commoner
Posts: 66 Joined: Mon Jul 28, 2003 11:52 am
Location: Austria
Post
by tylerdurden » Mon Jul 28, 2003 12:31 pm
Sami wrote: never make config files .inc!
they show up as plain text in browsers if someone guessed its location.
i suggest naming them inc.php so variables can't be shown in the browser.
And putting
Code: Select all
<Limit GET>
deny from all
</Limit> in your .htaccess file will protect them in case your Webserver for some reason fails to parse php files.
nielsene
DevNet Resident
Posts: 1834 Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA
Post
by nielsene » Mon Jul 28, 2003 12:48 pm
Sami wrote: never make config files .inc!
they show up as plain text in browsers if someone guessed its location.
i suggest naming them inc.php so variables can't be shown in the browser.
This is one of those flame-war debates that pops up every so often.
I prefer to name my class/include files .inc. However I have complete control over my hosting environment so I can place these files outside the webtree so there is no way for the user to surf to them directly.
IE.
/usr/local/projectname/include
/usr/local/projectname/www/
the second is Alias'd into the web tree using httpd.conf.
If you don't have the ability to place files ina non-web accessible place and/or you can't modify your apache config settings I can understand not using .inc. But stating
never is unwarranted in my mind.