View previous topic :: View next topic |
Author |
Message |
ICY-ME -
Joined: 25 Apr 2004 Posts: 48 Location: Ya know, I'm actually not sure. Location, now that's a great word, isn't it?
|
Posted: Wed Aug 11, 2004 1:34 pm Post subject: I can't seem to get my script to work. |
|
|
ok, so here is a screen cap of the errors it gives me:
and here is my script:
Code: | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Trade list administration</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
include("configuration.php");
if (!eregi("^http://", $domain)) {
$domain = "http://$url";
}
if (!eregi("/$", $domain)){
$domain = "$domain/";
}
if (!eregi("^/", $file_directory)) {
$file_directory = "/$file_directory";
}
if (!eregi("/$", $file_directory)) {
$file_directory = "$file_directory/";
}
if ($validation == "done") {
if (($password == $real_password) && ($username == $real_username)) {
if (eregi("$main_page_url", $HTTP_REFERER) or eregi("$admin_page_url", $HTTP_REFERER) or eregi("$admin_page_urlwww", $HTTP_REFERER) or eregi("$main_page_urlwww", $HTTP_REFERER)) {
$error = 'Sorry, dude. The file won\'t open! Check the code again.';
$file_contents = file("$file_directory/cdfile.txt");
sort($file_contents);
$sizeof = count($file_contents);
if(($action != "delete") OR ($action != "add")) {
?>
<form method="POST" action="<? echo($PHP_SELF); ?>">
<input type="hidden" name="action" value="delete">
<select name="todelete">
<?php
for($i=0; $i < $sizeof; $i++) {
$real_content = strip_tags($file_contents[$i]);
print("<option value=\"$file_contents[$i]\">$real_content</option>");
}
?>
</select>
<input type="hidden" name="password" value="<?php echo "$real_password"; ?>">
<input type="hidden" name="username" value="<?php echo "$real_username"; ?>">
<input type="hidden" name="validation" value="done">
<br> <input type="submit" value="Delete Cd">
</form><p>
<form method="POST" action="<? echo($PHP_SELF); ?>">
<input type="hidden" name="password" value="<?php echo "$real_password"; ?>">
<input type="hidden" name="username" value="<?php echo "$real_username"; ?>">
<input type="hidden" name="validation" value="done">
<input type="hidden" name="action" value="add">
Band: <input type="text" name="band" size=10><br>
Venue: <input type="text" name="venue" size=10><br>
Number of discs: <input type="text" name="discs" size=2><br>
<input type="submit" value="Add New CD">
</form>
<?php
}
if ($action == "add") {
if($filehandle = fopen("$file_directory/cdfile.txt", "a")) {
fputs($filehandle, "<tr><td>$band</td><td>$venue</td><td>$discs</td></tr>\n");
fclose($filehandle);
print("Successfully added <b>$band, $venue, $discs</b> to the file");
} else {
echo($error);
}
}
if ($action == "delete") {
if($filehandle = fopen("$file_directory/cdfile.txt", "w")) {
for($i=0; $i < $sizeof; $i++) {
if($file_contents[$i] != $todelete) {
fputs($filehandle, "$file_contents[$i]");
} else { $flag = 1; }
}
fclose($filehandle);
if($flag) { print("Successfully deleted <b>$todelete</b> from the file");
} else {
print("I didn't find $todelete to delete from file");
}
} else {
echo($error);
}
}
}
else {
$msg = "Security violation!";
}
}
else {
$msg = "Wrong username and or password!";
}
}
else {
$msg = "please enter your username and password";
}
if ($msg) {
echo "$msg <p>";
?>
<form method="POST" action="<? echo($PHP_SELF); ?>">
<table>
<tr><td>Username:</td><td><input type="text" name="username"></td></tr>
<tr><td>Password:</td><td><input type="password" name="password"></td></tr>
</table>
<input type="hidden" name="validation" value="done"><p>
<input type="submit" value="Enter">
</form>
<?php
}
?>
<p><font size="-2"><a href="cd.php">Go to your cd page</a></font>
</body>
</html>
|
i'm confusd. what is wrong? i have looked through everything, and i can't figure out what could be causing the errors. any help?
thanx. _________________ How bout you check out my site? Please do, we need hits! Thanks much.
http://lemonaid.250free.com/? |
|
Back to top |
|
|
roganty -
Joined: 08 Jun 2004 Posts: 357 Location: Bristol, UK
|
Posted: Wed Aug 11, 2004 3:38 pm Post subject: Re: I can't seem to get my script to work. |
|
|
some one else has had a similar problem
try viewtopic.php?t=5158
you are using a post request so you are going to have to use $_POST['url']
At the top of the page put this:
Code: | $url = ( isset($_POST['url']) ) ? $_POST['url'] : ""; |
you are going to have to do this for the other variables that you passed in the url
you are also going to get an error with the following line:
Code: | <form method="POST" action="<? echo($PHP_SELF); ?>"> |
this should solve it:
Code: | <form method="POST" action="<? echo($_SERVER["PHP_SELF"]); ?>"> |
hope this helps _________________ Anthony R
Roganty | Links-Links.co.uk |
|
Back to top |
|
|
ICY-ME -
Joined: 25 Apr 2004 Posts: 48 Location: Ya know, I'm actually not sure. Location, now that's a great word, isn't it?
|
Posted: Thu Aug 12, 2004 1:45 am Post subject: |
|
|
well, it's not exactly my script, but someone else's who simply wrote it for me, but i will do that for sure, and let ya know what happens. _________________ How bout you check out my site? Please do, we need hits! Thanks much.
http://lemonaid.250free.com/? |
|
Back to top |
|
|
aprelium-beta -
Joined: 24 Jun 2004 Posts: 383
|
Posted: Thu Aug 12, 2004 4:00 pm Post subject: |
|
|
ICY-ME wrote: | well, it's not exactly my script, but someone else's who simply wrote it for me, but i will do that for sure, and let ya know what happens. |
The messages you see are Notices, they doesn't mean that there is something wrong with the script. They simply gives hints to the programmer.
To disable Notices display (since they have no importance in most of the cases), please read http://www.aprelium.com/forum/viewtopic.php?t=4597 . _________________ Beta Testing Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
|
ICY-ME -
Joined: 25 Apr 2004 Posts: 48 Location: Ya know, I'm actually not sure. Location, now that's a great word, isn't it?
|
Posted: Fri Aug 13, 2004 1:08 am Post subject: |
|
|
thanks! :-) _________________ How bout you check out my site? Please do, we need hits! Thanks much.
http://lemonaid.250free.com/? |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|