[PHP] Help me in helping you.

Status
Not open for further replies.

Kryptos

prjRev.com
Jul 21, 2010
2,205
1,252
Hey guys,

This is a help thread, I need help in helping you.

I want you all to request me PHP tutorials, perhaps you want to do lets say.. a news system and you don't know how to? Don't be shy to ask me a tutorial on that for example!

Request away!
 

Kaz

BooYah
Staff member
Nov 16, 2010
3,064
1,025
A simple housekeeping thing which allows you to edit user data
I wouldnt mind something like this either, im due to start my housekeeping on my cms once i managed to fix the client.
I have an idea how the edit user would work, but not entirely 100%
 

Jo$h

Posting Freak
Jul 7, 2010
1,030
79
How would I go about making myself a Minecraft CMS, do I have to use OOP? I am so used to the procedural method.
 

Macemore

Circumcised pineapples
Aug 26, 2011
1,681
819
A good tutorial i would like is:
How to make a form that saves entered data from what a user typed in.
and saves it in a different file for later use.
E.G.
Enter name: {name}
Enter your facorite color: {color}
and it would save {name} & {color} in a separate predefined file.
sorry for being so specific xD
 

Livar

Now 35% cooler!
Oct 15, 2010
846
86
I wouldnt mind something like this either, im due to start my housekeeping on my cms once i managed to fix the client.
I have an idea how the edit user would work, but not entirely 100%

Did this before; forgot where I left my .rar file. I'll try and look for it :)

Kryptos, mind helping me?

Well I'm trying to make an housekeeping, with a feature give rank;

Here's my current code:

PHP:
<?php
$username = $_POST["username"];
$rank = $_POST["rank"];

if (isset($_POST['rank']))
{
    dbquery("UPDATE users set rank '" . $rank . "' WHERE username = '" . $username . "'");
    echo "Updated User";
}
?>
<form method="post">
<input type="text" name="motto" style="margin-right: 5px; width: 175px;" />
</form>

It gives off;
PHP:
[B][SIZE=10px][FONT=tahoma][COLOR=#000000]Notice[/COLOR][/FONT][/SIZE][/B][SIZE=10px][FONT=tahoma][COLOR=#000000]: Undefined index: username in [/COLOR][/FONT][/SIZE][B][SIZE=10px][FONT=tahoma][COLOR=#000000]C:\xampp\htdocs\hk_beta\giverank.php[/COLOR][/FONT][/SIZE][/B][SIZE=10px][FONT=tahoma][COLOR=#000000] on line [/COLOR][/FONT][/SIZE][B][SIZE=10px][FONT=tahoma][COLOR=#000000]51[/COLOR][/FONT][/SIZE][/B]
[SIZE=10px][FONT=tahoma][COLOR=#000000][/COLOR][/FONT][/SIZE]
[B][SIZE=10px][FONT=tahoma][COLOR=#000000]Notice[/COLOR][/FONT][/SIZE][/B][SIZE=10px][FONT=tahoma][COLOR=#000000]: Undefined index: rank in [/COLOR][/FONT][/SIZE][B][SIZE=10px][FONT=tahoma][COLOR=#000000]C:\xampp\htdocs\hk_beta\giverank.php[/COLOR][/FONT][/SIZE][/B][SIZE=10px][FONT=tahoma][COLOR=#000000] on line [/COLOR][/FONT][/SIZE][B][SIZE=10px][FONT=tahoma][COLOR=#000000]52[/CODE] Mind helping? ;)[/COLOR][/FONT][/SIZE][/B]
 

Kryptos

prjRev.com
Jul 21, 2010
2,205
1,252
I hate spoonfeeding, and I guess you haven't used Google to learn how to pass info from a form, but anywhore here it goes...

PHP:
<?php
$username = mysql_real_escape_string($_POST["username"]);
$rank = mysql_real_escape_string($_POST["rank"]);

if (isset($_POST['submit']))
{
    dbquery("UPDATE users SET rank = '" . $rank . "' WHERE username = '" . $username . "'");
    echo "Updated User";
}
?>
<form method="post" action="THIS PAGE.php">
<input type="text" name="username" style="margin-right: 5px; width: 175px;" />
<input type="text" name="motto" style="margin-right: 5px; width: 175px;" />
<input type="submit" name="submit" value="Submit" />
</form>
 

Spartak

Member
Sep 24, 2011
225
33
i coded one for my admin because your is for Owner, he can change your rank

Code:
 <?php
   
require_once "./global.php";

$pseudo= $_POST['pseudo'];
$rank= $_POST['rang'];

if ($pseudo == "")
{
echo "enter ur pseudo here";
}
elseif ($rank >= 7)
{
echo "sorry im french (that mean, you can't make rank heighter then 6) <b>6</b> !";
}
else
{
$update = "UPDATE users SET rank = '".$rank."' WHERE username = '".$pseudo."' ";
$MAJ = mysql_query($update);
if ($MAJ)
{
echo "Update Done";
}
mysql_close();
}
  
?>
<center>
<form method="post" action="rank">
<label>Pseudo</label><input type="text" name="pseudo" value="Pseudo" />
<select name="rang" id="pays">
          <option value="3">Pubeur/x/loup</option>
          <option value="4">Animateur</option>
          <option value="5">Mod&eacute;rateur</option>
          <option value="6">Administrateur</option>
          <option value="1">Normale</option>

      </select>

<input type="submit" value="Valider" />
</form>
</center>

I dident secured it so feel free to do it by ur self and if you can't pm me

pseudo = name

i will support if you have a problem
 

Benden

maging ang maganda mamatay
Jun 4, 2010
2,281
1,480
i coded one for my admin because your is for Owner, he can change your rank

Code:
 <?php

require_once "./global.php";

$pseudo= $_POST['pseudo'];
$rank= $_POST['rang'];

if ($pseudo == "")
{
echo "enter ur pseudo here";
}
elseif ($rank >= 7)
{
echo "sorry im french (that mean, you can't make rank heighter then 6) <b>6</b> !";
}
else
{
$update = "UPDATE users SET rank = '".$rank."' WHERE username = '".$pseudo."' ";
$MAJ = mysql_query($update);
if ($MAJ)
{
echo "Update Done";
}
mysql_close();
}

?>
<center>
<form method="post" action="rank">
<label>Pseudo</label><input type="text" name="pseudo" value="Pseudo" />
<select name="rang" id="pays">
          <option value="3">Pubeur/x/loup</option>
          <option value="4">Animateur</option>
          <option value="5">Mod&eacute;rateur</option>
          <option value="6">Administrateur</option>
          <option value="1">Normale</option>

      </select>

<input type="submit" value="Valider" />
</form>
</center>

I dident secured it so feel free to do it by ur self and if you can't pm me

pseudo = name

i will support if you have a problem
This thread isnt for gay habbo -.- Your spelling is pretty bad

Anyways manuel. Can you make a simple housekeeping script (not connected with habbo) That lets you edit user details
 

Supersup

Member
Dec 23, 2010
43
5
Make one on a simple register script, I have no clue how to do PHP and I kind of figured that is a good place to start.
1) Make your DB
2) Construct a Config file
3) Link your db to config file
4) Here's register, save it as .php ext


