Jump to content

Search the Community

Showing results for tags 'PHP'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

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


Languages

Found 981 results

  1. hello all, In my application I want to verify users email ID. So that I want to send a verification code to their email.Kindly anybody help regarding this. I want to send email from my application using a gmail account. Thank you
  2. Hi, I have created a website in which I have added the ability the user to choose a language. The structure of my site looks like in the image. Inside core folder, there's the initialize.php file where I have put this: $allowed_languages = array('fre', 'eng');if(isset($_GET['lang']) === true && in_array($_GET['lang'], $allowed_languages) === true){$_SESSION['lang'] = $_GET['lang'];}elseif(isset($_SESSION['lang']) === false){//set default language if not selected$_SESSION['lang'] = 'eng';}include_once("includes/langs/".$_SESSION['lang'].".php"); and inside the langs folder there are both eng.php and fre.php so the code inside them looks like this: //eng.php$lang = array();// Menu - Nav$lang['HOME'] = 'Home';$lang['ABOUT'] = 'About';$lang['CONTACT'] = 'Contact';// Index page$lang['WELCOME'] = 'Welcome to my website!';//About page$lang['ABOUT_PAGE'] = 'This is the about page.'; So in navigation I do: <a href="index.php"><?php echo $lang['HOME']; ?></a>,in index.php for example I do: <h2><?php echo $lang['WELCOME']; ?></h2>, etc etc. My question is if there's a page, for example the about.php, in which I have a lot of content like headings, paragraphs, lists etc etc which is the best way to output it on the page??Do I have to do it all like this $lang['PARAGRAPH_1'] = 'This is the first paragraph.';$lang['PARAGRAPH_2'] = 'This is another paragraph.';$lang['LISTITEM_1'] = 'This is the first list item.';.....<h2><?php echo $lang['ABOUT_PAGE'] ; ?></h2><p><?php echo $lang['PARAGRAPH_1'] ; ?></p><p><?php echo $lang['PARAGRAPH_2'] ; ?></p> or in pages like this there's a "better" way to approach this???
  3. Nice be with you everyone! I'm a beginner in CodeIgniter framework and I'm really interested to explore its classes, methods, properties, etc... May I know what is the usage of CI_Controller, load, helper, library, form,_validation, run & view ? I found these here... <?phpclass Form extends CI_Controller {function index(){ $this->load->helper(array('form', 'url')); $this->load->library('form_validation'); if ($this->form_validation->run() == FALSE) { $this->load->view('myform'); } else { $this->load->view('formsuccess'); }}}?> Thanks in advance!
  4. spluskhan

    Help Me Gyz

    suppose i have 10 products in my database Example:iphone 2 - iphone 3g - laptop i3 - laptop i7 - nokia n96 etcwhen i enter iphone in my search i see all records stored in database thats my prob!what i want ?suppose if i enter laptop i7 or laptop then i get result for laptop i7 or laptop here is my code.. <?php// Connects to your Databasemysql_connect("host.com", "userr", "pass") or die(mysql_error());mysql_select_db("products") or die(mysql_error()); [/font][/color][color=#000000][font=verdana, geneva, lucida,]$data = mysql_query("SELECT * FROM Products")or die(mysql_error());Print "<table border cellpadding=3>";while($info = mysql_fetch_array( $data )){Print "<tr>";Print "<th>Name:</th> <td>".$info['name'] . "</td> ";Print "<th>new:</th> <td>".$info['new_price'] . "</td> ";Print "<th>old:</th> <td>".$info['old_proce'] . "</td> ";Print "<th>faulty:</th> <td>".$info['Faulty_price'] . " </td></tr>";}Print "</table>";?> if any one have better code then please give me tankxx
  5. How to access or call the controller from the view page on change action of a drop down here my sample view page <?php //TO DO require_once __SITE_PATH . '/libs/form_handler.php'; // require_once __SITE_PATH . '/app/views/settings/redirect.php'; ?> <?php if (!empty($pagefields)) { $combotype = $pagefields['combotype']; }else { $combotype = ''; } $form = new lscform(); $form->openForm(array('action' => '', 'name' => 'addSettingsForm')); $form->addInline('<br />'); $form->addLabel('Combo Type', array('for' => 'Combo Type ', 'style' => 'float: left; width: 10em; margin-right: 1em;')); $form->openSelect(array('name' => 'combotype', 'id' => 'combotype', 'onchange' => 'getIPL(this.value)')); $form->addOption('Select the value',array('value'=>0)); foreach ($data as $value) { if ($value['id']==$combotype) { $form->addOption($value['type'],array('value'=>$value['id'] ,'selected'=>'selected' )); }else { $form->addOption($value['type'],array('value'=>$value['id'] )); } } $form->closeSelect(); $form->addInline('<br/>'); $form->closeForm(); //echo '<div style="border: 1px solid darkgrey; text-align: center; width:430px;">'; echo $form; //echo '</div>'; ?> <script src ="<?php echo __SITE_PATH;?>/styles/js/jquery.min.js"></script> <script type="text/javascript"> function getIPL(id) { var url = location.href; var pathname = location.pathname; var index1 = url.indexOf(pathname); var index2 = url.indexOf("/", index1 + 1); var baseLocalUrl = url.substr(0, index2); baseLocalUrl = baseLocalUrl + "/";   var url = "settings/Display"; // window.location.href=url ; if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); } else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("combotype").innerHTML=xmlhttp.responseText; } } queryString = "?id="+id; xmlhttp.open("GET", url+queryString , false); xmlhttp.send(null); } </script> <?php
  6. HiI'm trying to add an option page with a colorpick to my wordpress site, but I can't make the INPUT background update when a color is selected. I added a STYLE but this will only update the background color when I save the changes. I'm pretty sure that it's in the code below or in the javascript file the error is: <input type="text" name="my-theme-options[color]" value="<?php echo esc_attr( $options['color'] ); ?>" style="background-color: <?php echo esc_attr( $options['color'] ); ?>" id="color" /> Here's my code: http://pastebin.com/YHUR6HMk Based on this tutorial: http://theme.fm/2011/08/using-the-color-picker-in-your-wordpress-theme-options-2152/ Can someone please help?//MadsRH
  7. I got a gig helping to get this site running on wordpress, and I cannot figure out why most pages redirect to the homepage. The htaccess doesn't have anything but wordpress stuff in it. This is the site:http://capecodwithinreach.com/ Notice, if you type anything after that, like the pages i am trying to create, it redirects home.http://capecodwithin...com/newpage.phphttp://capecodwithin...still-redirects However, things like:http://capecodwithin...om/wp-login.phpstill go to the right place. Why is this, and how can I stop it? I can't create any pages! Thanks!
  8. Hello internet. I am trying to place the local time in a php table using the code below - it executes but is not displaying the local time EST that I would like - it is still displaying GMT. What am I doing wrong here? Table is ViewColumn for date in mysql is TStampAuto Increment column is M_idgru references with a 3 which is the gru number where I send the persons comments to the Cmnts column //code$result = mysql_query("SELECT * FROM View WHERE gru='3' AND DATE_ADD(NOW(), INTERVAL 2 HOUR) > TStamp ORDER BY M_id DESC");echo "<table border='0'><tr><th>Name</th><th>Comments</th><th>Date & Time</th></tr>";while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['NameC'] . "</td>"; echo "<td>" . $row['Cmnts'] . "</td>"; echo "<td>" . $row['TStamp'] . "</td>"; echo "</tr>"; }
  9. Hi all Expert, I am PHP learner. I want to do something by PHP. My process is below:I have created a form now need to do like this: I will input data by PHP in my database.(I can input only one field data but i need to input multiple field data). Then database's all data will show in other page in & there will show a EDIT button then anyone can update their data by selecting name or ID. Then it will show me welcome page. This process I want to do.
  10. Hello internet I am pulling out my hair trying to figure this one out. Below is the only code I have in the php file. What I am trying to do is delete the only line of data in the database table and replace it with a new line of data. The data will delete but it will not do the insert function to put the new data in. I started out trying an UPDATE function but that did not work either. Separately each set of <?php ?> code works if I put them in separate files but together they do not work. Why? How can I achieve the desired effect? Please help. <?php$con = mysql_connect("xxx","xxx","xxx");mysql_select_db("xxx", $con);mysql_query("DELETE FROM ViewIt WHERE misc='1'");mysql_close($con)?> <?php$con = mysql_connect("xxx","xxx","xxx");mysql_select_db("xxx", $con);$sql="INSERT INTO ViewIt (misc, CC)VALUES ('1', '2')";mysql_close($con)?>
  11. Hi, I'd like some help please. I'm trying to create a pagination that will display the links of the pages like this:<a href="#">First Page</a><a href="#">Previous Page</a><a href="#">Next Page</a><a href="#">Last Page</a>Not showing numbers Here's my code so far: <?php$per_page = 20;$page = (isset($_GET['page']) === true) ? (int)$_GET['page'] : 0;$start = $page * $per_page; $query = "SELECT `users`.`user_id` AS `id`, `users`.`first_name` AS `firstname` , `users`.`last_name` AS `lastname`, `users`.`email` AS `email`, FROM `users` ORDER BY `users`.`user_id` DESC"; $query_limit = sprintf("%s LIMIT %d, %d", $query, $start, $per_page);$sql = mysqli_query($connection, $query_limit) or die(mysqli_error());$row_sql = mysqli_fetch_assoc($sql); $all = mysqli_query($connection, $query);$total_rows = mysqli_num_rows($all); $total_pages = ceil($total_rows/$per_page)-1;//$previous_page = ($page > 0) ? $page - 1 : 0;//$next_page = $page + 1;?><html>....<?php do { ?><td><?php echo $row_sql['firstname']; ?></td><td><?php echo $row_sql['lastname']; ?></td><td><?php echo $row_sql['email']; ?></td><?php } while ($row_sql = mysqli_fetch_assoc($sql)); ?>...<!--- pagination links go here ---> Is it also possible to put it and inside a function where I can pass the $query and the $per_page so that I can re-use it???
  12. require_once("pclzip.lib.php"); $destination_dir = "../tempcontent"; $archive = new PclZip($file); if (($list = $archive->listContent()) == 0) { die("Error : ".$archive->errorInfo(true)); } for ($i=0; $i<sizeof($list); $i++) { /*for(reset($list[$i]); $key = key($list[$i]); next($list[$i])) { //echo "File $i / [$key] = ".$list[$i][$key].""; //$array[] = $list[$i][stored_filename]; //echo $list[$i][filename] . "<br/>"; //echo $list[$i][stored_filename] . "<br/>"; }*/ $array[] = $list[$i][stored_filename]; echo ""; } if ($archive->extract(PCLZIP_OPT_PATH, $destination_dir) == 0) { echo "\nError while extract..."; } else { echo "\nExtract okay..."; } $chapter = mysql_result(mysql_query("SELECT max(chapter) FROM komik_content_chapter WHERE komik_id=$komik_id"), 0); $chapter++; $komik = mysql_result(mysql_query("SELECT title FROM komik WHERE komik_id=$komik_id"), 0); $direction = "../komik/$komik"; if ($chapter=='1') { mkdir($direction); } mkdir($direction."/".$chapter); i have a question,how can i move my file after extract store in temp file ,after make dir. then move the file to new dir??? /*else if ($chapter!='1') { move upload file to here }*/ $datearry = split("-",$publish_date); $publish_date = $datearry[2]."-".$datearry[1]."-".$datearry[0]; $ts = date('Y-m-d H:i:s'); $seq = 0; $i=0; for($i =0; $i < count($array); $i++) { $seq++; $query = "INSERT INTO komik_content_chapter VALUES ('','$komik_id','$chapter','$seq','$charging','$array[$i]','$publish_date','$ts')"; $result = mysql_query($query); } $chapter_id = mysql_insert_id(); if ($result) return $chapter_id; else return false;
  13. Im looking for a little help, I am in the process of building a website and I want the contact form data to be sent to an email account.After looking at a tutorial on how to send my html form data to php I have hit a problem where the email always goes into the outlook accounts junk folder. I suspsect it may be the code I have used anyway any help would be very appreciated. Anyone know of a good tutorial or example code that will help me send my form data to email? Many thanks
  14. How to edit Language on php form or should i say change well im making a website in spanish and i want to chage the language of the contact form this is the site http://bioiman.com/ let me know
  15. Most of the time when I install PHP I get the current directory of the .php file returned from my script. With Zend Server 6 CE DOCUMENT_ROOT seems to be truncating the .php files running directory and is always returning htdocs as the last folder regardless of the fact that my application is actually in /htdocs/samedaycrm/documentroot.php. Is there some way to change the configuration for DOCUMENT_ROOT so that it starts returning the current running directory of the .php file?
  16. dewinky

    Vexing issue!

    I have a few questions i wish to see if anyone can assist me with:1. is it possible to have javascript dynamically adjust the height or width of a cell on a drag and drop event?, would i be better off using divs instead of table elements (easier to layout with my limited css skills). 2. would i be able to dynamically rotate the image of the dominoe, depending on which side of the dominoe is played and how could i do that? would i have to code something in javascript ondrop event 3. to enable select cells to allow dominoes to be dropped on them. 4. why does a dropped image takes one an opaque color? below is an image of my shoddy work and attached is the html output <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8" /> <title></title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" /> <link rel="stylesheet" href="/resources/demos/style.css" /> <link rel="stylesheet" href="../dominoes/css/dominoes.css" type="text/css" /><!--[if IE]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]--> <script> function allowDrop(ev) { ev.preventDefault(); } function drag(ev){ ev.dataTransfer.setData("Text",ev.target.id); } function drop(ev) { ev.preventDefault(); var data=ev.dataTransfer.getData("Text"); ev.target.appendChild(document.getElementById(data)); } </script> <script> $(document).ready(function(){ } );</script> </head> <body><div id="board" ><div id='playArea' ><table id='h1Row'><tr><td id='cell_0' ondrop='drop(event)' ondragover='allowDrop(event)' class='h1Row'></td><td id='cell_1' ondrop='drop(event)' ondragover='allowDrop(event)' class='h1Row'></td><td id='cell_2' ondrop='drop(event)' ondragover='allowDrop(event)' class='h1Row'></td><td id='cell_3' ondrop='drop(event)' ondragover='allowDrop(event)' class='h1Row'></td><td id='cell_4' ondrop='drop(event)' ondragover='allowDrop(event)' class='h1Row'></td><td id='cell_5' ondrop='drop(event)' ondragover='allowDrop(event)' class='h1Row'></td><td id='cell_6' ondrop='drop(event)' ondragover='allowDrop(event)' class='h1Row'></td></tr></table><table id='v1Row'><tr><td id='cell_7' ondrop='drop(event)' ondragover='allowDrop(event)' class='h1Row'></td><td id='cell_8' ondrop='drop(event)' ondragover='allowDrop(event)' class='h1Row'></td><td id='cell_9' ondrop='drop(event)' ondragover='allowDrop(event)' class='h1Row'></td></tr></table><table id='h2Row'><tr><td id='cell_17' ondrop='drop(event)' ondragover='allowDrop(event)' class='h1Row'></td><td id='cell_16' ondrop='drop(event)' ondragover='allowDrop(event)' class='h1Row'></td><td id='cell_15' ondrop='drop(event)' ondragover='allowDrop(event)' class='h1Row'></td><td id='cell_14' ondrop='drop(event)' ondragover='allowDrop(event)' class='h1Row'></td><td id='cell_13' ondrop='drop(event)' ondragover='allowDrop(event)' class='h1Row'></td><td id='cell_12' ondrop='drop(event)' ondragover='allowDrop(event)' class='h1Row'></td><td id='cell_11' ondrop='drop(event)' ondragover='allowDrop(event)' class='h1Row'></td><td id='cell_10' ondrop='drop(event)' ondragover='allowDrop(event)' class='h1Row'></td></tr></table><table id='v2Row'><tr><td id='cell_18' ondrop='drop(event)' ondragover='allowDrop(event)' class='h1Row'></td><td id='cell_19' ondrop='drop(event)' ondragover='allowDrop(event)' class='h1Row'></td><td id='cell_20' ondrop='drop(event)' ondragover='allowDrop(event)' class='h1Row'></td></tr></table><table id='h3Row'><tr><td id='cell_21' ondrop='drop(event)' ondragover='allowDrop(event)' class='h1Row'></td><td id='cell_22' ondrop='drop(event)' ondragover='allowDrop(event)' class='h1Row'></td><td id='cell_23' ondrop='drop(event)' ondragover='allowDrop(event)' class='h1Row'></td><td id='cell_24' ondrop='drop(event)' ondragover='allowDrop(event)' class='h1Row'></td><td id='cell_25' ondrop='drop(event)' ondragover='allowDrop(event)' class='h1Row'></td><td id='cell_26' ondrop='drop(event)' ondragover='allowDrop(event)' class='h1Row'></td><td id='cell_27' ondrop='drop(event)' ondragover='allowDrop(event)' class='h1Row'></td></tr></table><div id="Play2Right" ><div style="background-color: blue;" class="bones_Play2Right">55</div><div style="background-color: blue;" class="bones_Play2Right">53</div><div style="background-color: blue;" class="bones_Play2Right">41</div><div style="background-color: blue;" class="bones_Play2Right">65</div><div style="background-color: blue;" class="bones_Play2Right">11</div><div style="background-color: blue;" class="bones_Play2Right">32</div><div style="background-color: blue;" class="bones_Play2Right">51</div></div><div id="Play2Top" ><div style="background-color: red;" class="bones_Play2Top">30</div><div style="background-color: red;" class="bones_Play2Top">63</div><div style="background-color: red;" class="bones_Play2Top">64</div><div style="background-color: red;" class="bones_Play2Top">20</div><div style="background-color: red;" class="bones_Play2Top">52</div><div style="background-color: red;" class="bones_Play2Top">00</div><div style="background-color: red;" class="bones_Play2Top">54</div></div><div id="Play2Left" ><div style="background-color: green;" class="bones_Play2Left">43</div><div style="background-color: green;" class="bones_Play2Left">33</div><div style="background-color: green;" class="bones_Play2Left">31</div><div style="background-color: green;" class="bones_Play2Left">44</div><div style="background-color: green;" class="bones_Play2Left">22</div><div style="background-color: green;" class="bones_Play2Left">42</div><div style="background-color: green;" class="bones_Play2Left">40</div></div><div id="Play2Active" ><img id="img_21" draggable="true" ondragstart="drag(event)" class="bones_Play2Active" src="/dominoes/css/images/21.png" alt="21" ><img id="img_10" draggable="true" ondragstart="drag(event)" class="bones_Play2Active" src="/dominoes/css/images/10.png" alt="10" ><img id="img_66" draggable="true" ondragstart="drag(event)" class="bones_Play2Active" src="/dominoes/css/images/66.png" alt="66" ><img id="img_62" draggable="true" ondragstart="drag(event)" class="bones_Play2Active" src="/dominoes/css/images/62.png" alt="62" ><img id="img_61" draggable="true" ondragstart="drag(event)" class="bones_Play2Active" src="/dominoes/css/images/61.png" alt="61" ><img id="img_50" draggable="true" ondragstart="drag(event)" class="bones_Play2Active" src="/dominoes/css/images/50.png" alt="50" ><img id="img_60" draggable="true" ondragstart="drag(event)" class="bones_Play2Active" src="/dominoes/css/images/60.png" alt="60" ></div></div></div> </body></html>
  17. hello again, since most of my websites are made in PHP.i would like to ask a maybe little kind of rookie question, if i have 2 servers, and wonna have the Database on the other, and the website on the other.what to do?... i know its possible... just, how?... do i replace the localhost with (examble) speed-scene.com?... (one of my websites)... or do i get it wrong again?... -thanks as usually.
  18. Greetings, I am really new at coding php. I have been working for a while and doing some Google searches. I am trying to make a registeration page for something I am working on. I can get everything in the database but dates & times. Right now it's all bogus information. I am curious on how to take a date (like a birthday) and write it to my MySql datebase? Every attempt I have made that is the only piece that doesn't get written. Also I am having an issue with the php date getting into the database. Html code <!DOCTYPE HTML><html><head><title>Demo Game</title></head><body><h1>Test page</h1><p>This is a demo page. More to come.</p><p>In the area below. You will find a location for registration. Please attempt to make an account.</p> <!-- Divide for form formatting --> <div id="container" style="width:250px"><!-- Form for registering new users into the game. --><form id="register" action="reg.php" method="post"> <fieldset> <legend>Registration</legend> <div id="col1" style="width:75px; float:left;"> Username:<br> Password:<br> First name:<br> Last name:<br> Birthday:<br> Email: </div> <div id="input" style="width:100px; float:left;"> <input type"text" name="username" placeholder="Username" required autofocus><br> <input type="password" name="password" placeholder="Password" required><br> <input type"text" name="fname" placeholder="First Name" required><br> <input type"text" name="lname" placeholder="Last Name" required><br> <input type="date" name="bday" placeholder="(MM/DD/YYYY)" required><br> <input type="email" name="email" placeholder="Email address" required> </div> <div id="gender" style="text-align:center; clear:both;"> Gender: <select name="gender"> <option value="Male">Male</option> <option value="Female">Female</option> </select><br><br> </div> <input type="submit" value="Register"> </fieldset></form></div> </body></html> php code <?php// Variables//$Date = now();$User = "";$Password = "";$Database = "testgame";$Table = "players";$Host = "localhost";$sqlDate = date('Y-m-d H:i:s'); //Check to make sure variables are set from index.htmif(isset($_POST[username]) && isset($_POST[password]) && isset($_POST[fname]) && isset($_POST[lname])&& isset($_POST[bday]) && isset($_POST[email]) && isset($_POST[gender])){// Connect to the servermysql_connect($Host, $User, $Password) or die (mysql_error()); //Check connectivitymysql_select_db($Database) or die(mysql_error()); // Insert data into DB$insert = "INSERT INTO $Table (username, password, name, last, email, birthday, registered, gender) VALUES('$_POST[username]', '$_POST[password]', '$_POST[fname]', '$_POST[lname]', '$_POST[email]', '$_POST[bday]', '$sqlDate', '$_POST[gender]')"; //Check to see if the name exists (no duplicates)$result = mysql_query("SELECT * FROM $Table Where email = '$_POST[email]'"); echo $_POST[email]; if($result){ if(!mysql_query($insert)) { die (mysql_error()); echo "Record added. "; }}else { echo "Email already used."; } mysql_close($con); } //End of check ?>
  19. I have created some custom functions like these: function folder_exists($folder){ global $connection; $sql_folder_exists = "SELECT COUNT(`album_id`) FROM `albums` WHERE `folder` = '{$folder}' LIMIT 1"; $folder_exists = mysql_query($sql_folder_exists, $connection) or die(mysql_error()); return (mysql_result($folder_exists, 0) == 1) ? true : false;} function total_users(){global $connection;$sql_total_users = "SELECT COUNT(`user_id`) FROM `users` ";$total_users = mysql_query($sql_total_users,$connection) or die(mysql_error());return mysql_result($total_users, 0);} , but I decided to use the mysqli_* functions instead. My question is which mysqli_ function is used instead if the mysql_result in these cases??? I've searched through the manual and gives these functions mysqli_data_seek() , mysqli_field_seek() and mysqli_fetch_field(), but when i tried them they did not gave me the expected result and obviously ther's no mysqli_result() function.
  20. I have been developing a php web site. I have been trying to follow suggested best practices. I am running ubuntu minimalist install, and installed the following packages: nginx php5 php5-fpm postgresql phppgadmin php5-gd I have nginx up and running instead of apache.I have done some basic configuration for nginx.got my vhost setup and linked. and I am now able to browse my php pages on my local test machine running ubuntu. I have created my postgre database, and have a user setup. So I am to the point that I wanted to create a page to register/login/change password. I searched and found http://stackoverflow...asswords-safely it was posted back in 2010, it links to this guide using phpass: http://www.openwall....Users-Passwords The guide/tutorial was created using Mysql, I have been swapping out functions to their equivalent postgresql functions using the postgresql documentation. I modified the guide to the point that I can create new users in my postgre database. When I got to the point "How to authenticate existing users" I hit a snag. mysql version from guide: } else { $hash = '*'; // In case the user is not found($stmt = $db->prepare('select pass from users where user=?'))|| fail('MySQL prepare', $db->error);$stmt->bind_param('s', $user)|| fail('MySQL bind_param', $db->error);$stmt->execute()|| fail('MySQL execute', $db->error);$stmt->bind_result($hash)|| fail('MySQL bind_result', $db->error);if (!$stmt->fetch() && $db->errno)fail('MySQL fetch', $db->error); if ($hasher->CheckPassword($pass, $hash)) {$what = 'Authentication succeeded';} else {$what = 'Authentication failed';}unset($hasher);} my version: } else { $hash = '*'; // In case the user is not foundpg_prepare($dbconn, "quser", 'SELECT pass FROM users WHERE pk_users=$1') or fail('pg_prepare failed ',pg_last_error($dbconn));$hashx = pg_execute($dbconn, "quser", array($user)) or fail('pg_execute failed ',pg_last_error($dbconn));$hash = pg_fetch_result($hashx, 1, 'pass'); if (!$hash && pg_last_error($dbconn))fail('pg_execute failed.2 ',pg_last_error($dbconn)); if ($hasher->CheckPassword($pass, $hash)) {$what = 'Authentication succeeded';} else {$what = 'Authentication failed';$op = 'fail'; // Definitely not 'change'} I think it has to do with bind_result($hash) I used $hashx = pg_execute() I assumed it would take the results of pg_execute() and store it in the $hashx variable, and I thought that was what bind_result($hash) was doing in the mysql example. here is the error from the server logs: 2013/02/15 19:01:12 [error] 16860#0: *1 FastCGI sent in stderr: "PHP message: PHP Warning: pg_fetch_result(): Unable to jump to row 1 on PostgreSQL result index 5 in ..../testing.com/public/inc/user-man.php on line 91" while reading response header from upstream, client: 192.168.1.150, server: testing.com, request: "POST /inc/user-man.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "testing.com", referrer: "http://testing.com/inc/user-man.html" Also if anyone has any input weather or not this is still best practice for user registration/password security, please let me know. In addition to having a good user/password system I know that I am going to need to recheck my configuration for both nginx and postgresql to make sure everthing is locked down and secure, as well as user permissions, I have not looked for any info/guides on any of this yet. Thanks so much for any responses, I appreciate it.
  21. Nice be with you everyone! Can you give some tutorials about Validates Form using PHP with Ajax & JQuery? I red that it is the best practice...
  22. Hello,I'm new here and to be honest it's the first time I am writing into a Forum. Until now I was only reading through various posts which considerd the same problem as I had. But now I really have no idea what to search and where my problem is. Down here is the PHP Script I have written for a Prom Vote in a nearby school. It would be really great if someone could find my mistake and correct me. <!DOCTYPE html><html lang="en"> <head> <meta charset="utf-8" /> <title></title> </head> <body> <?php$con = mysql_connect("localhost","xxx","xxxxxxxxx");if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db(bgschwechat) or die( "Unable to select database");$abfrage = "SELECT * FROM teilnehmer";$ergebnis = mysql_query($abfrage);$abfrage2 = "SELECT * FROM teilnehmer";$ergebnis2 = mysql_query($abfrage2);echo '<script>';echo 'var stimmzahl = array();';echo 'var name = array();';echo '</script>';while($row = mysql_fetch_object($ergebnis)) { echo '<script>'; echo 'stimmzahl['; echo $row->id; echo '] = 0; '; echo 'name['; echo $row->id; echo '_name'; echo '] = '; echo $row->name; echo '; '; echo 'function '; echo $row->id; echo 'plus() {'; echo 'stimmzahl['; echo $row->id; echo ']++; '; echo 'document.getElementById("'; echo $row->id; echo 'result").innerHTML = stimmzahl['; echo $row->id; echo ']; '; echo '}'; echo 'function '; echo $row->id; echo 'minus() {'; echo 'stimmzahl['; echo $row->id; echo ']--; '; echo 'document.getElementById("'; echo $row->id; echo 'result").innerHTML = stimmzahl['; echo $row->id; echo ']; '; echo '}'; echo '</script>'; } echo '<table class="teilnehmer-liste">'; while($row = mysql_fetch_object($ergebnis2)) { echo '<tr>'; echo '<td>'; echo $row->name; echo '</td>'; echo '<td>'; echo '<button id="'; echo $row->id; echo 'plus" onClick= "function '; echo $row->id; echo 'plus()">+</button>'; echo '</td>'; echo '<td>'; echo '<button id="'; echo $row->id; echo 'minus" onClick=" function '; echo $row->id; echo 'minus()">-</button>'; echo '</td>'; echo '<td>'; echo '<div id="'; echo $row->id; echo 'result">/</div>'; echo '</td>'; echo '</tr>';}mysql_free_result($ergebnis);?></table> </body> </html> The PHP Code works pretty fine but I am not happy with the result because the + and - Buttons don't work :/ Here's the result of the PHP Code in HTML : <!DOCTYPE html><html lang="en"> <head> <meta charset="utf-8" /> <title></title> </head> <body> <script>var stimmzahl = array();var name = array();</script><script>stimmzahl[1] = 0; name[1_name] = Test Person 1; function 1plus() {stimmzahl[1]++; document.getElementById("1result").innerHTML = stimmzahl[1]; }function 1minus() {stimmzahl[1]--; document.getElementById("1result").innerHTML = stimmzahl[1]; }</script><script>stimmzahl[2] = 0; name[2_name] = Test Person 2; function 2plus() {stimmzahl[2]++; document.getElementById("2result").innerHTML = stimmzahl[2]; }function 2minus() {stimmzahl[2]--; document.getElementById("2result").innerHTML = stimmzahl[2]; }</script><table class="teilnehmer-liste"><tr><td>Test Person 1</td><td><button id="1plus" onClick= "function 1plus()">+</button></td><td><button id="1minus" onClick=" function 1minus()">-</button></td><td><div id="1result">/</div></td></tr><tr><td>Test Person 2</td><td><button id="2plus" onClick= "function 2plus()">+</button></td><td><button id="2minus" onClick=" function 2minus()">-</button></td><td><div id="2result">/</div></td></tr></table> </body> </html> It would be really great if someone could help me I need to find a solution as soon as possible because I only have rare time to finish the project. Thanks in advance. ASavic P.S. Here's the Website Link - http://www.cryze.com/bgschwechat/test.php - sometimes offline because it's in development. ^^
  23. hey guys, I'm trying to switch my mysql connections over to PDO but I'm having a hard time. I've read a section on it in the php book I'm reading, I watched the phpacademy,org tutorial on it, I've read the section on it here at w3schools and I can't get it working. I've also posted it on 2 other forums and no one has yet to figure out where the problem is and it's eaten up 2 days of my time as well. If I can't get it figured out today I'm seriously thinking of going back to using the old mysql functions because they worked right the first time and have never given me an ounce of trouble. It's just very frustrating that my registration/login system was working perfect and then I upgrade and nothing works and no one can figure it out. . . It says the error is on line 142, which is the fetchAll() function line. Thanks for any help you guys can offer! Here is the connection script <?php// Connects to Our Database$db_host = "localhost";$db_user = "root";$db_password = "";$db_database = "game_db";try{ $conn = new PDO ('mysql:host=localhost;dbname=game_db', $db_user, $db_password);$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);} catch (PDOException $e) { echo 'ERROR: ' . $e->getMessage();}?> And the query thats giving me the trouble $sql = "INSERT INTO `player_data` (`username`, `empire_name`, `ruler_name`, `founding_group`, `government`, `population`, `currency`, `p_currency`, `scrap`, `food`, `fuel`, `salvage_wpn`, `scrap_wpn`, `morale`, `initiative`, `influence`, `farms`, `housing`, `scrap_yards`, `barracks`, `taverns`, `scouts`, `militia`, `infantry`, `heavy_infantry`, `technicals`, `tanks`, `gate`, `tower`, `wall`, `tunnels`, `dogs`) VALUES (:user, :empire_name, :ruler_name, :founding_group, :government, 25, 1000, 100, 1000, 1000, 0, 0, 5, 10, 100, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)"; $query = $conn->prepare($sql); $query->bindValue(':user', $user, PDO::PARAM_STR); $query->bindValue(':empire_name', $empire_name, PDO::PARAM_STR); $query->bindValue(':ruler_name', $ruler_name, PDO::PARAM_STR); $query->bindValue(':founding_group', $founding_group, PDO::PARAM_STR); $query->bindValue(':government', $government, PDO::PARAM_STR); try { $query->execute(); } catch (Exception $e) { exit($e); } $row_count = $query->fetchAll(PDO::FETCH_ASSOC);
  24. Nice be with you everyone! My problem is: Every time I refresh my showDatabaseCatalog.php there is always insertion of blank data in MySQL database? Can anyone help me how to stop this undesirable insertion of blank data in MySQL database when refresh? Thank you.
  25. Looking code for simple php website. Logo, menu, three pages. I got code for menu but stuck on logo and how to create three pages and how to upload on hosting account. Code for menu. <html><body><a href="url">Home</a> - <a href="url/about.php">About Us</a> - <a href="url/contact.php">Contact Us</a> - <a href="url/privacy.php">Privacy</a> <br /><html><body>
×
×
  • Create New...