Learn php in the time it takes to drink one can of coke

Forum provided for public use.

Moderators: FeLiX, Mr.Magoo

Learn php in the time it takes to drink one can of coke

Postby DLinkOZ » Mon Sep 16, 2002 8:22 pm

That's what I did this morning. Granted, I can't do terribly fancy stuff, but so far today I've made a wonid database tool that can querry for a wonid. So you stick the wonid you suspect of whatever into the text box, hit enter, and it brings back the name(s) of the player using that wonid. I probably won't do much with that due to the tedious and time consuming task of formatting and inputting the data... suckage. Here it is, although it only has 1 week's worth of wonid's from 3 servers, so not much in there before I got bored with formatting and entering the data www.oesm.org/wonid.shtml (you can use the wonid 3048529, as it's in there and will return a result).

I also made a brand new news posting tool similar to the one we use now, but written entirely in php (current one is perl) and it, like the wonid tool I made, uses mysql as a backend (the current one uses flat files). You can see my work in progress at www.oesm.org/oesmnews/shownews.php although it just looks like any old news post. I've written in the ability add new posts (labeling each with the system date/time), modify old posts, etc. Only major things I can think of is to add in a drop sql querry to delete old posts, figure out how to make the news only display posts that are n days old and newer, and *possibly some sort of built in authentication rather than the built-in apache authentication I'm using now... and I *think* it'll be done.

So if anyone's interested in my oh-so novice code, lemme know and I'll post it here. Why am I posting this? Cause it's been a slow day for me so I decided to take the plunge and learn something new. Maybe someone else is interested, and my newbie code might be a good start for them. Who knows?

*edit*
stupid url's hate me
"Proving the human condition, one idiot at a time"
Server Pimpage
DLinkOZ`Fbs
"Diplomacy is the act of saying "Nice doggie!" till you can find a rock"
"Department of Redundancy Department"
"Eagles may soar, but weasels don't get sucked into jet engines"
"Quantum Mechanics: The dreams stuff is made of"
"Good health is merely the slowest possible rate at which one can die"
Image
DLinkOZ
Site Admin
Site Admin
 
Posts: 1643
Joined: Sun Nov 12, 2000 2:01 am
Location: McKinney, TX

Postby DLinkOZ » Wed Sep 18, 2002 4:23 pm

I'm aware that noone gives a rat's ass about this, but I'm posting anyway (helps keep things clear when I can look at this thread and know where I am progress-wise on my news scripts).

Ok, got the scripts to display only the last n posts, with a link on the bottom to scroll to the next n posts. Now for the built in authentication for editing... yuck!

If anyone's interested, it's at www.oesm.org/oesmnews/shownews.php

There will come a time when I'll need to further enhance it so you don't have 28093439 links at the bottom for going to the next page of news! I think I can edit my offset function to only allow up to a certain number of links, but who knows... not a priority right now.
"Proving the human condition, one idiot at a time"
Server Pimpage
DLinkOZ`Fbs
"Diplomacy is the act of saying "Nice doggie!" till you can find a rock"
"Department of Redundancy Department"
"Eagles may soar, but weasels don't get sucked into jet engines"
"Quantum Mechanics: The dreams stuff is made of"
"Good health is merely the slowest possible rate at which one can die"
Image
DLinkOZ
Site Admin
Site Admin
 
Posts: 1643
Joined: Sun Nov 12, 2000 2:01 am
Location: McKinney, TX

Postby Setzer » Wed Sep 18, 2002 7:34 pm

*pets cute php*

I do CGI, which can control Perl, PHP, SQL, etc etc. Wait, I do ASM and C/C++, which dicatates everything upon anything on a PC! That and I just finished ILE, and it works 100% :D. Now let's see, I think my first task is to make a set of loadouts consisting of pistols and grenades ONLY, and stick it on my server while cranking the bot AI wide open. That should prove humorous...
Image
Setzer
I'm too seksy for this board!
I'm too seksy for this board!
 
Posts: 524
Joined: Thu Aug 15, 2002 1:01 am

Postby DLinkOZ » Wed Sep 18, 2002 7:43 pm

CGI doesn't "control" anything. It's simply a term used that covers scripts running on your site giving access to other things on the system. Common Gateway Interface.
"Proving the human condition, one idiot at a time"
Server Pimpage
DLinkOZ`Fbs
"Diplomacy is the act of saying "Nice doggie!" till you can find a rock"
"Department of Redundancy Department"
"Eagles may soar, but weasels don't get sucked into jet engines"
"Quantum Mechanics: The dreams stuff is made of"
"Good health is merely the slowest possible rate at which one can die"
Image
DLinkOZ
Site Admin
Site Admin
 
Posts: 1643
Joined: Sun Nov 12, 2000 2:01 am
Location: McKinney, TX

Postby DLinkOZ » Thu Sep 19, 2002 12:14 am

I always hear you talk about it, but never seen anything. Cough up some fully functioning code please. I'll post the entire code to my news scripts if you do. My scripts currently offer:

mysql backend
easy posting function for new posts
edit feature to change existing posts
delete feature to remove old posts
indexing feature to list all posts
both the portion that lists the news on the main page and the one that indexes the posts for you have a configurable number of posts per page, so you don't have one huge page

AND I JUST TAUGHT MYSELF PHP YESTERDAY!! Is it perfect? Nope. Is it functional to the point that I could hand it out to other sites with minimal instructions and they could use it? Yep. The only major feature I want to add is built in security, right now I'm just stuffing it all in a password protected directory. But that's on it's way, soon!

So put up or shutup. Yeah, PHP isn't the toughest language in the world. But for having less than 2 days since I taught myself, I've written a full featured news program, a traceroute/ping combo program for the website, and a wonid database search tool. In fact, I had those all written the same day I learned PHP. Today was simply feature additions to my news program.
"Proving the human condition, one idiot at a time"
Server Pimpage
DLinkOZ`Fbs
"Diplomacy is the act of saying "Nice doggie!" till you can find a rock"
"Department of Redundancy Department"
"Eagles may soar, but weasels don't get sucked into jet engines"
"Quantum Mechanics: The dreams stuff is made of"
"Good health is merely the slowest possible rate at which one can die"
Image
DLinkOZ
Site Admin
Site Admin
 
Posts: 1643
Joined: Sun Nov 12, 2000 2:01 am
Location: McKinney, TX

Postby Setzer » Thu Sep 19, 2002 11:05 am

OK, check the link below. You WILL need a genuine INF_Loadouts.ini file to use the app, so I'll upload mine to the site as well.

http://dhta.oesm.org/ILE.rar
http://dhta.oesm.org/INF_Loadouts.ini

Basically, just unrar into some folder on your drive, click the EXE, and select the INI file. After that it's all cake. I would upload FF:FC, but since that's over 60mb in size now, I doubt you'd be very happy with that :D! Can we say mip-map dithering roolz?!
Image
Setzer
I'm too seksy for this board!
I'm too seksy for this board!
 
Posts: 524
Joined: Thu Aug 15, 2002 1:01 am

Postby Setzer » Thu Sep 19, 2002 11:09 am

Oh and btw, if you want to do some Windoze C/C++, I can give you an account on the FTP box and upload it in RAR. It weighs in around 84mb. I also wasn't bashing you D, hehe. I just like giving web-languages and scripts a hard time, as do my buddies. And to be honest, one of them gives me a hard time because he knows raw ASM by heart, something I'd go insane before learning. If you want to see some of my basic CGI work, check out our roster. I am also working on a CGI news script, but I got lazy and slacked off on it when I started ILE...
Image
Setzer
I'm too seksy for this board!
I'm too seksy for this board!
 
Posts: 524
Joined: Thu Aug 15, 2002 1:01 am

Postby DLinkOZ » Thu Sep 19, 2002 11:13 am

A file editor... how cute. 2 years ago you were talking about some graphics engine you wrote... I'd expect something a bit more (had I taken the time to learn some basic visual basic I could've probably written that on my second day). :)
"Proving the human condition, one idiot at a time"
Server Pimpage
DLinkOZ`Fbs
"Diplomacy is the act of saying "Nice doggie!" till you can find a rock"
"Department of Redundancy Department"
"Eagles may soar, but weasels don't get sucked into jet engines"
"Quantum Mechanics: The dreams stuff is made of"
"Good health is merely the slowest possible rate at which one can die"
Image
DLinkOZ
Site Admin
Site Admin
 
Posts: 1643
Joined: Sun Nov 12, 2000 2:01 am
Location: McKinney, TX

Postby DLinkOZ » Thu Sep 19, 2002 11:16 am

Speaking of DHTA, your roster, and why everyone in your clan left TFC cause it sucks... say hi to [DyS]Vgblood for me :)
"Proving the human condition, one idiot at a time"
Server Pimpage
DLinkOZ`Fbs
"Diplomacy is the act of saying "Nice doggie!" till you can find a rock"
"Department of Redundancy Department"
"Eagles may soar, but weasels don't get sucked into jet engines"
"Quantum Mechanics: The dreams stuff is made of"
"Good health is merely the slowest possible rate at which one can die"
Image
DLinkOZ
Site Admin
Site Admin
 
