View Single Post
ישן 12-07-15, 00:20   # 4
anon
חבר בקהילה
 
anon's Avatar
 
מיני פרופיל
תאריך הצטרפות: May 2015
הודעות: 54

anon לא מחובר  

PHP קוד:
<?php
    
if (isset($_POST['action']) && $_POST['action'] == 'post_users'){
        
mysql_connect('localhost''user''pass') or die(mysql_error());   
        
mysql_select_db('db_name') or die(mysql_error());

        
$all_users str_replace("\r","",$_POST['all_users']);
        
$usernames explode("\n"$all_users);
        foreach(
$usernames as $user){
          
mysql_query("INSERT INTO table_name (user_column) VALUES ('$user')");  
        }
        echo 
"Done.";
        exit;
    }
?><!DOCTYPE html>
<html lang="he">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>test</title>
</head>
<body>
    <form class="form" method="post">
        <textarea name="all_users" rows="30" cols="50" placeholder="Paste your users here..."></textarea>
        <input type="hidden" name="action" value="post_users" />
        <input type="submit" />
    </form>
</body>
</html>
זה על קצה המזלג וניתן לפתח את זה עוד הרבה אבל אני מעריך שהרעיונות שקיבלת פה מהחברים יעזרו לך לפתח את זה.. בהצלחה.
  Reply With Quote