UGN Security Forums
My ProfileMember DirectoryLogin
Search our ForumsView our FAQView our Site Rules
View our CalendarView our Active TopicsGo to our Main Page

UGN Security Store
 

Network Sites UGN Security, The GoNix Initiative, Elite Web Gamers, Back of the Web, EveryDay Helper, VNC Web Design & Development
November
Su M Tu W Th F Sa
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30
Sponsored Links
Latest Postings
Latest Reviews
Topic Options
Rate This Topic
#19303 - 01/13/04 07:16 PM Help: Simple (yeh, right) application script...
Gremelin Offline

Community Owner
*****

Registered: 02/28/02
Posts: 7193
Loc: Portland, OR; USA
Well, after scouring the internet for a whole of 30 minutes, I decided that nothing out there was exactly what i needed. So I snagged a few tut's and began working...

I fixed up the db i need through phpmyadmin (god bless the gui on that bitch)... See code below:
Code:
CREATE TABLE `ugn_applications` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(20) NOT NULL default '',
  `nick` varchar(20) NOT NULL default '',
  `email` varchar(50) NOT NULL default '',
  `yob` varchar(4) NOT NULL default '',
  `telephone` varchar(20) NOT NULL default '',
  `address` varchar(100) NOT NULL default '',
  `sections` varchar(100) NOT NULL default '',
  `aim` varchar(20) NOT NULL default '',
  `irc` varchar(20) NOT NULL default '',
  `bbs` varchar(20) NOT NULL default '',
  `moderate` varchar(10) NOT NULL default '',
  `admin` varchar(10) NOT NULL default '',
  `news` varchar(10) NOT NULL default '',
  `other` varchar(10) NOT NULL default '',
  `username` varchar(20) NOT NULL default '',
  `password` varchar(20) NOT NULL default '',
  `comments` varchar(255) NOT NULL default '',
  `country` varchar(20) NOT NULL default '',
  `ip` varchar(15) NOT NULL default '',
  `status` varchar(20) NOT NULL default '',
  PRIMARY KEY  (`id`)
) TYPE=MyISAM AUTO_INCREMENT=2 ;
Upon creating the forum to list data (I made a result first) all i get is "Error on line 20"... Anyone care to take a look?:

Code:
<?php
// Change below to your MySQL Host.
$host = "127.0.0.1";

// change below is your assigned mySQL username
$user = "[username]";

// change to the pw below is your assigned mySQL password
$pw = "[password]";

// change to the database you have permission to connect to
$db = "[databasename]";

$mysql_access = mysql_connect("$host", $user, $pw);
?>

