Jump to content

Search the Community

Showing results for tags 'database'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. HI, first time making a website... would really appreciate help with any errors in my code. Thanks! <div id="site_content"> <div class="sidebar"> <!-- form to select what books would like to be viewed, i.e. what category? --> <h3>Search Our Library!</h3> <div class="form_style"> <form action='titleSearch.php' method='GET'> <center> <h1>Search Any Book Title: </h1> <input type='text' size='90' name='search'> <input type='submit' name='submit' value='Search' > </center> </form> <form action='catSearch.php' method='GET'> <center> <h1>Search Book Categories:</h1> <?php // make an sql query to show all of the book titles $titleSQL = "select class, description from l_classification order by class"; // connect to the database require_once('dbconnect.php'); // execute the query $rsTitle = mysql_query($titleSQL); echo "<select name=\"class\">\n"; echo "<option value=\"all\">Show all books</option>"; // loop through all of the book titles in the record set // while while($row = mysql_fetch_array($rsTitle)) { $class = $row['class']; $description = $row['description']; echo "\t<option value=\"$class\">$class : $description</option>\n"; } // each record i'll display as an option in the form // end loop ?> <input type='submit' name='submit' value='Search' ></br></br></br></center> </form> </select> </div> </body> </html>
  2. I have a simple user login where it inserts the user session into database like this (id, user_id, hash). It works fine. I can delete the session from the database when the user logs out. Now I realized something. When I close the browser window, it'll destroy the session(log out the user) as intended but it won't delete the session from the database. I was wondering if there is a way to do that?
  3. I need new pair of eyes to look at this and tell me what's wrong with it. All I am trying to do is have a simple form that submits data to database. It works without the "token". With the token code added, it won't let process. I even did var_dump and the session and the $_post code doesn't match. Here's the code. Btw, session_start() and the database connection are in the init.php file. <?php require_once 'init.php'; $token = mcrypt_create_iv(16, MCRYPT_DEV_URANDOM); $_SESSION['token'] = $token; if(isset($_POST['register'], $_POST['token'])) { if($_POST['token'] === $_SESSION['token']) { $email = trim($_POST['email']); $password = trim($_POST['password']); if(empty($email)) { $error = 'Email is required!'; } else if(empty($password)) { $error = 'Password is required!'; } else if(strlen($password) < 6) { $error = 'Password must be at least 6 characters long!'; } else { $findUser = $db->prepare("SELECT email FROM users WHERE email = :email"); $findUser->bindParam(':email', $email); $findUser->execute(); $resultFind = $findUser->fetchAll(PDO::FETCH_ASSOC); if(count($resultFind) > 0) { $error = 'The email already exists! Please try a different email!'; } else { //Hash the password as we do NOT want to store our passwords in plain text. $passwordHash = password_hash($passward, PASSWORD_BCRYPT, array("cost" => 12)); $insertUser = $db->prepare("INSERT INTO users(email, password) VALUES(:email, :password)"); $insertUser->bindParam(':email', $email); $insertUser->bindParam(':password', $passwordHash); $resultInsert = $insertUser->execute(); if($resultInsert == false) { $error = 'There was a problem creating your account. Please try again later!'; } else { $success = 'Your account has been created.'; unset($_SESSION['token']); } } } } else { $error = 'The tokens do not match!'; } } ?> <h1>Sign up</h1> <form action="" method="post"> <fieldset> <input type="email" name="email" value="<?php echo $email; ?>" placeholder="Email" /> </fieldset> <fieldset> <input type="password" name="password" placeholder="Password" /> </fieldset> <fieldset> <input type="hidden" name="token" value="<?php echo $token; ?>" /> <input type="submit" name="register" value="Sign up" /> </fieldset> </form>
  4. $results = mysql_query("$select", $link_id); while ($query_data = mysql_fetch_row($results)) { $link_id = mysqli_connect("$db_host","$db_user","$db_password","$db_database"); if ($mysqli->connect_errno) { echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; } $link_id = mysql_connect("$db_host","$db_user","$db_password"); if (mysql_select_db("$db_database", $link_id)); else { echo "connection failed."; } I am having to update MySQL to mysqli as my host is upgrading to PHP5.6 I have managed to convert and connect to the database converted to I cannot get the fetch results to work, can anyone help me convert the following code Many Thanks
  5. Is it possible to save history of all my tables from my other site and copy all those history into my new one? I have milions of posts at my site, but since im moving to other one which is a free host, i want to have all those history. I can easily copy main structure but i have like millions of posts and i want to keep them all.
  6. Someone should please help me with this, i created this login script for Admin and Customer login based on the type of radio button choosed. But i dont knwo what the error is, i always get wrong user name and password but if i register it submit to the database but to login with my details continue to give wrong username and password. I have even tried it on my easyphp server it work fine, but when i uploaded it to the website online, i keep on getting wrong username and passwpord. Please, brother, sisters, friends, senior and whoever can help me you kindly do it. You can send your correct script to me, my email is jimohwareez@gmail.com Below is the script: <?php $username=$_POST['UserName']; $password=$_POST['Password']; $usertype=$_POST['rdType']; if($usertype=="Admin") { $con = mysql_connect("localhost","sample_sample","sample"); mysql_select_db("sample_sample", $con); $sql = "select * from admin_master where txtusername='".$username."' and txtpassword='".$password."'"; $result = mysql_query($sql,$con); $records = mysql_num_rows($result); $row = mysql_fetch_array($result); if ($records==0) { echo '<script type="text/javascript">alert("Wrong UserName or Password");window.location=\'index.php\';</script>'; } else { header("location:blend_sample_details_highvertical/index.php"); } mysql_close($con); } else if($usertype=="Customer") { $con = mysql_connect("localhost","sample_sample","sample"); mysql_select_db("sample_sample", $con); $sql = "select * from customer_registration where UserName='".$username."' and Password='".$password."' "; $result = mysql_query($sql,$con); $records = mysql_num_rows($result); $row = mysql_fetch_array($result); if ($records==0) { echo '<script type="text/javascript">alert("Wrong Username or Password");window.location=\'signin.php\';</script>'; } else { $_SESSION['id']=$row['customerid']; $_SESSION['name']=$row['customername']; header("location:customer/index.php"); } } ?>
  7. 1. HTML FORM #for user to enter the data <html> <title>reg</title> <style type="text/css"> body { background-color: rgb(200,200,200); color: white; padding: 20px; font-family: Arial, Verdana, sans-serif;} h4 { background-color: DarkCyan; padding: inherit;} h3 { background-color: #ee3e80; padding: inherit;} p { background-color: white; color: rgb(100,100,90); padding: inherit;} </style> <form method="POST" action="login_back.php" enctype="multipart/form-data"></br> &nbsp<font color="DarkCyan"> Choose a user name:</font> <input type="text" name="username"> </br></br> &nbsp<font color="DarkCyan"> First name:</font> <input type="text" name="firstname"/> </br></br> &nbsp<font color="DarkCyan"> Last name:</font><input type="text" name="lastname"/> </br></br> &nbsp<font color="DarkCyan"> File: <input type="file" name="image"></font> </br></br> <input type="submit" value="Save and Proceed"> </form> </html> ---------- 2 STORING IN DATABASE #backend processing to store and retrieve data from db <?php #echo "<body style='background-color:rgb(200,200,200)'>"; session_start(); if( isset($_POST['username']) && isset($_FILES['image']) ) { $_SESSION['username']=$_POST['username']; $_SESSION['firstname']=$_POST['firstname']; $lastname=$_POST['lastname']; $file=$_FILES['image']['tmp_name']; $image_size=getimagesize($_FILES['image']['tmp_name']); if(!isset($file)) echo"please select an image"; else { $image_name=$_FILES['image']['name']; //grabing image name $image_size=getimagesize($_FILES['image']['tmp_name']); //getting image size } echo "</br>"; #connection to db mysql_connect("localhost","root","")or die(mysql_error()); mysql_select_db("wordgraphic")or die(mysql_error()); #checking the available username $query = mysql_query("SELECT * FROM userdata WHERE username = '" . $_SESSION['username'] . "'" ); $ans=mysql_num_rows($query); if ($ans > 0) { echo "Username already in use please try another."; } else if($image_size==FALSE) { echo"That's not an image."; } else { #Insert data into mysql #1.Inserting user name & image into db $sql="INSERT INTO userdata(username, firstname, lastname, image)VALUES('" . $_SESSION['username'] . "', '" . $_SESSION['firstname'] . "', '$lastname','$image')"; $result1=mysql_query($sql); if($result1) { echo "</br>"; echo "Registration successful"; echo "</br>"; //displaying image $lastid=mysql_insert_id();//get the id of the last record echo "uploaded image is :"; echo "<img src='get.php?id=".$lastid."'>"; > this command has some mistake }#if insertion into db successful else { echo "Problem in database operation"; } }# else block of unique username n img }#end of isset ?> ---------- 3. GET.PHP #additional file that retrieve image from database <?php #connection to db mysql_connect("localhost","root","")or die(mysql_error()); mysql_select_db("wordgraphic")or die(mysql_error()); if(isset($_REQUEST['id']) ) > this block of code is not runninng { $mid=(int)($_REQUEST['id']); $image=mysql_query("SELECT * FROM userdata WHERE id=$mid") or die("Invalid query: " . mysql_error()); $image=mysql_fetch_assoc($image); $image=$image['image']; header("Content-type: image/jpeg"); echo $image; } else { echo"error"; } ?>
  8. 1. HTML FORM #for user to enter the data <html> <title>reg</title> <style type="text/css"> body { background-color: rgb(200,200,200); color: white; padding: 20px; font-family: Arial, Verdana, sans-serif;} h4 { background-color: DarkCyan; padding: inherit;} h3 { background-color: #ee3e80; padding: inherit;} p { background-color: white; color: rgb(100,100,90); padding: inherit;} </style> <form method="POST" action="login_back.php" enctype="multipart/form-data"></br> &nbsp<font color="DarkCyan"> Choose a user name:</font> <input type="text" name="username"> </br></br> &nbsp<font color="DarkCyan"> First name:</font> <input type="text" name="firstname"/> </br></br> &nbsp<font color="DarkCyan"> Last name:</font><input type="text" name="lastname"/> </br></br> &nbsp<font color="DarkCyan"> File: <input type="file" name="image"></font> </br></br> <input type="submit" value="Save and Proceed"> </form> </html> ---------- 2 STORING IN DATABASE #backend processing to store and retrieve data from db <?php error_reporting(0); #echo "<body style='background-color:rgb(200,200,200)'>"; session_start(); #if( isset($_POST['username']) && isset($_FILES['image']) ) #{ $_SESSION['username']=$_POST['username']; $_SESSION['firstname']=$_POST['firstname']; $lastname=$_POST['lastname']; $file=$_FILES['image']['tmp_name']; $image_size=getimagesize($_FILES['image']['tmp_name']); if(!isset($file)) echo"please select an image"; else { #$image=$_FILES['image']['tmp_image']; //grabing the file content $image_name=$_FILES['image']['name']; //grabing image name $image_size=getimagesize($_FILES['image']['tmp_name']); //getting image size } echo "</br>"; #connection to db mysql_connect("localhost","root","")or die(mysql_error()); mysql_select_db("wordgraphic")or die(mysql_error()); #checking the available username $query = mysql_query("SELECT * FROM userdata WHERE username = '" . $_SESSION['username'] . "'" ); $ans=mysql_num_rows($query); if ($ans > 0) { echo "Username already in use please try another."; } else if($image_size==FALSE) { echo"That's not an image."; } else { #Insert data into mysql #1.Inserting user name & image into db $sql="INSERT INTO userdata(username, firstname, lastname, image)VALUES('" . $_SESSION['username'] . "', '" . $_SESSION['firstname'] . "', '$lastname','$image')"; $result1=mysql_query($sql); if($result1) { echo "</br>"; echo "Registration successful"; echo "</br>"; //displaying image $lastid=mysql_insert_id();//get the id of the last record echo "uploaded image is :"; echo "<img src='get.php?id=".$lastid."'>"; > this command has some mistake }#if insertion into db successful else { echo "Problem in database operation"; } }# else block of unique username n img }#end of isset ?> ---------- 3. GET.PHP #additional file that retrieve image from database <?php #connection to db mysql_connect("localhost","root","")or die(mysql_error()); mysql_select_db("wordgraphic")or die(mysql_error()); if(isset($_REQUEST['id']) ) > this block of code is not running { $mid=(int)($_REQUEST['id']); $image=mysql_query("SELECT * FROM userdata WHERE id=$mid") or die("Invalid query: " . mysql_error()); $image=mysql_fetch_assoc($image); $image=$image['image']; header("Content-type: image/jpeg"); echo $image; } else echo"error"; ?>
  9. Hi dear php coders! ]'m almost new in php and now i'm dealing with wordpress . ] want to get a long string from database with get_post_meta function. (and aftar that i wanna Parse this string and Play with that ...! ) how can i do that ?? i don't know what arguments i must pass to the function ... any help would be appreciated. thanks in advance.
  10. Hello guys. I got a problem that whenever you register on my page, the registration is successful, no errors, successful redirection to login page, but the registration does not write the information into database and I have no idea why... I'm sure that i'm connecting correctly, to the correct table, with the correct commands, but it kinda does not work... BTW (This registration and login and all worked a few weeks ago, but I got an sudden internal server error, so I had to delete and reupload all files, and I had to change database. I changed the database, created the same table with the same columns, also I overwrote ALL old database information to the new (password, dbname,name) and, so page works fine, but that registration does not...I'm including my code for registration and registration form) Registration process CODE: <?php include_once 'db_connect.php'; include_once 'psl-config.php'; $error_msg = ""; if (isset($_POST['username'], $_POST['email'], $_POST['p'])) { // Sanitize and validate the data passed in $username = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_STRING); $email = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL); $email = filter_var($email, FILTER_VALIDATE_EMAIL); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { // Not a valid email $error_msg .= '<p class="error">The email address you entered is not valid</p>'; } $password = filter_input(INPUT_POST, 'p', FILTER_SANITIZE_STRING); // Username validity and password validity have been checked client side. // This should should be adequate as nobody gains any advantage from // breaking these rules. // $prep_stmt = "SELECT id FROM members WHERE email = ? LIMIT 1"; $stmt = $mysqli->prepare($prep_stmt); // check existing email if ($stmt) { $stmt->bind_param('s', $email); $stmt->execute(); $stmt->store_result(); if ($stmt->num_rows == 1) { $error_msg .= '<p class="error">A user with this email address already exists.</p>'; } $stmt->close(); } // check existing username $prep_stmt = "SELECT id FROM members WHERE username = ? LIMIT 1"; $stmt = $mysqli->prepare($prep_stmt); if ($stmt) { $stmt->bind_param('s', $username); $stmt->execute(); $stmt->store_result(); if ($stmt->num_rows == 1) { $error_msg .= '<p class="error">A user with this username already exists.</p>'; } $stmt->close(); } // TODO: // We'll also have to account for the situation where the user doesn't have // rights to do registration, by checking what type of user is attempting to // perform the operation. if (empty($error_msg)) { // Create salted password $passwordHash = password_hash($password, PASSWORD_BCRYPT); // Insert the new user into the database if ($insert_stmt = $mysqli->prepare("INSERT INTO members (username, email, password) VALUES (?, ?, ?)")) { $insert_stmt->bind_param('sss', $username, $email, $passwordHash); // Execute the prepared query. if (! $insert_stmt->execute()) { header('Location: ../error.php?err=Registration failure: INSERT'); } } header('Location: ./continue.php'); } } and Registration form : <div class="register-form"> <center><h2>Registration</h2></center> <form action="<?php echo esc_url($_SERVER['PHP_SELF']); ?>" method="post" name="registration_form"> <center><p></p><input type='text' name='username' placeholder="Username" id='username' /><br></center> <center><p></p><input type="text" name="email" id="email" placeholder="Email" /><br></center> <center><p></p><input type="password" name="password" placeholder="Insert Password" id="password"/><br></center> <center><p></p><input type="password" name="confirmpwd" placeholder="Repeat Password" id="confirmpwd" /><br></center> <center><p></p><input type="submit" class="button" value="Register" onclick="return regformhash(this.form, this.form.username, this.form.email, this.form.password, this.form.confirmpwd);" /> </center> </form> </div> Anybody know where is problem?
  11. help me, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''%jateng%' WHERE (`kabupaten` LIKE '%demak%') OR (`kecamatan` LIKE ' at line 1" <?php $query = $_GET['query']; $select = $_GET['select']; // gets value sent over search form $min_length = 3; // you can set minimum length of the query if you want if(strlen($query) >= $min_length){ // if query length is more or equal minimum length then $query = htmlspecialchars($query); // changes characters used in html to their equivalents, for example: < to > $query = mysql_real_escape_string($query); // makes sure nobody uses SQL injection $raw_results = mysql_query("SELECT * FROM '%".$select."%' WHERE (`kabupaten` LIKE '%".$query."%') OR (`kecamatan` LIKE '%".$query."%')") or die(mysql_error()); // * means that it selects all fields, you can also write: `id`, `title`, `text` // articles is the name of our table // '%$query%' is what we're looking for, % means anything, for example if $query is Hello // it will match "hello", "Hello man", "gogohello", if you want exact match use `title`='$query' // or if you want to match just full word so "gogohello" is out use '% $query %' ...OR ... '$query %' ... OR ... '% $query' if(mysql_num_rows($raw_results) > 0){ // if one or more rows are returned do following while($results = mysql_fetch_array($raw_results)){ // $results = mysql_fetch_array($raw_results) puts data from database into array, while it's valid it does the loop echo "<tr><td>".$results['provinsi']."</td>" ."<td>".$results['kabupaten']."</td>" ."<td>".$results['kecamatan']."</td>" ."<td>".$results['desa']."</td>" ."<td>".$results['kodepos']."</tr>"; // posts results gotten from database(title and text) you can also show id ($results['id']) } } else{ // if there is no matching rows do following echo "No results"; } } else{ // if query length is less than minimum echo "Minimum length is ".$min_length; } ?>
  12. Hello guys! I really really really hope anyone can help me because I am quite desperate about a little project I'm making. I want to construct a sort of online catalog for books with a "shoppingcart" and a profile for every user, but object orientated. I have a database with the table products which contains: ID, title, author, genre, price etc etc etc My main question is: How can I get one single field from the database with e.g. a function called getPrice(); I tried everything but nothing displays the data the way i want to. I simply want to have a sql-statement in this function and when I am calling the function getPrice() later on it displays just the number and no Array, code or whatever. Is there a way to call getPrice() and get "20.00" back? Please Help!
  13. So i was looking around and found that the contacts book (address book for Outlook) has the potential to store allot of data, and i mean more then what anyone would properly put in. Here is the list (100 Columns): Full_Name, Title, First_Name, Middle_Name, Surname, Initals, Suffix, Job_Title, Department, Organization, Email, Street_Address, City, State/Province/County, Postal_Code, Country, Telephone, Home_Tel., Fax, Other_Fax, Other_Email, Mobile, Pager, Info, Home_Post_Address, Home_Street_Address, Postal_Address, SMR_Address, Web_Site, Business_Street_2, Business_Street_3, Home_Street_2, Home_Street_3, Home_City, Home_State, Home_Postal_Code, Home_Country, Other_Street, Other_Street_2, Other_Street_3, Other_City, Other_State, Other_Postal_Code, Other_Country, Assistant's_Phone, Business_Fax, Business_Phone_2, Callback, Car_Phone, Company_Main_Phone, Home_Fax, Home_Phone_2, ISDN, Other_Phone, Primary_Phone, Radio_Phone, Telex, Account, Anniversary, Assistant's_Name_, Billing_Information, Birthday, Business_Address_PO_Box, Categories, Children, Company_Yomi, Directory_Server, E-mail_Type, E-mail_Display_Name, E-mail_2_Address, E-mail_2_Type, E-mail_Display_Name, E-mail_3_Address, E-mail_3_Type, E-mail_3_Display_Name, Gender, Government_ID_Number, Hobby, Home_Address_PO_Box, Internet_Free_Busy, Keywords, Language, Location, Manager's_Name, Mileage, Office_Location, Organizational_ID_Number, Other_Address_PO_Box, Prioity, Private, Profession, Referred_By, Sensitivity, Spouse, Surname_Yomi, User_1, User_2, User_3, User_4, Nickname I particularly like: Government_ID_Number (this could be handy) Language (I don't think that most of us would be Multi-Lingal) Mileage (Because i like the car and i want to by it at 300,000 KM) So what would you want to put in your database?
  14. Hello all, I need some help with my database. So far I have made a program that collects information from a mysql database and I can edit the information and all. Anyways, I use that program to keep track of my job orders but as it stands now I have to enter it all myself. Is there a way that I can have paypal or a php enter the clients name, email, order ID (dont even know how to do this in paypal), and what product he bought in a table on my database? Ill provide screenshots of my program and also database table. Dont know if it will help but it might a bit. By the way, I dont have a clue about php.
  15. Hi, I have a question is this situation possible below? sample database table Information ID, Username,Password,level 1 user1 Pass1 1 2 user2 Pass2 2 I want a php code i which when I login my username and password it will check 3 fields in the table, the username and password if it matches from the database and the it will check what level is the user. So if ever username and password is correct it will check if what level is the user, so if the users level is 1 it will go to level1.php page and if 2 it will go to level2.php Hope you can help me with this problem of mine.
  16. Hallo everyone... here is my following code. i am fetching the picture from the file but unable to fetch it. kindly help me. error in bold underline... Thanks <!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> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <?php session_start(); $uid=''; include("connection.php"); $query=mysql_query("SELECT * FROM users WHERE uid='".$_GET['uid']."'"); $row=mysql_fetch_array($query); $image=$row['images_path']; ?> <form action="edit.php" method="post"> <table border="1px" align="center" width="85%"> <tr> <td colspan="3"><?php include'header.php' ?></td> </tr> <input type="hidden" name="uid" value="<?=$_GET['uid'];?>" /> <tr> <td colspan="3">Welcome <?php echo $_GET['uid']; ?> </td> </tr> <tr height="30px;"> <td width="37%" style="padding-left:250PX;">User Name</td> <td width="63%"> <input type="text" name="uname" value="<?php echo $row['uname']?>" /></td> </tr> <tr height="30px;"> <td width="37%" style="padding-left:250PX;">User Email</td> <td width="63%"> <input type="text" name="email" value="<?php echo $row['email'];?>" /></td> </tr> <tr height="30px;"> <td width="37%" style="padding-left:250PX;">Mobile</td> <td width="63%"> <input type="text" name="mob" value="<?php echo $row['mob'];?>" /></td> </tr> <tr height="30px;"> <td width="37%" style="padding-left:250PX;">Type</td> <td width="63%"> <input type="text" name="type" value="<?php echo $row['type'];?>" /></td> </tr> <tr height="30px;"> <td width="37%" style="padding-left:250PX;">Status</td> <td width="63%"> <input type="text"name="status" value="<?php echo $row['status'];?>" /></td> </tr> <tr height="30px;"> <td width="37%" style="padding-left:250PX;">Picture</td> <td><?php echo "<img border=\"0\" src=\"".$row['images_path']."\" width=\"102\" alt=\"your name\" height=\"91\">"; ?></td> </tr> </tr> <tr height="50px;"> <td colspan="3" style="padding-left:350px;"><input type="submit" name="submit" /> <input type="reset" value="Clear" /></td> </tr> <tr> <td colspan="3"><?php include'footer.php' ?></td> </tr> </table> <div align="left"><a href="home_users.php">Home</a></div> </form> </body> </html> ------------------ Thanks in advance
  17. Hello guys, I do not know if anyone work or have worked with the "elFinder (file manager)" .. I incorporate "elFinder" to my platform .. I have the following question .. Have its connector: <?php error_reporting(0); // Set E_ALL for debuging include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderConnector.class.php'; include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinder.class.php'; include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeDriver.class.php'; include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeLocalFileSystem.class.php'; // Required for MySQL storage connector include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeMySQL.class.php'; // Required for FTP connector support include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeFTP.class.php'; /** * Simple function to demonstrate how to control file access using "accessControl" callback. * This method will disable accessing files/folders starting from '.' (dot) * * @param string $attr attribute name (read|write|locked|hidden) * @param string $path file path relative to volume root directory started with directory separator * @return bool|null **/ function access($attr, $path, $data, $volume) { return strpos(basename($path), '.') === 0 // if file/folder begins with '.' (dot) ? !($attr == 'read' || $attr == 'write') // set read+write to false, other (locked+hidden) set to true : null; // else elFinder decide it itself } $opts = array( // 'debug' => true, 'roots' => array( array( 'driver' => 'LocalFileSystem', // driver for accessing file system (REQUIRED) 'path' => '/home/', // path to files (REQUIRED) 'URL' => dirname($_SERVER['PHP_SELF']) . '/home/', // URL to files (REQUIRED) 'accessControl' => 'access' // disable and hide dot starting files (OPTIONAL) ) ) ); // run elFinder $connector = new elFinderConnector(new elFinder($opts)); $connector->run(); I want him to make the call the "$screen" (folder will be created automatically by the user) of each user .. and not the "/home/" (as an example of put) .. the "$screen" comes from my platform, and I add the "elFinder" to it .. Imagine that each user creates "1/2/3 or 4, etc .." folders .. The user then enters the "elFinder" and see the folder created "1/2/3 or 4" (created on the left side of the folders ) and want only see your folders him. My Example.. It gives me error when I try to use these functions .. I use these functions for the "$screen" .. Of course, that I try connect only the folder .. but the result was 0 .. //za screen imeto function clean($string) { $string = str_replace(' ', '-', $string); // Replaces all spaces with hyphens. $string = preg_replace('/[^A-Za-z0-9\-]/', '', $string); // Removes special chars. return preg_replace('/-+/', '-', $string); // Replaces multiple hyphens with single one. } //end $srvname = mysql_real_escape_string(trim($_POST['servername'])); //ime na servera $port = (int)$_POST['ports']; //port na servera $ip = mysql_real_escape_string(trim($_POST['serverip'])); //serverip $screen = clean($srvname).$port.'_'.uniqid(); //screen imeto $dir = "/home/"; $opts = array( // 'debug' => true, 'roots' => array( array( 'driver' => 'LocalFileSystem', // driver for accessing file system (REQUIRED) 'path' => '$dir/$screen', // path to files (REQUIRED) 'URL' => dirname($_SERVER['PHP_SELF']) . '$dir/$screen', // URL to files (REQUIRED) 'accessControl' => 'access' // disable and hide dot starting files (OPTIONAL) ) ) ); This example of more folders.. $opts = array( 'roots' => array( array( 'driver' => 'LocalFileSystem', // driver for accessing file system (REQUIRED) 'path' => 'path/to/files/first_root', // path to files (REQUIRED) 'URL' => 'http://localhost/files/first_root/', // URL to files (REQUIRED) 'alias' => 'First home', // The name to replace your actual path name. (OPTIONAL) 'accessControl' => 'access' // disable and hide dot starting files (OPTIONAL) ), array( 'driver' => 'LocalFileSystem', 'path' => 'path/to/files/second_root', 'URL' => 'http://localhost/files/second_root/', 'alias' => 'Second home' ) ) ); But I need to be automatic, for each creation of user.. I use the variable "$screen" to create automatic folder of user.. but how to call the database of $screen ? the $screen exist only on my platform.. I don't know if you understand me.. Regards, Joob
  18. Im running a website about health and foods. I would like that at the end of each article, it shows other related articles that I have on my website. Im relatively new with php and mysql so I figure I have to put every page onto a database table. I looked already everywhere but all I found is how to do with wordpress. But i'm not using anything like that. I made the website myself with css and html and php. Can somebody help me with a website where they explain how to do? Also I would like that automatically it shows my latest articles in a sidebar. Without anytime adding myself manually. Can anybody help me?
  19. If you are using Vertabelo for creating database models and you access your database with Propel library, you'll find the following instructions useful. Vertabelo is an online, free tool for visual database design. Once you create a model of your database in Vertabelo, you can generate a Propel schema file from it. To do this you'll have to use VertabeloPropel, a PHP script which converts a Vertabelo XML file into Propel's schema.xml file. The script is available on GitHub. Installing VertabeloPropel uses Composer to manage project dependencies. In your project directory create a file composer.json: { "require": { "vertabelo/vertabelo-propel": "*" } } Then run Composer install. composer install This will download VertabeloPropel into the vendor directory in your project directory. The script will be in vendor/bin/vertabelo-propel.php file or, for Windows, in vendor\bin\vertabelo-propel.php.bat. Using VertabeloPropel script 1. Create a database model with Vertabelo. 2. Download the model as an XML file and save it in your project directory (use an option "Export model as XML file" from Vertabelo's tool bar). 3. Generate Propel's schema.xml file. If you want to use the default settings (input file model.xml, output file schema.xml, database name test, default id method native), run in Windows vendor\bin\vertabelo-propel.php.bat in Mac/Linux vendor/bin/vertabelo-propel.php If you want to change the defaults, run in Windows vendor\bin\vertabelo-propel.php.bat -i model.xml -o schema.xml / --database-name bookshop ---default-id-method native in Mac/Linux vendor/bin/vertabelo-propel.php -i model.xml -o schema.xml --database-name bookshop --default-id-method native 4. The script generates Propel's schema.xml file. 5. Proceed with your normal Propel application development (or see "How to develop a PHP+MySQL application with Propel and Vertabelo"). Script options The script options are: --input-file (shortcut -i) location of Vertabelo XML file (default value "model.xml") --output-file (shortcut -o) location of output Propel schema.xml file (default value "schema.xml") --database-name name of the database (default value "test") --default-id-method database's defaultIdMethod. Allowed values are “native” or “none”, default value is "native". --help prints the help message --------------- The above information was originaly published on Vertabelo's blog.
  20. I am trying to connect to my database on xammp, Im trying to find info how to connect and set up for people that sign in to my website they can regsiter for it.
  21. Hello users: I am exploring the delightful world of PHP for web applications. I am in the stage where I need to use SESSIONS and COOKIES and MYSQL for a user/membership/profile structure. I understand most of the grammar behind PHP and am excited to apply this in application. I am searching for recommendations and comments about using: 1. COOKIES 2. SESSIONS 3. MYSQL/SQL Almost every website has an authentication mechanism, profile, and use information. My website required this similar structure, but I have been having some problems completing all of the technical steps for production. If anyone has code samples or places where I can review code on this topic, that would be wonderful. I am specifically searching for more advanced topics in these area for general robustness. Please kindly send me a message or respond to this post. Regards, Diamond
  22. Hello guys, I was just wondering in what way large scale systems can run sites like Weebley in terms of using multiple servers. Is it just MySQL database linking and using lots of same specification servers or is it all done via clustering etc. I'm pretty new to this and we are currently only using one server but my employer asked me to research and look into it. Thanks,
  23. Hi All, I need to get a small function working for a site I need to build for a group of friends. I was able to get a login page, and a way to add data to the data base. Now I am stuck on the search and show results fuctionalities. I have found tens of scripts on the internet, but most of them are outdated, or I cant get them to work, either it sends me back a blank page, does nothing or sends me to an error page The GOAL User Inputs text in a text box, clicks submit, the data in the text box is looked for in the second collumn of the DB, The information of the collumns 2 to 7 of the DB for the name search are displayed either on the same page or on a new page. Is there any chance you could hel me with that, taken into account that I dont need the html part of the code, I only need help with the php part... Thanks in advance to all the people reading this and the ones helping me...
  24. hello dear folks good evening dear PHP-Freaks, well i am not sure if this question fits here - in miscellaneous. but i am pretty sure that many many calc and excel-experts are here in this great forum. what is aimed: want to create a calendar - with 365-chunks that are imported into a caleandar form see some ideas where i can import this i posted the example-calc spreassheet that i want to import. note it has got 365 lines - for 365 days of the next year 2015 what needs to be done ; whats needs to be achieved: i need to impoort the example into the calendar form. see some of the examples -.. if i am able to import the texts (of the collumn ) in a writer or word document each line of the calc needs to get on a sheed of the word or writer. i need to know how to arrange this export of calc into the writer document. if i need to explain it more thoroughiy - just let me know! greetings you matze see some examples of calendar templates Blank daily calendar - Templates Daily lesson planner (color, landscape) - Templates note: all i need to know is to be able to export from calc to any word or calc document... see the attached sample below... 2015_sample_version_.ods.zip
  25. I'm a beginner here and i am learning the basic in converting from MySQL to MySQLi. I am currently working on this registration page which I would want to convert to MySQLi. Please advise me how to modify this script, I would prefer the procedural style. The MySQLi coding is not working because it would notg insert into the database like the MySQL coding would, would appreciate if your can help me. MYSQL <?php error_reporting(1); $submit = $_POST['submit']; //form data $name = mysql_real_escape_string($_POST['name']); $name2 = mysql_real_escape_string($_POST['name2']); $email = mysql_real_escape_string($_POST['email']); $password = mysql_real_escape_string($_POST['password']); $password2 = mysql_real_escape_string($_POST['password2']); $email2 = mysql_real_escape_string($_POST['email2']); $address = mysql_real_escape_string($_POST['address']); $address2 = mysql_real_escape_string($_POST['address2']); $address3 = mysql_real_escape_string($_POST['address3']); $address4 = mysql_real_escape_string($_POST['address4']); $error = array(); if ($submit) { //open database $connect = mysql_connect("localhost", "root", "Passw0rd") or die("Connection Error"); //select database mysql_select_db("logindb") or die("Selection Error"); //namecheck $namecheck = mysql_query("SELECT * FROM users WHERE email='{$email}'"); $count = mysql_num_rows($namecheck); if($count==0) { } else { if($count==1) { $error[] = "<p><b>User ID taken. Try another?</b></p>"; } } //check for existance if($name&&$name2&&$email&&$password&&$password2&&$email2&&$address&&$address2&&$address3&&$address4) { if(strlen($password)< { $error[] = "<p><b>Password must be least 8 characters</b></p>"; } if(!preg_match("#[A-Z]+#",$password)) { $error[] = "<p><b>Password must have at least 1 upper case characters</b></p>"; } if(!preg_match("#[0-9]+#",$password)) { $error[] = "<p><b>Password must have at least 1 number</b></p>"; } if(!preg_match("#[\W]+#",$password)) { $error[] = "<p><b>Password must have at least 1 symbol</b></p>"; } //encrypt password $password = sha1($password); $password2 = sha1($password2); if($_POST['password'] != $_POST['password2']) { $error[] = "<p><b>Password does not match</b></p>"; } //rescue email match check if($_POST['email2'] == $_POST['email']) { $error[] = "<p><b>Rescue Email must not be the same as User ID</b></p>"; } //generate random code $random = rand(11111111,99999999); //check for error messages if(isset($error)&&!empty($error)) { implode($error); } else { //Registering to database $queryreg = mysql_query("INSERT INTO users VALUES ('','$name','$name2','$email','$password','$password2','$email2','$address','$address2','$address3','$address4','$random','0')"); $lastid = mysql_insert_id(); echo "<meta http-equiv='refresh' content='0; url=Activate.php?id=$lastid&code=$random'>"; die (); } } } ?> MYSQLi (NOT WORKING AFTER CONVERTING) <?php error_reporting(1); $submit = $_POST['submit']; //form data $name = mysqli_real_escape_string($connect, $_POST['name']); $name2 = mysqli_real_escape_string($connect, $_POST['name2']); $email = mysqli_real_escape_string($connect, $_POST['email']); $password = mysqli_real_escape_string($connect, $_POST['password']); $password2 = mysqli_real_escape_string($connect, $_POST['password2']); $email2 = mysqli_real_escape_string($connect, $_POST['email2']); $address = mysqli_real_escape_string($connect, $_POST['address']); $address2 = mysqli_real_escape_string($connect, $_POST['address2']); $address3 = mysqli_real_escape_string($connect, $_POST['address3']); $address4 = mysqli_real_escape_string($connect, $_POST['address4']); $error = array(); if ($submit) { //open database $connect = mysqli_connect("localhost", "root", "Passw0rd", "logindb") or die("Connection Error"); //namecheck $namecheck = mysqli_query($connect, "SELECT * FROM users WHERE email='{$email}'"); $count = mysqli_num_rows($namecheck); if($count==0) { } else { if($count==1) { $error[] = "<p><b>User ID taken. Try another?</b></p>"; } } //check for existance if($name&&$name2&&$email&&$password&&$password2&&$email2&&$address&&$address2&&$address3&&$address4) { if(strlen($password)< { $error[] = "<p><b>Password must be least 8 characters</b></p>"; } if(!preg_match("#[A-Z]+#",$password)) { $error[] = "<p><b>Password must have at least 1 upper case characters</b></p>"; } if(!preg_match("#[0-9]+#",$password)) { $error[] = "<p><b>Password must have at least 1 number</b></p>"; } if(!preg_match("#[\W]+#",$password)) { $error[] = "<p><b>Password must have at least 1 symbol</b></p>"; } //encrypt password $password = sha1($password); $password2 = sha1($password2); if($_POST['password'] != $_POST['password2']) { $error[] = "<p><b>Password does not match</b></p>"; } //rescue email match check if($_POST['email2'] == $_POST['email']) { $error[] = "<p><b>Rescue Email must not be the same as User ID</b></p>"; } //generate random code $random = rand(11111111,99999999); //check for error messages if(isset($error)&&!empty($error)) { implode($error); } else { //Registering to database $queryreg = mysqli_query($connect, "INSERT INTO users VALUES ('','$name','$name2','$email','$password','$password2','$email2','$address','$address2','$address3','$address4','$random','0')"); $lastid = mysqli_insert_id(); echo "<meta http-equiv='refresh' content='0; url=Activate.php?id=$lastid&code=$random'>"; die (); } } } ?>
×
×
  • 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.