Samurai Legend Posted November 17, 2015 Share Posted November 17, 2015 I found a script on my computer, which belongs to someone here. But I do not know who. So I tried fixing it and I get an error, which I do not know the solution too. So I came to you guys for your help. Error - A non-critical error has occurred. Page execution will continue. Below are the details: PHP Notice: Undefined variable: br (8) Line executed: /home/nation/public_html/userimages.php:61 <?php require('globals.php'); echo "<h3><u>User Images</u></h3>"; if (!isset($_GET['action'])) { $_GET['action'] = ''; } switch ($_GET['action']) { case "view": view_image(); break; default: user_images(); break; } function user_images() { global $db, $ir, $notl; $_GET['delete'] = (isset($_GET['delete']) && is_numeric($_GET['delete'])) ? abs(intval($_GET['delete'])) : NULL; if($_GET['delete']) { $db->query("DELETE FROM `userimages` WHERE `imgID` = {$_GET['delete']} AND `imgUSER` = {$ir['userid']}"); confirmation("Image deleted from gallery."); } $_GET['set'] = (isset($_GET['set']) && is_numeric($_GET['set'])) ? abs(intval($_GET['set'])) : ''; if($_GET['set']) { $image = $db->query("SELECT `imgURL` FROM `userimages` WHERE `imgID` = {$_GET['set']}"); $img = $db->fetch_row($image); $db->query("UPDATE `users` SET `display_pic` = '{$img['imgURL']}' WHERE `userid` = {$ir['userid']}"); confirmation("New display picture set."); } $_GET['XID'] = (isset($_GET['XID']) && is_numeric($_GET['XID'])) ? abs(intval($_GET['XID'])) : ''; if(!isset($_GET['XID'])) { error("No userid submitted."); } else { $q = $db->query("SELECT * FROM `userimages` WHERE `imgUSER` = {$_GET['XID']}"); $x = $db->query("SELECT `userid` FROM `users` WHERE `userid` = {$_GET['XID']}"); if($db->num_rows($x) == 0 ) error("There is no such user."); } $y = $db->fetch_row($x); echo "<hr width = '95%'>" . $notl->username_nonformat($y['userid']) . "'s uploaded images.<hr width = '95%'>"; if(!$db->num_rows($q)) { echo "<table width = '95%' cellspacing = '1' class = 'table'><tr style='background:gray'> <td>This user has no uploaded images</td></tr> </table><hr width = '95%'>><a href='viewuser.php?u={$y['userid']}'>Go Back</a><hr width = '95%'>"; } else { echo "<table width = '95%' cellspacing = '1' class = 'table'><tr>"; while($r = $db->fetch_row($q)) { $br++; if($br == 3) { $div = "</tr><tr>"; $br = 0; } else { $div = ""; } $cnn++; echo "<td align = 'centre'><b>$cn. Profile image</b><br/><a href='userimages.php?action=view&ID={$r['imgID']}'><img src='{$r['imgURL']}' width='150' height='200'></a>"; if(isset($_GET['XID']) == $ir['userid']) { echo "<br />[<a href='userimages.php?XID={$r['imgUSER']}&delete={$r['imgID']}'>Delete</a>] <br />[<a href='userimages.php?XID={$r['imgUSER']}&set={$r['imgID']}'>Set Image</a>]"; } echo "<br /><br /></td>"; echo $div; } print "</tr></table><hr width = '95'><a href='viewuser.php?u={$y['userid']}'>>Go Back</a><hr width = '95'>"; } } function view_image() { global $db, $ir, $notl; $_GET['ID'] = (isset($_GET['ID']) && is_numeric($_GET['ID'])) ? abs(intval($_GET['ID'])) : ''; $q = $db->query("SELECT `imgURL`, `imgUSER` FROM `userimages` WHERE `imgID` = {$_GET['ID']}"); $r = $db->fetch_row($q); echo "<hr width = '75%'>" . $notl->username_nonformat($r['imgUSER']) . "'s Image - <hr width = '75%'><br /><img src = '{$r['imgURL']}' width = '250' height = '150'><br /><br /> <hr width = '75%'><a href='userimages.php?XID={$r['imgUSER']}'>>Go Back</a><hr width = '75%'>"; } $h->endpage(); ?> Quote Link to comment Share on other sites More sharing options...
~Rob0t Posted November 17, 2015 Share Posted November 17, 2015 (edited) PHP Notice: Undefined variable: br (8) Line executed: /home/nation/public_html/userimages.php:61 Step 1 - Look at the error Undefined adjective not clear or defined. Step 2 - Look at the line $br++; Step 3 - See what's happening Incrementing a value on a variable that hasn't been given a value before Step 4 - Put in a fix Put $br = 0; above the while() Step 5 - Issue payment Send cash for not reading the fucking error message. BTC: Donate to Wikimedia Thanks. http://stackoverflow.com/a/4261200 Edited November 17, 2015 by ~Rob0t Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.