<?php
$query = "SELECT * FROM ugn_applications";
$result = mysql_query($query, $mysql_access);
if(mysql_num_rows($result)) {
    // it is true, so let's print the results to the browser
   while($row = mysql_fetch_row($result))
  {
      print("$row[0]
");
  }
} else {
   // false, no results
}
?>

<?
mysql_close($mysql_access);
?>
The section that seems to be giving me the error is:
Code:
if(mysql_num_rows($result)) {
    // it is true, so let's print the results to the browser
   while($row = mysql_fetch_row($result))
  {
      print("$row[0]
");
  }
} else {
   // false, no results
}
Do we finally have any knowlegable php/mysql guys here, or do I need to just go shoot myself in the foot?
_________________________
Donate to UGN Security here.
UGN Security, Back of the Web, Elite Web Gamers & VNC Web Design Owner

Top
Sponsored Links
      
#19304 - 01/13/04 07:51 PM Re: Help: Simple (yeh, right) application script...
Scalli0n Offline
Junior Member

Registered: 08/01/02
Posts: 68
Code:
<?php
// Change below to your MySQL Host.
$host = "127.0.0.1";

// change below is your assigned mySQL username
$user = "[username]";

// change to the pw below is your assigned mySQL password
$pw = "[password]";

// change to the database you have permission to connect to
$db = "[databasename]";

$mysql_access = mysql_connect($host, $user, $pw) or die(mysql_error());
mysql_select_db($db) or die(mysql_error()); // make sure you add this ;)
?>

<?php
$query = "SELECT * FROM ugn_applications";
$result = mysql_query($query, $mysql_access) or die(mysql_error());
if(mysql_num_rows($result)>0) { // if we have results
	while($result2 = mysql_fetch_array($result)) { 
		echo $row[0]."
\n";
		// or you can do echo "{$row[0]}
\n";
		// tag the \n on for readable html ;)
	}
}
?>
<!-- I presume you have html code here -->
<?
	mysql_close($mysql_access);
	// I usually don't mysql_close, at the end of PHP processing the script all mysql
	// connections are killed unless they're persistant
?>
// notice that I added "or die(mysql_error()); " to all the main SQL functions? 
// this can pinpoint the problem &  will print out an error straight from mysql
// don't put these in final versions though, make your own error msg else you'll
// be giving away free information about your query structure & db structure 
// to hackers trying SQL inject attacks.

Top
#19305 - 01/13/04 07:56 PM Re: Help: Simple (yeh, right) application script...
Scalli0n Offline
Junior Member

Registered: 08/01/02
Posts: 68
change $rows to $result2

Top
#19306 - 01/14/04 05:15 AM Re: Help: Simple (yeh, right) application script...
§intå× Offline


*****

Registered: 12/03/02
Posts: 3255
Loc: Maryland
A few changes I would make.

Code:
<?php

$host = "localhost";

$user = "[username]";

$pw = "[password]";

// change to the database you have permission to connect to
$db = "[databasename]";
	
$db = "bflfrq8";

//Why use variables, save on some lines of code.  You can add a auth scriptlet to this later to make sure they are supposed to be here.

mysql_connect($host, $user, $pw)or die(mysql_error());

mysql_select_db($db) or die(mysql_error()); 
$result = mysql_query("SELECT * FROM ugn_applications") or die(mysql_error());
if(mysql_num_rows($result)>0) { // if we have results
	while($result2 = mysql_fetch_array($result)) { 
		echo $result2[0]."
\n";
		// or you can do echo "".$result2[0]."
\n";
		// tag the \n on for readable html ;)
	}
}
?>
<!-- I presume you have html code here -->
<?
	mysql_close($mysql_access);
	// I usually don't mysql_close, at the end of PHP processing the script all mysql
	// connections are killed unless they're persistant
?>
// notice that I added "or die(mysql_error()); " to all the main SQL functions? 
// this can pinpoint the problem &  will print out an error straight from mysql
// don't put these in final versions though, make your own error msg else you'll
// be giving away free information about your query structure & db structure 
// to hackers trying SQL inject attacks.
_________________________
My New site OpenEyes

Top
#19307 - 01/14/04 10:22 AM Re: Help: Simple (yeh, right) application script...
Gremelin Offline

Community Owner
*****

Registered: 02/28/02
Posts: 7193
Loc: Portland, OR; USA
Need to work on an input script, anyone wanna help? I don't know this shit! lol`
_________________________
Donate to UGN Security here.
UGN Security, Back of the Web, Elite Web Gamers & VNC Web Design Owner

Top
#19308 - 01/14/04 10:34 PM Re: Help: Simple (yeh, right) application script...
Scalli0n Offline
Junior Member

Registered: 08/01/02
Posts: 68
If you pay me I'll do it. You know my sn.

Top
#19309 - 01/15/04 01:58 AM Re: Help: Simple (yeh, right) application script...
AnthonyVSD Offline
Junior Member

Registered: 12/21/03
Posts: 17
Loc: BC, Canada
As will I, but cheaper
_________________________
Anthony Gorecki
"Freedom through knowledge."

Top
#19310 - 01/17/04 04:02 PM Re: Help: Simple (yeh, right) application script...
§intå× Offline


*****

Registered: 12/03/02
Posts: 3255
Loc: Maryland
Ahh fuck guys, gizzy is having trouble as is with the money on this place.

email me the specs gizmo...
_________________________
My New site OpenEyes

Top
#19311 - 01/17/04 07:55 PM Re: Help: Simple (yeh, right) application script...
Gremelin Offline

Community Owner
*****

Registered: 02/28/02
Posts: 7193
Loc: Portland, OR; USA
Lol, money, that's funny... :watches months fly out of wallet:
_________________________
Donate to UGN Security here.
UGN Security, Back of the Web, Elite Web Gamers & VNC Web Design Owner

Top
#19312 - 01/21/04 11:58 AM Re: Help: Simple (yeh, right) application script...
§intå× Offline


*****

Registered: 12/03/02
Posts: 3255
Loc: Maryland
Check your P/M's the frame work is done.
_________________________
My New site OpenEyes

Top
#19313 - 01/21/04 10:38 PM Re: Help: Simple (yeh, right) application script...
Gremelin Offline

Community Owner
*****

Registered: 02/28/02
Posts: 7193
Loc: Portland, OR; USA
Guess I should have said when Neo, Scallion and I hammered out the front end... lol... I have some code for you to look at later though, I'll email it to you heh...
_________________________
Donate to UGN Security here.
UGN Security, Back of the Web, Elite Web Gamers & VNC Web Design Owner

Top
#19314 - 01/22/04 09:48 AM Re: Help: Simple (yeh, right) application script...
Shinobi Offline
UGN Member

Registered: 09/25/02
Posts: 390
Loc: Asheville, NC
I would help! But I AM A NINJA!!!!!!!
_________________________
"The secret to creativity is knowing how to hide your sources."
-Albert Einstein

Tech Ninja Security

Top
#19315 - 01/24/04 09:47 AM Re: Help: Simple (yeh, right) application script...
§intå× Offline


*****

Registered: 12/03/02
Posts: 3255
Loc: Maryland
Still waiting on that email Gizzy...
_________________________
My New site OpenEyes

Top
#19316 - 01/24/04 10:31 PM Re: Help: Simple (yeh, right) application script...
Gremelin Offline

Community Owner
*****

Registered: 02/28/02
Posts: 7193
Loc: Portland, OR; USA
check your pm's, i'll get it off to you in a sec..
_________________________
Donate to UGN Security here.
UGN Security, Back of the Web, Elite Web Gamers & VNC Web Design Owner

Top

Moderator:  §intå×, Gremelin 
Featured Member
Registered: 03/02/02
Posts: 136
Forum Stats
2151 Members
46 Forums
35784 Topics
70954 Posts

Max Online: 1567 @ 04/25/10 05:20 AM
Top Posters
UGN Security 28945
Gremelin 7193
§intå× 3255
SilentRage 1273
Ice 1146
pergesu 1136
Infinite 1041
jonconley 955
Girlie 908
unreal 860
Newest Members
HushHush, golqm, Tim050, Gecko666, defghi795767
2150 Registered Users
Who's Online
0 registered (), 463 Guests and 307 Spiders online.
Key: Admin, Global Mod, Mod
Latest News


Donate
  Get Firefox!
Get FireFox!