Posts: 1643
Joined: Sun Nov 12, 2000 2:01 am
Location: McKinney, TX

Postby Setzer » Thu Sep 19, 2002 11:50 am

Uhm, view the roster. I should change the ACTIVE and INACTIVE flags to MAIN and SECONDARY. I also don't care about multi-clanning as long as it isn't the same game. Hell I am STILL part of DCD5 and I was the whole time I was in OESM. Nobody cares because it's a Doom-Engine clan (although we use Legacy now).

As for VB, my kitten could make the *seph's a fag* or HL or even RTCW engine in VB. I mean come the f*ck on! How hard is it to drag, paint, etc and let some kernel do the coding? If you use Visual ANYTHING you are NOT a programmer. My coding buds and I all feel very strong on this subject and we've proven it time and time again. Ask a f*cking VB/VC++ programmer to open Notepad and code JUST the WinMain() function (required for ANY Windoze app to work) and nine times out of ten they have no clue such a function ever existed. All they know how to do is make pretty windows and such and think they're hardcore coders. I like busting Visual kiddies down to size.

Now, as for the OpenGL engine, I can send it. But without all the maps, textures, voice files, and audio subsystem it'll lack in a few ways. Of course I could send you the whole thing for about 60mb. Actually I'd rather not send out FF:FC, but I would be happy to send AoY SE. It's no longer that crappy MIDI music half 3d engine I sent way back during the JG beta. It's now OpenGL with MP3, WAV, and VOC support.
Image
Setzer
I'm too seksy for this board!
I'm too seksy for this board!
 