PHP:
<?php include "config/config.php"; ?> // Your config file path 
<?php
if(!empty($_POST['username']) && !empty($_POST['password']))
{
    $username = mysql_real_escape_string($_POST['username']);
    $password = md5(mysql_real_escape_string($_POST['password']));
    $email = mysql_real_escape_string($_POST['email']);
 
    $checkemail = mysql_query("SELECT * FROM users WHERE EmailAddress = '".$email."'");
    if(mysql_num_rows($checkemail) == 1)
    {
        echo "<p>Sorry, the email is taken. Please <a href=\"register.php\">click here to try again</a>.</p>";
        }
   
        else
        {
   
   
       
 
   
 
    $checkusername = mysql_query("SELECT * FROM users WHERE Username = '".$username."'");
 
    if(mysql_num_rows($checkusername) == 1)
    {
   
        echo "<p>Sorry, the username is taken. Please <a href=\"register.php\">click here to try again</a>.</p>";
    }
    else
    {
        $registerquery = mysql_query("INSERT INTO users (Username, Password, EmailAddress) VALUES('".$username."', '".$password."', '".$email."')");
        if($registerquery)
        {
         
            echo "<p>Your account was successfully created. Please <a href=\"index.php\">click here to login</a>.</p>";
        }
        else
        {
       
            echo "<p>Sorry, your registration failed. Please go back and try again.</p>";
        }
    }
}
}
else
{
 
    ?>
 
 
 
    <form method="post" action="register.php" name="registerform" id="registerform">
 
        <label for="username">Username </label><input type="text" name="username" id="username" /><br />
<br />
        <label for="password">Password </label><input type="password" name="password" id="password" /><br />
<br />
        <label for="email">Email Address </label><input type="text" name="email" id="email" />
        <input type="submit" name="register" id="register" value="Register" />
 
    </form>
 
    <?php
}
?>

Made this script in a hurry, so erm idk about exploits. Although I recommend that you google it up.
 

Kristopher

Photographer
Dec 25, 2010
802
66
Make one on a simple register script, I have no clue how to do PHP and I kind of figured that is a good place to start.
Monster has released a script somewhere but Kryptos would you Make a tut or w.e on how to show images like this
 
Status
Not open for further replies.

Users who are viewing this thread

Top