Jump to content

karimali831

Members
  • Posts

    436
  • Joined

  • Last visited

Everything posted by karimali831

  1. where can I find the script to convert text to alphanumeric? Example, $name = 'The -Name-'; function (preg_replace...) return $name output: TheName Thanks for help
  2. Hi, When I execute this query from phpmyadmin: SELECT cupID FROM cup_clans WHERE clanID='1' AND 1on1='1' It selects two rows from the cupID column which works fine. And for php: $isuser = safe_query("SELECT cupID FROM cup_clans WHERE clanID='1' AND 1on1='1'"); $dp=mysql_fetch_array($isuser); echo $dp['cupID']; echo's only one ID.. and not both? I don't understand why? I want it to echo all rows in the cupID column.
  3. Thanks for that but this seems to work fine anyway... $name = htmlspecialchars(mb_substr(trim($_POST['name']), 0, 30)); $check = safe_query("SELECT * FROM ".PREFIX."cup_all_clans WHERE name='$name'"); $num = mysql_num_rows($check); if($num) die('A team with this name already exists.');
  4. Solved with trim $name = htmlspecialchars(mb_substr(trim($_POST['name']), 0, 30)); $check = safe_query("SELECT * FROM ".PREFIX."cup_all_clans WHERE name='$name'"); $num = mysql_num_rows($check); if($num) die('A team with this name already exists.');
  5. Hello, I'm trying to prevent users from signup up if they use a same name in my database. Is there anything wrong with my queries? The problem is that they can still signup even with the same name in the database. $getclans = safe_query("SELECT name FROM ".PREFIX."cup_all_clans"); $db=mysql_fetch_array($getclans); $name = $db['name']; $check = safe_query("SELECT * FROM ".PREFIX."cup_all_clans WHERE name='$name'"); $db=mysql_fetch_array($check); if($_POST['name']==$name) { die('There is already a team with this name!'); } Thanks for any help.
  6. Well in my case is, for leagues and tournaments, a team leader sends an invite to someone to join their team with 1 link. Many leagues has this.. no one is really going to care if it's safe or not as it's just a team that takes part in leagues and not credit card information. As you said there is no way of getting the password once it's encrypted using md5, is there an alternative or must I not use encrryption altogether? There is a league that is very active, around 15k users online that uses decrypted passwords and a join link like /join_team/4971608/?joinpw=mypassword
  7. Like for example, when a user retrieves for a lost password and they email it to themselves, they will get the password and not the decrypted one in the database. Understand? I'm not familar with this password hashing..
  8. Thanks for your reply, is there a tutorial for this?
  9. Hey, When a user sends an invite to join their team, the URL format is like: ?site=clans&action=clanjoin&clanID=459&password=547ed66d627d350f8b3847d24b661f49 I use md5 for password encryption but you can't use an encrypted password to POST data? It would just say password is incorrect unless I manually edit the row in phpmyadmin with a random password and use that one. Is there a way to get the actual encrypted password instead of decrypted one when I use sql fetch?
  10. Lol. No I so haven't, have I? I want to
  11. Hi, I have two tables, (table1 & and table2) table 1 columns -> ID, 1on1 table 2 columns -> ID, 1on1 I want to use an SQL UPDATE query for table2 so that the rows in table 1 for the 1on1 column is the same in table 2 for the same 1on1 column. Rows in table 1 is how I want it in table 2 for the 1on1 column, ID in table 1 is the same ID in table 2 so I was thinking that I must use WHERE ID clause for the UPDATE query? Current rows for 1on1 column is 0 for table2. Thanks for help if you can.
  12. You'll probably say this is terrible and laugh but I'm just trying different ways.. <?php $getid=safe_query("SELECT cupID FROM ".PREFIX."cup_matches"); $ds=mysql_fetch_array($getid); $cupID = $ds['cupID']; $ergebnis2=safe_query("SELECT 1on1 FROM ".PREFIX."cups WHERE ID='$cupID'"); $dl=mysql_fetch_array($ergebnis2); if(isset($_GET['action']) && $_GET['action'] == 'alter'){ safe_query("UPDATE ".PREFIX."cup_matches SET 1on1='".$dl['1on1']."' WHERE cupID='$cupID'"); echo '<center><h2>Successfully updated to V4.1.4b!</h2><br><a href="index.php"><b>View Site</b></a></center>'; }elseif(!$ds['1on1']) { mysql_query("ALTER TABLE `".PREFIX."cup_matches` ADD `1on1` INT( 11 ) NOT NULL default '1' AFTER `einspruch`;") OR die(PREFIX.'cup_matches <font color="red">failed!</font><br> You have already updated to V4.1.4b!<br />'); redirect('?site=update&action=alter', '<center>Now sorting rows</center>', 0); } ?>
  13. That's what I thought but I have no idea how to do this... can you help me do this please using the existing code I posted previously? I'll appreciate it alot. Been stuck with this for the last few days... and haven't got very far Well this is German style, I have no idea what is good and what is bad.. but if it works, it works
  14. Was thinking if I need a WHERE clause for the mysql_query?
  15. (See post above and this is the current code:) <?php $getid=safe_query("SELECT cupID FROM ".PREFIX."cup_matches"); $ds=mysql_fetch_array($getid); $cupID = $ds['cupID']; $get1on1=safe_query("SELECT 1on1 FROM ".PREFIX."cups WHERE ID='$cupID'"); $dl=mysql_fetch_array($get1on1); mysql_query("ALTER TABLE `".PREFIX."cup_matches` ADD `1on1` INT( 11 ) NOT NULL default '".$dl['1on1']."' AFTER `einspruch`;") OR die(PREFIX.'cup_matches <font color="red">failed!</font><br> You have already updated to V4.1.4b!<br />'); echo '<center><h2>Successfully updated to V4.1.4b!</h2><br><a href="index.php"><b>View Site</b></a></center>'; ?> Problem: Adding incorrect value for added column at cup_matches table. (Adds 1 for all rows) Column "ID = 1" at _cups table -> 1on1 = 0 so it should add this column with 0 value if ID = 1 and cupID = 1. ID = cupID
  16. Take a look at the attatchment, surely you will understand from that? I hope anyway. Not sure why you would say this database has a bad design.. why is this? If ID in the cups table, not cupID. [attachment deleted by admin]
  17. my question does not make sense or is this rather complicated to do?
  18. havenpets and Karl, there is a problem with both scripts you posted. Syntax error I assume. I tried this: <?php $getid=safe_query("SELECT cupID FROM ".PREFIX."cup_matches"); $ds=mysql_fetch_array($getid); $cupID = $ds['cupID']; $ergebnis2=safe_query("SELECT 1on1 FROM ".PREFIX."cups WHERE ID='$cupID'"); $dl=mysql_fetch_array($ergebnis2); if($dl['1on1'] ==1) { mysql_query("ALTER TABLE `".PREFIX."cup_matches` ADD `1on1` INT( 11 ) NOT NULL default '1' AFTER `einspruch`;") OR die(PREFIX.'cup_matches <font color="red">failed!</font><br> You have already updated to V4.1.4b!<br />'); echo '<center><h2>Successfully updated to V4.1.4b!</h2><br><a href="index.php"><b>View Site</b></a></center>'; }else{ mysql_query("ALTER TABLE `".PREFIX."cup_matches` ADD `1on1` INT( 11 ) NOT NULL default '0' AFTER `einspruch`;") OR die(PREFIX.'cup_matches <font color="red">failed!</font><br> You have already updated to V4.1.4b!<br />'); echo '<center><h2>Successfully updated to V4.1.4b!</h2><br><a href="index.php"><b>View Site</b></a></center>'; } ?> No syntax error but adds "1" for each row. I'm trying to add a 1on1 column to my cup_matches table and insert value "1" if ID in the cups table has value "1" in the 1on1 column or insert value "0" if ID in the cups table has value "0" in the 1on1 column. Does that make sense? I believe the mysql_query must be changed? Changing ADD `1on1` INT( 11 ) NOT NULL default '0' AFTER `einspruch`;") to something like ADD `1on1` INT( 11 ) NOT NULL default '$dl['1on1']' AFTER `einspruch`;") make sense .. but won't work.
  19. Hi I'm trying to add a 1on1 column to my cup_matches table and insert value "1" if ID in the cups table has value "1" in the 1on1 column or insert value "0" if ID in the cups table has value "0" in the 1on1 column. See attatchments to help. I believe there is something wrong with my code: <?php $getid=safe_query("SELECT cupID FROM ".PREFIX."cup_matches"); while($ds=mysql_fetch_array($getid)) $cupID = $ds['cupID']; $is1on1=safe_query("SELECT 1on1 FROM ".PREFIX."cups WHERE ID='$cupID'"); $dl=mysql_fetch_array($is1on1); mysql_query("ALTER TABLE `".PREFIX."cup_matches` if($is1on1($cupID)) ADD `1on1` INT( 11 ) NOT NULL default '1' AFTER `einspruch`, else ADD `1on1` INT( 11 ) NOT NULL default '0' AFTER `einspruch`;") OR die(PREFIX.'cup_matches <font color="red">failed!</font><br> You have already updated to V4.1.4b!<br />'); echo '<center><h2>Successfully updated to V4.1.4b!</h2><br><a href="index.php"><b>View Site</b></a></center>'; ?> Any help I'll appreciate, thank you. [attachment deleted by admin]
  20. Ok hello, Be great if someone can correct this for me, I'll appreciate it. <?php $getid = safe_query("SELECT cupID from ".PREFIX."cup_matches"); while($dd = mysql_fetch_array($getid)) $id = $dd['cupID']; if(is1on1($id)) mysql_query("ALTER TABLE `".PREFIX."cup_matches` ADD `1on1` INT( 11 ) NOT NULL default '1' AFTER `einspruch`;") else mysql_query("ALTER TABLE `".PREFIX."cup_matches` ADD `1on1` INT( 11 ) NOT NULL default '0' AFTER `einspruch`;") OR die(PREFIX.'cup_matches <font color="red">failed!</font><br> You have already updated to V4.1.4b!<br />'); echo '<center><h2>Successfully updated to V4.1.4b!</h2><br><a href="index.php"><b>View Site</b></a></center>'; ?>
  21. Hi I want to make "ID" from one table and "userID" from another table unique, so they can't be the same and if userID already exists, it will get the next available one if that makes sense. Is this hard to do? [attachment deleted by admin]
×
×
  • 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.