abelingaw 69 Posting Whiz in Training

The modem's sim card is loaded. Here in Philippines, as long as a subscriber is registered to a text or call promo. doesn't really matter how many texts or call you make as long as that subscription hasn't expired yet.

It really is just that the messages I sent are recieved but as I said, doesn't show anything.

abelingaw 69 Posting Whiz in Training

I'm currently developing an SMS sender using C# (2010). The program does send the message but the message received was not the message sent, (i.e " yt+ 35") and while running the program several times, the received message do not contain anything at all, even the senders number.

I am using a GSM modem and COM port for sending.

Any idea what I am missing here?

Code found in the Class:

if (this.serialPort.IsOpen == true)
        {
            try
            {
                this.serialPort.WriteLine("AT" + (char)(13));
                Thread.Sleep(4);
                this.serialPort.WriteLine("AT+CMGF=1" + (char)(13));
                Thread.Sleep(5);
                this.serialPort.WriteLine("AT+CMGS=\"" + cellNo + "\"");
                Thread.Sleep(10);
                this.serialPort.WriteLine(">" + messages + (char)(26));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Source);
            }
            return true;
        }
        else
        return false;
abelingaw 69 Posting Whiz in Training

Might wanna try this.

abelingaw 69 Posting Whiz in Training

Are your variables on Line 5 were given a value?

i.e

$username = $_POST["txtuname"];
abelingaw 69 Posting Whiz in Training
abelingaw 69 Posting Whiz in Training

There are SQL statements which differ in the way they are written but faster when it comes in loading data.

You should also consider some factors:

Network speed (if it is networked)
Transmission line capacity (still, if networked)
abelingaw 69 Posting Whiz in Training

What would be better, to use GIS software (ArcGIS) or Google maps.

Someone suggested GIS but idk if it works with WAMP.

abelingaw 69 Posting Whiz in Training

Coded just the initial parts (login & main page only), no other links yet.

Perhaps, advice on Google map API, using it in a localhost, since I am using WAMP. I really have no experience on using that in developing a web system.

abelingaw 69 Posting Whiz in Training

Just the basic parts, login and home page, no links whatsoever yet.

Can you give me links of an institution that employ a DMS or sort of?

Advice on using Google map will be very helpful.

I am using localhost by the way (WAMP).

abelingaw 69 Posting Whiz in Training

The Orientation property isn't available on VB6 by default (IICRC).

You need service pack 6 (maybe 5, not sure anymore), not the service pack from MS website.

Just search the web for the SPs.

abelingaw 69 Posting Whiz in Training

The proposed system would be for the provincial disaster coordinating council.

The system would include the following:

  • Registration of disaster including location & other details
  • Registration of missing & found people (with description + image)
  • Geo-location of evacuation centers (registered or not) with max capacity
  • Population of each area
  • Population of affected area

The system would run both on PC or mobile (I used bootstrap for initial development)

Any suggestions will be appreciated for the project's improvement.

Reference

abelingaw 69 Posting Whiz in Training

Web Development (PHP, MySQL)

I use WAMP as my development platform.

No experience in integrating GIS.

abelingaw 69 Posting Whiz in Training

I would like to develop a web-based Disaster Management System but don't know where to start.

Possible features may include:

  • Situation Awareness
  • Missing Person Registration
  • GIS (or google map)

Suggestions and ideas?

Thanks in advance.

abelingaw 69 Posting Whiz in Training

Try using a variable to store that ID with a SELECT statement and change your query with some AND.

abelingaw 69 Posting Whiz in Training

I'm trying to ban a user from logging in to a site after 3 failed attempts.

Code:

<?php

require 'konek/dbcon.php';

