-
Posts
3,584 -
Joined
-
Last visited
-
Days Won
3
Everything posted by JonnoTheDev
-
No it doesn't. You have 1 single file that displays any tutorial. You could have another file that displays any video. The data is requested via a database query from what are known as url parameters i.e links to 2 tutorials tutorial.php?id=123 tutorial.php?id=127856 Do you think that there is a new php page created on this forum whenever a new topic is posted. Just look at the url. We remain on index.php throughout and the post is obtained through the url parameters.
-
There are plenty of windows desktop applications that can do this. Your user could convert then upload to the web site. If you were to do this with php I guess you would need a windows web server with php using the COM extensions. I don't think there is anything off the shelf although I maybe wrong. You should really spend the time on forcing the user to have documents in the appropriate format for the web and restrict the upload to pdf. If they don't want to convert the documents its really tough luck. Just tell them there is no soultion other than to have the proper format.
-
This makes absolutely no sense unless you post code demonstrating why there is an issue.
-
By creating a new array <?php $test = array('ZXhwZXJpbWVudA==' => 'example'); $new = array(); foreach($test as $key => $val) { $new[base64_decode($key)] = $val; } print_r($new); ?>
-
Only if you will be constantly adding additional features. If it works as it is and requires no additional functionality then just leave it and learn from your mistakes.
-
You dont have to use the pear library. You could use the following: fopen fputs curl Look at these functions in the php manual
-
It is a PEAR library. You must install it on your server http://pear.php.net/package/HTTP_Request/
-
config to set what is visible to my users
JonnoTheDev replied to gibbo1715's topic in PHP Coding Help
for($x = 0; $x < count($_SESSION['permissions']); $x++) { This is definately correct. Look for any missing ; as your error states. I assume you are familiar with syntax errors -
Along the lines of (make sure you change the filenames and sql queries appropriately) <td width="41" valign="top"><strong>ID</strong><a href="filename.php?order=asc">[asc]</a> <a href="filename.php?order=desc">[desc]</a></td> <?php // default to asc order unless clicked $order = ($_GET['order']) ? strtoupper($_GET['order']) : "ASC"; $result = mysql_query("SELECT * FROM node WHERE uid = '$user->uid' AND type ='something' ORDER BY fieldname ".$order); // ... rest of code ?>
-
config to set what is visible to my users
JonnoTheDev replied to gibbo1715's topic in PHP Coding Help
Sorry, this line: for($x = 0; $x < count($_SESSION['permissions']); $x++) { Be aware that the code I have posted is not a fully working model. You would have to integrate it into your design yourself. -
OK, you are going wrong with the code on domain 2 that is processing the data and checking the database. You have used the syntax 'return true' and 'return false'. This is incorrect. return is used in functions. This is not what you want. You need to produce output that the script making the request can read. i.e produce output in xml or simply print text to the screen if ($check2 == 0) print "invalid"; Then on the script making the call you can check the output from the response i.e if(strstr($output, "invalid")) { // login invalid }
-
config to set what is visible to my users
JonnoTheDev replied to gibbo1715's topic in PHP Coding Help
No as the data is saved into a session upon login. It will exist until it is destroyed. The permissions are exploded to an array so they will look like 0 => 0 1 => 1 2 => 0 3 => 0 4 => 1 So you can use a loop <?php $menus = array('menu1','menu2','menu3','menu4','menu5'); for($x = 0; $x < count($_SESSION['permissions']) $x++) { if($_SESSION['permissions'][$x]) { // display the menu item print $menus[$x]."<br />"; } } ?> Do some reading on sessions. They will be needed to allow users to login to your website -
Do you mean order the result of the sql query. If so you can use the ORDER BY claus i.e SELECT * FROM tablename ORDER BY fieldname DESC
-
config to set what is visible to my users
JonnoTheDev replied to gibbo1715's topic in PHP Coding Help
I guess the user has to login, correct? You could load the permissions into a session variable once the user login details have been validated (the code is purely hypothetical). It may also be better to strore the permissions in a single field separated by commas i.e 0,1,1,0 <?php // login.php session_start(); // validate user if($validated == true) { // user validated - load in permissions $result = mysql_query("SELECT permissions FROM users WHER userId='x'"); $row = mysql_fetch_assoc($result); $_SESSION['permissions'] = explode(",",$row['permissions']); // redirect user header("Location:index.php"); exit(); } else { // bad login } ?> -
Not doing too bad this season.
-
You are creating a process that has complexities. The code I have posted is purely hypothetical even though it uses objects. You can use whatever coding standard you like. I suggest you follow this tutorial on making a REST call to a service on another domain. Then you will get the idea of how to make calls to services and read the responses. In your case the service will be checking a database to see if the user data sent to the service is valid. http://www.sematopia.com/2006/10/how-to-making-a-php-rest-client-to-call-rest-resources/
-
Why would you even create a process like that? Anyhow, if that is what you want then you need to create a service on the domain that checks the login data i.e domaintwo.com. A REST service. Essentially you will send the login data over from domainone.com to domaintwo.com and domaintwo.com will return a response. You could make it send back an xml response after it has looked up the details from your database. domainone.com will parse the response and then decide if the user session can be set i.e This is a pure example, the code is not literal <?php // form has been submitted if($_POST['submit']) { // send the data over to form processing $x = new loginProcess('http://domaintwo.com/loginapi.php'); $result = $x->validate($_POST['username'], $_POST['password']); // parse the response $response = parseResponse($result); if($response == true) { // successful login } else { // failed login } } ?> The code on domaintwo.com will receive the request and return the response i.e <?php if($_POST['username'] && $_POST['password']) { // check against database mysql_query(); // return XML response } ?> To make it much simpler why not just grant access to the database on server1 from server2 and do all the validation on the same website?
-
Is the file too large? What is your upload limit set to in your php configuration? Improve your script's error handling or write a better script. What has flickr got to do with anything? Just because you can upload it to their website doesn't prove anything. You are not using the same system as flickr.
-
Do you see the following form action that you already have. It is submitting to the current page. <form action="<?php echo $_SERVER['PHP_SELF']?>" method="post"> Lets take your 2 domains: domainone.com domaintwo.com I am on domaintwo.com and I want to login so I can access resources on domainone.com. OK, domaintwo.com will not do any login processing. All this website displays is a form so the user can enter their details. However, the form will submit to domainone.com/login.php where the details will be checked against the database. If the details are incorrect you simply throw the user back to domaintwo.com with an error. All you need to do is change the action of the form on domaintwo.com. It cannot be much simpler to explain: <form action="http://www.domainone.com/login.php" method="post">
-
How to show more than 1 users with this code...
JonnoTheDev replied to LexHammer's topic in PHP Coding Help
i.e loop the users out within the template with a foreach construct {foreach item=user from=$users} {$user->user_displayname()}<br /> {/foreach} If you are not familiar with the code then I suggest you learn from a book or online. http://smarty.net -
A Geordie eh. Welcome. We can help you with your programming but not getting your team back in the premiership.
-
Which PHP Editor do you think is the best? [v2]
JonnoTheDev replied to Daniel0's topic in Miscellaneous
Trialing DWCS4. Couldn't get used to netbeans. Happy so far. The code colouring is far better than any other IDE. Too much customising in netbeans. -
If you want a visual application, try iMacros http://www.iopus.com/
-
It makes sense to store these on a separate server to your database and website files, and access them from a different url i.e main website: www.xyz.com images: images.xyz.com This is also better for you usage stats as people tend to hotlink images.
-
Just grant access to the new database using the same username & password as the website. http://dev.mysql.com/doc/refman/5.1/en/grant.html