PHP Web Host - Quality Web Hosting For All PHP Applications $35/month $250/year (Unlimited) - $25/month - 200,000 impressions - Your Ad Could be Here - Click For Details
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
scorpious
Worker
Worker


Joined: Dec 03, 2005
Posts: 109
Location: West Midlands. United Kingdom

PostPosted: Sat Mar 29, 2008 5:32 am Reply with quote Back to top

Hi all

I have done this module it seams to work fine, it shows the database information needed. But, when I click on the delete button I get the error message Sorry, that module file was not found [ Go Back ]

In the address bar I see
Only registered users can see links on this board!
Get registered or login to the forums!


Below is the code inthe index.file, on the last echo statement where the delete button is I have <a href='?del=".$id."'>Delete I think its this part that is causeing the error. all it should do is delete the information from the database.

Code:
<?php
if (!eregi("modules.php", $_SERVER['SCRIPT_NAME'])) {
die ("You can't access this file directly...");
}

require_once("mainfile.php");
define('INDEX_FILE', true);
$module_name = basename(dirname(__FILE__));
include("header.php");
//
 mysql_connect("Localhost","Username","Password");
// Change the above line
 mysql_select_db("DBName");

 OpenTable();
 
echo "<tr><td>ID</td><td>Song</td><td></td><td>Artist</td><td></td><td>Requested by</td><td></td><td>IP</td><td>Delete</td></tr>";

// $requested = $db->sql_query('SELECT id, id, song, artist, name, ip, name FROM request_song ORDER BY id LIMIT 6');
 if ($_GET['del']) {
$delete = $_GET['del'];
$delque = "DELETE FROM request_song WHERE id='{$delete}'";
mysql_query($delque);
}
$query = "SELECT * FROM request_song ORDER BY id LIMIT 10";
$result = mysql_query($query);
while ($row = mysql_fetch_assoc($result)) {
$id = $row['id'];
$song = $row['song'];
$artist = $row['artist'];
$name = $row['name'];
$ip = $row['ip'];
echo "<tr><td>".$id."</td><td>".$song."</td><td></td><td>".$artist."</td><td></td><td>".$name."</td><td></td><td>".$ip."</td><td><a href='?del=".$id."'>Delete</a></td></tr>";
}

CloseTable();
include("footer.php");
?>


Edited by admin to wrap the code around BBCode Code tags...
View user's profile Send private message Yahoo Messenger
montego
Site Admin


Joined: Aug 29, 2004
Posts: 7459
Location: Arizona

PostPosted: Sat Mar 29, 2008 7:35 am Reply with quote Back to top

scorpious, please wrap your code within BBCode Code tags... I have modified your post above as such.

First of all, although not really a part of your question, since you are including this with *nuke as a module and you are already including mainfile.php, you already have a connection to your database. You might want to use the $db object instead (see other nuke modules for examples). Of course, if this is intentional in order to go against another database, then you have to do what you are doing.

Now to you question. You are telling it to do this within your code here:

Code:
href='?del=".$id."


Take a look at other modules and the links there, they are all of the form:

href="modules.php?name=<NameOfYourModule>&other args..."

You need to include the "modules.php?name=.......&del="
View user's profile Send private message Visit poster's website
scorpious
Worker
Worker


Joined: Dec 03, 2005
Posts: 109
Location: West Midlands. United Kingdom

PostPosted: Sat Mar 29, 2008 1:25 pm Reply with quote Back to top

Hi Montego

This is what I have now:
<a href='modules.php?name=Requested&?del=".$id."'>
Which stops the Error Message, But, The delete is not working now lol

Cheers Scorp
View user's profile Send private message Yahoo Messenger
montego
Site Admin


Joined: Aug 29, 2004
Posts: 7459
Location: Arizona

PostPosted: Sat Mar 29, 2008 1:51 pm Reply with quote Back to top

Well, it has to be valid URL string. Remove the extra "?" that you have after the "&" sign in front of the "del".
View user's profile Send private message Visit poster's website
scorpious
Worker
Worker


Joined: Dec 03, 2005
Posts: 109
Location: West Midlands. United Kingdom

PostPosted: Sat Mar 29, 2008 5:46 pm Reply with quote Back to top

Hi Montego

I now have <a href='modules.php?name=Requested?del=".$id."'> and now the error is Sorry, that module file was not found.
[ Go Back ]

These is what is in the address bar
Only registered users can see links on this board!
Get registered or login to the forums!


Requested is that module name.

Cheers scorp
View user's profile Send private message Yahoo Messenger
montego
Site Admin


Joined: Aug 29, 2004
Posts: 7459
Location: Arizona

PostPosted: Sat Mar 29, 2008 9:03 pm Reply with quote Back to top