if (isset($_POST['login'])) 
 {
    session_start();

    //$link = mysqli_connect('localhost', 'root', '','abra') or die("Could not connect database");
    if (empty($_POST['uname']) || empty($_POST['passw']))
        {
            header ('Location: login.php');
            die();
        }

    if (ctype_upper($_POST['uname']) || ctype_upper($_POST['passw']))
        {
            header ('Location: login.php');
            die();
        }

    $username = mysqli_real_escape_string($con, $_POST['uname']);
    $password = mysqli_real_escape_string($con, $_POST['passw']);

    //FOR VALIDATION
    $result=mysqli_query($con, "SELECT * FROM customers WHERE username= '".$username."' AND password='".$password."'");
    $row = mysqli_fetch_assoc($result);

    $usertype = 'customer';
    $ldate = date('Y-m-d H:i:s');

    //SAVE DETAILS FOR LOGS
    $sql="INSERT INTO logs (username, utype, logdate) VALUES ('$username', '$usertype', '$ldate')";
    $result2 = mysqli_query($con, $sql);


        if(mysqli_num_rows($result) != 0 && $result2) 
        {
            session_regenerate_id();
            $_SESSION['SES_ID'] = $row['cID'];
            $_SESSION['SES_UNAME'] = $row['username'];
            session_write_close();
            header('location: main/index.php');
            die();
        }
        else 
        {
            if(isset($_COOKIE['login']))
                    {
                        if($_COOKIE['login'] < 3)
                            {
                                $attempts = $_COOKIE['login'] + 1;
                                setcookie('login', $attempts, time()+60*10);
                                header('location: login.php');
                                die();
                            } 
                        else
                        {
                            echo '<script language="javascript">alert("3 Login attempts failed. Wait for 10 minutes then try again.")</script>';
                            echo '<script language="javascript">location.replace("index.php");</script>';
                        }
                    } else {
                        setcookie('login', 1, time()+60*10);
                    }
                    exit;


        }
    }
?>

It all works, but there's a problem. If the user logs in with the correct details the 4rth time, they can enter the site (main).
Is there a work-around this so not to allow user to login even with correct details for 10 minutes?

abelingaw 69 Posting Whiz in Training

Ok. So 1st, is to add the product to cart.

<?php
    include("includes/db.php");
    include("includes/functions.php");



    if(ISSET($_POST['command']) && ISSET($_POST['productid'])){
        $_POST['command']=='add';
        $_POST['productid']>0;
        $pid=$_POST['productid'];
        $user = $_SESSION['SES_UNAME'];

        addtocart($pid,1);
        header("location: shoppingcart.php");
        exit();
    }

?>

//--------JAVASCRIPT TO ADD THE ITEM--------------

<script language="javascript">
    function addtocart(pid){
        document.form1.productid.value=pid;
        document.form1.command.value='add';
        document.form1.submit();
    }
</script>

//--------PHP TO DISPLAY PRODUCT INFO AND TO ACTIVATE THE JAVASCRIPT--------------