Posts: 524
Joined: Thu Aug 15, 2002 1:01 am

Postby Mr.Magoo » Thu Sep 19, 2002 11:56 am

1337 tac0 b3ll scr1pt0r
I just bought this game yesterday.
Mr.Magoo
Moderator
Moderator
 
Posts: 297
Joined: Thu Nov 16, 2000 2:01 am

Postby comwiz56 » Sat Sep 28, 2002 2:16 pm

DLink, think you could give me the WonID script?
comwiz56
noobeh
noobeh
 
Posts: 5
Joined: Sun Aug 18, 2002 1:01 am

Postby DLinkOZ » Sat Sep 28, 2002 5:28 pm

The script expects the db layout as follows:

database name wonid
table within wonid named players
players has id (the database id), name, wonid

Here's the script to do searches against that data:

Code: Select all

<html>

<body>

<?php

/*
This script was written by Dave Urig (aka DLinkOZ)
Feel free to use it or modify it as you see fit,
but please keep this section intact... Thanks.
*/

$servername = "localhost";
$dbusername = "username";
$dbpassword = "password";
$dbname = "dbname";
$dbtable = "tablename";

$db = mysql_connect("$servername", "$dbusername", "$dbpassword");

mysql_select_db("$dbname",$db);

// display individual record

if ($wonid) {

   $result = mysql_query("SELECT * FROM $dbtable WHERE wonid=$wonid",$db);

   $myrow = mysql_fetch_array($result);

   printf("Player Name(s): %s\n<br>", $myrow["name"]);

   printf("Wonid: %s\n<br>", $myrow["wonid"]);

   print ("<br><br><br><a href=\"/wonid.shtml\">Return to search</a>");

} else {

    // show wonid list

   $result = mysql_query("SELECT * FROM $dbtable",$db);

    if ($myrow = mysql_fetch_array($result)) {

      // display list if there are wonids to display

      do {

        printf("<a href=\"%s?wonid=%s\">%s</a><br>\n", $PHP_SELF, $myrow["wonid"], $myrow["wonid"]);

      } while ($myrow = mysql_fetch_array($result));

    } else {

      // no records to display

      echo "Sorry, no records were found!";   

    }

}

?>

</body>

</html>

"Proving the human condition, one idiot at a time"
Server Pimpage
DLinkOZ`Fbs
"Diplomacy is the act of saying "Nice doggie!" till you can find a rock"
"Department of Redundancy Department"
"Eagles may soar, but weasels don't get sucked into jet engines"
"Quantum Mechanics: The dreams stuff is made of"
"Good health is merely the slowest possible rate at which one can die"
Image
DLinkOZ
Site Admin
Site Admin
 
Posts: 1643
Joined: Sun Nov 12, 2000 2:01 am
Location: McKinney, TX

Postby Setzer » Sat Sep 28, 2002 7:42 pm

That reminds me of BASIC! However it's structured like C, which is intresting. I bet you could catch on to QB4.5 in less than an hour.
Image
Setzer
I'm too seksy for this board!
I'm too seksy for this board!
 
Posts: 524
Joined: Thu Aug 15, 2002 1:01 am


Return to FO.Net's Public Forum

Who is online

Users browsing this forum: No registered users and 5 guests

cron