You misread my post. You needed to lose the extra "?" no the "&". The URL string that you posted is not valid. Might this work a bit better???
Only registered users can see links on this board!
Get registered or login to the forums!


Wink
View user's profile Send private message Visit poster's website
scorpious
Worker
Worker


Joined: Dec 03, 2005
Posts: 109
Location: West Midlands. United Kingdom

PostPosted: Sun Mar 30, 2008 12:42 pm Reply with quote Back to top

Hi Montego

Sorry completely read it wrong lol ( was tired if thats a good excuse )

Worked like a charm

Cheers for your advise and help once again

Scorp
View user's profile Send private message Yahoo Messenger
scorpious
Worker
Worker


Joined: Dec 03, 2005
Posts: 109
Location: West Midlands. United Kingdom

PostPosted: Sun Mar 30, 2008 3:46 pm Reply with quote Back to top

Hi
I have created a module called Request

Once I hits the request button these are the errors I get:

Code:
// User Input Area
// echo '<form method=\"post\" action=\"modules.php?name=$module_name\">'; // Webpage can not be found
// echo "<form method=\"post\" action=\"modules.php?name=$module_name\">"; // Sorry, that module file was not found.
// echo '<form method=\"post\" action=\"modules.php?name=Request\">';  // Webpage can not be found
// echo '<form action="modules.php?name=Request" method="POST">'; // Sorry, that module file was not found.
// echo "<form name=\"Request\" action=\"modules.php?name=$module_name\" method=\"post\">"; // Sorry, that module file was not found.
echo '<form action="index.php" method="POST">'; // This works but takes the user back to the root index.php


I need the page to refresh and then stay inside the module

Cheers Scorp
View user's profile Send private message Yahoo Messenger
Gremmie
Former Moderator in Good Standing


Joined: Apr 06, 2006
Posts: 2401
Location: Iowa, USA

PostPosted: Sun Mar 30, 2008 4:50 pm Reply with quote Back to top

Try
Code:

echo '<form method="post" action="modules.php?name=', $module_name, '">';


You might want to brush up on your use of quotes in PHP. Smile
View user's profile Send private message
scorpious
Worker
Worker


Joined: Dec 03, 2005
Posts: 109
Location: West Midlands. United Kingdom

PostPosted: Sun Mar 30, 2008 4:54 pm Reply with quote Back to top

Hi Gremmie

Tried that and got Sorry, that module file was not found.

These is the request block, I thought I try and turn it into a module

Scorp
View user's profile Send private message Yahoo Messenger
Guardian2003
Site Admin


Joined: Aug 28, 2003
Posts: 4824

PostPosted: Sun Mar 30, 2008 5:33 pm Reply with quote Back to top

I think the forum messed with Gremmies code.
Before and after $module_name it should be a full-stop . not a comma ,
View user's profile Send private message Send e-mail Visit poster's website
Gremmie
Former Moderator in Good Standing


Joined: Apr 06, 2006
Posts: 2401
Location: Iowa, USA

PostPosted: Sun Mar 30, 2008 5:36 pm Reply with quote Back to top

scorpious, here is a tip. Do a view source on your page in your browser and look at the generated HTML. Use that to guide you on what you need to do in your PHP code.

Guardian2003, you must have missed the thread where we discovered that PHP echo takes a comma separated list of arguments. It's actually faster to do it that way than to concatenate with the . operator. Smile
View user's profile Send private message
Gremmie
Former Moderator in Good Standing


Joined: Apr 06, 2006
Posts: 2401
Location: Iowa, USA

PostPosted: Sun Mar 30, 2008 5:39 pm Reply with quote Back to top

For example, is that code inside a function? If so you may need a global statement for $module_name. Look at the generated code and post it here.
View user's profile Send private message
Guardian2003
Site Admin


Joined: Aug 28, 2003
Posts: 4824

PostPosted: Sun Mar 30, 2008 6:19 pm Reply with quote Back to top

Gremmie wrote:
Guardian2003, you must have missed the thread where we discovered that PHP echo takes a comma separated list of arguments. It's actually faster to do it that way than to concatenate with the . operator. Smile

Wow, yes I did miss that one - interesting Smile
View user's profile Send private message Send e-mail Visit poster's website
scorpious
Worker
Worker


Joined: Dec 03, 2005
Posts: 109
Location: West Midlands. United Kingdom

PostPosted: Mon Mar 31, 2008 4:24 am Reply with quote Back to top

Hi All

Here is the code I am using.

Code:
<?php

if (!eregi("modules.php", $_SERVER['SCRIPT_NAME'])) {
die ("You can't access this file directly...");
}

require_once("mainfile.php");
define('INDEX_FILE', true);
$module_name = basename(dirname(__FILE__));
include("header.php");

