Follow us on Twitter!
One mans freedom fighter, another's terrorist.
Thursday, April 24, 2014
Navigation
Home
HellBoundHackers Main:
HellBoundHackers Find:
HellBoundHackers Information:
Learn
Communicate
Submit
Shop
Challenges
HellBoundHackers Exploit:
HellBoundHackers Programming:
HellBoundHackers Think:
HellBoundHackers Track:
HellBoundHackers Patch:
HellBoundHackers Other:
HellBoundHackers Need Help?
Other
Members Online
Total Online: 25
Guests Online: 23
Members Online: 2

Registered Members: 82893
Newest Member: mor-amit
Latest Articles
View Thread

HellBound Hackers | Computer General | Programming

Author

Help in PHP

killgooglecom
Member

Your avatar

Posts: 5
Location:
Joined: 24.01.12
Rank:
Newbie
Posted on 15-02-12 01:23
Hello, this is a PHP newbie talking, and I would like help coding my new website, it is a torrent site and everything is going good but I need a simple PHP script that searches a specific directory, I don't want it to hook it to a MySQL DB, because I'm currently developing a user account system. If you can help me, Please post a 1 file script. Thanks and on the site I will give credit to the person on my site. P.S. I am looking for some people to help me code my site if you are interested contact [mail]carson768@gmail.com[/mail].Grin
carsons.serveblog.net
Author

RE: Help in PHP

Arabian
Banned



Posts: 332
Location: inside you.
Joined: 22.09.10
Rank:
Apprentice
Posted on 15-02-12 01:45
what kind of directory, where, and how do you want it to interact with your site?


Code
<?php 
 function dirSearch ($dir) {
    $file = "/folder/{$dir}/"; 
   
    if (file_exists($file)) { 
        echo "The directory {$dir} exists"; 
    } else { 
        mkdir("folder/{$dir}", 0777); 
        echo "The directory {$dir} was successfully created."; 
    } 
}
?>




or if it's a local file, use perl:

Code
#!/usr/bin/perl
use warnings;
use strict;
&findDir($ARGV[0]);

sub findDir {
$handle = shift;
qx(if [[ ! -d $handle ]] ;
        then
              echo "creating directory!";
              mkdir $handle;
        else
              echo "Directory exists!";
     fi);
}




If you haven't noticed, Perl is a beautiful and sleek entity, with glorious masterrace syntax full of mystery and wonder. PHP looks like my slovenian grandmother gargling testicles for money. Do choose wisely, which languages you want to use.



G'bye y'all! I was an asshole, So korg banned me.

Edited by Arabian on 15-02-12 02:05
Author

RE: Help in PHP

killgooglecom
Member

Your avatar

Posts: 5
Location:
Joined: 24.01.12
Rank:
Newbie
Posted on 15-02-12 02:01
I'm sorry I should have posted more info. The server directory is is http://localhost/torrents/. The server is a windows OS. Plus I don't like CGI/PERL so please post a PHP script.
carsons.serveblog.net
Author

RE: Help in PHP

Arabian
Banned



Posts: 332
Location: inside you.
Joined: 22.09.10
Rank:
Apprentice
Posted on 15-02-12 02:04
the first half of my post still stands. Feel free to modify it to within the constraints of your needs, IE changing the filehandle and dirhandle names.



G'bye y'all! I was an asshole, So korg banned me.
Author

RE: Help in PHP

killgooglecom
Member

Your avatar

Posts: 5
Location:
Joined: 24.01.12
Rank:
Newbie
Posted on 15-02-12 02:09
Ok, but I need it to function as
Code

<form method=get action="this-action.php">
<input type=text name=q size=60>
<input type=submit value=search border=0>
</form>




I am sorry to keep questioning you but, will it funtion work this form and search my directory? EDIT: I feel so stupid, I need it to search for a file in a directory...

Edited by killgooglecom on 15-02-12 02:17
carsons.serveblog.net
Author

RE: Help in PHP

Arabian
Banned



Posts: 332
Location: inside you.
Joined: 22.09.10
Rank:
Apprentice
Posted on 15-02-12 02:16
it will if you add the line

Code
dirSearch($GET_['q']);




above the function. It's probably a good idea to actually know how to program before abusing other people's scripts or asking for help that you won't think twice about. Also, learn about POST/GET and how to use PHP.


G'bye y'all! I was an asshole, So korg banned me.

Edited by Arabian on 15-02-12 02:20
Author

RE: Help in PHP

goluhaque
Member



Posts: 197
Location: India
Joined: 17.02.10
Rank:
Apprentice
Warn Level: 30
Posted on 15-02-12 10:45
Arabian wrote:
it will if you add the line

Code
dirSearch($GET_['q']);




above the function. It's probably a good idea to actually know how to program before abusing other people's scripts or asking for help that you won't think twice about. Also, learn about POST/GET and how to use PHP.

AND, you need to add validation before actually pasting that directly to your site.


That applause I receive from y'all on posting this post would have gotten me drunk on power if I hadn't already been high on life.
Author

RE: Help in PHP

Arabian
Banned



Posts: 332
Location: inside you.
Joined: 22.09.10
Rank:
Apprentice
Posted on 15-02-12 20:17
goluhaque wrote:
Arabian wrote:
it will if you add the line

Code
dirSearch($GET_['q']);




above the function. It's probably a good idea to actually know how to program before abusing other people's scripts or asking for help that you won't think twice about. Also, learn about POST/GET and how to use PHP.

AND, you need to add validation before actually pasting that directly to your site.


SHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHSHHHHHHHHHHHHHHSHHHHHHHSHSHSHSHHSHSHHSSHHSHSHSHSHSH!!!!!!!!!!!!!!!!!!!!!!

>:C


G'bye y'all! I was an asshole, So korg banned me.
Author

RE: Help in PHP

just a panda
Member

Your avatar

Posts: 15
Location:
Joined: 22.07.09
Rank:
Newbie
Posted on 16-02-12 11:45
op you know what needs to be done so heres file_exists, realpath and $_GET['q'] is what a get variable would actually look like. now do the work yourself and dont listen to people who dont $_GET['php'];
be warned: unicode can really fuck with php
Author

RE: Help in PHP

spyware
Member



Posts: 4192
Location:
Joined: 14.04.07
Rank:
God
Warn Level: 90
Posted on 16-02-12 12:57
just a panda wrote:
now do the work yourself and dont listen to people who dont $_GET['php']


I cringed.



img507.imageshack.us/img507/3580/spynewsig3il1.png
"The chowner of property." - Zeph
[small]
Widespread intellectual and moral docility may be convenient for leaders in the short term,
but it is suicidal for nations in the long term.
- Carl Sagan
[center]�Since the grid is inescapable, what were the earlier lasers about? Does the corridor have a sense of humor?� - Ebert[/ce
Author

RE: Help in PHP

goluhaque
Member



Posts: 197
Location: India
Joined: 17.02.10
Rank:
Apprentice
Warn Level: 30
Posted on 17-02-12 16:55
goluhaque wrote:
Arabian wrote:
it will if you add the line

Code
dirSearch($GET_['q']);




above the function. It's probably a good idea to actually know how to program before abusing other people's scripts or asking for help that you won't think twice about. Also, learn about POST/GET and how to use PHP.

AND, you need to add validation before actually pasting that directly to your site.

The first thing to do should be stripping the entire search string of slashes. Add other validation according to your taste.


That applause I receive from y'all on posting this post would have gotten me drunk on power if I hadn't already been high on life.

Edited by goluhaque on 17-02-12 16:55