Jump to content

unidox

Members
  • Posts

    557
  • Joined

  • Last visited

    Never

Everything posted by unidox

  1. How do that, and I have another question... Here is my code: function delete($confirm, $s, $access, $id, $link, $table, $table_id, $log, $user, $name) { $q = mysql_query("SELECT * FROM `pcp_users` WHERE `username` = '$user'") or die (mysql_error()); $r = mysql_fetch_array($q); $lvl = $r['level']; // Find the users level. $date = date("F jS, g:i a"); $group = $r['group']; $user_name = $r['username']; if ($lvl == 1) { $q2 = mysql_query("SELECT * FROM `pcp_groups` WHERE `level` = '2'"); $r2 = mysql_fetch_array($q2); $pages = $r2['pages']; $array = split(":", $pages); } else { $q2 = mysql_query("SELECT * FROM `pcp_groups` WHERE `name` = '$group'"); $r2 = mysql_fetch_array($q2); $pages = $r2['pages']; $array = split(":", $pages); } if (($s == 'delete_user') && ($confirm == 'true') && (in_array($access, $array))) { if (!is_numeric($id)) { header("Location: index.php?p=error&h=" . $link . "&e=" . $link . "_1" . ""); exit(); } $q = mysql_query("SELECT * FROM `pcp_$table` WHERE '$table_id' = '$id'") or die (mysql_error()); $r = mysql_fetch_array($q); return mysql_num_rows($q) . "<br />" . $r['level']; } } But when I do $class = new functions(); echo $class->delete(true, "delete_user", "users", "69", "users", "users", "user_id", "User", "unidox", "username"); It doesnt output anything. Whats wrong? BTW the class the function is in is called functions.
  2. I am just starting to use classes because it will help me stop repition of code, but I was wondering I have $_SESSION['user'] to show the user name of the person on the page. I need this to be accessed by each function in the class, I tried using var $username = $_SESSION['user']; but I guess var needs to be an int. How would I go about doing this?
  3. Well, 1st, use functions to handle xss and sql prevention. www.gigaspartan.com has a login/registration tutorial I made that you can easily build off of.
  4. Confusing as hell to fix, but here: <?php if($action == "Register") { $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string($_POST['password']); $password_verify = mysql_real_escape_string($_POST['password_verify']); $password_encrypt = md5($password); $email = mysql_real_escape_string($_POST['email']); $kingdom_name = mysql_real_escape_string($_POST['kingdom_name']); $server = mysql_real_escape_string($_POST['server']); $joined = date('m:d:y'); $ip = $_SERVER['REMOTE_ADDR']; echo '<table border="1" width="100%"> <tr> <th>Registration Progress</th> </tr> <tr>'; if(isset($username)) { if(isset($password)) { if(isset($password_verify)) { if($password == $password_verify) { if(isset($email)) { if(isset($kingdom_name)) { if(isset($server)) { $q = mysql_query("SELECT * FROM Users WHERE Username='$username'"); $row = mysql_num_rows($q); if($row > 0) { $q = mysql_query("SELECT * FROM Users WHERE Email='$email'"); $row = mysql_num_rows($q); if($row > 0) { $q = mysql_query("SELECT * FROM Kingdoms WHERE Kingdom_Name = $kingdom_name"); $row = mysql_num_rows($q); if($row > 0) { mysql_query("INSERT INTO Users (`Username`, `Password`, `Ip`, `Joined`, `Email`) VALUES ('$username', '$password_encrypt', '$ip', '$joined', '$email')") or die(mysql_error()); $user_success = true; mysql_query("INSERT INTO Kingdoms (`Kingdom_Owner`, `Kingdom_Name`, `Kingdom_Gold`, `Kingdom_Turns`, `Kingdom_GoldMine_Level`, `Kingdom_Barracks_Level`, `Kingdom_TownCenter_Level`, `Kingdom_Spies_Count`, `Kingdom_Guards_Count`, `Kingdom_Swordsmen_Count`, `Kingdom_Macemen_Count`, `Kingdom_Spearmen_Count`, `Kingdom_Archers_Count`, `Kingdom_Server`) VALUES ('$username', '$kingdom_name', '5000', '50', '1', '1', '1', '0', '10', '0', '0', '0', '0', '$server')") or die(mysql_error()); $kingdom_success = true; if($user_success) { if($kingdom_success) { echo '<td>User has been inserted into the database successfully.<br />Kingdom has been inserted into the database successfully.<br /><br />Registration Successful, please <a href="login.php">Login.</a></td>'; } else { echo '<td>Kingdom was not inserted into the database.<br /></td>'; } } else { echo '<td>User was not inserted into the database.<br /></td>'; } } else { echo '<td>Kingdom name already exists!<br /></td>'; } } else { echo '<td>Email already exists!<br /></td>'; } } else { echo '<td>Username already exists!<br /></td>'; } } else { echo '<td>Please choose a server.<br /></td>'; } } else { echo '<td>Please enter a name for your kingdom.<br /></td>'; } } else { echo '<td>Please enter your email.<br /></td>'; } } else { echo '<td>The passwords do not match.<br /></td>'; } } else { echo '<td>Please verify your password.<br /></td>'; } } else { echo '<td>Please enter your password.<br /></td>'; } } else { echo '<td>Please enter your username.<br /></td>'; } echo '</tr> </table>'; } ?>
  5. http://gigaspartan.com/ I made a login tutorial on it.
  6. unidox

    Code

    I need a script so I can post php on my blog. Like the one phpfreaks uses with Anyone know? Thanks
  7. I am thinking he wants something like whois.sc where it takes a thumbnail of the website that the person is looking up.
  8. Let me see your login script so I can implement for you.
  9. use sessions then use an if statement to determine if the user is logged in as admin, if he is, then display the form.
  10. I have this script: $url = "http://www.site.com/license.php?key=" . SITE_LIC . "&ref=" . $_SERVER["SERVER_NAME"] . ""; $lic = @fopen($url, "r+"); $lic = @fread($lic, 8192); if ($lic == "0") { header("Location: http://www.site.com/index.php?p=lic_invalid&site=" . $_SERVER["SERVER_NAME"] . ""); exit(); } fclose($lic); If I type the url in my address bar, it outputs 1 as desired. But when I try to echo $lic, nothing even outputs. Whats wrong?
  11. unidox

    Email

    I found this website that converts files into .flv and it emails them to you. I was wondering if this is possible and how to do it: 1) Submit the form from a remote website. 2) Receive the converted file in the email. 3) Upload the new .flv file onto the remote server. Just wanna know if its possible.
  12. http://templora.com/content/14 just do a google search.
  13. Is there a way I can output the script url, like http://site.com/folder/script.php
  14. Is there a way I can insert a php url from a mysql database, into a javascript function within script tags?
  15. use a while loop. $q = mysql_query() or die(mysql_error()); echo "<option value=\"blank\">Please select.</option>"; while ($r = mysql_fetch_array($q)) { echo "<option value=\"" . $r['id'] . "\">" . $r['name'] . "</option>"; }
  16. unidox

    Opinion

    I am making a CMS and allowing the admin to upload a COTW(Clip of the week.) The only problem is that the video player I was thinking to implement only supports .flv and .mp4 extensions. I was thinking of using mencoder, mplayer, ffmpeg, lame, and Libogg + Libvorbis. But thats specific to linux,unix systems. I am just wondering which is better, an os specific cms or a small hassle to convert movies into flv. Please share your opinion.
  17. I have a flv player, and a video upload script. The only problem is when someone uploads something other than a .flv. I was wondering does anyone know a php converter for video files that I can either buy or use open source. Thanks
  18. Oh, I thought he wanted to pass the cookie...
  19. Use get. http://www.tizag.com/phpT/postget.php
  20. <?php if (!$_COOKIE['RFant_agree']) { header("Location: tos.php"); exit(); } ?> Then in TOS.php: <?php if (isset($_POST['check'])) { $_COOKIE['RFant_agree'] = 1; header("Location: index.php"); exit(); } ?>
  21. You just repeated what I posted but with code that he doenst need. Please read post guidelines before you get a permanent ban.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.