<?php
            $result=mysqli_query($con,"SELECT * FROM products") or die('Connection Error.<br/><br/>'  .mysql_error());
            while($row=mysqli_fetch_array($result)){
        ?>
        <tr>
            <td><img src="admin/<?php echo $row['image']?>" height='100' width='100' /></td>
            <td><br>  <b><?php echo $row['pname']?></b><br />
                    <?php echo $row['pdesc']?><br />
                    Price:<big style="color:green">
                        <?php echo $row['price']?></big>
                    <br><br><input type="button" value="Add to Cart" onclick="addtocart(<?php echo $row['pId']?>)" /><br><br>

            </td>

Now the processed information will be stored to variables (including sessions) using a function.

<?php


    function get_product_name($pid){
    $result=mysqli_query($con,"SELECT pname FROM products where pId=$pid") or die("SELECT pname FROM products where pId=$pid"."<br/><br/>".mysql_error());
        $row=mysqli_fetch_array($result);
        return $row['pname'];
    }
    function get_price($pid){
        $con = mysqli_connect('localhost', 'abra', 'abra','abra') or die("Could not connect database");
        $result=mysqli_query($con,"SELECT price FROM products where pId=$pid") or die("SELECT pname FROM products where pId=$pid"."<br/><br/>".mysql_error());
        $row=mysqli_fetch_array($result);
        return $row['price'];
    }
    function remove_product($pid){
        $pid=intval($pid);
        $max=count($_SESSION['cart']);
        for($i=0;$i<$max;$i++){
            if($pid==$_SESSION['cart'][$i]['productid']){
                unset($_SESSION['cart'][$i]);
                break;
            }
        }
        $_SESSION['cart']=array_values($_SESSION['cart']);
    }
    function get_order_total(){
        $max=count($_SESSION['cart']);
        $sum=0;
        for($i=0;$i<$max;$i++){
            $pid=$_SESSION['cart'][$i]['productid'];
            $q=$_SESSION['cart'][$i]['qty'];
            $price=get_price($pid);
            $sum+=$price*$q;
        }
        return $sum;
    }
    function addtocart($pid,$q){
        if($pid<1 or $q<1) return;

        if(is_array($_SESSION['cart'])){
            if(product_exists($pid)) return;
            $max=count($_SESSION['cart']);
            $_SESSION['cart'][$max]['productid']=$pid;
            $_SESSION['cart'][$max]['qty']=$q;
        }
        else{
            $_SESSION['cart']=array();
            $_SESSION['cart'][0]['productid']=$pid;
            $_SESSION['cart'][0]['qty']=$q;
        }
    }
    function product_exists($pid){
        $pid=intval($pid);
        $max=count($_SESSION['cart']);
        $flag=0;
        for($i=0;$i<$max;$i++){
            if($pid==$_SESSION['cart'][$i]['productid']){
                $flag=1;
                break;
            }
        }
        return $flag;
    }

?>

Then display the cart.

<?php

    include("includes/db.php");
    include("includes/functions.php");

    $currentuser = &$_GET['user'];

    if(ISSET($_REQUEST['command']) && ISSET($_REQUEST['pid'])){
        $_REQUEST['command']=='delete';
        $_REQUEST['pid']>0;
        remove_product($_REQUEST['pid']);
    }
    else if(ISSET($_REQUEST['command'])){
        $_REQUEST['command']=='clear';
        unset($_SESSION['cart']);
    }
    else if(ISSET($_REQUEST['command'])){
        $_REQUEST['command']=='update'; 
        $max=count($_SESSION['cart']);
        for($i=0;$i<$max;$i++){
            $pid=$_SESSION['cart'][$i]['productid'];
            $q=intval($_REQUEST['product'.$pid]);
            if($q>0 && …
abelingaw 69 Posting Whiz in Training

I'm nearly finish with a site template for a shopping cart.

I am encountering a problem, updating of quantity. Say:

On the Product Table page: If the user clicks on the same product to add it, only the quantity should increment on the Cart page (Quantity is displayed using a textbox).

On the Cart page: The user can increase or decrease the quantity by manually typing the number on the textbox I mentioned above, by clicking on the update button below the cart table.

That is where my problem is, even If I enter another number (say 2), the price of the product should be multiplied to that number (say 800 x 2), instead, the original quantity (1) remains and so is the price (800 instead of 1600).

Where Am I getting the error.
Attached are the files for selecting product, adding to cart up to placing the order.

Thanks in advance.

abelingaw 69 Posting Whiz in Training
    <?php

        $link = mysqli_connect('localhost', 'root', 'admin','admin') or die("Could not connect database");
        $result=mysqli_query($link, "SELECT * FROM questions");
        $row = mysqli_fetch_assoc($result);
    ?>

        <label for="login-username">Secret Question:</label>
            <select name="sq" id="sq" style="width:250px; height:30px">

                <?php do { ?>
                        <option ><?php echo $row['question'];  ?></option>
                <?php } while ($row = mysqli_fetch_assoc($result)); ?>

            </select> 
abelingaw 69 Posting Whiz in Training

Something like this?

Adapter = new SqlDataAdapter("SELECT MAX(CID) + 1 FROM candidates",cn);

Or Am i going the other way.

abelingaw 69 Posting Whiz in Training

Ok, I got finally got this to work.

{
            SqlDataAdapter Adapter;
            DataSet ds;


            cn.Open();
            Adapter = new SqlDataAdapter("SELECT MAX(CID) FROM candidates",cn);
            ds = new DataSet();

            Adapter.Fill(ds, "candidates");

            try
            {
                System.Text.StringBuilder id = new System.Text.StringBuilder();
                int lengthToAdd = 3;

                for (int i = 1; i <= lengthToAdd; i++)
                {
                    id.Append("0");
                }

                string prefixID = "EMP"; int newID = 2;
                string employeeId = string.Format("{0}{1}{2}", prefixID, id.ToString(), newID);

                txtcp.Text =employeeId;
            }

            catch (Exception ex)
            {
               MessageBox.Show(""+ex);
            }

            cn.Close();
        }

Now the problem is that, when I add new record, it still generates the same ID number which is EMP0002.

Its suppose to increment by 1, say EMP0003 and so on.

abelingaw 69 Posting Whiz in Training

Tried Fenrir()'s suggestion. Seems ok but how about the prefix?

abelingaw 69 Posting Whiz in Training

I have a column named Emp_Id and set as primary key (not Auto Incr).I am trying to generate an ID (employee) and save it into a SQL database.

The logic goes this way:

Generate the id number with a prefix plus the number (i.e. EMP0001).
Display it on a textbox on a form so that I can save it on the Emp_Id column.

I can't provide any codes since I really do not know how to begin with this.

Appreciate your help. Thanks

abelingaw 69 Posting Whiz in Training

I'm having trouble connecting to a database file on another PC. In this case, my PC is the client.

Using:

  1. Windows 7 32-bit on both PC's.
  • Same Workgroup
  • Connection verified using cmd (PING)
  • Connected using hub (straight through)
  • Workgroup status: Joined
  1. MS Access 2007 as database app.

My connection string:

    Con.Open "Provider=Microsoft.ACE.OLEDB.12.0;
    Data Source=\\192.168.1.1\SERVERPC\C:\MYDB.accdb;
    Persist Security Info=False;User Id=Admin;
    Jet OLEDB:Database Password = mypassword"

The IP address and database locations are correct.

I'm recieveing THIS error.

Is my connection string wrong or is it on the hardware?

abelingaw 69 Posting Whiz in Training

I suggest you use ADODB for this one.

Read THIS.

abelingaw 69 Posting Whiz in Training

Maybe something like this.

Private Sub DataGrid1_Click()

Dim x As String

x = Adodc1.Recordset("ID").Value
Adodc1.RecordSource = "Select * from Users where ID = '" & x & "'"

Label1.Caption = x

End Sub

Note that:

I used an ADODC since you did not specify what connection type you are using.
I used a label to display the ID value (selected).

abelingaw 69 Posting Whiz in Training

The code I provided would solve your problem, no need to use another IF clause there.

Use the code, then your code for saving (NO IF) follows.

abelingaw 69 Posting Whiz in Training

Ok. To alert the user using a pop up is kinda annoying if there are more than 1 item nearly expired. You don't want 10 + msgbox popping up upon form load.

I guess it would be better if you could just use another control, say label to notify the user if a specific item (Selected) is nearly expired.

Anyway, base on your code, it seems you let user to select an item one by one. Try using a listview instead?

Just a suggestion though, up to you.

abelingaw 69 Posting Whiz in Training

Example:

rs.Open "Select * from tablename where criteria = '" & control name & "'", db, adOpenDynamic, adLockOptimistic

    If rs.EOF = False Then
        MsgBox "Record already exist.", vbExclamation, ""
        Exit Sub
    End If
    rs.Close

    'Your code to save new record follows

Much effective if your criteria would be your PRIMARY KEY since there are some records which have the same names etc.

abelingaw 69 Posting Whiz in Training

The answer is already on your code (line 12 - 25), just place it on the correct event.

You can try the form's load or activate event. You'll figure it out eventually.

Good luck.

abelingaw 69 Posting Whiz in Training

Sorry but you can't just actually subtract (or any arithmetic operation) 2 SQL statements. (or maybe for UNION or JOINS)

What you need to do is modify your 2 SQL then subtract the value of 2 specifice columns on those tables.

Dim sum1, sum2 as String

sum1 = Adodc1.Recordset.Fields("Fieldname") 'replace fieldname with your column name
sum2 = Adodc2.Recordset.Fields("Fieldname2") 'replace fieldname2 with your column name

'I used Adodc1 & Adodc2 since you can't assign 
'2 Recordsource for a single Adodc control

Label1.Caption = sum1 - sum2 'if you are to display the result on a label control

Not actually the correct code, but you'll get it.

abelingaw 69 Posting Whiz in Training

From your prev codes, it seems that you are searching for a current record and modify that specific record with a new value.

If that's the case, the you got to modify your SQL statement.

abelingaw 69 Posting Whiz in Training

I assume that you are referring to the value of the column RcvdPcs on table tblReceived.

prevent user
to released more than the received pcs.

Here's an idea, how can you released 6 items if you only received 5?

abelingaw 69 Posting Whiz in Training
          With rs1

           .Open "Select * from due", con, adOpenKeyset, adLockOptimistic

            If .Fields("partyname") = " & Me.cmbPartyName & " Then
                    .Fields("due") = rs1.Fields("due") + Val(Me.txtdue)
                    .Update 'updates the existing record on your field
            'try using a msgbox here to confirm if the old record is updated

            Else

                .AddNew
                    !partyname = cmbPartyName
                    !due = txtdue.Text      
                    .Update
            'use a msgbox here to confirm that a new record was created            

            End If

           .Close
        End With

`

Note that on the IF clause, there is no .AddNew method since there is already a record, so it'll only update the current.

On the ELSE clause, there is the .AddNew to create a new record and .Update to save it.

abelingaw 69 Posting Whiz in Training

Try moving line 29 (End If) before line 33 (End With).

abelingaw 69 Posting Whiz in Training

Really no time to tackle this one so read THIS.

abelingaw 69 Posting Whiz in Training

Just wanna ask if it is possible to add 1 or more DETAIL sections in a VB6 Report.

If it is, any link to such or steps on how to do it.

Thanks.

abelingaw 69 Posting Whiz in Training

Sorry, but what I want is a shorter way so modifying my code would be great.

abelingaw 69 Posting Whiz in Training

Was trying to save the contents of a listview column (2nd column) into a table in the dbase, 1 column of the table per content of the listview column, meaning only 1 row will be affected.

Here's my code using while loop.

Fcount = 2
Scount = 1

  While Scount <> Me.lvsub2.ListItems.Count And Fcount <> 11
      RS2.Fields(Fcount) = Me.lvsub2.ListItems(Me.lvsub2.ListItems.Count).SubItems(Fcount)

    Fcount = Fcount + 1
    Scount = Scount + 1

  Wend

Works but the problem is that, it only saves items from the 1st column of the listview and it gives an error ones there is a null value from the listview's column.
Any way to get around this with just a small modification of the code?

abelingaw 69 Posting Whiz in Training

I'm having trouble with the AND operator when I used it 3 times.

If Text1.Text = "THIS" And Text2.Text = "THAT" and Text3.Text = "THOSE" then
    Call Display

elseIf Text1.Text = "THIS" And Text2.Text = "THAT" and Text3.Text = "THOSE" then
    Call Display2   

else
    MsgBox"Failed"
End If

It always ends up to the ELSE statement even if all the expressions are TRUE.
When I try to remove the 3rd expression (and Text3.Text = "THOSE"), it works.

Any way to round this? I tried using Goto, Select Case and nested If but does't work also.

abelingaw 69 Posting Whiz in Training

Do you mean creating a path for a control that when clicked, opens a Word (MSOFFICE) file?

Dim wrdApp As New WORD.Application

wrdApp.Documents.Open App.Path & "\Reports\Leave.docx"
wrdApp.WindowState = wdWindowStateMaximize
wrdApp.Visible = True

wrdApp - variable name, can be changed

Reports - folder where the file is located (this folder is also located where your VB6 project is)

Leave.docx - file name

abelingaw 69 Posting Whiz in Training

I think he meant:

I get the error when saving the file/project.

The only reason I can think is that you are using the FLASH8.ocx file.

Try removing that control in your form.

abelingaw 69 Posting Whiz in Training

Try googling BLOB..

abelingaw 69 Posting Whiz in Training
 rs.Open "Select * from TABLENAME where COLUMNFORTIME Between #" & Combo2.Text & "# AND #" & Combo1.Text & "#;", con, adOpenKeyset, adLockPessimistic

Perhaps..

abelingaw 69 Posting Whiz in Training

Try using Rose Setup Factory. Been using it in creating installers from VB6 projects.

Enables Serial Key for installer or even an Expiration date.

Click Here

abelingaw 69 Posting Whiz in Training

Was having trouble printing special characters using Ascii codes for this two characters:

**Ñ and ñ. **

I'm trying to enable inserting them on textboxes using Keypress event but to no avail. But since the Alt key doesn't have Ascii equivalent, I can't figure it out. I would want to try Keyup or Keydown but want to have some idea first.

Printing the 2 characters above using Alt key plus their numeric (from numeric keypad)

Anyways, does the FN key in laptops have ascii? So that inserting those 2 symbols would work both on PC and laptop.

abelingaw 69 Posting Whiz in Training

I don't know if you don't receive any compile error on line 2 also, but I do.
Your code on line 28 will also give you an error.

I'm not really sure if what you want to happen is this:

Nothing will happen on single click, only if flexgrid is clicked 2x. If that's what you want, then:

Private Sub Form_Load()

    clickSpeed% = GetDoubleClickTime
    Timer1.Enabled = False
    Timer1.Interval = clickSpeed%

End Sub
Private Sub FlexGrid1_Click()

    Timer1.Enabled = True

End Sub

Private Sub FlexGrid1_dblClick()

    Timer1.Enabled = False
    MsgBox "double click"

End Sub
Private Sub Timer1_Timer()

    Timer1.Enabled = False
    MsgBox "single click"

End Sub
abelingaw 69 Posting Whiz in Training

Edit:

with adodc1

   .ConnectionString = connectdb
    .RecordSource = "Select * from 'tablename'"
    .Refresh

    .AddNew


        .Recordset.Fields("Tablecolumn name") = txtYourtextbox.Text

 'any entry on that specific textbox would be save to that specific column on your table
 'make sure your textbox control is connected to your adodc

    .Update
    end with
AndreRet commented: Plain and simple. Nice! +13
abelingaw 69 Posting Whiz in Training

First, you have to unload or hide the current window (where you will click the button) then show the window that you want to show using it's name.

On the button which will show the next form.

VB 6:

Private Sub Command1_Click()

Me.Hide
Form2.Show()

End Sub

VB 2008:

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Me.Hide()   // this will hide the window where this code is entered
        Form2.Show() //this will display the other window, Form2 is the name,replace it with yours, you can also use Form2.ShowDialog() 

    End Sub
End Class

Haven't tried VB 2010. :-)

abelingaw 69 Posting Whiz in Training

Some if not mostly, you need the DLL/OCX/etc..etc.. files (if not all) used in the development of that program to be also available on those computers where you want to install them, otherwise, you will receive error/s.

So one thing to avoid such, is to make sure all needed resources are available to the other machines.

abelingaw 69 Posting Whiz in Training

Can you check this things?

  1. What is the max of your progress bar, is it 100?

  2. Interval of your timer control? though this won't cause the problem if > 0

Here's what i did for my backup module before:

  1. Same as you did, i have a timer and a progress bar. But I used FileSystemObject for it.

  2. Codes for my backup is on a sub-module

  3. And the progressbar increment process is on my timer control

  4. On the Backup Button, when it is clicked, the timer control will be enabled.

Note:

Make sure that the timer is disabled on form load/activate event.
The attachment is only from my Thesis Project so, it's only for a reference, you'll get it.