Everything posted by Tex0gen
-
TideSDK Hiding php database passwords
Just letting you know, i fixed this issue. I re-packed the .exe and dependancies into a new .exe so... app.exe runs the_real_app.exe within itself. (Like a virtualbox). That way, all dependant folders are hidden.
-
Selecting multiple values from a database
Ideally, you should always use an auto_increment ID on table items. Even if your not using it, it will come in handy at one point or another. See below for examples on sql joins. http://www.w3schools.com/sql/sql_join.asp
-
TideSDK Hiding php database passwords
Hey there, I have started an application using TideSDK (If you have not heard of it, it is awesome! Check it out!) Bascially, it uses web programming to compile a native desktop application. So, i am writing an application to login to a website from the application. What i have done, is allowed access remotely to the database and have successfully connected with the app. I can do the usual stuff but then realised that when the application is compiled, on a mac you can open package contents. This then shows the resources folder which shows the raw PHP files where the connection variables are clearly viewable. I am just looking for options on what i can do to stop this being possible to keep the database as secure as possible from intrusion as it will eventually contain A LOT of information. Thanks in advance!
-
Primary Key Duplicate Entry - User Message (mysqli.errno)
$res = mysqli_query($GLOBALS["___mysqli_ston"], $check); $count = mysqli_num_rows($res); if ($count>1){ echo 'Sorry, this gamertag already exists'; } Missed a bracket on line 1. Unexpected double arrow on line 3. This now works on my system as the code is. (Not tested the whole function)
-
Primary Key Duplicate Entry - User Message (mysqli.errno)
What are the errors? Post the output please?
-
Primary Key Duplicate Entry - User Message (mysqli.errno)
Ah, sorry.. i read the post wrong slightly.. okay... <?php $conn = ($GLOBALS["___mysqli_ston"] = mysqli_connect("HOST", "USER-NAME", "PASSWORD!")); $db = ((bool)mysqli_query($conn, "USE DATEBASE NAME")); ?> <?php $yourname = mysql_real_escape_string($_POST['user-name']); $xboxgamertag = mysql_real_escape_string($_POST['xbox-gamertag']); $game1 = mysql_real_escape_string($_POST['game1']); $game2 = mysql_real_escape_string($_POST['game2']); $game3 = mysql_real_escape_string($_POST['game3']); $check = "SELECT xboxgamertag FROM yourtable WHERE xboxgamertag = $xboxgamertag"; $res = mysqli_query($GLOBALS["___mysqli_ston"], $check; $count = mysqli_num_rows($res); if ($count=>1){ echo 'Sorry, this gamertag already exists'; } else { $sql = "INSERT into xbox values('$yourname','$xboxgamertag','$game1','$game2','$game1')"; $qury = mysqli_query($GLOBALS["___mysqli_ston"], $sql); if(!$qury) echo ((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)) ; else { echo "Success, $yourname! Your now added to GamerTag Finder with the gamertag $xboxgamertag and want people to add you for $game1, $game2 and $game3."; echo "<a href='xboxgamertags.php'>View Xbox GamerTags</a>"; } } ?> Not tested i am afriad but you get the general idea. just do a query on the database for the new username being added and if the amount of rows is more than 1, do nothing.. if its not.. then add it in.
-
PHP Include file within another included file
Had to change is slightly to: include(__DIR__ . '/../file2.php'); But it worked! Thank you very much!!
-
Declaring all variables at start of program
When i first saw this thread.. $var1 = 'hi'; $var2 = 'hi2'; $var3 = "hi3"; $var4 = "hi4"; etc etc etc.. I chuckled.
-
displaying images in a webpage using php
Ahhh, i see what your saying now.. by "hard coding" i was thinking.. "wah?, looks dynamic to me.." then realised your adding in the id of the image to be pulled out. <td><img src="showimage2.php?id=5" title="tan" width="150"height="150"/></td> Just stick in a while loop. Then add a link to the image for a full view. while($row = mysql_fetch_assoc($result){ echo '<a href="/showimahe2.php?id='.$row['id'].'"><img src="/showimahe2.php?id='.$row['id'].'"/></a>'; }
-
Primary Key Duplicate Entry - User Message (mysqli.errno)
Any chance you can post your mysql table structure? I suspect your primary key is an incorrect data type.
-
PHP Include file within another included file
Okay, so this is going to sound like the most amature question ever. I remember needing to do something like this years ago but never figured it out, so here i am. I have a structure like the following: ------------- index.php (Includes file1.php FOLDER1 > file1.php (This includes file2.php) FOLDER2 > file2.php -------------- So, index.php includes file1.php perfectly. But then errors out with file2.php. It says it cannot open stream. File not found. I have changed file.php to the following configs but with no success... include('../FOLDER2/file2.php'); include('FOLDER2/file2.php'); include('/FOLDER2/file2.php'); include('../../FOLDER2/file2.php'); Any idea how i can go about this? Thanks in advance!
-
Lithium Framework (PHP) Session based links
I checked out Laravel 4. Completely agree with the documentation. Lithium lacks detailed documentation. To be honest, i found CakePHP to be pretty much the same framework as Lithium and much better documented so i have now moved over to CakePHP. Thank you for the heads up though!
-
Lithium Framework (PHP) Session based links
Solved, for future ref, heres how i did it. In Layouts default.html.php: <?php if($this->user->connected()){ echo '<a href="/lithium/lithgit/logout">Logout</a>'; } else { echo '<a href="/lithium/lithgit/login">Login</a>'; } ?> And then created a Helper called user.php and added the following: <?php namespace app\extensions\helper; use lithium\security\Auth; class User extends \lithium\template\helper { public function connected() { return Auth::check('default', $this->_context->_config['request']); } } Thanks guys.
-
Holiday misery...
I hate drinking full stop. I don't touch the stuff so i am with you on that one! But the clubs.. everyone loves music surely! And.. (unless you bat for the other team) the women! I would say those alone are enough for me to just be in bliss.. let alone the sunshine. Have to say (minus the idiots) i am jealous! You get all the pros and none of the cons. Wake up, chill, go out, meet the girls, rave to the tunes, go to bed.. and the next day.. all over again hangover free!
-
What is pet name?
I have 3 cats, Moochie, Pugsley and Lilley.
-
Lithium Framework (PHP) Session based links
Hey, I have just started to use my first php framework. Previously, i wrote everything from scratch. I have been recommended to use Lithium. I learn better when diving in the deep end and so far, it has been.. somewhat fruitful yet frustrating. I have managed to add a login/logout script with a private page. No worries. Thing is, documentation is thin. I know this is probably going to be the most basic of tasks (Doing it without a framework is easy). But i need to find out how to create session based links. (IE: LOGIN/LOGOUT on the conditions that the user is logged in or logged out obviously). Any help is much appreciated!
-
Echoing Code From Database?
Why don't you store the products as a list in the database and the blog posts seperately? Then within the blog post, add a custom field which holds an ID of a product. Then when your blog post calls the ID in the post, it will also call the product to be displayed... IE Products Table: 1 - Oak Table 2 - Pine Chair 3 - Oak Chair Blog Table: 1 - About my Oak Chair - Content about chair here - 3 (< this being ID of the product to be shown) 2 - About my Oak Table - content for table - 1 etc etc? Edit: You could also say IF Product_ID (In the blog table) is empty.. do nothing, else show this and this.
-
Searching Multi Tables and Multi fields
Hey there, I need to be able to search all of the fields across a few of my tables i have created. I managed to get that far at least but im unsure on how to go about echoing out the data for links that go direct to that search item. if(preg_match("/^[a-zA-Z]+/", $_POST['search'])){ $name= mysql_real_escape_string($_POST['search']); $select = mysql_real_escape_string($_POST['where']); $moi = $_SESSION['id']; if ($select == 1):{ $src = '_clients'; } elseif ($select == 2):{ $src = '_invoices'; } elseif ($select == 3):{ $src = '_users'; } elseif ($select == 4):{ $src = '_product'; } elseif ($select == 5):{ $src = '_sales'; } elseif ($select == 6):{ $src = '_projects'; } endif; //connect to the database $res = mysql_query("SHOW COLUMNS FROM $src"); if (mysql_num_rows($res) > 0){ $i=0; while($rows = mysql_fetch_array($res)){ if ($i == 0){ $q = "SELECT * FROM $src WHERE ".$rows[0]." LIKE '%".$name."%'"; echo $rows[0]; } else { $q.=" or ".$rows[0]." LIKE '%".$name."%'"; } $i++; } $q .= "AND uid = $moi"; } $newstr = str_replace('_', '', $src); $sql = "SELECT * FROM $src WHERE name LIKE '%" . $name . "%'"; $result = mysql_query($q) or die(mysql_error()); echo 'We found <strong>'.mysql_num_rows($result).'</strong> Results to Display for the term <strong>'.$name.'</strong>.<br/><br/>'; while($row=mysql_fetch_assoc($result)){ //-display the result of the array echo '<a href="'.$newstr.'.php">found</a><br/><br/>'; } if (mysql_num_rows($result)==0){ echo 'Found <strong>0</strong> Results to Display for the Term <strong>'.$name.'</strong>.'; } } else{ echo "<p>Please enter a search query</p>"; } Hope fully this makes sense just by reading the above.
-
Google Calendar API
After continuous googling, i figure that the easiest route it to create my own php based calendar to handle all the little bits i need and then dynamically create a .ics file so users can subscribe across devices. (I think). Just this little tip here to stop users doing the same thing i did and assume there was a fully fledged system out there ready made. If there is, i cant find it.
-
People per hour
I used to use PPH a fair bit but then i noticed after sending so many proposals the clients were all pulling out the day before ending. I gave up after that.
-
Google Calendar API
Hey all, So here is one iv googled alot but found not alot. So, im developing a website at the moment where users sign up and (missing out a huge chunk of its general functionality for client prefs) allows each user to have their own calendar. I have been looking into google calendar API but id like it to sync also with iCal as well. So heres what im after: My page > Calendar shows. My page > Add/Remove events and appointments or whatever. My page > Sync my calendar with other people in the same group as i am (Defined in Mysql DB) Sync Cal > Google & iCal But, each user must have their own calendar OR a calendar that identifys that person be it with colour across applications. Make sense? I have found examples of the calendar API using it as 1 person but not multipul people and especially not with a single group. My site has for example. .. 10 users. 5 of those belong to group 1. The other 5 belong to group 2. Group 1 calendar should be viewable by all of group 1 users. Each user can add events identifyable to them. Group 2 users have the same as group 1.. and so on ++++++++ Any help (As always) MUCH appreciated.
-
Autocomplete UI Insert values into more than 1 textbox
Sorry, i fixed it earlier on, now im having issues with it auto-correcting all of my fields with the last data that was input and the totals are not working. Is there an event you can use to update it without keyup or clicking? HTML: <tr class="iii"> <td class="first"><input placeholder="Code" name="data[0][0]" id="itmcode" class="autof" /></td> <td><input type="text" name="data[0][1]" class="itmname" id="itmnme" placeholder="Name" /></td> <td><input type="text" name="data[0][2]" class="itmdesc" id="itmdesc" placeholder="Description" /></td> <td><input type="text" data-field="price" class="itmprc" name="data[0][3]" id="itmamnt" placeholder="Price" class="auto" /></td> <td><input type="text" data-field="quantity" name="data[0][4]" id="itmqty" value="1" class="itmqty" /></td> <td><input type="text" data-field="total" name="data[0][5]" id="totals" class="total" placeholder="Total" readonly="readonly" /></td> <td><input type="checkbox" name="data[0][6]" id="prodadd" /></td> </tr> JQuery: $(document).ready(function(){ var table = $("#TextBoxesGroup"); var row = table.find("tr").eq(1); var count = 0; $("#addRow").click(function(e){ if (table.find("tr").length >= 10){ alert("Maximum of 10 rows"); return; } var newRow = row.clone(); var regex = new RegExp("data\[[0-9]+\]", "g"); newRow.html(newRow.html().replace(regex, "data[" + (++count) + "]")); table.append(newRow); }); $(document).on('focus keyup', "*[data-field='quantity'],*[data-field='price']", function(e){ var thisRow = $(this).parents("tr.iii"); var rowTotalField = thisRow.find("*[data-field='total']"); var price = parseFloat(thisRow.find("*[data-field='price']").val()); var quantity = parseInt(thisRow.find("*[data-field='quantity']").val()); rowTotalField.val("\u00A3" + (!isNaN(price) && !isNaN(quantity) ? price*quantity : 0).toFixed(2)); var total = 0; table.find("*[data-field='total']").each(function(){ var t = parseFloat($(this).val().replace("£", "")); total += !isNaN(t) ? t : 0; }); $(".totalhide").val(total.toFixed(2)); $(".total").text(total.toFixed(2)); }); }); $(document).on("focus keyup", function() { $(".autof").autocomplete({ source: "suggest.php", minLength: 2, select: function(event, ui) { $('.autof').val(ui.item.value); $('.itmname').val(ui.item.name); $('.itmdesc').val(ui.item.desc); $('.itmprc').val(ui.item.price); $('.total').val('£' + ui.item.price); } }); });
- Update Facebook business page with PHP?
- Free Online SEO Tools
-
Advice on hosting
http://www.unlimitedwebhosting.co.uk Go for unlimited and you can add unlimited domains, SQL databases, etc with plesk control panel and i pay about £3.50 a month and iv got about 30 domains on there. Load times are fast, iv had 1 period of downtime for about an hour or 2 at 1am but was scheduled. Moved from heartinternet with a reseller. I do not regret it.