global $prefix, $db;
 OpenTable();

$reg = "yes";
$ip = $_SERVER['REMOTE_ADDR'];
echo "<center>Your ip is: ".$ip."</center><br />";
//
if (isset($_POST['submit'])) {
if (empty($_POST['song'])) {
echo "Sorry, you haven't supplied the song title!<br />";
$reg = "no";
}
if (empty($_POST['artist'])) {
echo "Sorry, you haven't supplied the artists name!<br />";
$reg = "no";
}
if (empty($_POST['name'])) {
echo "Sorry, you haven't supplied your name<br />";
$reg = "no";
}

  $result = mysql_query($sql);
  if (mysql_result($result, 0) > 0) {
echo "Sorry, your ip has already wished for one song, you can not wish for <br />another until the DJ's have seen your request!<br />";
$reg = "no";
}
if ($reg == "yes") {
    $sql = "INSERT INTO request_song(song, artist, name, ip)
            VALUES('{$_POST['song']}', '{$_POST['artist']}', '{$_POST['name']}', '{$ip}')";
    mysql_query($sql);
}
}
// User Input Area
// What i have tried and the erros at the end
// echo '<form method=\"post\" action=\"modules.php?name=$module_name\">'; // Webpage can not be found
// echo "<form method=\"post\" action=\"modules.php?name=$module_name\">"; // Sorry, that module file was not found.
// echo '<form method=\"post\" action=\"modules.php?name=Request\">';  // Webpage can not be found
// echo '<form action="modules.php?name=Request" method="POST">'; // Sorry, that module file was not found.
// echo "<form name=\"Request\" action=\"modules.php?name=$module_name\" method=\"post\">"; // Sorry, that module file was not found.
// echo '<form method="post" action="modules.php?name='. $module_name. '">'; // Sorry, that module file was not found.
echo '<form action="index.php" method="POST">'; // This works but takes the user back to the root index.php
echo '<table>';
echo '<tr><td>Song title: </td><td><input type="text" name="song" value=""></td></tr>';
echo '<tr><td>Artist: </td><td><input type="text" name="artist" value=""></td></tr>';
echo '<tr><td>Your name: </td><td><input type="text" name="name" value=""></td></tr>';
 
echo '</table>';
echo '<input type="submit" name="submit" value="Send!">';
echo '</form>';
//

CloseTable();
include("footer.php");
?>


Cheers Scorp
View user's profile Send private message Yahoo Messenger
Gremmie
Former Moderator in Good Standing


Joined: Apr 06, 2006
Posts: 2401
Location: Iowa, USA

PostPosted: Mon Mar 31, 2008 7:16 am Reply with quote Back to top

I still think this should work:

Code:

echo '<form method="post" action="modules.php?name=', $module_name, '">';


Where is this file located? Is it called modules/Requested/index.php?
View user's profile Send private message
scorpious
Worker
Worker


Joined: Dec 03, 2005
Posts: 109
Location: West Midlands. United Kingdom

PostPosted: Mon Mar 31, 2008 7:41 am Reply with quote Back to top

Hi Gremmie

It is called modules/Request/index.php?

same error Sorry, that module file was not found. lol

scorp
View user's profile Send private message Yahoo Messenger
Gremmie
Former Moderator in Good Standing


Joined: Apr 06, 2006
Posts: 2401
Location: Iowa, USA

PostPosted: Mon Mar 31, 2008 8:04 am Reply with quote Back to top

Ok, you were saying Requested above, so are you sure Request is correct? And you have activated the module in the control panel?

Do a "view source" on the page showing the form. Search for the <form> line in the source, what does it look like there?
View user's profile Send private message
scorpious
Worker
Worker


Joined: Dec 03, 2005
Posts: 109
Location: West Midlands. United Kingdom

PostPosted: Mon Mar 31, 2008 8:47 am Reply with quote Back to top

Hi Gremmie

I have two modules 1 called Request and the other called requested < (admin only)

The rquested module works great now. I have posted within the same topic for another problem with the request module.

When I view in page source this is what I get


Code:
<center>Your ip is: 77.100.17.141</center><br /><form method="post" action="modules.php?name=Request"><table><tr><td>Song title: </td><td><input type="text" name="song" value=""></td></tr><tr><td>Artist: </td><td><input type="text" name="artist" value=""></td></tr><tr><td>Your name: </td><td><input type="text" name="name" value=""></td></tr></table><input type="submit" name="submit" value="Send!"></form>


Yes the module is active
Scorp
View user's profile Send private message Yahoo Messenger
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
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
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2008 by Raven
Proud to be listed at Lobo Links Web Directory

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::

:: fisubice Theme Recoded To 100% W3C CSS & HTML 4.01 Transitional Compliance by Raven and 64bitguy ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum