Jump to content

QuickOldCar

Staff Alumni
  • Posts

    2,972
  • Joined

  • Last visited

  • Days Won

    28

Everything posted by QuickOldCar

  1. $marray = array( '1' => 'apple,', '2' => 'orange,', '3' => ' ', '4' => ' ', '5' => 'apple'); //just values $trimmedArray = array_filter(array_map('trim', $marray)); $mrules = "Welcome Moderator please read the following rules. ".implode(" ",$trimmedArray); echo $mrules."<br />"; //alternate if need keys $mrules = "Welcome Moderator please read the following rules. "; foreach($marray as $key=>$value){ if(trim($value) !=''){ $mrules .= $key.". ".$value." "; } } echo $mrules;
  2. Does this even work? Are passing an undefined $hash variable through password_hash() when should be $password I guess I was bored, tried to simplify it more. Lot of changes including some error checking, html form and server side validation. Didn't see the point doing the functions in it because I kept checking for an empty error array. Since their passwords are saved as hashed values is no point filtering them but I added a minimum length. Untested database related, try it out. <?php $errors = array(); $msg = "Complete the registration form below"; if (isset($_POST['submit'])) { define("EOL", "<br />\n"); // data source name define("DSN", "mysql:host=localhost;dbname=ditacms;charset=utf8"); define("USER", "account_creator"); define("PASSWORD", "UrsaOwnsRoshan"); try { $db = new PDO(DSN, USER, PASSWORD); } catch (PDOException $ex) { // echo $ex->getMessage(); // echo $ex->getTraceAsString(); $errors[] = "database"; $msg = "Attempt to connect to database failed!" . EOL; die($msg); } if (empty($errors)) { if (isset($_POST['username']) && ctype_alnum(str_replace(array( "-", "_" ), '', trim($_POST['username']))) && strlen(trim($_POST['username'])) >= 5) { $username = trim($_POST['username']); } else { $username = ''; $errors[] = 'username'; } if (isset($_POST['email']) && filter_var(trim($_POST['email']), FILTER_VALIDATE_EMAIL)) { $email = trim($_POST['email']); } else { $email = ''; $errors[] = 'email'; } if (isset($_POST['password']) && strlen(trim($_POST['password'])) >= 5) { $password = trim($_POST['password']); } else { $password = ''; $errors[] = 'password'; } if (isset($_POST['confirm_password']) && strlen(trim($_POST['confirm_password'])) >= 5) { $confirm_password = trim($_POST['confirm_password']); } else { $confirm_password = ''; $errors[] = 'confirm password'; } // if the passwords do not exactly match... if ($password !== $confirm_password) { $password = ''; $errors[] = 'password'; $confirm_password = ''; $errors[] = 'confirm password'; } if (empty($errors)) { $query = $db->prepare("SELECT username FROM `ditacms`.`members` WHERE username = :username"); $query->bindValue(":username", $username, PDO::PARAM_STR); if (!$query->execute()) { $errors[] = "query fail"; $msg = "The user check query failed" . EOL; } else { if ($query->fetchColumn()) { $errors[] = "user exists"; $msg = "A user with that username already exists!" . EOL; } } } if (empty($errors)) { $msg = "Creating new user..." . EOL; $insert = $db->prepare("INSERT INTO `ditacms`.`members` (username, email, password) VALUES(:username, :email, :password)"); $hash = password_hash($password, PASSWORD_DEFAULT); $insert->bindValue(":username", $username, PDO::PARAM_STR); $insert->bindValue(":email", $email, PDO::PARAM_STR); $insert->bindValue(":password", $hash, PDO::PARAM_STR); if (!$insert->execute()) { $errors[] = "insert failure"; $msg = "Insertion failure..." . EOL; } else { $msg = "Successfully registered new account!" . EOL; } } } if (empty($errors)) { //redirect to login or main page header("Location: http://" . $_SERVER['SERVER_NAME']); exit; } else { $msg .= "<p style='color:#FF3300;'>You have the following errors: " . implode($errors, ", ") . "</p>"; } } ?> <!DOCTYPE html> <html> <head> <title>ditacms User Registration</title> <style> *:focus { outline: none; } body { font: 14px/21px "Lucida Sans", "Lucida Grande", "Lucida Sans Unicode", sans-serif; max-width:99%; } a { text-decoration:none; } .wrap{ position:relative; width:75%; margin-left:auto; margin-right:auto; padding:5px; } ul{ list-style-type: none; padding:0; margin:0; } .register_form h2, .register_form label { font-family:Georgia, Times, "Times New Roman", serif; } .form_hint, .required_notification { font-size: 11px; } .register_form ul { width:750px; list-style-type:none; list-style-position:outside; margin:0px; padding:0px; } .register_form li{ padding:12px; border-bottom:1px solid #eee; position:relative; } .register_form li:first-child, .register_form li:last-child { border-bottom:1px solid #777; } .register_form h2 { margin:0; display: inline; } .required_notification { color:#d45252; margin:5px 0 0 0; display:inline; float:right; } .register_form label { width:150px; margin-top: 3px; display:inline-block; float:left; padding:3px; } .register_form input { height:20px; width:300px; padding:5px 8px; -moz-transition: padding .25s; -webkit-transition: padding .25s; -o-transition: padding .25s; transition: padding .25s; } .register_form textarea { padding:8px; width:300px; -moz-transition: padding .25s; -webkit-transition: padding .25s; -o-transition: padding .25s; transition: padding .25s; } .register_form button { margin-left:156px; } .register_form input, .register_form textarea { padding-right:30px; border:1px solid #aaa; box-shadow: 0px 0px 3px #ccc, 0 10px 15px #eee inset; border-radius:2px; } .register_form input:focus, .register_form textarea:focus { background: #fff; border:1px solid #555; box-shadow: 0 0 3px #00FF00; padding-right:70px; } /* Button Style */ button.submit { background-color: #68b12f; background: -webkit-gradient(linear, left top, left bottom, from(#68b12f), to(#50911e)); background: -webkit-linear-gradient(top, #68b12f, #50911e); background: -moz-linear-gradient(top, #68b12f, #50911e); background: -ms-linear-gradient(top, #68b12f, #50911e); background: -o-linear-gradient(top, #68b12f, #50911e); background: linear-gradient(top, #68b12f, #50911e); border: 1px solid #509111; border-bottom: 1px solid #5b992b; border-radius: 3px; -webkit-border-radius: 3px; -moz-border-radius: 3px; -ms-border-radius: 3px; -o-border-radius: 3px; box-shadow: inset 0 1px 0 0 #9fd574; -webkit-box-shadow: 0 1px 0 0 #9fd574 inset ; -moz-box-shadow: 0 1px 0 0 #9fd574 inset; -ms-box-shadow: 0 1px 0 0 #9fd574 inset; -o-box-shadow: 0 1px 0 0 #9fd574 inset; color: white; font-weight: bold; padding: 6px 20px; text-align: center; text-shadow: 0 -1px 0 #396715; } button.submit:hover { opacity:.85; cursor: pointer; } button.submit:active { border: 1px solid #20911e; box-shadow: 0 0 10px 5px #356b0b inset; -webkit-box-shadow:0 0 10px 5px #356b0b inset ; -moz-box-shadow: 0 0 10px 5px #356b0b inset; -ms-box-shadow: 0 0 10px 5px #356b0b inset; -o-box-shadow: 0 0 10px 5px #356b0b inset; } input:required, textarea:required { background: #fff; border-color:#FF0000; } .register_form input:required:valid, .register_form textarea:required:valid { /* when a field is considered valid by the browser */ background: #fff; box-shadow: 0 0 5px #5cd053; border-color: #28921f; } .form_hint { background: #d45252; border-radius: 3px 3px 3px 3px; color: white; margin-left:8px; padding: 1px 6px; z-index: 999; /* hints stay above all other elements */ position: absolute; /* allows proper formatting if hint is two lines */ display: none; } .form_hint::before { content: "\25C0"; /* left point triangle in escaped unicode */ color:#d45252; position: absolute; top:1px; left:-6px; } .register_form input:focus + .form_hint { display: inline; } .register_form input:required:valid + .form_hint { background: #28921f; } .register_form input:required:valid + .form_hint::before { color:#28921f; } </style> </head> <body> <div class="wrap"> <form class="register_form" method="post" action="" novalidate> <ul> <li> <h2>Register</h2> <button style="float:right;"><a href="login.php">LOGIN</a></button> </li> <p><?php echo $msg;?></p> <li> <label>Username : </label> <input type="text" pattern="[\w-_]{5,}" name="username" value="<?php echo $username;?>" required title="Allowed: Minimum 5 charactersers,A-Z,a-z,0-9,-_"/> <span class="form_hint">Allowed: Minimum 5 charactersers,A-Z,a-z,0-9,-_</span> </li> <li> <label>Email : </label> <input type="text" name="email" value="<?php echo $email;?>" required title="Format: name@domain.com"/> <span class="form_hint">Format: "name@domain.com"</span> </li> <li> <label>Password : </label> <input type="password" pattern=".{5,}" name="password" value="<?php echo $password;?>" required title="Minimum 5 characters"/> <span class="form_hint">Minimum 5 characters</span> </li> <li> <label>Re-Type Password : </label> <input type="password" pattern=".{5,}" name="confirm_password" value="<?php echo $confirm_password;?>" required title="Minimum 5 characters"/> <span class="form_hint">Minimum 5 characters</span> </li> <li> <button class="submit" type="submit" name="submit" >Register</button> </li> </ul> </form> </div> </body> </html>
  3. You didn't copy paste it. Mine had: <form method="post" action="" > You linked back to your other code <form method="post" action="hw3.php" > Do this with a .php extension as well and not .html, if you put all the code at hw3.php will work.
  4. My code did not match your form names and was an example. Before using any variables they must exist. Your function is looking for $textcolor and $bgcolor which doesn't exist in your code except inside the function. Then you never called on the function. You were way off, take a look at what this does, you need to learn why and how or this homework is useless. <?php //define variables $textcolor = "black"; $bgcolor = "white"; //check if form submitted if (isset($_POST['submit'])) { //if below statements are true will overwrite the variable //check if textcolor is set if (isset($_POST['textcolor'])) { $textcolor = $_POST['textcolor']; } //check if bgcolor is set if (isset($_POST['bgcolor'])) { $bgcolor = $_POST['bgcolor']; } } ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Homework 3</title> <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css"> <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css"> <link rel="stylesheet" href="css/ui.totop.css"> <link rel="stylesheet" href="css/style.css"> <style type='text/css'> body { color: <?php echo $textcolor;?>; background-color: <?php echo $bgcolor;?>; } </style> </head> <body> <div class="container"> <form method="post" action="" > <h2>Conditional Statements - Homework 3</h2> <p> Please choose a color for the text</p> <select name="textcolor"> <option value="black">Black</option> <option value="white">White</option> <option value="red">Red</option> <option value="green">Green</option> <option value="blue">Blue</option> <option value="orange">Orange</option> <option value="yellow">Yellow</option> </select> <br> <br> <p> Please choose a color for the background</p> <input type="radio" name="bgcolor" value="black" />Black<br /> <input type="radio" name="bgcolor" value="white" />White<br /> <input type="radio" name="bgcolor" value="red" />Red<br /> <input type="radio" name="bgcolor" value="green" />Green<br /> <input type="radio" name="bgcolor" value="blue" />Blue<br /> <input type="radio" name="bgcolor" value="orange" />Orange<br /> <input type="radio" name="bgcolor" value="yellow" />Yellow<br /> <p><input type="submit" name="submit" value="Submit"></p> </form> <p>The text color is <?php echo $textcolor;?></p> <p>The background color is <?php echo $bgcolor;?></p> </div> </body> </html>
  5. You don't show any other code, but can do something like this using the $_POST value or a default color if not set <?php if(isset($_POST['background']) && trim($_POST['background']) !=''){ $background = $_POST['background']; } else { $background = "#FFFFFF"; } ?> <style type='text/css'> body { background-color: <?php echo $background;?>; } </style>
  6. Do within the while loop. <?php include("dbinfo.inc.php"); $query = "SELECT * FROM boc"; $result = mysqli_query($con, $query); /* fetch associative array */ while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { //Assign variables $post_id = $row['post_id']; $date = $row['date']; $type = $row['type']; $title = $row['title']; $content = $row['content']; echo "$date - <a href='viewnotice.php?id=".$post_id."'>".$title."</a><br />"; } /* free result set */ mysqli_free_result($result); mysqli_close($con); ?>
  7. Depends if your application is going to require an always online connection or work offline just within that device. Could even make one that does local data storage when offline and syncs when is online. Platform Software: As you can imagine if doing only offline will be a lot more coding work for each specific device if are not using a cross-platform software. If that seems like a lot of work to you...imagine also maintaining that code in the future for all devices. Frameworks come and go, sdk's change, new operating systems or even updates, you may want to modify your application. Multiply all that work for every device you want to support, yeah becomes a nightmare depending how complex your application is. Most sdk's are either java or some renamed javascript based framework. I'm the type of person that sticks to the popular and should be around a while more, with that said some good choices are to do it with C,C++,QT,GTK,Python Let's say your application requires an online connection, is something using web based data and otherwise is a useless application. Now instead of the device software doing the grunt work and requiring more coding, can have a remote server with an api that does client -> server, processing/data manipulation -> client. In your application could simplify the coding by making a gui a client can interact with, connect to api, use the server data however your application intends to, display to client. API: I am going to write this and link to some items so even a beginner knows what I am talking about. REST : Representational state transfer (my simple definition) Uses url or uri over http web The data set to be retrieved could use the url,uri or any query parameter and or their values to access a particular data set. Can use GET, PUT, POST, or DELETE http methods Do local server actions with them or send out a response to a client or server. You can literally return any type of response you want, some popular ones used in api's would be json,xml and html The format of the response can also be determined by a url parameter in the query, such as format=json,format=xml,format=html XML-RPC : (very old) remote procedure call using xml to encode and http transport SOAP : (very basic summary) soap evolved from xml-rpc xml based Has an envelope for defining the message structure and how to process it. Encoding rules to determine each instance of application data types. A method to handle procedure calls and responses. Uses HTTP, SMTP, TCP, UDP, and JMS transport protocols. Here is my opinion, others may have different preferences or advice, that could be their opinion. If application is web based, the current and future of the internet is a server with optional cloud based storage using an API incorporating CRUD (SCRUD,CRUDL,BREAD,DRULAB) using REST and JSON data using a request-response over http. If you want to use different methods other than mentioned above that's your choice to do so. API response types could be html,json,xml or solely json and the api or (*)-application can use that data or easily convert it to whatever you need, even your website using the same api internally or externally across a network. Nearly everything can work using json. Through the api you can use various header fields To me just using json or a single data type has an advantage, you know is just one type of data in your applications. Also is useful when comes to caching. You can have a public or private api. Items such as user log in, public and private keys, tokens, domain restrictions, paid subscriptions, access restriction. A lot of people use oauth, I make my own. There would be a programming language (list) at the server for processing. Data storage: Your application may not require any data storage, does some processing in the application or at the server and returns live results. Could use a database at server or in the application Application based storage, locally stored in the operating system a database such as sqlite or flat files Browser based storage using sessions, cookies, local storage With sessions the client does not have the ability to change the data. Using sessions forces the client to log in each time because they get lost expire times and garbage collection. It's possible to use a combination of sessions and cookies to keep that user logged in longer, although I would lean towards creating an access token instead. Cookies were useful a while, many people are blocking them now. Depending what country are in such as the UK, you are in have to supply a warning are saving their cookies and they accept it. There are cookies and also html5 has web storage localStorage http://www.w3.org/TR...orage-attribute localStorage can store 5 mb versus cookies having a limit of 4095 bytes per cookie Cookies are primarily to be read server-side while localStorage is meant as client-side only If localStorage is saved from a secured ssl such as https it doesn't work for non https If your server needs to read from localStorage and is lots of data it's not worth sending the data back with javascript/ajax in the HTTP header or like in hidden forms localStorage has no expiration date, it only gets removed via javascript, clearing browser cache or the browser is closed. There is also sessionStorage http://www.w3.org/TR...orage-attribute When a new HTMLDocument is created, the user agent must check to see if the document's top-level browsing context has allocated a session storage area for that document's origin. If it has not, a new storage area for that document's origin must be created. localStorage persists over different tabs or windows, and even if we close the browser, accordingly with the domain security policy and user choices about quota limit. Leaving the tab or page were on sessionStorage is gone while localStorage can remain. Cookies, localStorage and sessionStorage can easily be read or changed from within the client/browser and should not be used for storage of secure data. There is attempts modern browsers to prevent Cross-Site Scripting (XSS)/Script injection by setting an HTTP only flag... but I wouldn't rely on it. If you are not using SSL, cookie information can also be intercepted in transit, especially on an open wifi. If you want to save a pile of information and is just for the clients purposes, localStorage is the best way. If is some sort of temporary data just for a user that page then sessionStorage If the data is to be used for your own server then normal cookies is a better way to go. Summing it all up...it's better to use sessions unless is not important data.
  8. Nicedad, You can post your project need done the following link. http://forums.phpfreaks.com/forum/77-job-offerings/
  9. Not quite sure why your Y/N not working... Do as hansford suggested and echo $row['active'] in your while loop to see what it is md5 is not secure to use and should look into password_hash() and password_verify() instead Also why are you adding a Limit 1 to the update statement? mysqli_query($db_connect, "UPDATE `users` SET `active` = 'Y' WHERE `email` = '".$email."' LIMIT 1"); If you would so happen to have more than one of the same email should also be doing an additional check, I personally use autoincrement id's or make a unique constraint on emails only allowing one in the entire database. mysqli_query($db_connect, "UPDATE `users` SET `active` = 'Y' WHERE `email` = '".$email."' AND `uname` = '".$row['uname']."'"); Don't see the need for an if else check I also like checking positively if ($row['active'] == 'Y') { // Account is active $_SESSION['uname'] = $_POST['uname']; header("Location: /profile"); exit; } else { // Account is not active echo "<p>Your account has not been activated! Please check your email inbox.</p><br />"; }
  10. Also don't supress the errors with an @, if do not want to see them turn off error reporting and log them a live site. During development the error reporting really helps though.
  11. http://php.net/manual/en/mysqli-result.fetch-array.php
  12. Since you say free, how about netbeans and enable git. There is also the database explorer module for it.
  13. The most important language a programmer needs to learn is English.

  14. On second thought...forget I even mentioned this and please tackle the multiple posting issue.
  15. You are using 2 different database functions, need to use one type. mysqli_ or pdo is what should be using stop using any mysql_ related finctions Can see some examples here
  16. I was wondering if was possible to add the ability to enter more than one website in your own profile area. I know can do a signature with a few for the posts, I removed them because of mass spam and looked like I was peddling my services...which am not.
  17. Sorry I missed a few items on userpage.php if ($_SERVER['HTTP_HOST'] != "dynainternet.com") { include('db-con.php'); $this_user = str_replace(".dynainternet.com", "", $_SERVER['HTTP_HOST']); $user_sql = "SELECT * FROM users WHERE username = '" . mysqli_real_escape_string($con, $this_user) . "'"; if ($result = $con->query($user_sql)) { if (mysqli_num_rows($result) >= 1) { while ($row = $result->fetch_assoc()) { $username = trim($row['username']); echo "<a href='http://" . $_SERVER['HTTP_HOST'] . "'>" . $username . "</a><br />"; } //load site if available $site_directory = $directory_path . "/sites/"; $site_path = $site_directory . $this_user . "/index.php"; if (is_dir($site_directory) && is_readable($site_directory)) { if (is_file($site_path) && is_readable($site_path)) { require_once($site_path); } else { echo "No custom site folder, fetch some dynamic data for this user"; } } else { echo "Directory doesn't exist"; } //end load site } else { echo "No user named " . $this_user . " exists."; } } else { echo "Sorry, Database issue."; } } else { echo "Display error or redirect"; }
  18. Well having many different html files is not a good start. Is hard to give you some perfect advice on what you have besides saying you need to make rewrite rules in htaccess or apache itself. To make what you want easier... Should have more of a dynamic site such as an index.php file and loading different data depending on the GET parameters. After that could do rewrite rules in htaccess or apache itself. Such as removing GET keys and or values and formatted pretty. Then can include the directory/file or any dynamic data you are doing. You could even do these as subdomains such as johnsmith.realeastesales.com which could also be the same as realeastesales.com/johnsmith or even realeastesales.com/agents/johnsmith Bear with me as I try to show an example of how I do it. Add a new a record through your domain registrar with * and the ip Some make a new serveralias in apache under the main virtual host with the servers ip change this: ServerAlias www.yourdomain.com to: ServerAlias *.yourdomain.com I do my site by making a simple index file in the root folder. That index file includes some other scripts needed across entire domain. One thing it includes is a controller script that examines the GET array and will include different scripts using a switch and ensuring file exists with permissions. Mind you this is my custom cms and in progress, did not even make them pretty urls yet. http://dynainternet.com/?action=services Through my controller, If the action is set and is in my whitelist I include in this case....services.php controller.php //whitelist to only allow these GET paramters to pass in code $allowed_get = array( "search", "action", "user", "id", "page", "preview", "q", "contact" ); //loop get requests and remove any unwanted ones if (isset($_GET)) { foreach ($_GET as $key => $value) { if (!in_array($key, $allowed_get)) { unset($_GET[$key]); } } } //default page displayed if all else fails $page = "home.php"; /* loop through action array to determine destination $action_array located in actions.php, if action value is not in the array it won't load */ if (isset($_REQUEST['action'])) { if (in_array($_REQUEST['action'], $action_array)) { switch ($_REQUEST['action']) { case "home": //$page = "home.php"; header("Location: ".$server_host); exit; break; case "services": $page = "articles.php"; break; case "articles": $page = "articles.php"; break; case "help": $page = "articles.php"; break; case "help_post": $page = "help_post.php"; break; case "register": $page = "register.php"; break; case "account": $page = "account.php"; break; case "support": $page = "support.php"; break; case "users": $page = "users.php"; break; case "search": $page = "search.php"; break; case "preview": $page = "search.php"; break; case "contact": $page = "contact.php"; break; default: //$page = "home.php"; header("Location: ".$server_host); exit; } } } //include the page only if it exists $script = dirname(__FILE__) . DIRECTORY_SEPARATOR . $page; if (file_exists($script)) { require_once($script); } else { header("Location: ".$server_host); exit; } I have wildcard subdomains set up and rewrite rules. If the server host name is a subdomain and that user exists, could show just their content, This could be through a users folder using their subdomain/name or including the same template as I did here to return just that users data or site within. http://quick.dynainternet.com/ This actual url is http://*.dynainternet.com/userpage.php the * can be anything and is a wildcard. I have in my index.php file an if statement to load different content. You could do this any subdomain directly but I happen to want this just as a content area for my needs. $directory_path = dirname(__FILE__) . DIRECTORY_SEPARATOR; if($_SERVER['HTTP_HOST'] != "dynainternet.com"){ require_once($directory_path . "/userpage.php"); }else{ require_once($directory_path . "/controller.php"); } I have rules to go to exact subdomains for other purposes as well. This is my http://api.dynainternet.com/ which would be denied access for without the parameters and a public key Subdomain is a folder in my root directory named api In my /etc/apache2/apache2.conf file I added virtual host rules for it <VirtualHost *:80> ServerName api.dynainternet.com DocumentRoot /var/www/api <Directory /var/www/api> Options +Indexes allow from all </Directory> </VirtualHost> Could also do domain mapping such as this. <VirtualHost *:80> ServerName videowebcast.me DocumentRoot /var/www/videowebcast <Directory /var/www/videowebcast> Options +Indexes </Directory> </VirtualHost> Another subdomain I have is called service which is also a folder, that I did through htaccess. ErrorDocument 404 / AddDefaultCharset UTF-8 RewriteEngine On RewriteBase / RewriteCond %{HTTPS}s on(s)| RewriteCond %{HTTP_HOST} ^www\.(.+)$ RewriteRule ^ http%2://%1%{REQUEST_URI} [R=301,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)/$ /$1 [L,R=301] RewriteCond %{HTTP_HOST} !^www\. RewriteCond %{HTTP_HOST} service\.dynainternet\.com RewriteCond $1 !^service RewriteRule (.*) /service/$1 [L] Now to get back to showing how to load specific folders per agent/user. userpage.php include('db-con.php'); $user_sql = "SELECT * FROM users WHERE username = '" . mysqli_real_escape_string($con, $this_user) . "'"; if ($result = $con->query($user_sql)) { if (mysqli_num_rows($result) >= 1) { while ($row = $result->fetch_assoc()) { $username = trim($row['username']); echo "<a href='http://" . $_SERVER['HTTP_HOST'] . "'>" . $username . "</a><br />"; } //load site if available $site_directory = $directory_path . "/sites/"; $site_path = $site_directory . $this_user . "/index.php"; if (is_dir($site_directory) && is_readable($site_directory)) { if (is_file($site_path) && is_readable($site_path)) { require_once($site_path); } else { echo "No custom site folder, fetch some dynamic data for this user"; } } else { echo "Directory doesn't exist"; } //end load site } else { echo "No user named " . $this_user . " exists."; } } else { echo "Sorry, Database issue."; } } Here is 3 different results using the above. http://demo.dynainternet.com/ http://quick.dynainternet.com/ http://blahblah.dynainternet.com/ Now you can take the same idea as above and use header redirects or loading specific folders or agents.
  19. Looks like you need to enable some modules and acquire some needed dll's
  20. Possible an .htaccess file in root or the roundcube directory overwriting it?
  21. I you have permission to scrape the contents of this site, the owner of that site can supply you a better means to get the data as in a feed or api. Otherwise....nope.
  22. mysql_* functions are deprecated, use pdo or mysqli The code on that page converted to html entities Go through all the codes and replace any html entities ( &characters; ) to their proper characters http://dev.w3.org/html5/html-author/charref This line: if(mysql_num_rows( $query)>0) { should have been: if(mysql_num_rows($query) > 0) { $response='NEW:1' is what that person is saving the response as. ereg_replace() to preg_replace() conversion is a matter of adding a delimeter and also escape anything required with a backslash \ http://php.net/manual/en/reference.pcre.pattern.posix.php Some alternatives: added i for a pattern modifier for case insensitive because POSIX regex was case-insensitive and a + for multiples $output = preg_replace("/[ \t\n\r]+/i","",$input)."\0"; $output = preg_replace("~[\s\t\n\r]+~ i","",$input)."\0"; $output = preg_replace('/\s+/', '', trim($input))."\0"; $output = str_replace(array("\r\n","\r","\n","\t"," "),"",trim($input))."\0";
  23. No, I meant... If you are using post as the method in your form check for $_POST values. If you use get as the method in the form check for $_GET values.
  24. Try using a premade cms such as wordpress,joomla or drupal, then add a plugin/module that can do what you need. I doubt anyone will make this for you
  25. in your form: method="post" what you are looking for is $_GET, use the same method
×
×
  • 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.