Jump to content

Ethandvv

Members
  • Posts

    12
  • Joined

  • Last visited

Ethandvv's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Ethandvv

    $file

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Chat - Customer Module</title> <link type="text/css" rel="stylesheet" href="style.css" /> </head> <body bgcolor="black"> <div id="wrapper"> <div id="menu"> <p class="welcome">Welcome, <b></b></p> <p class="logout"><a id="exit" href="logout.php">Exit Chat</a></p> <div style="clear:both"></div> </div> <div id="chatbox"> <?php if(file_exists("log.html") && filesize("log.html") > 0){ $handle = fopen("log.html", "r"); $contents = fread($handle, filesize("log.html")); fclose($handle); echo $contents;} ?> </div> <form name="message" action=""> <input name="usermsg" type="text" id="usermsg" size="63" /> <input name="submitmsg" type="submit" id="submitmsg" value="Send" /> </form> </div> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script> <script type="text/javascript"> // jQuery Document $(document).ready(function(){ }); </script> </body> </html> Here is the whole script set-out and i have CSS and JS plus some other PHP files linked in from an external folder
  2. Ethandvv

    $file

    <?php if(file_exists("log.html") && filesize("log.html") > 0){ $handle = fopen("log.html", "r"); $contents = fread($handle, filesize("log.html")); fclose($handle); echo $contents;}?></div> ===== I'm using PHP to create a chat, but i have encountered an error in which the ">" tag is causing the rest of the operation to be shown on the webpage. Any suggestions? (I have the part where the problem is occurring in bold and underlined. If you want me to post the main frame of this I can, just ask, I'm not sure if it's a file or just the script.
  3. Thanks, tons! JS wasn't working and now i know why, lol. I've read into the PHP a little and have a Question for you: When (after the user has submited the form), the PhP script starts if I use the $file=mkdir(fname == 'username') would i use that to make a new directory with the users 'username' or not?
  4. Okay, so any suggestions on how i would do that.. I know very little PHP and I'm unable to most actions due to my use of Mac
  5. Should I simplify it? Like this: ( I got messed up in the making and got myself confused, sorry ) function saveFile(){var userid;userid=document.getElementById('userid');var passid;passid=document.getElementById('passid');var passwordConfirm;passwordConfirm=document.getElementById('confirm'); if (passid == passwordConfirm) { /* Then some how save the userid and passid to external file, then close it */ }else { alert('Sorry, Passwords do not match.'); }} Thats better i think
  6. To create registration form for website in JS, but save it to an external file (users.txt)
  7. I'm making a chat website for some friends and I've tried multiple types of registration pages but, i can't figure it out. Please Help. This is what I have so far: <div id="body contents"> <div align="center" id="form_holder"> <form id="form_placement"> Username:<input type="text" id="UN" name="UN" autocomplete="on" runat="server" /> <br/> Password:<input type="password" id="PW1" autocomplete="off" runat="server" name="PW1" /> <br/> Confirm:<input type="password" id="PW2" autocomplete="off" runat="server" name="PW2" /> <br/> <input type="button" runat="server" id="submit_form" name="form_submition" onclick="saveFile()" value="Submit" /> </form> </div> <h6 id="results" runat="server"></h6> </div> <div id="script contents"> <script type="text/javascript"> function saveFile() { var userid; userid=document.getElementById('UN'); var passid; passid=document.getElementById('PW1'); var confirmid; confirmid=document.getElementById('PW2'); if (passid.name == confirmid.name) { document.getElementById('reults').innerHTML= "File save as "+ userid +" and "+ passid +"."; alert('Saved file succesfully.') if (userid.name === 0) { fopen('users.txt').mkdir(userid.name ++ passid.name); fclose() } } else { alert('Sorry Username or Password is taken, or is incorrect.'); } } </script> Any suggestions?
  8. Try; <HTML> <body> <head> <div id="id1"> <video src="http://www.somevideurl.com/" width="absolute" height="absolute"></video> !-- Other content.... --! </head> </body> </html> The only program need for this is Chrome because it supports all files/coding in the movie configuration.. Personally, me myself, am new to any of this and not sure if anything i post is helpful. Hope this helps. -Thanks!
  9. The solution (for me personally) was this: <div id="wrapper" align="top" height="auto" width="<!-- User set --!>"><div id="spacer">.......</div>.... ETC.THE RESULT OF THAT IS AN AUTO SET HEIGHT THAT WILL ADJUST ACCORDING TO THE AMOUNTOF FIELDS SET INTO THE DOCUMENT/DIV SECTION
  10. // admin controls<?phpif (!defined('CHAT_VERSION')) exit('No direct script access allowed');class Chat_Admin extends topcmmRequestRemote{ private $table_name; function Chat_Admin(){ $this->__construct(); } function __construct(){ global $wpdb; $this->table_name = $wpdb->prefix . "123flashchat"; } function chat_active(){ register_activation_hook(__FILE__,'jal_install'); } function chat_deactivate(){ global $wpdb; // remove activation check & version delete_option( 'widget_chat_activation' ); // delete 123flashchat table $deletechat = $wpdb->query( "DROP TABLE $this->table_name" ); //delete 123flashchat page $wpdb->query("DELETE FROM $wpdb->posts WHERE post_name = '123flashchat'"); } function my_chat_admin_init(){ wp_register_script('myPluginScript', CHAT_PLUGIN_URL.'/js/main_settings.js'); } function wm_add_chat_page(){ add_object_page('123FlashChat', '123FlashChat', 'manage_options', 'chat_settings', array( $this, 'chat_settings_page' ), CHAT_PLUGIN_URL.'/image/123flashchat.png', 6); $chat_settings = add_submenu_page( 'chat_settings', '123FlashChat', 'Chat Settings', 'manage_options', 'chat_settings', array( $this, 'chat_settings_page' )); $admin_panel = add_submenu_page( 'chat_settings', '123FlashChat', 'Admin Panel', 'manage_options', 'chat_adminpanel', array( $this, 'chat_adminpanel_page' )); add_action( "admin_print_scripts-$chat_settings", array( $this, 'my_chat_admin_styles' ), CHAT_VERSION ); } function my_chat_admin_styles(){ /* * It will be called only on your plugin admin page, enqueue our script here */ wp_enqueue_script('myPluginScript'); } function chat_settings_page(){ global $wpdb; $updateChat = $this->updateChatSetting(); $getChat = $wpdb->get_results( "SELECT * FROM {$this->table_name} where id = '1'" ); $get_chat_settings = $getChat[0]; do_action( 'option_tree_admin_header' ); include (CHAT_PLUGIN_DIR."/chat_settings.php"); } function chat_adminpanel_page(){ global $wpdb; $getChat = $wpdb->get_results( "SELECT * FROM {$this->table_name} where id = '1'" ); $get_chat_settings = $getChat[0]; do_action( 'option_tree_admin_header' ); include (CHAT_PLUGIN_DIR."/chat_adminpanel.php"); } function chat_load(){ add_thickbox(); wp_enqueue_script( 'jquery-table-dnd', CHAT_PLUGIN_URL.'/js/main_settings.js', array('javascript'), CHAT_VERSION ); } function save_Local_Settings(){ if(!$_REQUEST){ $error_Info .= "Save Failed"; return $error_Info; } $data['fc_extendserver'] = 0; $data['fc_servertype'] = $_REQUEST['fc_servertype']; $client_location = $_REQUEST['fc_client_loc']; if($client_location){ $data['fc_client_loc'] = $client_location . (substr($client_location,-1,1) != '/' ? '/' : ''); $serverinfo = $this->getServerHostPortLocal($data['fc_client_loc']); $data['fc_server_host'] = !empty($_REQUEST['fc_server_host']) ? $_REQUEST['fc_server_host'] : (empty($serverinfo['fc_server_host']) ? $_SERVER['HTTP_HOST'] : $serverinfo['fc_server_host']) ; $data['fc_server_host_s'] = empty($serverinfo['fc_server_host_s']) ? $data['fc_server_host'] : $serverinfo['fc_server_host_s']; $data['fc_server_host_h'] = empty($serverinfo['fc_server_host_h']) ? $data['fc_server_host'] : $serverinfo['fc_server_host_h']; if(!is_numeric($_REQUEST['fc_server_port']) || strpos($_REQUEST['fc_server_port'] ,".")!==false){ $data['fc_server_port'] = empty($serverinfo['fc_server_port']) ? ( $data['fc_servertype'] ==1 ? '51212' : '51127') : $serverinfo['fc_server_port'] ; }else{ $data['fc_server_port'] = $_REQUEST['fc_server_port']; } if(!is_numeric($_REQUEST['fc_server_port_h']) || strpos($_REQUEST['fc_server_port_h'] ,".")!==false){ $data['fc_server_port_h'] = empty($serverinfo['fc_server_port_h']) ? ( $data['fc_servertype'] == 1 ? '31212' : '35555') : $serverinfo['fc_server_port_h'] ; }else{ $data['fc_server_port_h'] = $_REQUEST['fc_server_port_h']; } $data['fc_server_port_s'] = empty($serverinfo['fc_server_port_s']) ? ( $data['fc_servertype'] == 1 ? '51213' : '51128') : $serverinfo['fc_server_port_s'] ; $data['fc_api_url'] = 'http://' . $data['fc_server_host'] . ':' . $data['fc_server_port_h'] . '/'; }else{ $data['fc_server_host'] = $_SERVER['HTTP_HOST']; $data['fc_server_host_h'] = $data['fc_server_host_s'] = $data['fc_server_host']; if($data['fc_servertype'] == 1){ $data['fc_server_port_h'] = '31212'; $data['fc_server_port_s'] = '51213'; $data['fc_server_port'] = '51212'; }else{ $data['fc_server_port_h'] = '35555'; $data['fc_server_port_s'] = '51128'; $data['fc_server_port'] = '51127'; } $data['fc_api_url'] = 'http://' . $data['fc_server_host'] . ':' . $data['fc_server_port_h'] . '/'; $data['fc_client_loc'] = $data['fc_api_url']; } if($data['fc_servertype'] == 1){ $data['fc_clienttype'] = 0; }else{ $data['fc_clienttype'] = $_REQUEST['fc_clienttype']; } $s_own_loc = 1; $c_own_loc = 1; $da = 1; if($_REQUEST['server_loc']){ $c_own_loc = validate_client($data['fc_client_loc']); $da = validate_data_api($data['fc_api_url'] . 'online.js'); if($c_own_loc || $da){ $error_Info .= 'Chat Server host or port is configured incorrectly'; return $error_Info; } }else{ $c_own_loc = validate_client($data['fc_client_loc']); if($c_own_loc){ $error_Info .= 'Chat Server http_port or Client location is configured incorrectly'; return $error_Info; } } $check = validate_client('http://'.parse_url($data['fc_client_loc'], PHP_URL_HOST).':'.$data['fc_server_port_h'].'/'); if($check){ $error_Info .= 'Client Location is configured incorrectly'; return $error_Info; } $getPublic = $this->getPublic(); $getPost = $data + $getPublic; $updatechat = $this->UpdateChatSettingTabel($getPost); return $updatechat; } function save_Host_Settings(){ if(!$_REQUEST){ $error_Info .= "Save Failed"; return $error_Info; } $data['fc_extendserver'] = 1; $data['fc_client_loc'] = $_REQUEST['fc_client_loc'] ? ($_REQUEST['fc_client_loc'] . (substr($_REQUEST['fc_client_loc'],-1,1) != '/' ? '/' : '')) : ''; if(empty($data['fc_client_loc'])){ $error_Info .= "Client Location is Empty!"; return $error_Info; } $serverinfo = $this->getServerHostPortHost($data['fc_client_loc']); if($serverinfo){ $data['fc_server_host'] = empty($serverinfo['fc_server_host']) ? parse_url($data['fc_client_loc'], PHP_URL_HOST) : $serverinfo['fc_server_host']; $data['fc_server_host_s'] = empty($serverinfo['fc_server_host_s']) ? '' : $serverinfo['fc_server_host_s']; $data['fc_server_host_h'] = empty($serverinfo['fc_server_host_h']) ? '' : $serverinfo['fc_server_host_h']; $data['fc_server_port'] = empty($serverinfo['fc_server_port']) ? '' : $serverinfo['fc_server_port']; $data['fc_server_port_h'] = empty($serverinfo['fc_server_port_h']) ? '' : $serverinfo['fc_server_port_h']; $data['fc_server_port_s'] = empty($serverinfo['fc_server_port_s']) ? '' : $serverinfo['fc_server_port_s']; $data['fc_api_url'] = 'http://' . $data['fc_server_host'] . '/'; $data['fc_group'] = substr(parse_url($data['fc_client_loc'], PHP_URL_PATH),1,-1); $c_own_loc = validate_client($data['fc_client_loc']); $da = validate_data_api($data['fc_api_url'] . 'online.js?group=' . $data['fc_group']); if($c_own_loc || $da){ $error_Info .= "Client Location is configured incorrectly"; return $error_Info; } }else{ $error_Info .= "Client Location is configured incorrectly"; return $error_Info; } $data['fc_clienttype'] = $_REQUEST['fc_clienttype']; //public $getPublic = $this->getPublic($_REQUEST); $getPost = $data + $getPublic; $updatechat = $this->UpdateChatSettingTabel($getPost); return $updatechat; } function save_Free_Settings(){ if(!$_REQUEST){ $error_Info .= "Save Failed"; return $error_Info; } $data['fc_extendserver'] = "2"; $room = trim($_REQUEST['fc_room']); if($room != ""){ preg_match("/w+$/", $room,$matches); if(strlen($room) != strlen($matches[0])){ $error_Info .= "Chat Room can only use numbers,letters and underline!"; return $error_Info; } $data['fc_room'] = $room; }else{ $data['fc_room'] = 'Lobby'; } //public $getPublic = $this->getPublic($_REQUEST); $getPost = $data + $getPublic; $updatechat = $this->UpdateChatSettingTabel($getPost); return $updatechat; } function updateChatSetting(){ global $wpdb; $table_name = $wpdb->prefix . "123flashchat"; if($_GET['action'] == "setchat"){ switch ($_REQUEST['fc_extendserver']){ case 0: $report_Info = $this->save_Local_Settings(); break; case 1: $report_Info = $this->save_Host_Settings(); break; default: $report_Info = $this->save_Free_Settings(); } // $updatechat = $this->UpdateChatSettingTabel($report_Info); if(!empty($report_Info)){ return $report_Info; } } } function UpdateChatSettingTabel($report_Info){ global $wpdb; $getvar = ""; $chattable = $wpdb->update( $this->table_name, $report_Info,array('id' => "1")); $n = 0; foreach ( $report_Info as $key => $value){ if($n == 0){ $getvar .= "$key='".$value."'"; }else{ $getvar .= " and $key='".$value."'"; } $n = 2; } $updated = $wpdb->get_var("SELECT id FROM {$this->table_name} WHERE $getvar"); if($updated){ $updatechat = "Update success!"; }else{ $updatechat = "Update Fail!"; } return $updatechat; } function getPublic(){ //local $data['fc_room_list'] = $_REQUEST['fc_room_list'] ? "1" : "0"; $data['fc_user_list'] = $_REQUEST['fc_user_list'] ? "1" : "0"; // $fc_popup = isset($_REQUEST['fc_popup']) ? "1" : "0"; $data['fc_fullscreen'] = $_REQUEST['fc_fullscreen']; if(!is_numeric($_REQUEST['fc_client_width'] ) || strpos($_REQUEST['fc_client_width'] ,".")!==false){ $data['fc_client_width'] = 750; }else{ $data['fc_client_width'] = $_REQUEST['fc_client_width']; } if(!is_numeric($_REQUEST['fc_client_height'] ) || strpos($_REQUEST['fc_client_height'] ,".")!==false){ $data['fc_client_height'] = 642; }else{ $data['fc_client_height'] = $_REQUEST['fc_client_height']; } $data['fc_client_lang'] = $_REQUEST['fc_client_lang']; if ($_REQUEST['fc_client_skin']){ $data['fc_client_skin'] = $_REQUEST['fc_client_skin']; }else{ $data['fc_client_skin'] = 'default'; } return $data; } function getServerHostPortLocal($client_location){ $content = topcmmRequestRemote::requestRemote($client_location.'htmlchat/config/config.js',1); if ($content){ //server host preg_match('/init_host = "([a-zA-Z0-9.]*)";/', $content, $matches); if(isset($matches[1])){ $data['fc_server_host'] = $matches[1]; }else{ preg_match('/init_host="([a-zA-Z0-9.]*)";/', $content, $matches); if(isset($matches[1])){ $data['fc_server_host'] = $matches[1]; }else{ $data['fc_server_host'] = ''; } } //server port preg_match('/init_port = ([0-9]*);/', $content, $matches); if(isset($matches[1])){ $data['fc_server_port'] = $matches[1]; }else{ $data['fc_server_port'] = ''; } //server host s preg_match('/init_host_s = "([a-zA-Z0-9.]*)";/', $content, $matches); if(isset($matches[1])){ $data['fc_server_host_s'] = $matches[1]; }else{ preg_match('/init_host_s="([a-zA-Z0-9.]*)";/', $content, $matches); if(isset($matches[1])){ $data['fc_server_host_s'] = $matches[1]; }else{ $data['fc_server_host_s'] = ''; } } //server port s preg_match('/init_port_s = ([0-9]*);/', $content, $matches); if(isset($matches[1])){ $data['fc_server_port_s'] = $matches[1]; }else{ $data['fc_server_port_s'] = ''; } //server host h preg_match('/init_host_h = "([a-zA-Z0-9.]*)";/', $content, $matches); if(isset($matches[1])){ $data['fc_server_host_h'] = $matches[1]; }else{ preg_match('/init_host_h="([a-zA-Z0-9.]*)";/', $content, $matches); if(isset($matches[1])){ $data['fc_server_host_h'] = $matches[1]; }else{ $data['fc_server_host_h'] = ''; } } //server port h preg_match('/init_port_h = ([0-9]*);/', $content, $matches); if(isset($matches[1])){ $data['fc_server_port_h'] = $matches[1]; }else{ $data['fc_server_port_h'] = ''; } return $data; }else{ return false; } } function getServerHostPortHost($client_location){ $content = topcmmRequestRemote::requestRemote($client_location,1); if ($content){ //server port preg_match('/init_port=([0-9]*)/', $content, $matches); if(isset($matches[1])){ $data['fc_server_port'] = $matches[1]; } //server port s preg_match('/init_port_s=([0-9]*)/', $content, $matches); if(isset($matches[1])){ $data['fc_server_port_s'] = $matches[1]; } //server port h preg_match('/init_port_h=([0-9]*)/', $content, $matches); if(isset($matches[1])){ $data['fc_server_port_h'] = $matches[1]; } //server host preg_match('/init_host=([a-zA-Z0-9.]*)/', $content, $matches); if(isset($matches[1])){ $data['fc_server_host'] = $matches[1]; } //server host s preg_match('/init_host_s=([a-zA-Z0-9.]*)&/', $content, $matches); if(isset($matches[1])){ $data['fc_server_host_s'] = $matches[1]; } //server host h preg_match('/init_host_h=([a-zA-Z0-9.]*)&/', $content, $matches); if(isset($matches[1])){ $data['fc_server_host_h'] = $matches[1]; } return $data; }else{ return false; } }}?> I used this, but started editing some parts of it to create my own 'roles of authority' files -Save_to- page then i used this (with a few edits of my own) to create the Admin Control Panel's page. Hope this helps! -Thanks for reading <?phpif (!defined('CHAT_VERSION')) exit('No direct script access allowed'); global $current_user; $server = $get_chat_settings->fc_extendserver;?> This is the "No script access denial" you need this to activate the [$get_chat_settings-] <?phpif (!defined('CHAT_VERSION')) exit('No direct script access allowed'); global $current_user; $server = $get_chat_settings->fc_extendserver;?><!-- This is the divider for the settings --!><br /><br /><br /><div text-align="center" align="center"><?php if($server == 2){?> That's all that i used, though, i was creating a Chat, but i saw no comments here so i though i had to help somehow.
  11. //Making the input for signing upfopen('usersfile.txt');mkdir(userName, + passcode);... some code...// How, would I allow the input after adding your login passcode and user name go to a separate file on another page?
×
×
  • Create New...