Jump to content
MakeWebGames

Recommended Posts

Posted

I've Been On This Quite Some Time Now But I'm Still Not Getting It I Think o_O

Help Me

<?php

/*---------------------------------------------

-- Made by Fusion Studioz

-- Free mod for the CE Community -- Do not sell!

------------------------------------------------*/

include "globals.php";

switch($_GET['action'])

{

case 'signaturechange':

signature_change();

break;

case 'forumchange2':

do_forum_change();

break;

default:

prefs_home();

break;

}

function prefs_home()

{

global $db,$ir,$c,$userid,$h;

print "<h3>Preferences</h3>

Profile Signature Change

}

function signature_change()

{

global $ir,$c,$userid,$h;

print "<h3>Profile Signature Change</h3>

<form action='sigchange.php?action=signaturechange2' method='post'>

New Profile Signature:

<textarea rows=30 cols=90 name='newsignature' wrap='virtual' class='input'>{$ir['profileSIG']}</textarea>

 

<input type='submit' value='Change Signature' /></form>

> Back";

}

function do_signature_change()

{

global $db,$ir,$c,$userid,$h;

if($_POST['newsignature'] == "")

{

print "You did not enter a new profile signature.

> Back";

}

else

{

$db->query("UPDATE users SET profileSIG='{$_POST['newsignature']}' WHERE userid=$userid");

print "Profile Signature changed!

> Back";

}

$h->endpage();

?>

See What's Wrong Please Anyone.

Thank's.

Fusion

Posted

Re: Signature Change That I Can Put On Main Menu

$db->query("UPDATE users SET profileSIG='{$_POST['newsignature']}' WHERE userid=$userid");

Should be

$newSig = mysql_real_escape_string(htmlspecialchars($_POST['newsignature']));

$db->query("UPDATE users SET profileSIG='". $newSig ."' WHERE userid=$userid");

Posted

Re: Signature Change That I Can Put On Main Menu

 

I've Been On This Quite Some Time Now But I'm Still Not Getting It I Think o_O

Help Me

<?php

/*---------------------------------------------

-- Made by Fusion Studioz

-- Free mod for the CE Community -- Do not sell!

------------------------------------------------*/

include "globals.php";

switch($_GET['action'])

{

case 'signaturechange':

signature_change();

break;

case 'forumchange2':

do_forum_change();

break;

default:

prefs_home();

break;

}

function prefs_home()

{

global $db,$ir,$c,$userid,$h;

print "<h3>Preferences</h3>

Profile Signature Change

}

function signature_change()

{

global $ir,$c,$userid,$h;

print "<h3>Profile Signature Change</h3>

<form action='sigchange.php?action=signaturechange2' method='post'>

New Profile Signature:

<textarea rows=30 cols=90 name='newsignature' wrap='virtual' class='input'>{$ir['profileSIG']}</textarea>

 

<input type='submit' value='Change Signature' /></form>

> Back";

}

function do_signature_change()

{

global $db,$ir,$c,$userid,$h;

if($_POST['newsignature'] == "")

{

print "You did not enter a new profile signature.

> Back";

}

else

{

$db->query("UPDATE users SET profileSIG='{$_POST['newsignature']}' WHERE userid=$userid");

print "Profile Signature changed!

> Back";

}

$h->endpage();

?>

See What's Wrong Please Anyone.

Thank's.

Fusion

This should work - Not Tested!

<?php
include (DIRNAME(__FILE__) ."/globals.php");
switch($_GET['action'])
{
case 'signaturechange': signature_change(); break;

case 'forumchange2': do_forum_change(); break;

default: signature_change(); break;
}
function make_safe($variable)
{
$variable = mysql_real_escape_string(trim($variable));
return $variable;
}
function prefs_home()
{
global $db,$ir,$c,$userid,$h;
print "<h3>Preferences</h3>
[url='preferences.php?action=signaturechange']Profile Signature Change[/url]
";
}
function signature_change()
{
global $ir,$c,$userid,$h;
print "<h3>Profile Signature Change</h3>
<form action='sigchange.php?action=signaturechange2' method='post'>
New Profile Signature: 
";
echo sprintf("<textarea rows=30 cols=90 name='newsignature' wrap='virtual' class='input'>%s</textarea>

", make_safe($ir['profileSIG']));
print"<input type='submit' value='Change Signature' /></form>

[size="1"] > [/size][url='sigchange.php']Back[/url]";
}
function do_signature_change()
{
global $db,$ir,$c,$userid,$h;
if($_POST['newsignature'] == "")
{
print "You did not enter a new profile signature.

[size="1"]> [/size][url='sigchange.php?action=signaturechange']Back[/url]";
}
else
{
$sql = sprintf("UPDATE users SET profileSIG='%s' WHERE (userid = %u)", make_safe($_POST['newsignature']));
print "Profile Signature changed!

[size="1"]> [/size][url='sigchange.php']Back[/url]";
}
$h->endpage();
?>

Posted

Re: Signature Change That I Can Put On Main Menu

 

function make_safe($variable)

{

$variable = mysql_real_escape_string(trim($variable));

return $variable;

}

Should be:P

function make_safe($variable)

{

$variable = mysql_real_escape_string($variable);

$variable = htmlspecialchars($variable);

return $variable;

}

Why trim it?

Posted

Re: Signature Change That I Can Put On Main Menu

 

Should be:P

function make_safe($variable)

{

$variable = mysql_real_escape_string($variable);

$variable = htmlspecialchars($variable);

return $variable;

}

Why have it that long?

 

function make_safe($Variable) {
 return mysql_real_escape_string(htmlspecialchars($Variable));
}

// or even

function make_safe($Var) {
return (get_magic_quotes_gpc()) ? htmlentities($Var) : addslashes(htmlspecialchars($Var));
}
Posted

Re: Signature Change That I Can Put On Main Menu

Parse error: syntax error, unexpected $end in /home/fusion/public_html/sigchange.php on line 48

<?php

include (DIRNAME(__FILE__) ."/globals.php");

switch($_GET['action'])

{

case 'signaturechange': signature_change(); break;

case 'forumchange2': do_forum_change(); break;

default: signature_change(); break;

}

function make_safe($variable)

{

$variable = mysql_real_escape_string($variable);

$variable = htmlspecialchars($variable);

return $variable;

}

function prefs_home()

{

global $db,$ir,$c,$userid,$h;

print "<h3>Preferences</h3>

Profile Signature Change

";

}

function signature_change()

{

global $ir,$c,$userid,$h;

print "<h3>Profile Signature Change</h3>

<form action='sigchange.php?action=signaturechange2' method='post'>

New Profile Signature:

";

echo sprintf("<textarea rows=30 cols=90 name='newsignature' wrap='virtual' class='input'>%s</textarea>

", make_safe($ir['profileSIG']));

print"<input type='submit' value='Change Signature' /></form>

> Back";

}

function do_signature_change()

{

global $db,$ir,$c,$userid,$h;

if($_POST['newsignature'] == "")

{

print "You did not enter a new profile signature.

> Back";

}

else

{

$sql = sprintf("UPDATE users SET profileSIG='%s' WHERE (userid = %u)", make_safe($_POST['newsignature']));

print "Profile Signature changed!

> Back";

}

$h->endpage();

?>

Posted

Re: Signature Change That I Can Put On Main Menu

 

Parse error: syntax error, unexpected $end in /home/fusion/public_html/sigchange.php on line 48

<?php

include (DIRNAME(__FILE__) ."/globals.php");

switch($_GET['action'])

{

case 'signaturechange': signature_change(); break;

case 'forumchange2': do_forum_change(); break;

default: signature_change(); break;

}

function make_safe($variable)

{

$variable = mysql_real_escape_string($variable);

$variable = htmlspecialchars($variable);

return $variable;

}

function prefs_home()

{

global $db,$ir,$c,$userid,$h;

print "<h3>Preferences</h3>

Profile Signature Change

";

}

function signature_change()

{

global $ir,$c,$userid,$h;

print "<h3>Profile Signature Change</h3>

<form action='sigchange.php?action=signaturechange2' method='post'>

New Profile Signature:

";

echo sprintf("<textarea rows=30 cols=90 name='newsignature' wrap='virtual' class='input'>%s</textarea>

", make_safe($ir['profileSIG']));

print"<input type='submit' value='Change Signature' /></form>

> Back";

}

function do_signature_change()

{

global $db,$ir,$c,$userid,$h;

if($_POST['newsignature'] == "")

{

print "You did not enter a new profile signature.

> Back";

}

else

{

$sql = sprintf("UPDATE users SET profileSIG='%s' WHERE (userid = %u)", make_safe($_POST['newsignature']));

print "Profile Signature changed!

> Back";

}

$h->endpage();

?>

 


<?php
include (DIRNAME(__FILE__) ."/globals.php");
switch($_GET['action'])
{
case 'signaturechange': signature_change(); break;

case 'forumchange2': do_forum_change(); break;

default: signature_change(); break;
}
function make_safe($variable)
{
 $variable = mysql_real_escape_string($variable);
 $variable = htmlspecialchars($variable);
 return $variable;
}
function prefs_home()
{
global $db,$ir,$c,$userid,$h;
print "<h3>Preferences</h3>
[url='preferences.php?action=signaturechange']Profile Signature Change[/url]
";
}
function signature_change()
{
global $ir,$c,$userid,$h;
print "<h3>Profile Signature Change</h3>
<form action='sigchange.php?action=signaturechange2' method='post'>
New Profile Signature: 
";
echo sprintf("<textarea rows=30 cols=90 name='newsignature' wrap='virtual' class='input'>%s</textarea>

", make_safe($ir['profileSIG']));
print"<input type='submit' value='Change Signature' /></form>

[size="1"] > [/size][url='sigchange.php']Back[/url]";
}
function do_signature_change()
{
global $db,$ir,$c,$userid,$h;
if($_POST['newsignature'] == "")
{
print "You did not enter a new profile signature.

[size="1"]> [/size][url='sigchange.php?action=signaturechange']Back[/url]";
}
else
{
$sql = sprintf("UPDATE users SET profileSIG='%s' WHERE (userid = %u)", make_safe($_POST['newsignature']));
print "Profile Signature changed!

[size="1"]> [/size][url='sigchange.php']Back[/url]";
}
}
$h->endpage();

?>


Posted

Re: Signature Change That I Can Put On Main Menu

Well I was coding this while that got posted so i'm going to post mine anyway..

 

<?php
include_once (DIRNAME(__FILE__) . '/globals.php');

$_GET['action'] = isset($_GET['act']) && ctype_alnum($_GET['action']) ? strtolower(trim($_GET['action'])) : "";
switch($_GET['action']) {
 case 'signaturechange':
 signature_change();
 break;

 default:
 Index();
 break;
}

function Safe($Var) {
return (get_magic_quotes_gpc()) ? htmlentities($Var) : addslashes(htmlspecialchars($Var));
}

function Index() {
 echo '<h3>Preferences</h3>
 [url="'.$_SERVER['PHP_SELF'].'?action=signaturechange"]Profile Signature Change[/url]
';
}

function signature_change() {
 global $ir, $c, $userid, $h;

 if ($POST['Sig']) {
   if (trim($_POST['Sig']) = '') {
     echo 'You did not enter a new profile signature.

     [size="1"]>[/size] [url="'.$_SERVER['PHP_SELF'].'?action=signaturechange"]Back[/url]';
  $h->endpage();
  exit;
   } else {
     $db->query(sprintf("UPDATE `users` SET `profileSIG`='%s' WHERE `userid`='%u'", Safe($_POST['newsignature'])));
     echo 'Profile Signature changed!

     [size="1"]>[/size] [url="'.$_SERVER['PHP_SELF'].'"]Back[/url]';
  $h->endpage();
  exit;
   }
 } else {
   echo '<h3>Profile Signature Change</h3>
   <form action="'.$_SERVER['PHP_SELF'].'?action=signaturechange" method="post">
     New Profile Signature: 
';
     echo sprintf("<textarea rows='30' cols='90' name='Sig' wrap='virtual' class='input'>%s</textarea>

", $ir['profileSIG']);
     echo '<input type="submit" value="Change Signature" />
   </form>


   [size="1"]>[/size] [url="'.$_SERVER['PHP_SELF'].'"]Back[/url]';
 }
}
$h->endpage();
?>
Posted

Re: Signature Change That I Can Put On Main Menu

Dont Mean To Be A "Begger" But Could You Add This Too

Race Mod

 

case 'racechange2':

do_race_change();

break;

case 'racechange':

conf_race_change();

break;

Race Change

 

function race_change()

{

global $ir,$c,$userid,$h;

print "<center><hr width='20%'>Race Change<hr width='20%'>

<form action='preferences.php?action=racechange2' method='post'>

<select class=textbox name='race'>

<option value='Wizard'>Wizard</option>

<option value='Ware Wolf'>Ware Wolf</option>

<option value='Vampire'>Vampire</option>

<option value='Yeti'>Yeti</option>

<option value='Elf'>Elf</option>

<option value='Zombie'>Zombie</option>

<option value='Beast'>Beast</option>

<option value='Dwarf'>Dwarf</option>

<option value='Gangsta'>Gangsta</option>

<option value='Criminal'>Criminal</option>

<option value='Pimp'>Pimp</option>

<option value='Member'>Member</option>

<option value='Legendary Thug'>Legendary Thug</option>

<option value='Pilot'>Pilot</option>

<option value='Boxer'>Boxer</option>

<option value='Chief'>Chief</option>

<option value='Cop'>Cop</option>

<option value='Creature'>Creature</option>

<option value='Seller'>Seller</option>

<option value='Buyer'>Buyer</option>

<option value='Goth'>Goth</option>

<option value='Thief'>Thief</option>

<option value='Hacker'>Hacker</option>

<option value='Skeleton'>Skeleton</option>

<option value='Demon'>Demon</option>

<option value='Goblin'>Goblin</option>

<option value='Unknown' SELECTED>Unknown</option>

</Select>

<input class='textbox' type='submit' value='Change Race' />

</form>";

}

function do_race_change()

{

global $db,$ir,$c,$userid,$h;

$db->query("UPDATE users SET race='{$_POST['race']}' WHERE userid=$userid");

print "You Have Changed your Race Type!

Back";

}

And Also The Status Mod.

 

case 'statuschange2':

do_status_change();

break;

case 'statuschange':

conf_status_change();

break;

Status Change

 

function conf_status_change()

{

global $ir,$c,$userid,$h;

print "<center><hr width='20%'>Status Change<hr width='20%'>

<form action='preferences.php?action=statuschange2' method='post'>

<select class=textbox name='status'>

<option value='Unknown'>Unknown</option>

<option value='Be Right Back'>Be Right Back</option>

<option value='Wont Answer to Mails'>Wont Answer to Mails</option>

<option value='Busy'>Busy</option>

<option value='In a Call'>In a Call</option>

<option value='Mail Me'>Mail Me</option>

<option value='Bored'>Bored</option>

<option value='Be Back on Later'>Be Back on Later</option>

</Select>

<input class='textbox' type='submit' value='Change Status' />

</form>";

}

function do_status_change()

{

global $db,$ir,$c,$userid,$h;

$db->query("UPDATE users SET status='{$_POST['status']}' WHERE userid=$userid");

print "You Have Changed your Status Type!

Back";

}

THANKS MUCH APPRECIATED ! :)

Posted

Re: Signature Change That I Can Put On Main Menu

BTW i tried the other one you did for me and look v v v

Fatal error: Can't use function return value in write context in /home/fusion/public_html/sigchange.php on line 28

Posted

Re: Signature Change That I Can Put On Main Menu

 

<?php
include_once (DIRNAME(__FILE__) . '/globals.php');

$_GET['act'] = isset($_GET['act']) && ctype_alnum($_GET['act']) ? trim($_GET['act']) : "";
switch($_GET['act']) {
 case 'SigChange':
 SigChange();
 break;

 case 'StatusChange':
 StatusChange();
 break;

 case 'RaceChange':
 RaceChange();
 break;

 default:
 Index();
 break;
}

function Safe($Var) {
return (get_magic_quotes_gpc()) ? htmlentities($Var) : addslashes(htmlspecialchars($Var));
}

function Index() {
 echo '<h3>Preferences</h3>
 [url="'.$_SERVER['PHP_SELF'].'?act=SigChange"]Profile Signature Change[/url]

 [url="'.$_SERVER['PHP_SELF'].'?act=StatusChange"]Status Change[/url]

 [url="'.$_SERVER['PHP_SELF'].'?act=RaceChange"]Race Change[/url]
';
}

function SigChange() {
 global $db, $c, $ir, $h, $userid;

 if (isset($_POST['Sig'])) {
   if ($_POST['Sig'] = '') {
     echo 'You did not enter a new profile signature.

     [size="1"]>[/size] [url="'.$_SERVER['PHP_SELF'].'?act=SigChange"]Back[/url]';
    $h->endpage();
    exit;
   } else {
     $db->query(sprintf("UPDATE `users` SET `profileSIG`='%s' WHERE `userid`='%u'", Safe($_POST['Sig']), $userid));
     echo 'Profile Signature changed!

     [size="1"]>[/size] [url="'.$_SERVER['PHP_SELF'].'"]Back[/url]';
    $h->endpage();
    exit;
   }
 } else {
   echo '<h3>Profile Signature Change</h3>
   <form action="'.$_SERVER['PHP_SELF'].'?act=SigChange" method="post">
     New Profile Signature: 
';
     echo sprintf("<textarea rows='30' cols='90' name='Sig' wrap='virtual' class='input'>%s</textarea>

", $ir['profileSIG']);
     echo '<input type="submit" value="Change Signature" />
   </form>


   [size="1"]>[/size] [url="'.$_SERVER['PHP_SELF'].'"]Back[/url]';
 }
}

function StatusChange() {
 global $db, $c, $ir, $h, $userid;

 if (isset($_POST['Status'])) {
   $db->query(sprintf("UPDATE `users` SET `status`='%s' WHERE `userid`='%d'", $_POST['Status'], $userid));
   echo 'Your Status Is Now: 

   [i]'.$_POST['Status'].'[/i]';
   $h->endpage();
   exit;
 } else {
   echo '
   <h3>Status Change</h3>
   <form action="'.$_SERVER['PHP_SELF'].'?act=StatusChange" method="post">
     <select class="textbox" name="Status">
       <option value="Unknown">Unknown</option>
       <option value="Be Right Back">Be Right Back</option>
       <option value="Wont Answer to Mails">Wont Answer to Mails</option>
       <option value="Busy">Busy</option>
       <option value="In a Call">In a Call</option>
       <option value="Mail Me">Mail Me</option>
       <option value="Bored">Bored</option>
       <option value="Be Back on Later">Be Back on Later</option>
     </Select>
     <input class="textbox" type="submit" value="Change Status" />
   </form>';
 }
}

function RaceChange() {
 global $db, $c, $ir, $h, $userid;

 if (isset($_POST['Race'])) {
   $db->query(sprintf("UPDATE `users` SET `race`='%s' WHERE `userid`='%d'", $_POST['Race'], $userid));
   echo 'Your Race Is Now: 

   [i]'.$_POST['Race'].'[/i]';
   $h->endpage();
   exit;
 } else { 
   echo '
   <form action="'.$_SERVER['PHP_SELF'].'?act=RaceChange" method="post">
     <select class=textbox name="Race">
       <option value="Wizard">Wizard</option>
       <option value="Ware Wolf">Ware Wolf</option>
       <option value="Vampire">Vampire</option>
       <option value="Yeti">Yeti</option>
       <option value="Elf">Elf</option>
       <option value="Zombie">Zombie</option>
       <option value="Beast">Beast</option>
       <option value="Dwarf">Dwarf</option>
       <option value="Gangsta">Gangsta</option>
       <option value="Criminal">Criminal</option>
       <option value="Pimp">Pimp</option>
       <option value="Member">Member</option>
       <option value="Legendary Thug">Legendary Thug</option>
       <option value="Pilot">Pilot</option>
       <option value="Boxer">Boxer</option>
       <option value="Chief">Chief</option>
       <option value="Cop">Cop</option>
       <option value="Creature">Creature</option>
       <option value="Seller">Seller</option>
       <option value="Buyer">Buyer</option>
       <option value="Goth">Goth</option>
       <option value="Thief">Thief</option>
       <option value="Hacker">Hacker</option>
       <option value="Skeleton">Skeleton</option>
       <option value="Demon">Demon</option>
       <option value="Goblin">Goblin</option>
       <option value="Unknown" SELECTED>Unknown</option>
     </Select>
     <input class="textbox" type="submit" value="Change Race" />
   </form>';
 }
}
$h->endpage();
?>

 

Untested.

Posted

Re: Signature Change That I Can Put On Main Menu

 

<select class="textbox" name="Status">
       <option value="Unknown">Unknown</option>
       <option value="Be Right Back">Be Right Back</option>
       <option value="Wont Answer to Mails">Wont Answer to Mails</option>
       <option value="Busy">Busy</option>
       <option value="In a Call">In a Call</option>
       <option value="Mail Me">Mail Me</option>
       <option value="Bored">Bored</option>
       <option value="Be Back on Later">Be Back on Later</option>
     </Select>

 

You going to let a user change it from viewing source, with the toolbar i have :P

Use an in array when posting..

$types = array("Unknown", "Be Right Back", "Wont Answer to Mails", "Busy", "In a Call", "Mail Me", "Bored", "Be Back on Later");
if(!in_array($_POST['Status'], $types))
{
echo 'Invalid status type!';
$h->endpage();
exit();
}

 

:)

Also you can do the reset for the race mod, im to lazy xD

Posted

Re: Signature Change That I Can Put On Main Menu

And i also forgot to say no need for big code:P

When you can use foreach();

$types = array("Unknown", "Be Right Back", "Wont Answer to Mails", "Busy", "In a Call", "Mail Me", "Bored", "Be Back on Later");

foreach ($types as $names) {
echo '<option value="'. $names .'">'. $names .'</option>';
}

 

Alot better :D

Posted

Re: Signature Change That I Can Put On Main Menu

 

And i also forgot to say no need for big code:P

When you can use foreach();

$types = array("Unknown", "Be Right Back", "Wont Answer to Mails", "Busy", "In a Call", "Mail Me", "Bored", "Be Back on Later");

foreach ($types as $names) {
echo '<option value="'. $names .'">'. $names .'</option>';
}

 

Alot better :D

Why don't you consider:

$Types = array("Unknown", "Be Right Back", "Wont Answer to Mails", "Busy", "In a Call", "Mail Me", "Bored", "Be Back on Later");
for ($i = 0; $i <= count($Types); ++$i) {
 echo '<option value="'.$Types[$i].'">'.$Types[$i].'</option>';
}
  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...