|
Hi,
I would like to ask how to convert this C# code into PHP as my office application is in WinForm C# but need to have a PHP portal for it?
public string HashString(string toHash)
{
using (SHA512CryptoServiceProvider sha = new SHA512CryptoServiceProvider())
{
byte[] dataToHash = Encoding.UTF8.GetBytes(toHash);
byte[] hashed = sha.ComputeHash(dataToHash);
return Convert.ToBase64String(hashed);
}
}
public string HashPassword(string password, string salt)
{
string combined = password + salt;
return HashString(combined);
}
Thanks,
Jassim
Technology News @ www.JassimRahma.com
|
|
|
|
|
|
I am overwriting the session cookie to set different domain names with respect to the protocol(http/https)
i wanted to know whether the following is good comparing to the next
$sessname = session_name();
setcookie($sessname, $_COOKIE[$sessname], ...
vs
setcookie(session_name(), session_id(), ....
which one to use?
|
|
|
|
|
When I upload files to localhost, it runs ok. When I upload to real server and connect to it, here is what I get:
Apache 2.
Apache was not able to cross-connect to remote host.
Ive even reinstalled LAMP. With no luck
|
|
|
|
|
Hi
I am running OpenSuse
I am have flash drive on my laptop which I would like to read the contents.
I am guessing it's one of the SDXX directories in the /dev directory.
I have tried to mount each and every sda device (I have sda, sda1,sda2,sda3) and none of those seem like the flash drive
When I do a lsusb command I can see the device listed as bus 3 device 3
Any help appreciated
Thanks
|
|
|
|
|
ForNow wrote: I have tried to mount each and every sda device (I have sda, sda1,sda2,sda3) and none of those seem like the flash drive
sda will almost certainly be the HDD of you laptop with sda1 being the first partiton and sd12 the second and so on.
I would have a look at sdb and /or sdc. Haven't worked with OpenSuse, but if you're use a GUI you should be able to see the USB drive from one of the graphical programs.
Michael Martin
Australia
"I controlled my laughter and simple said "No,I am very busy,so I can't write any code for you". The moment they heard this all the smiling face turned into a sad looking face and one of them farted. So I had to leave the place as soon as possible."
- Mr.Prakash One Fine Saturday. 24/04/2004
|
|
|
|
|
Hi all,
I have got 4 drop down selection boxes.The idea is to be able to select an item from each selection box,get them strung together in sql string and get the result of the query printed
The problem is I keep getting the following message:
Parse error: syntax error, unexpected '$rs' (T_VARIABLE) in C:\xampp\htdocs\dreamincode.php on line 60
I know the code is not too sophisticated but it's part of a little project I started earlier this year and then got distracted and just managed to get back to it now.
Here is the code in full.Any suggestions greatly appreciated.
<pre lang="xml"><!DOCTYPE HTML>
02 <html>
03 <body>
04
05
06 <select name = "author">
07 <option value="kendavies">ken davies</option>
08 <option value="arthursmith">arthur smith</option>
09 <option value="gillrafferty">gill rafferty</option>
10 <option value="mollybrown">molly brown</option>
11 <option value="gilbert riley">gilbert riley</option>
12 <option value="colinwilson">colin wilson</option>
13 <option value="jamesgreen">james green</option>
14 <option value="arnoldlaing">arnold laing</option>
15 <option value="cathyellis">cathy ellis</option>
16 <option value="carolreed">carol reed</option>
17
18 </select>
19
20 <select name = "publisher">
21 <option value="yonkers">yonkers</option>
22 <option value="blueparrot">blue parrot</option>
23 <option value="zoot">zoot</option>
24
25 </select>
26 <select name = "published">
27 <option value="2003">2003</option>
28 <option value="2004">2004</option>
29 <option value="2005">2005</option>
30 <option value="2006">2006</option>
31 <option value="2007">2007</option>
32 <option value="2008">2008</option>
33
34 </select>
35
36 <select name = "genre">
37 <option value="adventure">adventure</option>
38 <option value="thriller">thriller</option>
39 <option value="crime">crime</option>
40 <option value="biography">biography</option>
41 <option value="romance">romance</option>
42
43 </select>
44 $aa = "author"
45 $bb = "publisher"
46 $cc = "yearpublished"
47 $dd = "genre"
48 </body>
49 </html>
50 <?php
51
52 $aa = "author";
53 $bb = "publisher";
54 $cc = "yearpublished";
55 $dd = "genre";
56 mysql_connect ("localhost","root","") or die(mysql_error());
57 mysql_select_db ("authors") or die(mysql_error());
58
59 $strSQL = SELECT * FROM `books`WHERE author = '".$aa."' AND publisher = '".$bb."' AND yearpublished = '".$cc."' AND genre ='".$dd."'" ";
60 $rs = mysql_query($strSQL);
61
62
63
64 while($row = mysql_fetch_array($rs) ) {
65
66 print $row ['ID']."<br/>";
67 print $row ['author']."<br/>";
68 print $row ['booktitle']."<br/>";
69 print $row ['publisher']."<br/>";
70 print $row ['yearpublished']."<br/>";
71 print $row ['genre']."<br/>";
72 print $row ['copiessold']."<br/>";
73
74
75 }
76 mysql_close();
77 ?>
78 </body>
79 </html>
kind regards
col
|
|
|
|
|
Looks like you are missing the opening double quote before SELECT and a missing space before WHERE . I should go through the syntax for that statement again. You could check the final string by displaying it on the page before you try to execute it.
|
|
|
|
|
Hi Richard,
Many thanks for your reply.Tried all of your suggestions(and a few more variations)but to no avail.Here is an odd thing I changed the name of the $rs variable to $aaa,but strangely when I get the e Error up still refers to that variable as $rs..this makes me think that the error is still somewhere in the SELECT line.I will keep at it
Again many thanks for your reply
Kind regards
Colin
st
|
|
|
|
|
Are you sure you saved the modified version of the code before running it? If it still says "$rs" then it must be using the version before you changed the name. It is almost guaranteed that you have some mismatched quotes in your SELECT string.
|
|
|
|
|
I have a table has two columns one which show a dropdown field for no of rooms (1,2,3 ) and the other which shows the price of the room selected with total nights ( EGP 200 ) i have this code but its not working well, can someone help me? :
>
check_in_date) && !empty($this->check_out_date)) {
$room_info = $room_db->getAvailableRooms($room_type_info['id'], $this->post_search_info);
$pprice = $room_info[0]['total_price'];
?>
$(document).ready(function() {
$("#target").kendoTooltip({
autoHide: false
});
});
getShortName() . ' ' .''. $this->escape($pprice).''; ?>
Show prices
>
check_in_date) && !empty($this->check_out_date)) {
?>
0
$room_info_arr) {
$price_sum = $this->price($this->escape($room_type_info['descount_price']));
$per_night_price_sum += $price_sum;
$selected = ($this->postValues['apartments_no' . $count] && in_array($room_info_arr['room_id'], $this->postValues['apartments_no' . $count]) ) ? 'selected="selected"' : '';
if(!$this->postValues['apartments_no' . $count] && $room_info_key == 1){
$selected = 'selected="selected"';
}
$room_id_value .= (empty($room_id_value)) ? $room_info_arr['room_id'] : ',' . $room_info_arr['room_id'];
$price += $room_info_arr['total_price'];
//$selected =
echo '' . $room_cnt . '';
$room_cnt++;
}
}
?>">
|
|
|
|
|
I am new in LAMP. I want to run a simple web app running python using Django and some good interface like mod_wsgi. I have googled a lot but I am not succesful. Please give me step by step process to do it. Please suggest appropriate server.
I am using windows 7.
|
|
|
|
|
Member 9493720 wrote: Please give me step by step process to do it. No one is likely to do that on a programming forum. You need to find some tutorials and samples for yourself and start studying the systems you want to use.
|
|
|
|
|
I am looking to build a portfolio of code samples that can show what I can do as a developer. However, I am not sure what types of things I can program. What are some projects that are relatively short to medium that I can build to help build a portfolio of code samples? I know people suggest having something that shows off knowledge in OOP but other than that I'm not sure what I can create. Thanks.
|
|
|
|
|
Brandi Boseman wrote: I am not sure what types of things I can program.
Brandi Boseman wrote: I'm not sure what I can create.
There seems to be a problem with your approach.
Have you done any coding? Share sample functions. It does not have to be anything big or long. Whoever ends up caring about the portfolio won't go through it in great detail anyway so show that you know the common way of naming variables and functions, that you can use proper looping techniques, that you don't waste lots of processing time, that your code is readable, comments are effective, etc, etc.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Yes I have, but the majority of it is either stuff for my day job ( which is owned by them and can't go in a portfolio ) or stupid things that don't show off my skill as a developer. the only think i have added to some code samples are a tic tac toe class which can handle a game of tic tac toe up to 10 squares and a function that will solve a text string equation ( if you put in " ( 5 + 3 ) / 3 - 2 it will give you the right answer. accounts for parentheses, exponentials etc but i feel like those aren't "enought"
|
|
|
|
|
The first thing anyone will/should care about is your experience. You say you have "skill as a developer" so I assume you have been doing this for a fair while.
Why create a portfolio then?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
i only ask because for job interviews a lot of employers want to see a code sample, but without any constraint or basis of what type of code sample they want to see i have no clue what to send them. i sent one out and they said my code work looked like i was more suited for a "junior" position, that was a user class which managed users, it had functionality to check to see if a user was logged in, logged out a user, create a new user including generating a password hash, logging in a new user, checking to see if a user was verified etc. standard functions. i used oop principles since that was done for a job that assigned a project to me that specifically said it had to be object oriented, and had member private, with accessor classes for things that needed to be accessed from outside the class.
i've been doing professional web development for 8 years now, my current job we use cakephp framework or wordpress depending on the site. i'm just perplexes as to what would be something good. the feedback i have gotten from my code samples was that i didn't look like i was up to the level they needed, ok, well what type of code sample do you want, what are you looking for, etc? if you give me a task i can do it, but if you say "show me code" i have no clue what to give you. i can show you plenty of code...
|
|
|
|
|
OK, that makes sense.
1. It may be worth you posting some of the samples you have provided so that people here can provide feedback and perhaps more up to date approaches. I have seen developers that worked 10+ years yet their approach was still juvenile such as not using more modern features of the language.
2. I see your dilemma and perhaps the LAMP world is different than the Microsoft world, but if you have programmed for 8 years I wouldn't care about code samples, I'd want to hear you talk through challenges and projects you have worked on. As a hiring manager, I'd learn much more by listening to you than by looking at code samples.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Thanks. I've done that too ( showing it to other coders to get input ) I wish more hiring managers would take your approach, as the random-code-sample is a bit hard
|
|
|
|
|
Hi,
I am starting with Slideshare and trying to do a basic search using the below code but all I am getting is a blank page. why?
<?
function search($query)
{
$url="http://www.slideshare.net/api/2/search_slideshows";
$api_key="xxxxxxx";
$secret_key = "xxxxxxx";
$hash = hash('sha1',$secret_key.$time);
$lang="en";
$req = $url ."?api_key=".$api_key
."&hash=".$hash
."&q=".$query;
echo $req;
$xml = simplexml_load_file($req)
or die();
var_dump ($xml);
}
$query = "PHP";
echo search($query);
?>
Technology News @ www.JassimRahma.com
|
|
|
|
|
Hi,
I'm currently working on a small application that would allow users on our forum to upload/send some data to our database. To avoid that our users need to create a second account I wanted to use their existing account (from our current board) details to log in.
After searching the web I found a project from a couple of years back called ForumConnect (Open Source on Bitbucket) After contacting the owner of the project he informed me support for it discontinued a while back.
After doing some testing with all versions released (1,2 and 3) I'm stranding on different phases in every try.
v1 gets me a connection, but after checking the password hashes it returns a false result while they actually do match...
v2 doesn't get the connection when trying to ping the server
v3 has a completely different structure on the php file(s) used and got me puzzled
I'm currently in my second year of programming (evening classes) and the c# side looks to be fine for me to handle.
But since I lack advanced php knowledge I was wondering if there would be someone willing to take up the last version and refresh it with me?
Let me know if you're interested in figuring this out and we can get in touch.
Thanks in advance for taking a look at my post
Cheers,
Z
|
|
|
|
|
I am going to create a computerized enrollment system for my thesis. Typically, whenever I will use PHP as my programming language, the system about to create is always web-based. But in my case, I am going to use PHP for Intranet only and my adviser told me that it should be client server in terms of getting the records from the database. Is it possible? 
|
|
|
|
|
Yes. You can use PHP in such way (and no need of web for that). Search for PHP database access...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Is it the same just like client server in ASP.Net? I have not yet encountered that kind of scenario. Is there any processes/instructions that I need to follow?
|
|
|
|